[gnome-builder/wip/chergert/layout] layout: add helper to count views
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/layout] layout: add helper to count views
- Date: Mon, 17 Jul 2017 10:12:08 +0000 (UTC)
commit cfeb5c2bea8130ae8a94985d8cd30d33ca79b707
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 17 02:41:11 2017 -0700
layout: add helper to count views
libide/layout/ide-layout-grid.c | 21 +++++++++++++++++++++
libide/layout/ide-layout-grid.h | 1 +
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libide/layout/ide-layout-grid.c b/libide/layout/ide-layout-grid.c
index 45e8688..595327c 100644
--- a/libide/layout/ide-layout-grid.c
+++ b/libide/layout/ide-layout-grid.c
@@ -863,6 +863,8 @@ ide_layout_grid_stack_items_changed (IdeLayoutGrid *self,
removed,
added);
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CURRENT_VIEW]);
+
return;
}
@@ -926,3 +928,22 @@ _ide_layout_grid_stack_removed (IdeLayoutGrid *self,
}
}
}
+
+static void
+count_views_cb (GtkWidget *widget,
+ gpointer data)
+{
+ (*(guint *)data)++;
+}
+
+guint
+ide_layout_grid_count_views (IdeLayoutGrid *self)
+{
+ guint count = 0;
+
+ g_return_val_if_fail (IDE_IS_LAYOUT_GRID (self), 0);
+
+ ide_layout_grid_foreach_view (self, count_views_cb, &count);
+
+ return count;
+}
diff --git a/libide/layout/ide-layout-grid.h b/libide/layout/ide-layout-grid.h
index a14d1ac..9492a44 100644
--- a/libide/layout/ide-layout-grid.h
+++ b/libide/layout/ide-layout-grid.h
@@ -54,6 +54,7 @@ void ide_layout_grid_set_current_column (IdeLayoutGrid *se
IdeLayoutGridColumn *column);
IdeLayoutStack *ide_layout_grid_get_current_stack (IdeLayoutGrid *self);
IdeLayoutView *ide_layout_grid_get_current_view (IdeLayoutGrid *self);
+guint ide_layout_grid_count_views (IdeLayoutGrid *self);
void ide_layout_grid_foreach_view (IdeLayoutGrid *self,
GtkCallback callback,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]