[gnome-color-manager] Fallback to the profile filename if the description is not present



commit 1dd2bfa73a94314e09654090239ccd54a1748071
Author: Richard Hughes <richard hughsie com>
Date:   Mon Nov 9 22:52:58 2009 +0000

    Fallback to the profile filename if the description is not present

 src/gcm-prefs.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index eecdf02..24d7e57 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -650,6 +650,8 @@ gcm_prefs_add_profiles (GtkWidget *widget)
 	profiles_array = gcm_utils_get_profile_filenames ();
 	for (i=0; i<profiles_array->len; i++) {
 		filename = g_ptr_array_index (profiles_array, i);
+
+		/* parse the profile name */
 		profile = gcm_profile_new ();
 		ret = gcm_profile_parse (profile, filename, &error);
 		if (!ret) {
@@ -658,9 +660,19 @@ gcm_prefs_add_profiles (GtkWidget *widget)
 			g_object_unref (profile);
 			continue;
 		}
+
+		/* get text to use in the combobox */
 		g_object_get (profile,
 			      "description", &displayname,
 			      NULL);
+
+		/* there's nothing sensible to display */
+		if (displayname == NULL || displayname[0] == '\0') {
+			g_free (displayname);
+			displayname = g_path_get_basename (filename);
+		}
+
+		/* add the entry */
 		gtk_combo_box_append_text (GTK_COMBO_BOX (widget), displayname);
 		g_free (displayname);
 		g_object_unref (profile);



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