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

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* If set, the file to load at startup time */
static char *startup_file;

static struct argp_option argp_options [] = {
	{ "file",   'f',   N_("FILE"),    0, N_("FIle to load at startup"), 0 },
	{ 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
32
33
34
int
main (int argc, char *argv [])
{
35
36
37
	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
	textdomain (PACKAGE);
	
38
	gnome_init ("Gnumeric", &parser, argc, argv, 0, NULL);
39

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

	if (startup_file)
		current_workbook = gnumericReadXmlWorkbook (startup_file);

	if (current_workbook == NULL)
50
		current_workbook = workbook_new_with_sheets (1);
51

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

	gtk_main ();

	return 0;
}
58