[empathy] preferences: don't display variants checkbox if there is no variant



commit 434aec0c86f6eae4a7f09759d25810dc176bfc49
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Oct 11 17:01:23 2011 -0400

    preferences: don't display variants checkbox if there is no variant
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660586

 src/empathy-preferences.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index e141aa2..3eb9e60 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -846,7 +846,8 @@ preferences_theme_variant_notify_cb (GSettings   *gsettings,
 	g_free (conf_name);
 }
 
-static void
+/* return TRUE if we added at least one variant */
+static gboolean
 preferences_theme_variants_fill (EmpathyPreferences *preferences,
 				 GHashTable         *info)
 {
@@ -856,6 +857,7 @@ preferences_theme_variants_fill (EmpathyPreferences *preferences,
 	GPtrArray    *variants;
 	const gchar  *default_variant;
 	guint         i;
+	gboolean      result = FALSE;
 
 	model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combobox_chat_theme_variant));
 	store = GTK_LIST_STORE (model);
@@ -870,12 +872,16 @@ preferences_theme_variants_fill (EmpathyPreferences *preferences,
 			COL_VARIANT_NAME, name,
 			COL_VARIANT_DEFAULT, !tp_strdiff (name, default_variant),
 			-1);
+
+		result = TRUE;
 	}
 
 	/* Select the variant from the GSetting key */
 	preferences_theme_variant_notify_cb (priv->gsettings_chat,
 					     EMPATHY_PREFS_CHAT_THEME_VARIANT,
 					     preferences);
+
+	return result;
 }
 
 static void
@@ -943,11 +949,14 @@ preferences_theme_changed_cb (GtkComboBox        *combo,
 				       EMPATHY_PREFS_CHAT_THEME,
 				       name);
 		if (is_adium) {
+			gboolean variant;
+
 			g_settings_set_string (priv->gsettings_chat,
 					       EMPATHY_PREFS_CHAT_ADIUM_PATH,
 					       path);
-			preferences_theme_variants_fill (preferences, info);
-			gtk_widget_show (priv->hbox_chat_theme_variant);
+
+			variant = preferences_theme_variants_fill (preferences, info);
+			gtk_widget_set_visible (priv->hbox_chat_theme_variant, variant);
 		} else {
 			gtk_widget_hide (priv->hbox_chat_theme_variant);
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]