}
\f
-
-struct init_source
-{
- GSource parent;
- int state;
- GMainLoop *loop;
- gchar *file;
-};
-
-
gboolean
init_prepare (GSource *source, gint *timeout_)
{
{
struct init_source *is = (struct init_source *)ss;
- bool finished = initialize (is->file, is->state++);
+ bool finished = initialize (is);
+ is->state++;
if (finished)
{
startup = g_timer_new ();
g_timer_start (startup);
- if ( ! gtk_parse_args (&argc, &argv) )
- {
- perror ("Error parsing arguments");
- exit (1);
- }
-
if ( (vers = gtk_check_version (GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION)) )
exit (EXIT_FAILURE);
argv_parser_destroy (parser);
- /* Initialise GDK. Theoretically this call can remove options from argc,argv if
- it thinks they are gdk options.
- However there shouldn't be any here because of the gtk_parse_args call above. */
+ /* Initialise GDK. GTK gets initialized later. */
gdk_init (&argc, &argv);
GMainContext *context = g_main_context_new ();
g_source_attach (ss, context);
+ ((struct init_source *) ss)->argc = &argc;
+ ((struct init_source *) ss)->argv = &argv;
((struct init_source *) ss)->loop = loop;
((struct init_source *) ss)->file = optind < argc ? argv[optind] : NULL;
bool
-initialize (const char *data_file, int state)
+initialize (const struct init_source *is)
{
- switch (state)
+ switch (is->state)
{
case 0:
i18n_init ();
bind_textdomain_codeset (PACKAGE, "UTF-8");
break;
case 8:
- create_icon_factory ();
+ if ( ! gtk_parse_args (is->argc, is->argv) )
+ {
+ perror ("Error parsing arguments");
+ exit (1);
+ }
break;
case 9:
- psppire_output_window_setup ();
+ create_icon_factory ();
break;
case 10:
- journal_init ();
+ psppire_output_window_setup ();
break;
case 11:
- textdomain (PACKAGE);
+ journal_init ();
break;
case 12:
+ textdomain (PACKAGE);
+ break;
+ case 13:
/* FIXME: This should be implemented with a GtkInterface */
psppire_selector_set_default_selection_func (GTK_TYPE_ENTRY, insert_source_row_into_entry);
psppire_selector_set_default_selection_func (PSPPIRE_VAR_VIEW_TYPE, insert_source_row_into_tree_view);
psppire_selector_set_default_selection_func (GTK_TYPE_TREE_VIEW, insert_source_row_into_tree_view);
psppire_selector_set_default_selection_func (PSPPIRE_TYPE_MEANS_LAYER, insert_source_row_into_layers);
break;
- case 13:
+ case 14:
{
- if (data_file)
+ if (is->file)
{
- gchar *filename = local_to_filename_encoding (data_file);
+ gchar *filename = local_to_filename_encoding (is->file);
int retval = any_reader_detect (filename, NULL);
#ifndef PSPPIRE_H
#define PSPPIRE_H
+#include <glib.h>
+
#include <stdbool.h>
struct lexer;
-bool initialize (const char *data_file, int state);
+
+struct init_source
+{
+ GSource parent;
+ int state;
+ GMainLoop *loop;
+ gchar *file;
+ int *argc;
+ char ***argv;
+};
+
+bool initialize (const struct init_source *is);
+
void de_initialize (void);
void psppire_quit (void);