[gnome-builder/editor-layout] grid: add helper to find a tab of certain type
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/editor-layout] grid: add helper to find a tab of certain type
- Date: Mon, 1 Dec 2014 13:20:44 +0000 (UTC)
commit 6e6869f400b4ed55edfc95291712c6863aeb3bb7
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 1 05:08:53 2014 -0800
grid: add helper to find a tab of certain type
src/tabs/gb-tab-grid.c | 27 +++++++++++++++++++++++++++
src/tabs/gb-tab-grid.h | 2 ++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/tabs/gb-tab-grid.c b/src/tabs/gb-tab-grid.c
index a549615..1615d8b 100644
--- a/src/tabs/gb-tab-grid.c
+++ b/src/tabs/gb-tab-grid.c
@@ -756,6 +756,33 @@ gb_tab_grid_focus_tab (GbTabGrid *grid,
}
}
+GbTab *
+gb_tab_grid_find_tab_typed (GbTabGrid *grid,
+ GType type)
+{
+ GbTab *ret = NULL;
+ GList *list;
+ GList *iter;
+
+ g_return_val_if_fail (GB_IS_TAB_GRID (grid), NULL);
+ g_return_val_if_fail (g_type_is_a (type, GB_TYPE_TAB), NULL);
+
+ list = gb_tab_grid_get_tabs (grid);
+
+ for (iter = list; iter; iter = iter->next)
+ {
+ if (g_type_is_a (G_TYPE_FROM_INSTANCE (iter->data), type))
+ {
+ ret = iter->data;
+ break;
+ }
+ }
+
+ g_list_free (list);
+
+ return ret;
+}
+
static void
gb_tab_grid_grab_focus (GtkWidget *widget)
{
diff --git a/src/tabs/gb-tab-grid.h b/src/tabs/gb-tab-grid.h
index 3a1f8b7..fa75f6b 100644
--- a/src/tabs/gb-tab-grid.h
+++ b/src/tabs/gb-tab-grid.h
@@ -63,6 +63,8 @@ void gb_tab_grid_focus_next_tab (GbTabGrid *grid,
GbTab *tab);
void gb_tab_grid_focus_previous_tab (GbTabGrid *grid,
GbTab *tab);
+GbTab *gb_tab_grid_find_tab_typed (GbTabGrid *grid,
+ GType type);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]