[master] Rework the placement of items on hubs.

David Shea dshea at redhat.com
Wed Oct 29 17:26:33 UTC 2014


We have been using xscale=0.5 on the hub alignment to center and pad
items when the alignment's children do not use the entire width of the
hub. This has a couple of problems. When the alignment does not need a
lot of space, the scrollbar, if shown, is way over to the left instead
of all the way on the right side of the screen. If the alignment does
need a lot of space, there's no padding so the spokes are pushed all the
way against the left sidebar and the right edge of the window.

Redo the alignment of the hub GtkAlignment to match the one on the
spokes: xalign=0.5, xscale=1.0. Add left and right padding to the
alignment to keep things away from the sidebar and the edge of the
window.
---
 pyanaconda/ui/gui/hubs/progress.glade |  6 +++++-
 pyanaconda/ui/gui/hubs/summary.glade  |  6 +++++-
 widgets/src/HubWindow.c               |  4 ++--
 widgets/src/glade-adaptor.c           | 17 ++++++++---------
 4 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/pyanaconda/ui/gui/hubs/progress.glade b/pyanaconda/ui/gui/hubs/progress.glade
index f459ce0..b072e32 100644
--- a/pyanaconda/ui/gui/hubs/progress.glade
+++ b/pyanaconda/ui/gui/hubs/progress.glade
@@ -23,6 +23,9 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
             </child>
           </object>
@@ -36,7 +39,8 @@
           <object class="GtkAlignment" id="AnacondaHubWindow-alignment1">
             <property name="can_focus">False</property>
             <property name="yalign">0</property>
-            <property name="xscale">0.5</property>
+            <property name="left_padding">12</property>
+            <property name="right_padding">6</property>
             <child internal-child="action_area">
               <object class="GtkBox" id="progressWindow-actionArea">
                 <property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/hubs/summary.glade b/pyanaconda/ui/gui/hubs/summary.glade
index 8588791..88313c2 100644
--- a/pyanaconda/ui/gui/hubs/summary.glade
+++ b/pyanaconda/ui/gui/hubs/summary.glade
@@ -24,6 +24,9 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
             </child>
           </object>
@@ -37,7 +40,8 @@
           <object class="GtkAlignment" id="AnacondaHubWindow-alignment1">
             <property name="can_focus">False</property>
             <property name="yalign">0</property>
-            <property name="xscale">0.5</property>
+            <property name="left_padding">12</property>
+            <property name="right_padding">6</property>
             <child internal-child="action_area">
               <object class="GtkBox" id="summaryWindow-actionArea">
                 <property name="can_focus">False</property>
diff --git a/widgets/src/HubWindow.c b/widgets/src/HubWindow.c
index bfdd228..a093bce 100644
--- a/widgets/src/HubWindow.c
+++ b/widgets/src/HubWindow.c
@@ -133,8 +133,8 @@ static void anaconda_hub_window_init(AnacondaHubWindow *win) {
 
     /* The hub has different alignment requirements than a spoke. */
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-    gtk_alignment_set(GTK_ALIGNMENT(anaconda_base_window_get_alignment(ANACONDA_BASE_WINDOW(win))),
-                      0.5, 0.0, 0.5, 1.0);
+    gtk_alignment_set_padding(GTK_ALIGNMENT(anaconda_base_window_get_alignment(ANACONDA_BASE_WINDOW(win))),
+            0, 0, 12, 6);
 G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
diff --git a/widgets/src/glade-adaptor.c b/widgets/src/glade-adaptor.c
index 8cc37d2..b5146f1 100644
--- a/widgets/src/glade-adaptor.c
+++ b/widgets/src/glade-adaptor.c
@@ -62,15 +62,14 @@ void anaconda_standalone_window_post_create(GladeWidgetAdaptor *adaptor,
 
     alignment_widget = glade_widget_get_from_gobject(anaconda_base_window_get_alignment(window));
 
+    glade_widget_property_set(alignment_widget, "xalign", 0.5);
+    glade_widget_property_set(alignment_widget, "yalign", 0.0);
+    glade_widget_property_set(alignment_widget, "xscale", 1.0);
+    glade_widget_property_set(alignment_widget, "yscale", 1.0);
+
+    /* Set padding on hubs */
     if (ANACONDA_IS_HUB_WINDOW(object)) {
-        glade_widget_property_set(alignment_widget, "xalign", 0.5);
-        glade_widget_property_set(alignment_widget, "yalign", 0.0);
-        glade_widget_property_set(alignment_widget, "xscale", 0.5);
-        glade_widget_property_set(alignment_widget, "yscale", 1.0);
-    } else {
-        glade_widget_property_set(alignment_widget, "xalign", 0.5);
-        glade_widget_property_set(alignment_widget, "yalign", 0.0);
-        glade_widget_property_set(alignment_widget, "xscale", 1.0);
-        glade_widget_property_set(alignment_widget, "yscale", 1.0);
+        glade_widget_property_set(alignment_widget, "left-padding", 12);
+        glade_widget_property_set(alignment_widget, "right-padding", 6);
     }
 }
-- 
2.1.0



More information about the anaconda-patches mailing list