main.c 1.28 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

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

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

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

	if (startup_file)
		current_workbook = gnumericReadXmlWorkbook (startup_file);

	if (current_workbook == NULL)
58
		current_workbook = workbook_new_with_sheets (1);
59

60
	gtk_widget_show (current_workbook->toplevel);
Arturo Espinosa's avatar
Arturo Espinosa committed
61
62
63

	gtk_main ();

64
65
	cursors_shutdown ();
	format_color_shutdown ();
Arturo Espinosa's avatar
Arturo Espinosa committed
66
67
	return 0;
}
68