Author: post
Date: 2010-05-29 20:32:53 +0200 (Sat, 29 May 2010)
New Revision: 3410

Modified:
   trunk/src/application.c
   trunk/src/rs-actions.c
Log:
Make Quick Export work with default parameters, and work correctly with 
profiles. Also fixed assertion on export failure.

Modified: trunk/src/application.c
===================================================================
--- trunk/src/application.c     2010-05-29 17:37:41 UTC (rev 3409)
+++ trunk/src/application.c     2010-05-29 18:32:53 UTC (rev 3410)
@@ -164,7 +164,6 @@
 rs_photo_save(RS_PHOTO *photo, RSOutput *output, gint width, gint height, 
gboolean keep_aspect, gdouble scale, gint snapshot)
 {
        gfloat actual_scale;
-       RSIccProfile *profile = NULL;
 
        g_assert(RS_IS_PHOTO(photo));
        g_assert(RS_IS_OUTPUT(output));
@@ -218,19 +217,24 @@
 
        g_object_unref(meta);
 
-       /* FIXME: Select correct output profile */
-       if (!profile)
-               profile = rs_icc_profile_new_from_file(PACKAGE_DATA_DIR "/" 
PACKAGE "/profiles/generic_camera_profile.icc");
-       g_object_set(finput, "icc-profile", profile, NULL);
-       g_object_unref(profile);
+       /* Set input profile */
+       RSDcpFile *dcp_profile  = rs_photo_get_dcp_profile(photo);
+       RSIccProfile *icc_profile  = rs_photo_get_icc_profile(photo);
 
-//     RSFilterResponse *response = rs_filter_get_image8(navigator->cache, 
request);
+       if (dcp_profile != NULL)
+       {
+               g_object_set(fdcp, "profile", dcp_profile, NULL);
+       }
+       if (icc_profile != NULL)
+       {
+               RSColorSpace *icc_space = 
rs_color_space_icc_new_from_icc(icc_profile);
+               g_object_set(finput, "color-space", icc_space, NULL);
+       }
 
        /* actually save */
-       g_assert(rs_output_execute(output, fend));
-//     g_object_unref(request);
+       gboolean exported = rs_output_execute(output, fend);
 
-       photo->exported = TRUE;
+       photo->exported |= exported;
        rs_cache_save(photo, MASK_ALL);
 
        /* Set the exported flag */
@@ -247,7 +251,7 @@
        g_object_unref(fdenoise);
        g_object_unref(fdcp);
 
-       return(TRUE);
+       return exported;
 }
 
 RS_BLOB *

Modified: trunk/src/rs-actions.c
===================================================================
--- trunk/src/rs-actions.c      2010-05-29 17:37:41 UTC (rev 3409)
+++ trunk/src/rs-actions.c      2010-05-29 18:32:53 UTC (rev 3410)
@@ -187,10 +187,23 @@
        filename_template = rs_conf_get_string("quick-export-filename");
        output_identifier = rs_conf_get_string("quick-export-filetype");
 
+       /* Initialize directory to home dir if nothing is saved in config */
+       if (!directory)
+       {
+               const char *homedir = g_getenv("HOME");
+               if (!homedir)
+                       homedir = g_get_home_dir();
+               directory = g_strdup(homedir);
+       }
+
        /* Initialize filename_template to default if nothing is saved in 
config */
        if (!filename_template)
                filename_template = g_strdup(DEFAULT_CONF_EXPORT_FILENAME);
 
+       /* Output as Jpeg, if nothing is saved in config */
+       if (!output_identifier)
+               output_identifier = g_strdup("RSJpeg");
+
        RSOutput *output = rs_output_new(output_identifier);
 
        GString *filename = g_string_new("");
@@ -204,7 +217,11 @@
 
        if (parsed_filename && output)
        {
+               guint msg = gui_status_push(_("Exporting..."));
+               gui_set_busy(TRUE);
+               GTK_CATCHUP();
                g_object_set(output, "filename", parsed_filename, NULL);
+               rs_output_set_from_conf(output, "quick-export");
 
                if (rs_photo_save(rs->photo, output, -1, -1, FALSE, 1.0, 
rs->current_setting))
                {
@@ -214,6 +231,9 @@
                }
                else
                        gui_status_notify(_("Export failed"));
+
+               gui_status_pop(msg);
+               gui_set_busy(FALSE);
        }
 
        g_object_unref(output);


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

Reply via email to