[gtk+/treeview-refactor] Print files to Documents directory by default



commit 0fe9e481dd010340417f491de12d85460b4d8b0a
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Nov 10 10:48:17 2010 +0100

    Print files to Documents directory by default
    
    Set default directory to G_USER_DIRECTORY_DOCUMENTS
    when printing to file backend and fallback to the current
    directory when it is not available (#633896).

 modules/printbackends/file/gtkprintbackendfile.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/modules/printbackends/file/gtkprintbackendfile.c b/modules/printbackends/file/gtkprintbackendfile.c
index 27cc0a4..79023c9 100644
--- a/modules/printbackends/file/gtkprintbackendfile.c
+++ b/modules/printbackends/file/gtkprintbackendfile.c
@@ -253,13 +253,21 @@ output_file_from_settings (GtkPrintSettings *settings,
 
       if (locale_name != NULL)
         {
-	  gchar *current_dir = g_get_current_dir ();
-          path = g_build_filename (current_dir, locale_name, NULL);
-          g_free (locale_name);
+          const gchar *document_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+          
+          if (document_dir == NULL)
+            {
+              gchar *current_dir = g_get_current_dir ();
+              path = g_build_filename (current_dir, locale_name, NULL);
+              g_free (current_dir);
+            }
+          else
+            path = g_build_filename (document_dir, locale_name, NULL);
 
           uri = g_filename_to_uri (path, NULL, NULL);
+
+          g_free (locale_name);
           g_free (path);
-	  g_free (current_dir);
 	}
     }
 



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