summaryrefslogtreecommitdiff
path: root/capplets/keyboard
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2010-01-12 12:08:41 +0000
committerThomas Wood <thomas.wood@intel.com>2010-01-12 12:08:41 +0000
commit92c9f7e7ac51b1fafcea0abc4684a552ba170e7e (patch)
tree7e99c1ded07f579c98fed9832681ad4bb5e94e45 /capplets/keyboard
parente94adcf7e9d99b24ab9e8c82d1e2bba66dd6414d (diff)
downloadgnome-control-center-92c9f7e7ac51b1fafcea0abc4684a552ba170e7e.tar.gz
[keyboard] add a --socket option
Allow embedding in another application by adding a --socket option to specify the ID of an window.
Diffstat (limited to 'capplets/keyboard')
-rw-r--r--capplets/keyboard/gnome-keyboard-properties.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/capplets/keyboard/gnome-keyboard-properties.c b/capplets/keyboard/gnome-keyboard-properties.c
index d2aef71fe..20b1fde9b 100644
--- a/capplets/keyboard/gnome-keyboard-properties.c
+++ b/capplets/keyboard/gnome-keyboard-properties.c
@@ -119,7 +119,8 @@ dialog_response (GtkWidget * widget,
}
static void
-setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset)
+setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset,
+ guint32 socket_id)
{
GObject *peditor;
gchar *monitor;
@@ -180,8 +181,20 @@ setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset)
gtk_notebook_remove_page (nb, tb_page);
}
- g_signal_connect (WID ("keyboard_dialog"), "response",
- (GCallback) dialog_response, changeset);
+ if (socket_id) {
+ GtkWidget *content, *plug;
+
+ /* re-parent contents */
+ content = WID ("vbox1");
+
+ 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);
+ } else {
+ g_signal_connect (WID ("keyboard_dialog"), "response",
+ (GCallback) dialog_response, changeset);
+ }
setup_xkb_tabs (dialog, changeset);
setup_a11y_tabs (dialog, changeset);
@@ -198,6 +211,7 @@ main (int argc, char **argv)
static gboolean apply_only = FALSE;
static gboolean switch_to_typing_break_page = FALSE;
static gboolean switch_to_a11y_page = FALSE;
+ static guint32 socket_id = 0;
static GOptionEntry cap_options[] = {
{"apply", 0, 0, G_OPTION_ARG_NONE, &apply_only,
@@ -219,6 +233,16 @@ main (int argc, char **argv)
N_
("Start the page with the accessibility settings showing"),
NULL},
+
+ { "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}
};
@@ -241,7 +265,7 @@ main (int argc, char **argv)
changeset = NULL;
dialog = create_dialog ();
- setup_dialog (dialog, changeset);
+ setup_dialog (dialog, changeset, socket_id);
if (switch_to_typing_break_page) {
gtk_notebook_set_current_page (GTK_NOTEBOOK
(WID
@@ -258,7 +282,8 @@ main (int argc, char **argv)
capplet_set_icon (WID ("keyboard_dialog"),
"preferences-desktop-keyboard");
- gtk_widget_show (WID ("keyboard_dialog"));
+ if (!socket_id)
+ gtk_widget_show (WID ("keyboard_dialog"));
gtk_main ();
return 0;