[gnome-control-center] background: Guard against XDG_PICTURES_DIR not being defined
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Guard against XDG_PICTURES_DIR not being defined
- Date: Thu, 13 Feb 2014 11:38:12 +0000 (UTC)
commit 8ef67d6be023ae1c34a7d75382f8daed2479f3a9
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Feb 11 16:38:37 2014 +0100
background: Guard against XDG_PICTURES_DIR not being defined
https://bugzilla.gnome.org/show_bug.cgi?id=709771
panels/background/bg-pictures-source.c | 3 +++
panels/background/cc-background-chooser-dialog.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index 9b86c87..8df098d 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -718,6 +718,9 @@ bg_pictures_source_init (BgPicturesSource *self)
NULL);
pictures_path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+ if (pictures_path == NULL)
+ pictures_path = g_get_home_dir ();
+
g_mkdir_with_parents (pictures_path, USER_DIR_MODE);
dir = g_file_new_for_path (pictures_path);
diff --git a/panels/background/cc-background-chooser-dialog.c
b/panels/background/cc-background-chooser-dialog.c
index e238173..f7395a1 100644
--- a/panels/background/cc-background-chooser-dialog.c
+++ b/panels/background/cc-background-chooser-dialog.c
@@ -269,6 +269,7 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
GtkStyleContext *context;
gchar *markup, *href;
const gchar *pictures_dir;
+ gchar *pictures_dir_basename;
chooser->priv = CC_CHOOSER_DIALOG_GET_PRIVATE (chooser);
priv = chooser->priv;
@@ -390,9 +391,22 @@ cc_background_chooser_dialog_init (CcBackgroundChooserDialog *chooser)
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+
pictures_dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
- href = g_markup_printf_escaped ("<a href=\"file://%s\">%s</a>", pictures_dir,
- g_path_get_basename (pictures_dir));
+ if (pictures_dir == NULL)
+ {
+ pictures_dir = g_get_home_dir ();
+ /* translators: "Home" is used in place of the Pictures
+ * directory in the string below when XDG_PICTURES_DIR is
+ * undefined */
+ pictures_dir_basename = g_strdup (_("Home"));
+ }
+ else
+ pictures_dir_basename = g_path_get_basename (pictures_dir);
+
+ href = g_markup_printf_escaped ("<a href=\"file://%s\">%s</a>", pictures_dir, pictures_dir_basename);
+ g_free (pictures_dir_basename);
+
/* translators: %s here is the name of the Pictures directory, the string should be translated in
* the context "You can add images to your Pictures folder and they will show up here" */
markup = g_strdup_printf (_("You can add images to your %s folder and they will show up here"), href);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]