Author: abrander
Date: 2010-01-11 20:13:34 +0100 (Mon, 11 Jan 2010)
New Revision: 2979

Modified:
   branches/rawstudio-ng-color/librawstudio/rs-profile-selector.c
   branches/rawstudio-ng-color/librawstudio/rs-profile-selector.h
   branches/rawstudio-ng-color/src/rs-toolbox.c
Log:
Changed rs_profile_selector_select_profile() to accept a profile instead of an 
index.

Modified: branches/rawstudio-ng-color/librawstudio/rs-profile-selector.c
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-profile-selector.c      
2010-01-10 16:07:42 UTC (rev 2978)
+++ branches/rawstudio-ng-color/librawstudio/rs-profile-selector.c      
2010-01-11 19:13:34 UTC (rev 2979)
@@ -105,10 +105,27 @@
 }
 
 void
-rs_profile_selector_select_profile(RSProfileSelector *selector, gint index)
+rs_profile_selector_select_profile(RSProfileSelector *selector, gpointer 
profile)
 {
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       gpointer current = NULL;
+
        g_assert(RS_IS_PROFILE_SELECTOR(selector));
-       gtk_combo_box_set_active (&selector->parent, index);
+
+       model = GTK_TREE_MODEL(selector->store);
+
+       if (gtk_tree_model_get_iter_first(model, &iter))
+               do {
+                       gtk_tree_model_get(model, &iter,
+                               COLUMN_POINTER, &current,
+                               -1);
+                       if (current == profile)
+                       {
+                               
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(selector), &iter);
+                               break;
+                       }
+               } while (gtk_tree_model_iter_next(model, &iter));
 }
 
 void

Modified: branches/rawstudio-ng-color/librawstudio/rs-profile-selector.h
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-profile-selector.h      
2010-01-10 16:07:42 UTC (rev 2978)
+++ branches/rawstudio-ng-color/librawstudio/rs-profile-selector.h      
2010-01-11 19:13:34 UTC (rev 2979)
@@ -33,7 +33,7 @@
 rs_profile_selector_set_profiles(RSProfileSelector *selector, GList *profiles);
 
 void
-rs_profile_selector_select_profile(RSProfileSelector *selector, gint index);
+rs_profile_selector_select_profile(RSProfileSelector *selector, gpointer 
profile);
 
 void
 rs_profile_selector_set_profiles_steal(RSProfileSelector *selector, GList 
*profiles);

Modified: branches/rawstudio-ng-color/src/rs-toolbox.c
===================================================================
--- branches/rawstudio-ng-color/src/rs-toolbox.c        2010-01-10 16:07:42 UTC 
(rev 2978)
+++ branches/rawstudio-ng-color/src/rs-toolbox.c        2010-01-11 19:13:34 UTC 
(rev 2979)
@@ -860,17 +860,11 @@
        rs_profile_selector_set_profiles_steal(toolbox->selector, dcp_profiles);
        
        /* Find current profile and mark it active */
-       if (photo && photo->metadata && dcp_profiles)
+       if (photo)
        {
                RSDcpFile *dcp_profile = rs_photo_get_dcp_profile(photo);
-               GList *node = g_list_first(dcp_profiles);
-               for (i = 0; node != NULL; node = g_list_next(node))
-               {
-                       if (node->data == dcp_profile)
-                               
rs_profile_selector_select_profile(toolbox->selector, i);
-                       i++;
-               }
-               g_list_free(dcp_profiles);
+               rs_profile_selector_select_profile(toolbox->selector, 
dcp_profile);
+               /* FIXME: support ICC profiles too */
        }
        gtk_widget_set_sensitive(toolbox->transforms, !!(toolbox->photo));
 }


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to