[maemo-commits] [maemo-commits] r13457 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Aug 29 14:34:42 EEST 2007
Author: jobi
Date: 2007-08-29 14:34:40 +0300 (Wed, 29 Aug 2007)
New Revision: 13457

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-home-background-dialog.c
Log:

2007-08-29  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-home-background-dialog.c: do not add the same
	background twice to the list. Fixes: NB#66007



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-29 11:12:31 UTC (rev 13456)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-29 11:34:40 UTC (rev 13457)
@@ -1,5 +1,10 @@
 2007-08-29  Johan Bilien  <johan.bilien at nokia.com>
 
+	* src/hd-home-background-dialog.c: do not add the same
+	background twice to the list. Fixes: NB#66007
+
+2007-08-29  Johan Bilien  <johan.bilien at nokia.com>
+
 	* libhildondesktop/hildon-home-area.c:
 	- also recalculate mask after the state of a child is back to
 	normal, if necessary. Fixes: NB#65895

Modified: projects/haf/trunk/hildon-desktop/src/hd-home-background-dialog.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-home-background-dialog.c	2007-08-29 11:12:31 UTC (rev 13456)
+++ projects/haf/trunk/hildon-desktop/src/hd-home-background-dialog.c	2007-08-29 11:34:40 UTC (rev 13457)
@@ -706,6 +706,37 @@
                 NULL);
 }
 
+static gboolean
+hd_home_background_dialog_find_by_path (HDHomeBackgroundDialog *dialog,
+                                        const gchar            *path,
+                                        GtkTreeIter            *iter)
+{
+  GtkTreeModel                         *model;
+  HDHomeBackgroundDialogPrivate        *priv;
+  gboolean                              valid;
+
+  priv = HD_HOME_BACKGROUND_DIALOG_GET_PRIVATE (dialog);
+  model = GTK_TREE_MODEL (priv->combobox_contents);
+
+  valid = gtk_tree_model_get_iter_first (model, iter);
+
+  while (valid)
+  {
+    gchar *iter_path = NULL;
+
+    gtk_tree_model_get (model, iter,
+                        BG_IMAGE_FILENAME, &iter_path,
+                        -1);
+
+    if (iter_path && g_str_equal (path, iter_path))
+      break;
+
+    valid = gtk_tree_model_iter_next (model, iter);
+  }
+
+  return valid;
+}
+
 static void
 hd_home_background_dialog_background_dir_changed
                                     (HDHomeBackgroundDialog *dialog)
@@ -773,8 +804,8 @@
       gchar *image_path = NULL;
       gchar *filename   = NULL;
       gint   image_order = 0;
-      
-      if (!g_str_has_suffix (image_desc_file, BG_IMG_INFO_FILE_TYPE)) 
+
+      if (!g_str_has_suffix (image_desc_file, BG_IMG_INFO_FILE_TYPE))
         continue;
 
       error = NULL;
@@ -788,8 +819,8 @@
                                       G_KEY_FILE_NONE,
                                       &error))
         goto end_of_loop;
-      
 
+
       image_name = g_key_file_get_string (kfile,
                                           BG_DESKTOP_GROUP,
                                           BG_DESKTOP_IMAGE_NAME,
@@ -811,6 +842,11 @@
 
       if (error) goto end_of_loop;
 
+      if (hd_home_background_dialog_find_by_path (dialog,
+                                                  image_path,
+                                                  &iterator))
+        goto end_of_loop;
+
       gtk_list_store_append (priv->combobox_contents, &iterator);
 
       gtk_list_store_set (priv->combobox_contents,


More information about the maemo-commits mailing list