changeset 14989:8d3a5ff15f05

[gaim-migrate @ 17768] some more situations where gtk_widget_destroy() should be used instead of gtk_container_remove() committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 17 Nov 2006 19:27:58 +0000
parents 41ced1c9ba29
children 633d4c25e82c
files gtk/gtkblist.c
diffstat 1 files changed, 10 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkblist.c	Fri Nov 17 06:12:17 2006 +0000
+++ b/gtk/gtkblist.c	Fri Nov 17 19:27:58 2006 +0000
@@ -560,7 +560,7 @@
 rebuild_joinchat_entries(GaimGtkJoinChatData *data)
 {
 	GaimConnection *gc;
-	GList *list = NULL, *tmp = NULL;
+	GList *list = NULL, *tmp;
 	GHashTable *defaults = NULL;
 	struct proto_chat_entry *pce;
 	gboolean focus = TRUE;
@@ -569,11 +569,8 @@
 
 	gc = gaim_account_get_connection(data->account);
 
-	while (GTK_BOX(data->entries_box)->children)
-	{
-		gtk_container_remove(GTK_CONTAINER(data->entries_box),
-			((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
-	}
+	while ((tmp = gtk_container_get_children(GTK_CONTAINER(data->entries_box))))
+		gtk_widget_destroy(tmp->data);
 
 	g_list_free(data->entries);
 	data->entries = NULL;
@@ -5111,7 +5108,7 @@
 rebuild_addchat_entries(GaimGtkAddChatData *data)
 {
 	GaimConnection *gc;
-	GList *list = NULL, *tmp = NULL;
+	GList *list = NULL, *tmp;
 	GHashTable *defaults = NULL;
 	struct proto_chat_entry *pce;
 	gboolean focus = TRUE;
@@ -5120,11 +5117,8 @@
 
 	gc = gaim_account_get_connection(data->account);
 
-	while (GTK_BOX(data->entries_box)->children)
-	{
-		gtk_container_remove(GTK_CONTAINER(data->entries_box),
-			((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
-	}
+	while ((tmp = gtk_container_get_children(GTK_CONTAINER(data->entries_box))))
+		gtk_widget_destroy(tmp->data);
 
 	g_list_free(data->entries);
 
@@ -6126,17 +6120,14 @@
 
 		submenu = l->data;
 
-		menuitems = gtk_container_get_children(GTK_CONTAINER(submenu));
-		while (menuitems != NULL)
+		while ((menuitems = gtk_container_get_children(GTK_CONTAINER(submenu))) != NULL)
 		{
-			GaimPluginAction *action;
 			menuitem = menuitems->data;
-			action = g_object_get_data(G_OBJECT(menuitem), "plugin_action");
-			g_free(action);
-			menuitems = g_list_delete_link(menuitems, menuitems);
+			g_free(g_object_get_data(G_OBJECT(menuitem), "plugin_action"));
+			gtk_widget_destroy(menuitem);
 		}
 
-		gtk_container_remove(GTK_CONTAINER(pluginmenu), GTK_WIDGET(submenu));
+		gtk_widget_destroy(GTK_WIDGET(submenu));
 	}
 	g_list_free(plugin_submenus);
 	plugin_submenus = NULL;