From 4ced018164553d115a24947ec74dace836e99732 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 30 Sep 2017 02:25:47 +0200 Subject: Hunted every GList to the last (except in libnrtype and libcroco) --- src/live_effects/parameter/togglebutton.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/live_effects/parameter/togglebutton.cpp') diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index 16b8f9067..e26884d6a 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -147,21 +147,25 @@ ToggleButtonParam::refresh_button() if(!box_button){ return; } - GList * childs = gtk_container_get_children(GTK_CONTAINER(box_button->gobj())); - guint total_widgets = g_list_length (childs); + std::vector children = Glib::wrap(GTK_CONTAINER(box_button))->get_children(); if (!param_label.empty()) { + Gtk::Label *lab = dynamic_cast(children[children.size()-1]); + if (!lab) return; if(value || inactive_label.empty()){ - gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, total_widgets-1)), param_label.c_str()); + lab->set_text(param_label.c_str()); }else{ - gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, total_widgets-1)), inactive_label.c_str()); + lab->set_text(inactive_label.c_str()); } } if ( _icon_active ) { GdkPixbuf * icon_pixbuf = NULL; + Gtk::Image *im = dynamic_cast(children[0]); + Gtk::IconSize is(_icon_size); + if (!im) return; if(!value){ - gtk_image_set_from_icon_name (GTK_IMAGE(g_list_nth_data(childs, 0)), _icon_inactive, _icon_size); + im->set_from_icon_name(_icon_inactive, is); } else { - gtk_image_set_from_icon_name (GTK_IMAGE(g_list_nth_data(childs, 0)), _icon_active, _icon_size); + im->set_from_icon_name(_icon_active, is); } } } -- cgit v1.2.3