Mercurial > pidgin
changeset 32736:cc361e897c41
Correctly save the conversation theme pref when re-choosing the Default.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 04 Mar 2012 03:32:07 +0000 |
parents | 01741f87cc1e |
children | 2efee7ca90be |
files | pidgin/gtkprefs.c |
diffstat | 1 files changed, 22 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkprefs.c Sun Mar 04 02:16:12 2012 +0000 +++ b/pidgin/gtkprefs.c Sun Mar 04 03:32:07 2012 +0000 @@ -1101,43 +1101,42 @@ static void prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) { - PidginConvTheme *theme = NULL; GtkTreeIter iter; - gchar *name = NULL; if (gtk_combo_box_get_active_iter(combo_box, &iter)) { - const GList *variants; - const char *current_variant; - gboolean unset = TRUE; + gchar *name = NULL; gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); - if (!name || !*name) { - g_free(name); - return; - } purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name); /* Update list of variants */ gtk_list_store_clear(prefs_conv_variants); - theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); - current_variant = pidgin_conversation_theme_get_variant(theme); - - variants = pidgin_conversation_theme_get_variants(theme); - for (; variants && current_variant; variants = g_list_next(variants)) { - gtk_list_store_append(prefs_conv_variants, &iter); - gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); - - if (g_str_equal(variants->data, current_variant)) { - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); - unset = FALSE; + if (name && *name) { + PidginConvTheme *theme; + const char *current_variant; + const GList *variants; + gboolean unset = TRUE; + + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + current_variant = pidgin_conversation_theme_get_variant(theme); + + variants = pidgin_conversation_theme_get_variants(theme); + for (; variants && current_variant; variants = g_list_next(variants)) { + gtk_list_store_append(prefs_conv_variants, &iter); + gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); + + if (g_str_equal(variants->data, current_variant)) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); + unset = FALSE; + } } + + if (unset) + gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); } - if (unset) - gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); - g_free(name); } }