[gnome-builder/wip/chergert/headerbar] headerbar: add helper to get IdeOmniBar



commit cd5fd6baa847c8e61474a657fe0dcf7ca6142945
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 22 18:29:28 2016 -0700

    headerbar: add helper to get IdeOmniBar
    
    The OmniBar is pretty much what it says, the joining of a bunch of things
    into a single widget. Getting the density of information we want definitely
    can result in non-clean abstractions.
    
    However, if we can come up with a good way to have extension points in the
    omnibar, we might just be able to clean this up.

 libide/workbench/ide-workbench-header-bar.c  |   14 +++++++++++++-
 libide/workbench/ide-workbench-header-bar.h  |   23 +++++++++++++----------
 libide/workbench/ide-workbench-header-bar.ui |    2 +-
 3 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/libide/workbench/ide-workbench-header-bar.c b/libide/workbench/ide-workbench-header-bar.c
index 92d2dc5..26a3144 100644
--- a/libide/workbench/ide-workbench-header-bar.c
+++ b/libide/workbench/ide-workbench-header-bar.c
@@ -34,6 +34,7 @@ typedef struct
   EggPriorityBox *center_left_box;
   EggPriorityBox *right_box;
   EggPriorityBox *left_box;
+  IdeOmniBar     *omni_bar;
 } IdeWorkbenchHeaderBarPrivate;
 
 static void buildable_iface_init (GtkBuildableIface *iface);
@@ -57,8 +58,9 @@ ide_workbench_header_bar_class_init (IdeWorkbenchHeaderBarClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, center_box);
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, center_right_box);
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, center_left_box);
-  gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, menu_button);
   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);
   gtk_widget_class_bind_template_child_private (widget_class, IdeWorkbenchHeaderBar, right_box);
 }
 
@@ -174,3 +176,13 @@ buildable_iface_init (GtkBuildableIface *iface)
 {
   iface->get_internal_child = ide_workbench_header_bar_get_internal_child;
 }
+
+IdeOmniBar *
+ide_workbench_header_bar_get_omni_bar (IdeWorkbenchHeaderBar *self)
+{
+  IdeWorkbenchHeaderBarPrivate *priv = ide_workbench_header_bar_get_instance_private (self);
+
+  g_return_val_if_fail (IDE_IS_WORKBENCH_HEADER_BAR (self), NULL);
+
+  return priv->omni_bar;
+}
diff --git a/libide/workbench/ide-workbench-header-bar.h b/libide/workbench/ide-workbench-header-bar.h
index 2ccd7b7..69d3a41 100644
--- a/libide/workbench/ide-workbench-header-bar.h
+++ b/libide/workbench/ide-workbench-header-bar.h
@@ -21,6 +21,8 @@
 
 #include <gtk/gtk.h>
 
+#include "ide-omni-bar.h"
+
 G_BEGIN_DECLS
 
 #define IDE_TYPE_WORKBENCH_HEADER_BAR (ide_workbench_header_bar_get_type())
@@ -41,16 +43,17 @@ struct _IdeWorkbenchHeaderBarClass
   gpointer _reserved8;
 };
 
-GtkWidget *ide_workbench_header_bar_new          (void);
-void       ide_workbench_header_bar_focus_search (IdeWorkbenchHeaderBar *self);
-void       ide_workbench_header_bar_insert_left  (IdeWorkbenchHeaderBar *self,
-                                                  GtkWidget             *widget,
-                                                  GtkPackType            pack_type,
-                                                  gint                   priority);
-void       ide_workbench_header_bar_insert_right (IdeWorkbenchHeaderBar *self,
-                                                  GtkWidget             *widget,
-                                                  GtkPackType            pack_type,
-                                                  gint                   priority);
+GtkWidget  *ide_workbench_header_bar_new          (void);
+IdeOmniBar *ide_workbench_header_bar_get_omni_bar (IdeWorkbenchHeaderBar *self);
+void        ide_workbench_header_bar_focus_search (IdeWorkbenchHeaderBar *self);
+void        ide_workbench_header_bar_insert_left  (IdeWorkbenchHeaderBar *self,
+                                                   GtkWidget             *widget,
+                                                   GtkPackType            pack_type,
+                                                   gint                   priority);
+void        ide_workbench_header_bar_insert_right (IdeWorkbenchHeaderBar *self,
+                                                   GtkWidget             *widget,
+                                                   GtkPackType            pack_type,
+                                                   gint                   priority);
 
 G_END_DECLS
 
diff --git a/libide/workbench/ide-workbench-header-bar.ui b/libide/workbench/ide-workbench-header-bar.ui
index f730d75..cf812f0 100644
--- a/libide/workbench/ide-workbench-header-bar.ui
+++ b/libide/workbench/ide-workbench-header-bar.ui
@@ -30,7 +30,7 @@
           </packing>
         </child>
         <child type="center">
-          <object class="IdeOmniBar" id="bar">
+          <object class="IdeOmniBar" id="omni_bar">
             <property name="visible">true</property>
           </object>
         </child>


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