diff options
Diffstat (limited to 'mixgtk/mixgtk.c')
-rw-r--r-- | mixgtk/mixgtk.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c index ff218f6..6089dd2 100644 --- a/mixgtk/mixgtk.c +++ b/mixgtk/mixgtk.c @@ -32,27 +32,20 @@ #include "mixgtk_colorsel.h" #include "mixgtk_fontsel.h" #include "mixgtk_config.h" +#include "mixgtk_wm.h" #include "mixgtk.h" +static const gchar *SPLIT_ARG_ = "-s"; +static const gchar *SPLIT_LONG_ARG_ = "--s"; /* initialise the app */ gboolean mixgtk_init (int argc, char *argv[]) { mix_vm_t *vm; - - const gchar *gfile = GLADE_FILE; - FILE *f = fopen (gfile, "r"); - if (!f && !(f = fopen ((gfile = LOCAL_GLADE_FILE), "r"))) - { - g_error ("Configuration file not found (tried %s and %s)", - GLADE_FILE, LOCAL_GLADE_FILE); - return FALSE; - } - fclose (f); + gboolean split = FALSE; + gint k; - gtk_init (&argc, &argv); - mix_init_lib (); if (!mixgtk_config_load ()) @@ -61,41 +54,62 @@ mixgtk_init (int argc, char *argv[]) return FALSE; } - if (!mixgtk_widget_factory_init (gfile)) + for (k = 0; k < argc; ++k) + if (!strcmp (argv[k], SPLIT_ARG_) || !strcmp (argv[k], SPLIT_LONG_ARG_)) + { + split = TRUE; + break; + } + if (!split && mixgtk_config_is_split ()) split = TRUE; + mixgtk_config_set_split (split); + + gtk_init (&argc, &argv); + + if (!mixgtk_widget_factory_init (split)) { - g_error ("Unable to initialise application using %s\n", gfile); + g_error ("Unable to initialise application: missing glade file"); return FALSE; } - if (!mixgtk_cmd_dispatcher_init ()) + if (!mixgtk_cmd_dispatcher_init (MIXGTK_MAIN)) { g_error ("Unable to initialise application (command dispatcher)\n"); return FALSE; } + if (split) + gtk_widget_show (mixgtk_widget_factory_get_dialog (MIXGTK_MAIN)); + vm = mixgtk_cmd_dispatcher_get_vm (); - if (!mixgtk_device_init (GTK_NOTEBOOK - (mixgtk_widget_factory_get (MIXGTK_WIDGET_DEVICE)), - vm)) + if (!mixgtk_mixvm_init (vm, MIXGTK_MIXVM_DIALOG)) { - g_error ("Unable to initialise application (devices)\n"); + g_error ("Unable to initialise application (mixvm widgets)\n"); return FALSE; } - if (!mixgtk_mixvm_init (vm)) + if (!mixgtk_mixal_init (vm, MIXGTK_MIXAL_DIALOG)) { - g_error ("Unable to initialise application (mixvm widgets)\n"); + g_error ("Unable to initialise application (mixal widgets)\n"); return FALSE; } - if (!mixgtk_mixal_init (vm)) + if (!mixgtk_device_init (GTK_NOTEBOOK + (mixgtk_widget_factory_get + (MIXGTK_DEVICES_DIALOG, MIXGTK_WIDGET_DEVICE)), + vm)) { - g_error ("Unable to initialise application (mixal widgets)\n"); + g_error ("Unable to initialise application (devices)\n"); return FALSE; } - - mixgtk_fontsel_load_defaults (); + + if (!mixgtk_wm_init ()) + { + g_error ("Unable to initialise application (visibility)\n"); + return FALSE; + } + + mixgtk_fontsel_load_defaults (split); return TRUE; } |