From 6bfd0c4d534dff0e3286911f977d613a8acfe958 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 3 May 2001 23:34:40 +0000 Subject: (mixgtk_init) check for the existence of glade xml file(s) before using it --- mixgtk/mixgtk.c | 20 +++++++++++++++----- 1 file 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 + #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; } -- cgit v1.2.3