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



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

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

 capplets/appearance/appearance-main.c |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c
index e02a50a..4a4a718 100644
--- a/capplets/appearance/appearance-main.c
+++ b/capplets/appearance/appearance-main.c
@@ -123,6 +123,7 @@ main (int argc, char **argv)
   gchar *install_filename = NULL;
   gchar *start_page = NULL;
   gchar **wallpaper_files = NULL;
+  guint  socket_id = 0;
   GOptionContext *option_context;
   GOptionEntry option_entries[] = {
       { "install-theme",
@@ -140,6 +141,14 @@ main (int argc, char **argv)
         /* TRANSLATORS: don't translate the terms in brackets */
         N_("Specify the name of the page to show (theme|background|fonts|interface)"),
         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") },
       { G_OPTION_REMAINING,
       	0,
       	G_OPTION_FLAG_IN_MAIN,
@@ -167,11 +176,27 @@ main (int argc, char **argv)
 
   /* prepare the main window */
   w = appearance_capplet_get_widget (data, "appearance_window");
-  capplet_set_icon (w, "preferences-desktop-theme");
-  gtk_widget_show_all (w);
+  if (socket_id)
+    {
+      GtkWidget *content, *plug;
+
+      /* re-parent contents */
+      content = appearance_capplet_get_widget (data, "main_notebook");
+
+      plug = gtk_plug_new (socket_id);
+      g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
 
-  g_signal_connect_after (w, "response",
-                          (GCallback) main_window_response, data);
+      gtk_widget_reparent (content, plug);
+      gtk_widget_show_all (plug);
+    }
+  else
+    {
+      capplet_set_icon (w, "preferences-desktop-theme");
+      gtk_widget_show_all (w);
+
+      g_signal_connect_after (w, "response",
+                              (GCallback) main_window_response, data);
+    }
 
   /* default to background page if files were given on the command line */
   if (wallpaper_files && !install_filename && !start_page)



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