[gnome-control-center] shell: Make the main window a GtkApplicationWindow



commit ad4da161269a991153408227ae9c665956fec9e6
Author: Florian MÃllner <fmuellner gnome org>
Date:   Fri May 18 16:40:31 2012 +0200

    shell: Make the main window a GtkApplicationWindow
    
    This is a prerequisite of using the new GMenu API. Also move the
    check for small screen sizes introduced in commit 22ed5a9fd5, as
    GtkApplicationWindows cannot be realized unless their application
    property has been set.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675471

 shell/gnome-control-center.c |   20 ++++++++++++++++----
 shell/shell.ui               |    2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 5cf3817..61f8c3b 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -1221,6 +1221,21 @@ main_window_configure_cb (GtkWidget *widget,
 }
 
 static void
+application_set_cb (GObject    *object,
+                    GParamSpec *pspec,
+                    GnomeControlCenter *self)
+{
+  /* update small screen settings now - to avoid visible resizing, we want
+   * to do it before showing the window, and GtkApplicationWindow cannot be
+   * realized unless its application property has been set */
+  if (gtk_window_get_application (GTK_WINDOW (self->priv->window)))
+    {
+      gtk_widget_realize (self->priv->window);
+      update_small_screen_settings (self);
+    }
+}
+
+static void
 monitors_changed_cb (GdkScreen *screen,
                      GnomeControlCenter *self)
 {
@@ -1266,6 +1281,7 @@ gnome_control_center_init (GnomeControlCenter *self)
   screen = gtk_widget_get_screen (priv->window);
   g_signal_connect (screen, "monitors-changed", G_CALLBACK (monitors_changed_cb), self);
   g_signal_connect (priv->window, "configure-event", G_CALLBACK (main_window_configure_cb), self);
+  g_signal_connect (priv->window, "notify::application", G_CALLBACK (application_set_cb), self);
   g_signal_connect_swapped (priv->window, "delete-event", G_CALLBACK (g_object_unref), self);
   g_signal_connect (priv->window, "key_press_event",
                     G_CALLBACK (window_key_press_event), self);
@@ -1298,10 +1314,6 @@ gnome_control_center_init (GnomeControlCenter *self)
 
   setup_lock (self);
 
-  /* update small screen settings now */
-  gtk_widget_realize (priv->window);
-  update_small_screen_settings (self);
-
   /* store default window title and name */
   priv->default_window_title = g_strdup (gtk_window_get_title (GTK_WINDOW (priv->window)));
   priv->default_window_icon = g_strdup (gtk_window_get_icon_name (GTK_WINDOW (priv->window)));
diff --git a/shell/shell.ui b/shell/shell.ui
index da54bfe..87b7e7f 100644
--- a/shell/shell.ui
+++ b/shell/shell.ui
@@ -2,7 +2,7 @@
 <interface>
   <requires lib="gtk+" version="3.0"/>
   <!-- interface-naming-policy project-wide -->
-  <object class="GtkWindow" id="main-window">
+  <object class="GtkApplicationWindow" id="main-window">
     <property name="title" translatable="yes">System Settings</property>
     <property name="resizable">False</property>
     <property name="icon_name">preferences-desktop</property>



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