[PATCH] Return GOptionEntry instead of GOptionGroup in VncDisplay.



It's better for apps to get a GOptionEntry * than get a GOptionGroup.
Thus, it's up to apps to integrate those options, returned by gtk-vnc
into their own groups. This makes things flexible.
---
 examples/gvncviewer.c |    7 ++++++-
 src/vncdisplay.c      |   12 +++---------
 src/vncdisplay.h      |    2 +-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/examples/gvncviewer.c b/examples/gvncviewer.c
index 97bdef8..f938ced 100644
--- a/examples/gvncviewer.c
+++ b/examples/gvncviewer.c
@@ -308,12 +308,17 @@ int main(int argc, char **argv)
 	GtkWidget *fullscreen;
 	GtkWidget *scaling;
 	const char *help_msg = "Run 'gvncviewer --help' to see a full list of available command line options";
+	GOptionGroup *group;
 
 	/* Setup command line options */
 	context = g_option_context_new ("- Simple VNC Client");
 	g_option_context_add_main_entries (context, options, NULL);
 	g_option_context_add_group (context, gtk_get_option_group (TRUE));
-	g_option_context_add_group (context, vnc_display_get_option_group ());
+
+	group = g_option_group_new ("gtk-vnc", "GTK-VNC Options", "Show GTK-VNC Options", NULL, NULL);
+	g_option_group_add_entries (group, vnc_display_get_option_entries ());
+	g_option_context_add_group (context, group);
+
 	g_option_context_parse (context, &argc, &argv, &error);
 	if (error) {
 		g_print ("%s\n%s\n",
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 3fc7137..067b677 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -2235,16 +2235,10 @@ gboolean vnc_display_is_pointer_absolute(VncDisplay *obj)
 	return obj->priv->absolute;
 }
 
-GOptionGroup *
-vnc_display_get_option_group (void)
+const GOptionEntry *
+vnc_display_get_option_entries (void)
 {
-	GOptionGroup *group;
-
-	group = g_option_group_new ("gtk-vnc", "GTK-VNC Options", "Show GTK-VNC Options", NULL, NULL);
-
-	g_option_group_add_entries (group, gtk_vnc_args);
-
-	return group;
+	return gtk_vnc_args;
 }
 
 #ifdef WIN32
diff --git a/src/vncdisplay.h b/src/vncdisplay.h
index c3779ad..8a5c7f1 100644
--- a/src/vncdisplay.h
+++ b/src/vncdisplay.h
@@ -136,7 +136,7 @@ void		vnc_display_force_grab(VncDisplay *obj, gboolean enable);
 
 gboolean	vnc_display_is_pointer_absolute(VncDisplay *obj);
 
-GOptionGroup *  vnc_display_get_option_group(void);
+const GOptionEntry *  vnc_display_get_option_entries(void);
 
 G_END_DECLS
 
-- 
1.6.0.4


--=-mo5SGSQkaXRNoFDf0KD6--



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]