main.c 1.15 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 "color.h"
Arturo Espinosa's avatar
Arturo Espinosa committed
7

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

static struct argp_option argp_options [] = {
12
	{ "file",   'f',   N_("FILE"),    0, N_("File to load at startup"), 0 },
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	{ 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
34
35
36
int
main (int argc, char *argv [])
{
37
38
39
	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
	textdomain (PACKAGE);
	
40
	gnome_init ("Gnumeric", &parser, argc, argv, 0, NULL);
41

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

	if (startup_file)
		current_workbook = gnumericReadXmlWorkbook (startup_file);

	if (current_workbook == NULL)
54
		current_workbook = workbook_new_with_sheets (1);
55

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

	gtk_main ();

	return 0;
}
62