[gnome-control-center/single-window-shell] [default-applications] 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] [default-applications] add a --socket option
- Date: Mon, 11 Jan 2010 16:34:33 +0000 (UTC)
commit 9125c030fd2f0689dd9bbc75cb6ec8300393f9ea
Author: Thomas Wood <thomas wood intel com>
Date: Mon Jan 11 11:06:21 2010 +0000
[default-applications] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
capplets/default-applications/gnome-da-capplet.c | 43 +++++++++++++++++++---
1 files changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/capplets/default-applications/gnome-da-capplet.c b/capplets/default-applications/gnome-da-capplet.c
index 438ee13..ade7f1a 100644
--- a/capplets/default-applications/gnome-da-capplet.c
+++ b/capplets/default-applications/gnome-da-capplet.c
@@ -700,7 +700,8 @@ _gtk_builder_get_widget (GtkBuilder *builder, const gchar *name)
static void
-show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
+show_dialog (GnomeDACapplet *capplet, const gchar *start_page,
+ guint32 socket_id)
{
GObject *obj;
GtkBuilder *builder;
@@ -729,8 +730,26 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
exit (EXIT_FAILURE);
}
- capplet->window = _gtk_builder_get_widget (builder,"preferred_apps_dialog");
- g_signal_connect (capplet->window, "response", G_CALLBACK (close_cb), NULL);
+ if (socket_id) {
+ GtkWidget *content, *plug;
+
+ /* re-parent contents */
+ content = _gtk_builder_get_widget (builder, "preferred_apps_notebook");
+
+ 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);
+ capplet->window = plug;
+ }
+ else {
+ capplet->window = _gtk_builder_get_widget (builder,
+ "preferred_apps_dialog");
+ g_signal_connect (capplet->window, "response", G_CALLBACK (close_cb),
+ NULL);
+ }
+
capplet->web_browser_command_entry = _gtk_builder_get_widget (builder, "web_browser_command_entry");
capplet->web_browser_command_label = _gtk_builder_get_widget (builder, "web_browser_command_label");
@@ -946,6 +965,7 @@ int
main (int argc, char **argv)
{
GnomeDACapplet *capplet;
+ guint32 socket_id;
gchar *start_page = NULL;
GOptionContext *context;
@@ -958,11 +978,22 @@ main (int argc, char **argv)
/* TRANSLATORS: don't translate the terms in brackets */
N_("Specify the name of the page to show (internet|multimedia|system|a11y)"),
N_("page") },
- { 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}
};
context = g_option_context_new (_("- GNOME Default Applications"));
- g_option_context_add_main_entries (context, option_entries, GETTEXT_PACKAGE);
+ g_option_context_add_main_entries (context, option_entries,
+ GETTEXT_PACKAGE);
capplet_init (context, &argc, &argv);
@@ -976,7 +1007,7 @@ main (int argc, char **argv)
gnome_da_xml_load_list (capplet);
- show_dialog (capplet, start_page);
+ show_dialog (capplet, start_page, socket_id);
g_free (start_page);
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]