[gnome-control-center/single-window-shell: 2/9] [mouse] add a --socket option



commit 22945de8be6de14135e4b4b1e92a9077c7d42409
Author: Thomas Wood <thomas wood intel com>
Date:   Tue Nov 24 15:56:18 2009 +0000

    [mouse] add a --socket option
    
    Allow embedding in another application by adding a --socket option to
    specify the ID of an window.

 capplets/mouse/gnome-mouse-properties.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c
index fe88434..c5a05e9 100644
--- a/capplets/mouse/gnome-mouse-properties.c
+++ b/capplets/mouse/gnome-mouse-properties.c
@@ -580,6 +580,7 @@ main (int argc, char **argv)
 	GtkBuilder     *dialog;
 	GtkWidget      *dialog_win, *w;
 	gchar *start_page = NULL;
+	guint32 socket_id;
 
 	GOptionContext *context;
 	GOptionEntry cap_options[] = {
@@ -589,6 +590,14 @@ main (int argc, char **argv)
 		 /* TRANSLATORS: don't translate the terms in brackets */
 		 N_("Specify the name of the page to show (general|accessibility)"),
 		 N_("page") },
+		{ "socket",
+		  's',
+		  G_OPTION_FLAG_IN_MAIN,
+		  G_OPTION_ARG_INT,
+		  &socket_id,
+		  /* TRANSLATORS: don't translate the terms in brackets */
+		  N_("ID of the socket to embed in"),
+		  N_("socket") },
 		{NULL}
 	};
 
@@ -610,9 +619,24 @@ main (int argc, char **argv)
 		setup_dialog (dialog, NULL);
 		setup_accessibility (dialog, client);
 
-		dialog_win = WID ("mouse_properties_dialog");
-		g_signal_connect (dialog_win, "response",
-				  G_CALLBACK (dialog_response_cb), NULL);
+		if (socket_id) {
+			GtkWidget *content, *plug;
+
+			/* re-parent contents */
+			content = WID ("prefs_widget");
+
+			plug = gtk_plug_new (socket_id);
+			gtk_widget_reparent (content, plug);
+			g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+
+			gtk_widget_show_all (plug);
+			dialog_win = plug;
+		}
+		else {
+			dialog_win = WID ("mouse_properties_dialog");
+			g_signal_connect (dialog_win, "response",
+					  G_CALLBACK (dialog_response_cb), NULL);
+		}
 
 		if (start_page != NULL) {
 			gchar *page_name;



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