main.c 1.12 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"
Arturo Espinosa's avatar
Arturo Espinosa committed
6

7
8
9
10
/* If set, the file to load at startup time */
static char *startup_file;

static struct argp_option argp_options [] = {
11
	{ "file",   'f',   N_("FILE"),    0, N_("File to load at startup"), 0 },
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
	{ NULL,     0,     NULL,          0, NULL, 0 },
};

static error_t
parse_an_arg (int key, char *arg, struct argp_state *state)
{
	switch (key){
	case 'f':
		startup_file = arg;
		break;
	default:
		return ARGP_ERR_UNKNOWN;
	}

	return 0;
}

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

Arturo Espinosa's avatar
Arturo Espinosa committed
33
34
35
int
main (int argc, char *argv [])
{
36
37
38
	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
	textdomain (PACKAGE);
	
39
	gnome_init ("Gnumeric", &parser, argc, argv, 0, NULL);
40

41
	string_init ();
42
	style_init ();
43
	symbol_init ();
Arturo Espinosa's avatar
Arturo Espinosa committed
44
	constants_init ();
Arturo Espinosa's avatar
Arturo Espinosa committed
45
	functions_init ();
46
	plugins_init ();
47
48
49
50
51

	if (startup_file)
		current_workbook = gnumericReadXmlWorkbook (startup_file);

	if (current_workbook == NULL)
52
		current_workbook = workbook_new_with_sheets (1);
53

54
	gtk_widget_show (current_workbook->toplevel);
Arturo Espinosa's avatar
Arturo Espinosa committed
55
56
57
58
59

	gtk_main ();

	return 0;
}
60