[gnome-builder/wip/chergert/headerbar] headerbar: remove workarounds for HeaderBar lacking hexpand support



commit 7156560f61b2c03927fe476ffaffc8c6d2ccaadb
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jun 27 13:37:28 2016 -0700

    headerbar: remove workarounds for HeaderBar lacking hexpand support
    
    Now that gtk+ has support for hexpand, we can remove our workaround (which
    wasn't totally correct anyway).

 libide/workbench/ide-omni-bar.ui             |    1 -
 libide/workbench/ide-workbench-header-bar.c  |   44 +++++---------------------
 libide/workbench/ide-workbench-header-bar.ui |   42 +-----------------------
 3 files changed, 10 insertions(+), 77 deletions(-)
---
diff --git a/libide/workbench/ide-omni-bar.ui b/libide/workbench/ide-omni-bar.ui
index 1255cd7..cccda98 100644
--- a/libide/workbench/ide-omni-bar.ui
+++ b/libide/workbench/ide-omni-bar.ui
@@ -14,7 +14,6 @@
             <property name="visible">true</property>
             <child>
               <object class="GtkBox">
-                <property name="hexpand">true</property>
                 <property name="visible">true</property>
                 <property name="margin-end">3</property>
                 <property name="margin-start">3</property>
diff --git a/libide/workbench/ide-workbench-header-bar.c b/libide/workbench/ide-workbench-header-bar.c
index dbb72cf..3e0fc0c 100644
--- a/libide/workbench/ide-workbench-header-bar.c
+++ b/libide/workbench/ide-workbench-header-bar.c
@@ -31,8 +31,6 @@ typedef struct
 {
   GtkMenuButton      *menu_button;
   EggPriorityBox     *center_box;
-  EggPriorityBox     *center_right_box;
-  EggPriorityBox     *center_left_box;
   EggPriorityBox     *right_box;
   EggPriorityBox     *left_box;
   IdeOmniBar         *omni_bar;
@@ -58,8 +56,6 @@ ide_workbench_header_bar_class_init (IdeWorkbenchHeaderBarClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/ide-workbench-header-bar.ui");
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, center_box);
-  gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, center_left_box);
-  gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, center_right_box);
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, left_box);
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, menu_button);
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, omni_bar);
@@ -104,22 +100,10 @@ ide_workbench_header_bar_insert_left (IdeWorkbenchHeaderBar *self,
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (pack_type == GTK_PACK_START || pack_type == GTK_PACK_END);
 
-  /*
-   * NOTE: Because GtkHeaderBar does not currently support hexpand, we
-   *       need to check the pack_type requested and possibly insert it
-   *       into our custom center-child.
-   */
-
-  if (pack_type == GTK_PACK_END)
-    gtk_container_add_with_properties (GTK_CONTAINER (priv->center_left_box), widget,
-                                       "pack-type", pack_type,
-                                       "priority", priority,
-                                       NULL);
-  else
-    gtk_container_add_with_properties (GTK_CONTAINER (priv->left_box), widget,
-                                       "pack-type", pack_type,
-                                       "priority", priority,
-                                       NULL);
+  gtk_container_add_with_properties (GTK_CONTAINER (priv->left_box), widget,
+                                     "pack-type", pack_type,
+                                     "priority", priority,
+                                     NULL);
 }
 
 void
@@ -134,22 +118,10 @@ ide_workbench_header_bar_insert_right (IdeWorkbenchHeaderBar *self,
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (pack_type == GTK_PACK_START || pack_type == GTK_PACK_END);
 
-  /*
-   * NOTE: Because GtkHeaderBar does not currently support hexpand, we
-   *       need to check the pack_type requested and possibly insert it
-   *       into our custom center-child.
-   */
-
-  if (pack_type == GTK_PACK_START)
-    gtk_container_add_with_properties (GTK_CONTAINER (priv->center_right_box), widget,
-                                       "pack-type", pack_type,
-                                       "priority", priority,
-                                       NULL);
-  else
-    gtk_container_add_with_properties (GTK_CONTAINER (priv->right_box), widget,
-                                       "pack-type", pack_type,
-                                       "priority", priority,
-                                       NULL);
+  gtk_container_add_with_properties (GTK_CONTAINER (priv->right_box), widget,
+                                     "pack-type", pack_type,
+                                     "priority", priority,
+                                     NULL);
 }
 
 static GObject *
diff --git a/libide/workbench/ide-workbench-header-bar.ui b/libide/workbench/ide-workbench-header-bar.ui
index 10112c8..4d947d7 100644
--- a/libide/workbench/ide-workbench-header-bar.ui
+++ b/libide/workbench/ide-workbench-header-bar.ui
@@ -15,38 +15,8 @@
       </packing>
     </child>
     <child type="title">
-      <object class="GtkBox" id="center_box">
-        <property name="spacing">6</property>
+      <object class="IdeOmniBar" id="omni_bar">
         <property name="visible">true</property>
-        <child>
-          <object class="EggPriorityBox" id="center_left_box">
-            <property name="halign">end</property>
-            <property name="margin-start">30</property>
-            <property name="visible">true</property>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-            <property name="fill">true</property>
-            <property name="expand">true</property>
-          </packing>
-        </child>
-        <child type="center">
-          <object class="IdeOmniBar" id="omni_bar">
-            <property name="visible">true</property>
-          </object>
-        </child>
-        <child>
-          <object class="EggPriorityBox" id="center_right_box">
-            <property name="halign">start</property>
-            <property name="margin-end">30</property>
-            <property name="visible">true</property>
-          </object>
-          <packing>
-            <property name="pack-type">end</property>
-            <property name="fill">true</property>
-            <property name="expand">true</property>
-          </packing>
-        </child>
       </object>
     </child>
     <child>
@@ -76,7 +46,7 @@
         </child>
         <child>
           <object class="IdeOmniSearchEntry" id="search_entry">
-            <property name="hexpand">true</property>
+            <property name="max-width-chars">25</property>
             <property name="placeholder-text" translatable="yes">Press Ctrl+. to search</property>
             <property name="visible">true</property>
           </object>
@@ -92,12 +62,4 @@
       </packing>
     </child>
   </template>
-  <object class="GtkSizeGroup">
-    <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
-    <widgets>
-      <!-- This is required due to bug https://bugzilla.gnome.org/show_bug.cgi?id=767932 -->
-      <widget name="center_right_box"/>
-      <widget name="center_left_box"/>
-    </widgets>
-  </object>
 </interface>


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