[gnome-builder] workbench: add typesafe helper to get headerbar



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

    workbench: add typesafe helper to get headerbar

 libide/workbench/ide-workbench.c |   16 ++++++++++++++++
 libide/workbench/ide-workbench.h |    3 +++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index 0062efe..e60eee9 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -850,3 +850,19 @@ ide_workbench_focus (IdeWorkbench *self,
   ide_workbench_show_parents (widget);
   gtk_widget_grab_focus (widget);
 }
+
+/**
+ * ide_workbench_get_headerbar:
+ *
+ * Helper that is equivalent to calling gtk_window_get_titlebar() and casting
+ * to an #IdeWorkbenchHeaderBar. This is convenience for plugins.
+ *
+ * Returns: (transfer none): An #IdeWorkbenchHeaderBar.
+ */
+IdeWorkbenchHeaderBar *
+ide_workbench_get_headerbar (IdeWorkbench *self)
+{
+  g_return_val_if_fail (IDE_IS_WORKBENCH (self), NULL);
+
+  return self->header_bar;
+}
diff --git a/libide/workbench/ide-workbench.h b/libide/workbench/ide-workbench.h
index bdcce00..b6b342a 100644
--- a/libide/workbench/ide-workbench.h
+++ b/libide/workbench/ide-workbench.h
@@ -25,6 +25,7 @@
 
 #include "util/ide-uri.h"
 #include "workbench/ide-perspective.h"
+#include "workbench/ide-workbench-header-bar.h"
 
 G_BEGIN_DECLS
 
@@ -96,6 +97,8 @@ void            ide_workbench_set_fullscreen               (IdeWorkbench
 void            ide_workbench_views_foreach                (IdeWorkbench           *self,
                                                             GtkCallback             callback,
                                                             gpointer                user_data);
+IdeWorkbenchHeaderBar *
+                ide_workbench_get_headerbar                (IdeWorkbench           *self);
 
 G_END_DECLS
 


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