nemiver r798 - in trunk: . src
- From: dodji svn gnome org
- To: svn-commits-list gnome org
- Subject: nemiver r798 - in trunk: . src
- Date: Sat, 12 Apr 2008 14:46:36 +0100 (BST)
Author: dodji
Date: Sat Apr 12 14:46:35 2008
New Revision: 798
URL: http://svn.gnome.org/viewvc/nemiver?rev=798&view=rev
Log:
fix #527696 â nemiver --help only shows libgnome related help messages
* src/main.cc: reorganised the command line options parsing.
Added init_option_context() to - guess what - initialize the option
context and add the nemiver and gtk+ groups to it, so that both gtk+
and nemiver options can be available. That way, both nemiver and gtk+
help messages can be displayed.
Make sure parse_command_line() does initialize the option context
by calling the brand new init_option_context(), before actually
trying to parse the command line.
This should fix
#527696 â nemiver --help only shows libgnome related help messages
Modified:
trunk/ChangeLog
trunk/src/main.cc
Modified: trunk/src/main.cc
==============================================================================
--- trunk/src/main.cc (original)
+++ trunk/src/main.cc Sat Apr 12 14:46:35 2008
@@ -134,14 +134,30 @@
g_option_context_free (a_opt);
}
}
-};//end struct GOptoinContextUnref
+};//end struct GOptionContextUnref
+
+struct GOptionGroupUnref {
+ void operator () (GOptionGroup *a_group)
+ {
+ if (a_group) {
+ g_option_group_free (a_group);
+ }
+ }
+};//end struct GOptionGroupUnref
struct GOptionContextRef {
void operator () (GOptionContext *a_opt)
{
if (a_opt) {}
}
-};//end struct GOptoinContextRef
+};//end struct GOptionContextRef
+
+struct GOptionGroupRef {
+ void operator () (GOptionGroup *a_group)
+ {
+ if (a_group) {}
+ }
+};//end struct GOptionGroupRef
static IWorkbench *s_workbench=0;
@@ -158,13 +174,17 @@
s_got_down = true;
}
}
+typedef SafePtr<GOptionContext,
+ GOptionContextRef,
+ GOptionContextUnref> GOptionContextSafePtr;
+
+typedef SafePtr<GOptionGroup,
+ GOptionGroupRef,
+ GOptionGroupUnref> GOptionGroupSafePtr;
-void
-parse_command_line (int& a_argc, char** a_argv)
+static GOptionContext*
+init_option_context ()
{
- typedef SafePtr<GOptionContext,
- GOptionContextRef,
- GOptionContextUnref> GOptionContextSafePtr;
GOptionContextSafePtr context;
context.reset (g_option_context_new
(_(" [<prog-to-debug> [prog-args]]")));
@@ -177,10 +197,22 @@
entries,
GETTEXT_PACKAGE);
g_option_context_set_ignore_unknown_options (context.get (), true);
+ GOptionGroupSafePtr gtk_option_group (gtk_get_option_group (FALSE));
+ THROW_IF_FAIL (gtk_option_group);
+ g_option_context_add_group (context.get (), gtk_option_group.release ());
+ return context.release ();
+}
+
+static void
+parse_command_line (int& a_argc,
+ char** a_argv)
+{
+ GOptionContextSafePtr context (init_option_context ());
+ THROW_IF_FAIL (context);
g_option_context_parse (context.get (), &a_argc, &a_argv, 0);
}
-bool
+static bool
process_command_line (int& a_argc, char** a_argv, int &a_return)
{
if (gv_log_debugger_output) {
@@ -399,17 +431,19 @@
bindtextdomain (GETTEXT_PACKAGE, NEMIVERLOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+
+ NEMIVER_TRY
+
Initializer::do_init ();
Gtk::Main gtk_kit (a_argc, a_argv);
+ parse_command_line (a_argc, a_argv);
+
//intialize gnome libraries
gnome_program_init (PACKAGE, PACKAGE_VERSION,
LIBGNOME_MODULE, a_argc, a_argv,
GNOME_PROGRAM_STANDARD_PROPERTIES, NULL);
- parse_command_line (a_argc, a_argv);
-
- NEMIVER_TRY
//**********************************
//load the workbench dynamic module
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]