[gnome-initial-setup] Keep the window centered



commit a88d91755b133d774ab352fdca386e3b4eb7c1b1
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 22 15:16:05 2012 -0400

    Keep the window centered
    
    When the monitor is resized, we should recenter the window.
    This needs to be fixed in GTK+, eventually.

 gnome-initial-setup/gnome-initial-setup.c |    9 +++++++++
 gnome-initial-setup/setup.ui              |    2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 4324ed4..1f429cb 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -77,11 +77,20 @@ prepare_cb (GisAssistant *assi, GtkWidget *page, SetupData *setup)
 }
 
 static void
+recenter_window (GdkScreen *screen, SetupData *setup)
+{
+  gtk_window_set_position (setup->main_window, GTK_WIN_POS_CENTER_ALWAYS);
+}
+
+static void
 prepare_main_window (SetupData *setup)
 {
         setup->main_window = OBJ(GtkWindow*, "main-window");
         setup->assistant = OBJ(GisAssistant*, "assistant");
 
+        g_signal_connect (gtk_widget_get_screen (GTK_WIDGET (setup->main_window)),
+                          "monitors-changed", G_CALLBACK (recenter_window), setup);
+
         g_signal_connect (setup->assistant, "prepare",
                           G_CALLBACK (prepare_cb), setup);
 
diff --git a/gnome-initial-setup/setup.ui b/gnome-initial-setup/setup.ui
index b2792eb..0961f47 100644
--- a/gnome-initial-setup/setup.ui
+++ b/gnome-initial-setup/setup.ui
@@ -266,7 +266,7 @@
     <property name="visible">False</property>
     <property name="deletable">False</property>
     <property name="resizable">False</property>
-    <property name="window-position">center</property>
+    <property name="window-position">center-always</property>
     <child>
       <object class="GisAssistant" id="assistant">
         <property name="visible">True</property>



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