[gnome-screenshot] screenshot: fetch the picture saved dir from the filename builder



commit e2aae6f29c1aaf6c0285f853628d2a5142465baa
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jan 26 10:14:31 2012 -0500

    screenshot: fetch the picture saved dir from the filename builder
    
    Instead of passing it through; simplifies code.

 src/screenshot-application.c      |    3 +--
 src/screenshot-filename-builder.c |   18 ++++++++++--------
 src/screenshot-filename-builder.h |    3 +--
 3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index ba20355..1f51ca7 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -384,8 +384,7 @@ finish_prepare_screenshot (ScreenshotApplication *self,
    *
    * screenshot_ensure_icc_profile (window);
    */
-  screenshot_build_filename_async (screenshot_config->last_save_dir,
-                                   build_filename_ready_cb, self);
+  screenshot_build_filename_async (build_filename_ready_cb, self);
 }
 
 static void
diff --git a/src/screenshot-filename-builder.c b/src/screenshot-filename-builder.c
index 5a5d4b8..1154c21 100644
--- a/src/screenshot-filename-builder.c
+++ b/src/screenshot-filename-builder.c
@@ -24,15 +24,18 @@
 #include <pwd.h>
 #include <string.h>
 
+#include "screenshot-config.h"
+
 typedef enum
 {
-  TEST_LAST_DIR = 0,
-  TEST_DEFAULT = 1
+  TEST_SAVED_DIR = 0,
+  TEST_DEFAULT,
+  NUM_TESTS
 } TestType;
 
 typedef struct 
 {
-  char *base_uris[3];
+  char *base_uris[NUM_TESTS];
   int iteration;
   TestType type;
 
@@ -138,7 +141,7 @@ async_existence_job_free (AsyncExistenceJob *job)
 {
   gint idx;
 
-  for (idx = 0; idx < 3; idx++)
+  for (idx = 0; idx < NUM_TESTS; idx++)
     g_free (job->base_uris[idx]);
 
   g_clear_object (&job->async_result);
@@ -255,18 +258,17 @@ out:
 }
 
 void
-screenshot_build_filename_async (const gchar *save_dir,
-                                 GAsyncReadyCallback callback,
+screenshot_build_filename_async (GAsyncReadyCallback callback,
                                  gpointer user_data)
 {
   AsyncExistenceJob *job;
 
   job = g_slice_new0 (AsyncExistenceJob);
 
-  job->base_uris[0] = sanitize_save_directory (save_dir);
+  job->base_uris[0] = sanitize_save_directory (screenshot_config->last_save_dir);
   job->base_uris[1] = get_default_screenshot_dir ();
   job->iteration = 0;
-  job->type = TEST_LAST_DIR;
+  job->type = TEST_SAVED_DIR;
 
   job->async_result = g_simple_async_result_new (NULL,
                                                  callback, user_data,
diff --git a/src/screenshot-filename-builder.h b/src/screenshot-filename-builder.h
index 3c61499..e26e7bd 100644
--- a/src/screenshot-filename-builder.h
+++ b/src/screenshot-filename-builder.h
@@ -23,8 +23,7 @@
 
 #include <gio/gio.h>
 
-void screenshot_build_filename_async (const gchar *save_dir,
-                                      GAsyncReadyCallback callback,
+void screenshot_build_filename_async (GAsyncReadyCallback callback,
                                       gpointer user_data);
 gchar *screenshot_build_filename_finish (GAsyncResult *result,
                                          GError **error);



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