From 9a1914e355330566fbc1bc4b2e03a110c8ecd8d2 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 1 May 1998 13:18:28 +0000 Subject: [PATCH] keep the channel list uptodate on position changes. unref list items on Fri May 1 13:22:21 1998 Tim Janik * app/channels_dialog.c: keep the channel list uptodate on position changes. unref list items on destruction. the app/channels_dialog.c app/layers_dialog.c code for dealing with GtkList is a MESS, it needs to be completely reworked somewhen. this is *no* fun: the selection is changed so update the list (causing the selection to change again: the selection is changed so update the list (causing the selection to change again: the selection is changed so update the list (.... oops, sorry got caught in a recursive loop there ;) ))). --- ChangeLog | 13 +++++++++++++ app/channels_dialog.c | 9 +++++---- app/gui/channels-dialog.c | 9 +++++---- app/gui/layers-dialog.c | 3 ++- app/layers_dialog.c | 3 ++- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa4717a827..2d84a16784 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri May 1 13:22:21 1998 Tim Janik + + * app/channels_dialog.c: keep the channel list uptodate + on position changes. unref list items on destruction. + + the app/channels_dialog.c app/layers_dialog.c code for dealing + with GtkList is a MESS, it needs to be completely reworked + somewhen. this is *no* fun: the selection is changed so update + the list (causing the selection to change again: the selection + is changed so update the list (causing the selection to change + again: the selection is changed so update the list (.... oops, + sorry got caught in a recursive loop there ;) ))). + Thu Apr 30 16:49:41 PDT 1998 Manish Singh * app/channels_dialog.c: fix for off-by-one error in channel diff --git a/app/channels_dialog.c b/app/channels_dialog.c index d911409c1c..378f7fe71f 100644 --- a/app/channels_dialog.c +++ b/app/channels_dialog.c @@ -690,12 +690,13 @@ channels_dialog_position_channel (ChannelWidget *channel_widget, /* Remove the channel from the dialog */ list = g_list_append (list, channel_widget->list_item); gtk_list_remove_items (GTK_LIST (channelsD->channel_list), list); - + channelsD->channel_widgets = g_slist_remove (channelsD->channel_widgets, channel_widget); + suspend_gimage_notify--; /* Add it back at the proper index */ gtk_list_insert_items (GTK_LIST (channelsD->channel_list), list, new_index + channelsD->num_components); - + channelsD->channel_widgets = g_slist_insert (channelsD->channel_widgets, channel_widget, new_index + channelsD->num_components); } @@ -1070,7 +1071,7 @@ create_channel_widget (GImage *gimage, gtk_widget_show (vbox); gtk_widget_show (list_item); - gtk_widget_ref (GTK_WIDGET (channel_widget->list_item)); + gtk_widget_ref (channel_widget->list_item); return channel_widget; } @@ -1085,7 +1086,7 @@ channel_widget_delete (ChannelWidget *channel_widget) /* Remove the channel widget from the list */ channelsD->channel_widgets = g_slist_remove (channelsD->channel_widgets, channel_widget); - /* Free the widget */ + /* Release the widget */ gtk_widget_unref (channel_widget->list_item); g_free (channel_widget); } diff --git a/app/gui/channels-dialog.c b/app/gui/channels-dialog.c index d911409c1c..378f7fe71f 100644 --- a/app/gui/channels-dialog.c +++ b/app/gui/channels-dialog.c @@ -690,12 +690,13 @@ channels_dialog_position_channel (ChannelWidget *channel_widget, /* Remove the channel from the dialog */ list = g_list_append (list, channel_widget->list_item); gtk_list_remove_items (GTK_LIST (channelsD->channel_list), list); - + channelsD->channel_widgets = g_slist_remove (channelsD->channel_widgets, channel_widget); + suspend_gimage_notify--; /* Add it back at the proper index */ gtk_list_insert_items (GTK_LIST (channelsD->channel_list), list, new_index + channelsD->num_components); - + channelsD->channel_widgets = g_slist_insert (channelsD->channel_widgets, channel_widget, new_index + channelsD->num_components); } @@ -1070,7 +1071,7 @@ create_channel_widget (GImage *gimage, gtk_widget_show (vbox); gtk_widget_show (list_item); - gtk_widget_ref (GTK_WIDGET (channel_widget->list_item)); + gtk_widget_ref (channel_widget->list_item); return channel_widget; } @@ -1085,7 +1086,7 @@ channel_widget_delete (ChannelWidget *channel_widget) /* Remove the channel widget from the list */ channelsD->channel_widgets = g_slist_remove (channelsD->channel_widgets, channel_widget); - /* Free the widget */ + /* Release the widget */ gtk_widget_unref (channel_widget->list_item); g_free (channel_widget); } diff --git a/app/gui/layers-dialog.c b/app/gui/layers-dialog.c index 09d55a46a2..4cd0496af2 100644 --- a/app/gui/layers-dialog.c +++ b/app/gui/layers-dialog.c @@ -531,6 +531,7 @@ layers_dialog_flush () { lw = (LayerWidget *) list->data; list = g_slist_next (list); + if ((gimage_pos = gimage_get_layer_index (gimage, lw->layer)) != pos) layers_dialog_position_layer ((lw->layer), gimage_pos); @@ -2034,7 +2035,7 @@ layer_widget_delete (LayerWidget *layer_widget) /* Remove the layer widget from the list */ layersD->layer_widgets = g_slist_remove (layersD->layer_widgets, layer_widget); - /* Free the widget */ + /* Release the widget */ gtk_widget_unref (layer_widget->list_item); g_free (layer_widget); } diff --git a/app/layers_dialog.c b/app/layers_dialog.c index 09d55a46a2..4cd0496af2 100644 --- a/app/layers_dialog.c +++ b/app/layers_dialog.c @@ -531,6 +531,7 @@ layers_dialog_flush () { lw = (LayerWidget *) list->data; list = g_slist_next (list); + if ((gimage_pos = gimage_get_layer_index (gimage, lw->layer)) != pos) layers_dialog_position_layer ((lw->layer), gimage_pos); @@ -2034,7 +2035,7 @@ layer_widget_delete (LayerWidget *layer_widget) /* Remove the layer widget from the list */ layersD->layer_widgets = g_slist_remove (layersD->layer_widgets, layer_widget); - /* Free the widget */ + /* Release the widget */ gtk_widget_unref (layer_widget->list_item); g_free (layer_widget); }