Author: post
Date: 2010-12-19 18:20:44 +0100 (Sun, 19 Dec 2010)
New Revision: 3684

Modified:
   trunk/src/rs-photo.c
   trunk/src/rs-toolbox.c
Log:
Load default DCP, when initially opening the photo, and don't use UI for that. 

Modified: trunk/src/rs-photo.c
===================================================================
--- trunk/src/rs-photo.c        2010-12-19 17:18:55 UTC (rev 3683)
+++ trunk/src/rs-photo.c        2010-12-19 17:20:44 UTC (rev 3684)
@@ -22,6 +22,8 @@
 #include "rs-photo.h"
 #include "rs-cache.h"
 #include "rs-camera-db.h"
+#include "rs-profile-factory.h"
+#include "rs-profile-camera.h"
 
 static void rs_photo_class_init (RS_PHOTOClass *klass);
 
@@ -689,6 +691,39 @@
                        if (!(mask & MASK_SATURATION) && 
(photo->metadata->saturation != -1.0))
                                rs_photo_set_saturation(photo, i, 
photo->metadata->saturation);
                }
+               /* Load default DCP */
+               if (!photo->dcp && !photo->icc && photo->metadata && 
photo->metadata->model_ascii)
+               {
+                       RSProfileFactory *factory = 
rs_profile_factory_new_default();
+                       const gchar* unique_id = NULL;
+
+                       if (photo->metadata->make_ascii)
+                               unique_id = 
rs_profile_camera_find(photo->metadata->make_ascii, 
photo->metadata->model_ascii);
+
+                       if (!unique_id)
+                               unique_id = 
g_strdup(photo->metadata->model_ascii);
+
+                       GSList *profiles = 
rs_profile_factory_find_from_model(factory, unique_id);
+
+                       /* Select alphabetically first profile */
+                       if (g_slist_length(profiles) > 0)
+                       {
+                               GSList *i = profiles;
+                               do {
+                                       RSDcpFile* dcp = RS_DCP_FILE(i->data);
+                                       if (photo->dcp)
+                                       {
+                                               if 
(g_strcmp0(rs_dcp_file_get_name(dcp),rs_dcp_file_get_name(photo->dcp)) < 0)
+                                                       photo->dcp = dcp;
+                                       }
+                                       else
+                                               photo->dcp = dcp;
+                                       i = i->next;
+                               } while (i != NULL);
+                               g_slist_free(profiles);
+                       }
+                       g_free((void*)unique_id);
+               }
        }
 
        return photo;

Modified: trunk/src/rs-toolbox.c
===================================================================
--- trunk/src/rs-toolbox.c      2010-12-19 17:18:55 UTC (rev 3683)
+++ trunk/src/rs-toolbox.c      2010-12-19 17:20:44 UTC (rev 3684)
@@ -1068,8 +1068,6 @@
                        rs_profile_selector_select_profile(toolbox->selector, 
dcp_profile);
                else if (embedded_present)
                        
gtk_combo_box_set_active(GTK_COMBO_BOX(toolbox->selector), 0);
-               else
-                       
gtk_combo_box_set_active(GTK_COMBO_BOX(toolbox->selector), 1);
                /* FIXME: support ICC profiles too */
                photo_spatial_changed(toolbox->photo, toolbox);
        }


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

Reply via email to