changeset 32737:2efee7ca90be

Fix some boring asserts when using the Default conversation theme.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 04 Mar 2012 03:49:49 +0000
parents cc361e897c41
children 8404c5b75e99
files pidgin/gtkconv.c pidgin/gtkprefs.c
diffstat 2 files changed, 31 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Sun Mar 04 03:32:07 2012 +0000
+++ b/pidgin/gtkconv.c	Sun Mar 04 03:49:49 2012 +0000
@@ -5714,7 +5714,8 @@
 private_gtkconv_new(PurpleConversation *conv, gboolean hidden)
 {
 	PidginConversation *gtkconv;
-	PurpleTheme *theme;
+	const char *theme_name;
+	PurpleTheme *theme = NULL;
 	PurpleConversationType conv_type = purple_conversation_get_type(conv);
 	GtkWidget *pane = NULL;
 	GtkWidget *tab_cont;
@@ -5740,7 +5741,9 @@
 #endif
 	gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
 	gtkconv->unseen_count = 0;
-	theme = purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"), "conversation");
+	theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme");
+	if (theme_name && *theme_name)
+		theme = purple_theme_manager_find_theme(theme_name, "conversation");
 	if (!theme)
 		theme = default_conv_theme;
 	gtkconv->theme = PIDGIN_CONV_THEME(g_object_ref(theme));
--- a/pidgin/gtkprefs.c	Sun Mar 04 03:32:07 2012 +0000
+++ b/pidgin/gtkprefs.c	Sun Mar 04 03:49:49 2012 +0000
@@ -1097,6 +1097,27 @@
 	}
 }
 
+/* sets the current conversation theme variant */
+static void
+prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data)
+{
+	PidginConvTheme *theme =  NULL;
+	GtkTreeIter iter;
+	gchar *name = NULL;
+
+	if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) {
+		gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1);
+		theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation"));
+		g_free(name);
+
+		if (gtk_combo_box_get_active_iter(combo_box, &iter)) {
+			gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1);
+			pidgin_conversation_theme_set_variant(theme, name);
+			g_free(name);
+		}
+	}
+}
+
 /* sets the current conversation theme */
 static void
 prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data)
@@ -1110,6 +1131,9 @@
 
 		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name);
 
+		g_signal_handlers_block_by_func(prefs_conv_variants_combo_box,
+		                                prefs_set_conv_variant_cb, NULL);
+
 		/* Update list of variants */
 		gtk_list_store_clear(prefs_conv_variants);
 
@@ -1137,31 +1161,12 @@
 				gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0);
 		}
 
+		g_signal_handlers_unblock_by_func(prefs_conv_variants_combo_box,
+		                                  prefs_set_conv_variant_cb, NULL);
 		g_free(name);
 	}
 }
 
-/* sets the current conversation theme variant */
-static void
-prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data)
-{
-	PidginConvTheme *theme =  NULL;
-	GtkTreeIter iter;
-	gchar *name = NULL;
-
-	if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) {
-		gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1);
-		theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation"));
-		g_free(name);
-
-		if (gtk_combo_box_get_active_iter(combo_box, &iter)) {
-			gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1);
-			pidgin_conversation_theme_set_variant(theme, name);
-			g_free(name);
-		}
-	}
-}
-
 /* sets the current icon theme */
 static void
 prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data)