summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2019-11-20 15:20:01 +1300
committerOndrej Holy <oholy@redhat.com>2019-12-10 09:54:27 +0000
commit36645259fd67818d4fbf530d447574911b4c3d08 (patch)
tree9f1a325e9fc1fce327b0923c930b67ee271a692e
parentcb6241f5409ee787bb30833b8759cc00c22d7c34 (diff)
downloadgnome-control-center-36645259fd67818d4fbf530d447574911b4c3d08.tar.gz
user-accouts: Don't use page names for CcCarousel
Ultimately the code was just trying to access the nth entry.
-rw-r--r--panels/user-accounts/cc-carousel.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/panels/user-accounts/cc-carousel.c b/panels/user-accounts/cc-carousel.c
index 703dbe215..70009c240 100644
--- a/panels/user-accounts/cc-carousel.c
+++ b/panels/user-accounts/cc-carousel.c
@@ -199,8 +199,8 @@ void
cc_carousel_select_item (CcCarousel *self,
CcCarouselItem *item)
{
- gchar *page_name;
gboolean page_changed = TRUE;
+ GList *children;
/* Select first user if none is specified */
if (item == NULL)
@@ -227,10 +227,8 @@ cc_carousel_select_item (CcCarousel *self,
return;
}
- page_name = g_strdup_printf ("%d", self->visible_page);
- gtk_stack_set_visible_child_name (self->stack, page_name);
-
- g_free (page_name);
+ children = gtk_container_get_children (GTK_CONTAINER (self->stack));
+ gtk_stack_set_visible_child (self->stack, GTK_WIDGET (g_list_nth_data (children, self->visible_page)));
update_buttons_visibility (self);
@@ -301,13 +299,10 @@ cc_carousel_add (GtkContainer *container,
last_box_is_full = ((g_list_length (self->children) - 1) % ITEMS_PER_PAGE == 0);
if (last_box_is_full) {
- g_autofree gchar *page = NULL;
-
- page = g_strdup_printf ("%d", CC_CAROUSEL_ITEM (widget)->page);
self->last_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (self->last_box);
gtk_widget_set_valign (self->last_box, GTK_ALIGN_CENTER);
- gtk_stack_add_named (self->stack, self->last_box, page);
+ gtk_container_add (GTK_CONTAINER (self->stack), self->last_box);
}
gtk_widget_show_all (widget);