diff options
-rw-r--r-- | interface-gtk.h | 5 | ||||
-rw-r--r-- | interface.h | 5 | ||||
-rw-r--r-- | main.cpp | 9 |
3 files changed, 17 insertions, 2 deletions
diff --git a/interface-gtk.h b/interface-gtk.h index 76868fd..e6b9166 100644 --- a/interface-gtk.h +++ b/interface-gtk.h @@ -20,6 +20,11 @@ public: InterfaceGtk(); //~InterfaceGtk(); + inline GOptionGroup * + get_options(void) + { + return gtk_get_option_group(TRUE); + } inline void parse_args(int &argc, char **&argv) { diff --git a/interface.h b/interface.h index a67fbfa..cf261fb 100644 --- a/interface.h +++ b/interface.h @@ -15,6 +15,11 @@ */ class Interface { public: + virtual GOptionGroup * + get_options(void) + { + return NULL; + } virtual void parse_args(int &argc, char **&argv) {} enum MessageType { @@ -28,15 +28,20 @@ process_options(int &argc, char **&argv) {NULL} }; - GOptionContext *options; + GOptionContext *options; + GOptionGroup *interface_group = interface.get_options(); options = g_option_context_new("- Advanced interactive TECO"); + g_option_context_add_main_entries(options, option_entries, NULL); - g_option_context_add_group(options, gtk_get_option_group(TRUE)); + if (interface_group) + g_option_context_add_group(options, interface_group); + if (!g_option_context_parse(options, &argc, &argv, NULL)) { g_printf("Option parsing failed!\n"); exit(EXIT_FAILURE); } + g_option_context_free(options); if (mung_file) { |