summaryrefslogtreecommitdiffhomepage
path: root/mixgtk
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-05-03 23:34:40 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-05-03 23:34:40 +0000
commitc9c662689acb86d42c1cc99cff1944bf226e756e (patch)
tree9d80d022fbb9b55e63394c6b0079b2f0009d1398 /mixgtk
parent9a5d5bd200ada18a71147856db28639d1ca1c28c (diff)
downloadmdk-c9c662689acb86d42c1cc99cff1944bf226e756e.tar.gz
mdk-c9c662689acb86d42c1cc99cff1944bf226e756e.tar.bz2
(mixgtk_init) check for the existence of glade xml file(s) before using it
Diffstat (limited to 'mixgtk')
-rw-r--r--mixgtk/mixgtk.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c
index 42002f2..fb2d38a 100644
--- a/mixgtk/mixgtk.c
+++ b/mixgtk/mixgtk.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk.c :
* Main functions of the mix gtk front-end
* ------------------------------------------------------------------
- * Last change: Time-stamp: "2001-04-29 12:36:16 jao"
+ * Last change: Time-stamp: "2001-05-04 01:33:02 jao"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -21,6 +21,8 @@
*
*/
+#include <stdio.h>
+
#include "mixgtk_widgets.h"
#include "mixgtk_cmd_dispatcher.h"
#include "mixgtk_device.h"
@@ -38,6 +40,16 @@ 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);
gtk_init (&argc, &argv);
@@ -49,11 +61,9 @@ mixgtk_init (int argc, char *argv[])
return FALSE;
}
- if (!mixgtk_widget_factory_init (GLADE_FILE)
- && !mixgtk_widget_factory_init (LOCAL_GLADE_FILE))
+ if (!mixgtk_widget_factory_init (gfile))
{
- g_error ("Unable to initialise application (using %s and %s)\n",
- GLADE_FILE, LOCAL_GLADE_FILE);
+ g_error ("Unable to initialise application using %s\n", gfile);
return FALSE;
}