From 82abe41759b69ed75cfcc8bb1c764801c68fef36 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Mon, 4 May 2020 14:13:32 +0300 Subject: [PATCH] session-bin: add _get_n_children() method --- lib/wp/session-bin.c | 12 ++++++++++++ lib/wp/session-bin.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/lib/wp/session-bin.c b/lib/wp/session-bin.c index 4ddfb33b..30d77b37 100644 --- a/lib/wp/session-bin.c +++ b/lib/wp/session-bin.c @@ -117,6 +117,18 @@ wp_session_bin_remove (WpSessionBin *self, WpSessionItem *item) return g_ptr_array_remove_fast (priv->items, item); } +/** + * wp_session_bin_get_n_children: + * @self: the session bin + * + * Returns: the number of child items in the bin + */ +guint +wp_session_bin_get_n_children (WpSessionBin *self) +{ + WpSessionBinPrivate *priv = wp_session_bin_get_instance_private (self); + return priv->items->len; +} struct _WpSessionBinIterator { diff --git a/lib/wp/session-bin.h b/lib/wp/session-bin.h index df827c8a..608aaf1c 100644 --- a/lib/wp/session-bin.h +++ b/lib/wp/session-bin.h @@ -42,6 +42,9 @@ gboolean wp_session_bin_add (WpSessionBin *self, WpSessionItem *item); WP_API gboolean wp_session_bin_remove (WpSessionBin *self, WpSessionItem *item); +WP_API +guint wp_session_bin_get_n_children (WpSessionBin *self); + WP_API WpIterator *wp_session_bin_iterate (WpSessionBin *self); -- GitLab