pidgin: 3358180c: Make sure the prpl has a get_account_tex...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Mon Dec 29 00:45:55 EST 2008


-----------------------------------------------------------------
Revision: 3358180c517dd929b1e1b5e96813243fb78f08f4
Ancestor: f94ddf7fa975e3a39a53fccae31b7e73f892fd57
Author: rekkanoryo at pidgin.im
Date: 2008-12-29T05:37:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3358180c517dd929b1e1b5e96813243fb78f08f4

Modified files:
        pidgin/gtkaccount.c

ChangeLog: 

Make sure the prpl has a get_account_text_table function before trying to
call it.  Fixes #7918.

-------------- next part --------------
============================================================
--- pidgin/gtkaccount.c	c5319c2c102c6848b66bfbc4bda82afef4af10c2
+++ pidgin/gtkaccount.c	8bb797f888360061f572e89e24d7eb1afb643da8
@@ -286,24 +286,26 @@ screenname_nofocus_cb(GtkWidget *widget,
 screenname_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog)
 {
 	GdkColor color = {0, 34952, 35466, 34181};
-	GHashTable *table;
-	const char *label;
+	GHashTable *table = NULL;
+	const char *label = NULL;
 
-	table = dialog->prpl_info->get_account_text_table(NULL);
-	label = g_hash_table_lookup(table, "login_label");
+	if(PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(dialog->prpl_info, get_account_text_table)) {
+		table = dialog->prpl_info->get_account_text_table(NULL);
+		label = g_hash_table_lookup(table, "login_label");
 
-	if (*gtk_entry_get_text(GTK_ENTRY(widget)) == '\0') {
-		/* We have to avoid hitting the screenname_changed_cb function 
-		 * because it enables buttons we don't want enabled yet ;)
-		 */
-		g_signal_handlers_block_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog);
-		gtk_entry_set_text(GTK_ENTRY(widget), label);
-		/* Make sure we can hit it again */
-		g_signal_handlers_unblock_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog);
-		gtk_widget_modify_text(widget, GTK_STATE_NORMAL, &color);
-	}
+		if (*gtk_entry_get_text(GTK_ENTRY(widget)) == '\0') {
+			/* We have to avoid hitting the screenname_changed_cb function 
+			 * because it enables buttons we don't want enabled yet ;)
+			 */
+			g_signal_handlers_block_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog);
+			gtk_entry_set_text(GTK_ENTRY(widget), label);
+			/* Make sure we can hit it again */
+			g_signal_handlers_unblock_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog);
+			gtk_widget_modify_text(widget, GTK_STATE_NORMAL, &color);
+		}
 
-	g_hash_table_destroy(table);
+		g_hash_table_destroy(table);
+	}
 
 	return FALSE;
 }


More information about the Commits mailing list