[gtk: 65/72] stacksidebar: Fold some functions into their only callers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 65/72] stacksidebar: Fold some functions into their only callers
- Date: Wed, 14 Oct 2020 19:08:13 +0000 (UTC)
commit 8f24b7ad27615e24ea5c342da6514052b3db6808
Author: Timm Bäder <mail baedert org>
Date: Sun Oct 11 19:56:22 2020 +0200
stacksidebar: Fold some functions into their only callers
gtk/gtkstacksidebar.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkstacksidebar.c b/gtk/gtkstacksidebar.c
index a9f5f24c08..ef43761d62 100644
--- a/gtk/gtkstacksidebar.c
+++ b/gtk/gtkstacksidebar.c
@@ -238,9 +238,10 @@ add_child (guint position,
static void
populate_sidebar (GtkStackSidebar *self)
{
- guint i;
+ guint i, n;
- for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->pages)); i++)
+ n = g_list_model_get_n_items (G_LIST_MODEL (self->pages));
+ for (i = 0; i < n; i++)
add_child (i, self);
}
@@ -295,20 +296,6 @@ selection_changed_cb (GtkSelectionModel *model,
}
}
-static void
-disconnect_stack_signals (GtkStackSidebar *self)
-{
- g_signal_handlers_disconnect_by_func (self->pages, items_changed_cb, self);
- g_signal_handlers_disconnect_by_func (self->pages, selection_changed_cb, self);
-}
-
-static void
-connect_stack_signals (GtkStackSidebar *self)
-{
- g_signal_connect (self->pages, "items-changed", G_CALLBACK (items_changed_cb), self);
- g_signal_connect (self->pages, "selection-changed", G_CALLBACK (selection_changed_cb), self);
-}
-
static void
set_stack (GtkStackSidebar *self,
GtkStack *stack)
@@ -318,7 +305,8 @@ set_stack (GtkStackSidebar *self,
self->stack = g_object_ref (stack);
self->pages = gtk_stack_get_pages (stack);
populate_sidebar (self);
- connect_stack_signals (self);
+ g_signal_connect (self->pages, "items-changed", G_CALLBACK (items_changed_cb), self);
+ g_signal_connect (self->pages, "selection-changed", G_CALLBACK (selection_changed_cb), self);
}
}
@@ -327,7 +315,8 @@ unset_stack (GtkStackSidebar *self)
{
if (self->stack)
{
- disconnect_stack_signals (self);
+ g_signal_handlers_disconnect_by_func (self->pages, items_changed_cb, self);
+ g_signal_handlers_disconnect_by_func (self->pages, selection_changed_cb, self);
clear_sidebar (self);
g_clear_object (&self->stack);
g_clear_object (&self->pages);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]