main.c 1.4 KB
Newer Older
1
#include <config.h>
Arturo Espinosa's avatar
Arturo Espinosa committed
2
3
#include <gnome.h>
#include "gnumeric.h"
4
#include "xml-io.h"
5
#include "plugin.h"
6
#include "format.h"
7
#include "color.h"
Arturo Espinosa's avatar
Arturo Espinosa committed
8
#include "cursors.h"
Arturo Espinosa's avatar
Arturo Espinosa committed
9

10
/* If set, the file to load at startup time */
11
static GList *startup_files;
12
13
14
15
16
17
18
19
20

static struct argp_option argp_options [] = {
	{ NULL,     0,     NULL,          0, NULL, 0 },
};

static error_t
parse_an_arg (int key, char *arg, struct argp_state *state)
{
	switch (key){
21
22
23
24
	case ARGP_KEY_INIT:
	case ARGP_KEY_FINI:
		return 0;

25
	default:
26
27
		if (arg)
			startup_files = g_list_prepend (startup_files, arg);
28
	}
29
	
30
31
32
33
34
35
36
	return 0;
}

static struct argp parser = {
	argp_options, parse_an_arg, NULL, NULL, NULL, NULL, NULL
};

Arturo Espinosa's avatar
Arturo Espinosa committed
37
38
39
int
main (int argc, char *argv [])
{
40
41
	GList *l;
	
42
43
44
	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
	textdomain (PACKAGE);
	
45
	gnome_init ("Gnumeric", &parser, argc, argv, 0, NULL);
46

47
	color_init ();
48
	string_init ();
49
	style_init ();
50
51
	format_color_init ();
	cursors_init ();
52
	symbol_init ();
Arturo Espinosa's avatar
Arturo Espinosa committed
53
	constants_init ();
Arturo Espinosa's avatar
Arturo Espinosa committed
54
	functions_init ();
55
	plugins_init ();
56

57
58
	for (l = startup_files; l; l = l->next){
		current_workbook = gnumericReadXmlWorkbook (l->data);
59

60
61
62
63
64
65
66
		if (current_workbook)
			gtk_widget_show (current_workbook->toplevel);
		
	}
	g_list_free (startup_files);
	
	if (current_workbook == NULL){
67
		current_workbook = workbook_new_with_sheets (1);
68
69
		gtk_widget_show (current_workbook->toplevel);
	}
Arturo Espinosa's avatar
Arturo Espinosa committed
70
71
72

	gtk_main ();

73
74
	cursors_shutdown ();
	format_color_shutdown ();
Arturo Espinosa's avatar
Arturo Espinosa committed
75
76
	return 0;
}
77