diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-04-28 20:54:11 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-04-28 20:54:11 +0000 |
commit | fef0865fae3728ed89b3403fbcc24cdd26ae1e46 (patch) | |
tree | 8791f7bea4e2d97da33f24802ded3245dce285b9 /mixgtk | |
parent | 75008f7cd9831b65de6e452860a6908b2019d9d1 (diff) | |
download | mdk-fef0865fae3728ed89b3403fbcc24cdd26ae1e46.tar.gz mdk-fef0865fae3728ed89b3403fbcc24cdd26ae1e46.tar.bz2 |
initialisation, clean-up and main functionality split
Diffstat (limited to 'mixgtk')
-rw-r--r-- | mixgtk/Makefile.am | 6 | ||||
-rw-r--r-- | mixgtk/gmixvm.c | 36 | ||||
-rw-r--r-- | mixgtk/mixgtk.c | 38 | ||||
-rw-r--r-- | mixgtk/mixgtk.h | 44 |
4 files changed, 103 insertions, 21 deletions
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 <stdlib.h> +#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 <stdlib.h> -#include <gtk/gtk.h> -#include <mixlib/mix.h> #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 <mixlib/mix.h> + +/* 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 */ + |