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).
This commit is contained in:
Marek Kasik 2010-11-10 10:48:17 +01:00 committed by Tristan Van Berkom
parent 9d52a9d920
commit 0fe9e481dd

View File

@ -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);
}
}