[gnome-control-center/single-window-shell] [keyboard] add a --socket option
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-control-center/single-window-shell] [keyboard] add a --socket option
- Date: Tue, 12 Jan 2010 12:09:11 +0000 (UTC)
commit ab6c567296fa79ae0e8e9dcaa7ff1437d58cc3da
Author: Thomas Wood <thomas wood intel com>
Date: Tue Jan 12 12:08:47 2010 +0000
[keyboard] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
capplets/network/gnome-network-properties.c | 53 +++++++++++++++++++++++----
1 files changed, 46 insertions(+), 7 deletions(-)
---
diff --git a/capplets/network/gnome-network-properties.c b/capplets/network/gnome-network-properties.c
index e3f0bed..48ccc48 100644
--- a/capplets/network/gnome-network-properties.c
+++ b/capplets/network/gnome-network-properties.c
@@ -1367,12 +1367,28 @@ main (int argc, char **argv)
"delete_button_img", NULL};
GConfClient *client;
GtkWidget *widget;
+ guint32 socket_id = 0;
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
+ GOptionContext *context;
+ GOptionEntry cap_options[] = {
+ { "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 }
+ };
+
+ context = g_option_context_new (_("- GNOME Network Preferences"));
+ g_option_context_add_main_entries (context, cap_options,
+ GETTEXT_PACKAGE);
+
+ capplet_init (context, &argc, &argv);
- gtk_init (&argc, &argv);
client = gconf_client_get_default ();
gconf_client_add_dir (client, "/system/http_proxy",
@@ -1392,9 +1408,32 @@ main (int argc, char **argv)
}
setup_dialog (builder);
- widget = _gtk_builder_get_widget (builder, "network_dialog");
- capplet_set_icon (widget, "gnome-network-properties");
- gtk_widget_show_all (widget);
+
+ if (socket_id) {
+ GtkWidget *content, *plug;
+
+ /* re-parent contents */
+ content = _gtk_builder_get_widget (builder, "dialog-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);
+
+ gtk_widget_hide (_gtk_builder_get_widget (builder,
+ "helpbutton1"));
+ gtk_widget_hide (_gtk_builder_get_widget (builder,
+ "closebutton1"));
+ gtk_container_set_border_width (GTK_CONTAINER (content), 12);
+
+ } else {
+ widget = _gtk_builder_get_widget (builder, "network_dialog");
+ capplet_set_icon (widget, "gnome-network-properties");
+ gtk_widget_show_all (widget);
+ }
+
gtk_main ();
g_object_unref (builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]