From fef0865fae3728ed89b3403fbcc24cdd26ae1e46 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 28 Apr 2001 20:54:11 +0000 Subject: initialisation, clean-up and main functionality split --- mixgtk/Makefile.am | 6 +++--- mixgtk/gmixvm.c | 36 ++++++++++++++++++++++++++++++++++++ mixgtk/mixgtk.c | 38 ++++++++++++++++++++------------------ mixgtk/mixgtk.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 mixgtk/gmixvm.c create mode 100644 mixgtk/mixgtk.h diff --git a/mixgtk/Makefile.am b/mixgtk/Makefile.am index c0a3788..4409625 100644 --- a/mixgtk/Makefile.am +++ b/mixgtk/Makefile.am @@ -13,13 +13,13 @@ EXTRA_DIST = mixgtk.glade INCLUDES = -I$(includedir) -DGLADE_FILE=\""$(pkgdatadir)/mixgtk.glade"\"\ -DLOCAL_GLADE_FILE=\"mixgtk.glade\" -LDADD = $(top_builddir)/mixlib/libmix.a $(top_builddir)/lib/libreplace.a \ - $(INTLLIBS) +LDADD = $(top_builddir)/mixlib/libmix.a $(top_builddir)/lib/libreplace.a $(INTLLIBS) if MAKE_GUI pkgdata_DATA = mixgtk.glade bin_PROGRAMS = gmixvm -gmixvm_SOURCES = mixgtk.c mixgtk_gen_handlers.h mixgtk_gen_handlers.c \ +gmixvm_SOURCES = gmixvm.c mixgtk.h mixgtk.c \ + mixgtk_gen_handlers.h mixgtk_gen_handlers.c \ mixgtk_cmd_dispatcher.h mixgtk_cmd_dispatcher.c \ mixgtk_widgets.h mixgtk_widgets.c \ mixgtk_device.h mixgtk_device.c \ diff --git a/mixgtk/gmixvm.c b/mixgtk/gmixvm.c new file mode 100644 index 0000000..6326957 --- /dev/null +++ b/mixgtk/gmixvm.c @@ -0,0 +1,36 @@ +/* -*-c-*- -------------- gmixvm.c : + * Main function of the mix gtk front-end + * ------------------------------------------------------------------ + * Last change: Time-stamp: "2001-04-28 22:37:45 jao" + * ------------------------------------------------------------------ + * Copyright (C) 2001 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include +#include "mixgtk.h" + +int +main(int argc, char *argv[]) +{ + if (!mixgtk_init (argc, argv)) return EXIT_FAILURE; + + mixgtk_main (); + mixgtk_release (); + + return EXIT_SUCCESS; +} diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c index 127780b..da67c7e 100644 --- a/mixgtk/mixgtk.c +++ b/mixgtk/mixgtk.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk.c : - * Main function of the mix gtk front-end + * Main functions of the mix gtk front-end * ------------------------------------------------------------------ - * Last change: Time-stamp: "2001-04-24 00:52:32 jao" + * Last change: Time-stamp: "2001-04-28 22:40:32 jao" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -21,9 +21,6 @@ * */ -#include -#include -#include #include "mixgtk_widgets.h" #include "mixgtk_cmd_dispatcher.h" #include "mixgtk_device.h" @@ -32,9 +29,12 @@ #include "mixgtk_input.h" #include "mixgtk_colorsel.h" #include "mixgtk_fontsel.h" +#include "mixgtk.h" -int -main(int argc, char *argv[]) + +/* initialise the app */ +gboolean +mixgtk_init (int argc, char *argv[]) { mix_vm_t *vm; @@ -47,13 +47,13 @@ main(int argc, char *argv[]) { g_error ("Unable to initialise application (using %s and %s)\n", GLADE_FILE, LOCAL_GLADE_FILE); - return EXIT_FAILURE; + return FALSE; } if (!mixgtk_cmd_dispatcher_init ()) { g_error ("Unable to initialise application (command dispatcher)\n"); - return EXIT_FAILURE; + return FALSE; } vm = mixgtk_cmd_dispatcher_get_vm (); @@ -63,37 +63,39 @@ main(int argc, char *argv[]) vm)) { g_error ("Unable to initialise application (devices)\n"); - return EXIT_FAILURE; + return FALSE; } if (!mixgtk_mixvm_init (vm)) { g_error ("Unable to initialise application (mixvm widgets)\n"); - return EXIT_FAILURE; + return FALSE; } if (!mixgtk_mixal_init (vm)) { g_error ("Unable to initialise application (mixal widgets)\n"); - return EXIT_FAILURE; + return FALSE; } if (!mixgtk_input_init ()) { g_error ("Unable to initialise application (word input widgets)\n"); - return EXIT_FAILURE; + return FALSE; } if (!mixgtk_fontsel_init () || !mixgtk_colorsel_init ()) { g_error ("Unable to initialise application (customization widgets)\n"); - return EXIT_FAILURE; + return FALSE; } - - gtk_main(); + return TRUE; +} +/* clean up */ +void +mixgtk_release (void) +{ mix_release_lib (); - - return EXIT_SUCCESS; } diff --git a/mixgtk/mixgtk.h b/mixgtk/mixgtk.h new file mode 100644 index 0000000..d92dda8 --- /dev/null +++ b/mixgtk/mixgtk.h @@ -0,0 +1,44 @@ +/* -*-c-*- ---------------- mixgtk.h : + * Gmixvm initialisation and cleanup functions + * ------------------------------------------------------------------ + * Last change: Time-stamp: <2001-04-28 22:32:58 jao> + * ------------------------------------------------------------------ + * Copyright (C) 2001 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef MIXGTK_H +#define MIXGTK_H + +#include + +/* initialise the app */ +extern gboolean +mixgtk_init (int argc, char *argv[]); + +/* enter the main mixgtk loop */ +#define mixgtk_main gtk_main + +/* clean up */ +extern void +mixgtk_release (void); + + + +#endif /* MIXGTK_H */ + -- cgit v1.2.3