[libpanel] grid: add foreach_frame() callback helper
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpanel] grid: add foreach_frame() callback helper
- Date: Fri, 16 Sep 2022 03:04:04 +0000 (UTC)
commit f823550b5ab7c8a542c3b0c41648128c4b0caef5
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 15 20:03:27 2022 -0700
grid: add foreach_frame() callback helper
src/panel-grid.c | 28 ++++++++++++++++++++++++++++
src/panel-grid.h | 4 ++++
2 files changed, 32 insertions(+)
---
diff --git a/src/panel-grid.c b/src/panel-grid.c
index dac2b4b..17f693e 100644
--- a/src/panel-grid.c
+++ b/src/panel-grid.c
@@ -732,3 +732,31 @@ panel_grid_agree_to_close_finish (PanelGrid *self,
return g_task_propagate_boolean (G_TASK (result), error);
}
+
+/**
+ * panel_grid_foreach_frame:
+ * @self: a #PanelGrid
+ * @callback: (scope call): a #PanelFrameCallback
+ * @user_data: closure data for @callback
+ *
+ * Calls @callback for each #PanelFrame within @grid.
+ */
+void
+panel_grid_foreach_frame (PanelGrid *self,
+ PanelFrameCallback callback,
+ gpointer user_data)
+{
+ guint n_columns;
+
+ g_return_if_fail (PANEL_IS_GRID (self));
+ g_return_if_fail (callback != NULL);
+
+ n_columns = panel_grid_get_n_columns (self);
+
+ for (guint i = 0; i < n_columns; i++)
+ {
+ PanelGridColumn *column = panel_grid_get_column (self, i);
+
+ panel_grid_column_foreach_frame (column, callback, user_data);
+ }
+}
diff --git a/src/panel-grid.h b/src/panel-grid.h
index 5f6ff9c..c7eefb2 100644
--- a/src/panel-grid.h
+++ b/src/panel-grid.h
@@ -48,6 +48,10 @@ PanelGridColumn *panel_grid_get_most_recent_column (PanelGrid *self);
PANEL_AVAILABLE_IN_ALL
PanelFrame *panel_grid_get_most_recent_frame (PanelGrid *self);
PANEL_AVAILABLE_IN_ALL
+void panel_grid_foreach_frame (PanelGrid *self,
+ PanelFrameCallback callback,
+ gpointer user_data);
+PANEL_AVAILABLE_IN_ALL
void panel_grid_add (PanelGrid *self,
PanelWidget *widget);
PANEL_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]