summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2009-11-24 15:56:18 +0000
committerThomas Wood <thomas.wood@intel.com>2010-01-11 09:40:20 +0000
commit22945de8be6de14135e4b4b1e92a9077c7d42409 (patch)
treeb653b5e10e68c6c8799759762de670f049ca06ce
parentb91106c128b0d29eb4bdc21853f3cf6f5fdcf137 (diff)
downloadgnome-control-center-22945de8be6de14135e4b4b1e92a9077c7d42409.tar.gz
[mouse] add a --socket option
Allow embedding in another application by adding a --socket option to specify the ID of an window.
-rw-r--r--capplets/mouse/gnome-mouse-properties.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c
index fe88434f1..c5a05e9eb 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;