diff options
author | Morten Welinder <terra@gnome.org> | 2004-03-17 15:29:06 +0000 |
---|---|---|
committer | Morten Welinder <mortenw@src.gnome.org> | 2004-03-17 15:29:06 +0000 |
commit | feba65f2669d9f06fa66df1b8d4a9ab87bcc92eb (patch) | |
tree | 4b714b218490657603dc2f48caf4e0a13a37e82d /gtk/gtkpathbar.c | |
parent | 1077e7f90471508ebb0cf227b0fea8fcf3891d90 (diff) | |
download | gtk+-feba65f2669d9f06fa66df1b8d4a9ab87bcc92eb.tar.gz |
Make this work when the slider buttons have been destroyed.
2004-03-17 Morten Welinder <terra@gnome.org>
* gtk/gtkpathbar.c (gtk_path_bar_forall): Make this work when the
slider buttons have been destroyed.
(gtk_path_bar_remove): Make this work for slider buttons too.
Fixes http://bugzilla.gnome.org/show_bug.cgi?id=137257
Diffstat (limited to 'gtk/gtkpathbar.c')
-rw-r--r-- | gtk/gtkpathbar.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 0f1aab9eac..3009ed7f43 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -497,6 +497,16 @@ gtk_path_bar_add (GtkContainer *container, } static void +gtk_path_bar_remove_1 (GtkContainer *container, + GtkWidget *widget) +{ + gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gtk_widget_unparent (widget); + if (was_visible) + gtk_widget_queue_resize (GTK_WIDGET (container)); +} + +static void gtk_path_bar_remove (GtkContainer *container, GtkWidget *widget) { @@ -505,23 +515,29 @@ gtk_path_bar_remove (GtkContainer *container, path_bar = GTK_PATH_BAR (container); - children = path_bar->button_list; + if (widget == path_bar->up_slider_button) + { + gtk_path_bar_remove_1 (container, widget); + path_bar->up_slider_button = NULL; + return; + } + if (widget == path_bar->down_slider_button) + { + gtk_path_bar_remove_1 (container, widget); + path_bar->down_slider_button = NULL; + return; + } + + children = path_bar->button_list; while (children) { if (widget == BUTTON_DATA (children->data)->button) { - gboolean was_visible; - - was_visible = GTK_WIDGET_VISIBLE (widget); - gtk_widget_unparent (widget); - + gtk_path_bar_remove_1 (container, widget); path_bar->button_list = g_list_remove_link (path_bar->button_list, children); g_list_free (children); - - if (was_visible) - gtk_widget_queue_resize (GTK_WIDGET (container)); - break; + return; } children = children->next; @@ -550,8 +566,11 @@ gtk_path_bar_forall (GtkContainer *container, (* callback) (child, callback_data); } - (* callback) (path_bar->up_slider_button, callback_data); - (* callback) (path_bar->down_slider_button, callback_data); + if (path_bar->up_slider_button) + (* callback) (path_bar->up_slider_button, callback_data); + + if (path_bar->down_slider_button) + (* callback) (path_bar->down_slider_button, callback_data); } static void |