[gimp/soc-2011-seamless-clone2] Bug 693797 - Sample colorize fails when you choose current gradient as target



commit b8f360b479ddae5ef4527d1e4ae90409a4b09649
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 15 18:52:02 2013 +0100

    Bug 693797 - Sample colorize fails when you choose current gradient as target
    
    Based on a patch from Hartmut Kuhse, make sure we don't remove
    custom-added items from GimpItemComboBoxes when repopulating it.

 libgimp/gimpitemcombobox.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/libgimp/gimpitemcombobox.c b/libgimp/gimpitemcombobox.c
index 2f62b66..7ed47d0 100644
--- a/libgimp/gimpitemcombobox.c
+++ b/libgimp/gimpitemcombobox.c
@@ -537,6 +537,24 @@ gimp_item_combo_box_drag_data_received (GtkWidget        *widget,
   g_free (str);
 }
 
+static gboolean
+gimp_item_combo_box_remove_items (GtkTreeModel *model,
+                                  GtkTreePath  *path,
+                                  GtkTreeIter  *iter,
+                                  gpointer      data)
+{
+  gint item_ID;
+
+  gtk_tree_model_get (model, iter,
+                      GIMP_INT_STORE_VALUE, &item_ID,
+                      -1);
+
+  if (item_ID > 0)
+    gtk_list_store_remove (GTK_LIST_STORE (model), iter);
+
+  return FALSE;
+}
+
 static void
 gimp_item_combo_box_changed (GimpIntComboBox *combo_box)
 {
@@ -544,7 +562,7 @@ gimp_item_combo_box_changed (GimpIntComboBox *combo_box)
 
   if (gimp_int_combo_box_get_active (combo_box, &item_ID))
     {
-      if (! gimp_item_is_valid (item_ID))
+      if (item_ID > 0 && ! gimp_item_is_valid (item_ID))
         {
           GtkTreeModel *model;
 
@@ -552,7 +570,9 @@ gimp_item_combo_box_changed (GimpIntComboBox *combo_box)
 
           g_signal_stop_emission_by_name (combo_box, "changed");
 
-          gtk_list_store_clear (GTK_LIST_STORE (model));
+          gtk_tree_model_foreach (model,
+                                  gimp_item_combo_box_remove_items,
+                                  NULL);
           gimp_item_combo_box_populate (combo_box);
         }
     }


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