im.pidgin.cpw.resiak.disconnectreason: d05eabc3d9cb0afe1d98c462f6e5aa5fa0f20b0d

resiak at soc.pidgin.im resiak at soc.pidgin.im
Wed Oct 31 11:41:03 EDT 2007


-----------------------------------------------------------------
Revision: d05eabc3d9cb0afe1d98c462f6e5aa5fa0f20b0d
Ancestor: 8182e735afe9772ddf522d11671bb93077b88670
Author: resiak at soc.pidgin.im
Date: 2007-10-31T00:57:26
Branch: im.pidgin.cpw.resiak.disconnectreason

Modified files:
        pidgin/gtkblist.c

ChangeLog: 

Break creating and removing generic error boxes by account into their own
functions.

-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	b1189f2d05c7947e1111c23973a85082dbe8f2c8
+++ pidgin/gtkblist.c	3ddbf234754f273de4a067f29bf39d81ebebbd5e
@@ -4358,10 +4358,10 @@ connection_error_button_clicked_cb(GtkBu
 
 #define BUTTON_DATA_KEY_ACCOUNT "account"
 
-/* Add some buttons that show connection errors */
-static GtkWidget *
-create_connection_error_button(PurpleAccount *account,
-                               const PurpleConnectionErrorInfo *err)
+/* Add a button showing the connection error message */
+static void
+add_generic_connection_error_button(PurpleAccount *account,
+                                    const PurpleConnectionErrorInfo *err)
 {
 	gchar *escaped, *text;
 	GtkWidget *button, *label, *image, *hbox;
@@ -4402,7 +4402,9 @@ create_connection_error_button(PurpleAcc
 	                 account);
 	gtk_widget_show_all(button);
 
-	return button;
+	gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button,
+	                 FALSE, FALSE, 0);
+	gtk_widget_show_all(gtkblist->error_buttons);
 }
 
 static gboolean
@@ -4416,15 +4418,25 @@ static void
 }
 
 static void
+remove_generic_connection_error_button(PurpleAccount *account)
+{
+	GtkButton *button;
+	GList *l = NULL;
+	GList *children = gtk_container_get_children(GTK_CONTAINER(gtkblist->error_buttons));
+	l = g_list_find_custom(children, account, (GCompareFunc) find_account_button);
+	if (l) { /* it may have already been removed by being clicked on */
+		button = GTK_BUTTON(l->data);
+		remove_error_button(button);
+	}
+	g_list_free(children);
+}
+
+static void
 update_account_error_state(PurpleAccount *account,
                            const PurpleConnectionErrorInfo *old,
                            const PurpleConnectionErrorInfo *new,
                            PidginBuddyList *gtkblist)
 {
-	GList *children = NULL;
-	GList *l = NULL;
-	GtkWidget *button;
-
 	/* For backwards compatibility: */
 	if (new)
 		pidgin_blist_update_account_error_state(account, new->description);
@@ -4432,21 +4444,11 @@ update_account_error_state(PurpleAccount
 		pidgin_blist_update_account_error_state(account, NULL);
 
 	if (old) {
-		children = gtk_container_get_children(GTK_CONTAINER(gtkblist->error_buttons));
-		l = g_list_find_custom(children, account, (GCompareFunc) find_account_button);
-		if (l) { /* it may have already been removed by being clicked on */
-			button = GTK_WIDGET(l->data);
-			remove_error_button(GTK_BUTTON(button));
-		}
-		g_list_free(l);
-		l = NULL;
+		remove_generic_connection_error_button(account);
 	}
 
 	if (new) {
-		button = create_connection_error_button(account, new);
-		gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button,
-		                 FALSE, FALSE, 0);
-		gtk_widget_show_all(gtkblist->error_buttons);
+		add_generic_connection_error_button(account, new);
 	}
 }
 


More information about the Commits mailing list