[xdg-user-dirs-gtk/f19] Ask again
Matthias Clasen
mclasen at fedoraproject.org
Fri May 31 00:18:43 UTC 2013
commit d28f048a1e520683df30f459930af78d168b2512
Author: Matthias Clasen <mclasen at redhat.com>
Date: Thu May 30 19:28:18 2013 -0400
Ask again
...he-Don-t-ask-again-checkbox-work-properly.patch | 91 ++++++++++++++++++++
xdg-user-dirs-gtk.spec | 9 ++-
2 files changed, 99 insertions(+), 1 deletions(-)
---
diff --git a/0001-Make-the-Don-t-ask-again-checkbox-work-properly.patch b/0001-Make-the-Don-t-ask-again-checkbox-work-properly.patch
new file mode 100644
index 0000000..ba59170
--- /dev/null
+++ b/0001-Make-the-Don-t-ask-again-checkbox-work-properly.patch
@@ -0,0 +1,91 @@
+From 9c19d7fedadf38cc4fec21efdb3908572448f658 Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Thu, 30 May 2013 19:21:11 -0400
+Subject: [PATCH] Make the 'Don't ask again' checkbox work properly
+
+We used to remove the user-dirs.locale file when this is checked,
+but that prevents xdg-user-dirs-gtk-update from ever running again.
+Instead, update it with the current locale. This has the effect
+of keeping xdg-user-dirs-gtk-update from running until the locale
+changes again, which is probably closer to the intended effect.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=968955
+---
+ update.c | 40 +++++++++++++++++++++++++++++++---------
+ 1 file changed, 31 insertions(+), 9 deletions(-)
+
+diff --git a/update.c b/update.c
+index 4697913..8710c79 100644
+--- a/update.c
++++ b/update.c
+@@ -48,12 +48,40 @@ has_xdg_translation (void)
+ if (strncmp (locale, "en_US", 5) == 0 ||
+ strcmp (locale, "C") == 0)
+ return TRUE;
+-
++
+ str = "Desktop";
+ return dgettext ("xdg-user-dirs", str) != str;
+ }
+
+ static void
++save_locale (void)
++{
++ FILE *file;
++ char *user_locale_file;
++ char *locale, *dot;
++
++ user_locale_file = g_build_filename (g_get_user_config_dir (),
++ "user-dirs.locale", NULL);
++ file = fopen (user_locale_file, "w");
++ g_free (user_locale_file);
++
++ if (file == NULL)
++ {
++ fprintf (stderr, "Can't save user-dirs.locale\n");
++ return;
++ }
++
++ locale = g_strdup (setlocale (LC_MESSAGES, NULL));
++ /* Skip encoding part */
++ dot = strchr (locale, '.');
++ if (dot)
++ *dot = 0;
++ fprintf (file, "%s", locale);
++ g_free (locale);
++ fclose (file);
++}
++
++static void
+ update_locale (XdgDirEntry *old_entries)
+ {
+ XdgDirEntry *new_entries, *entry;
+@@ -91,10 +119,9 @@ update_locale (XdgDirEntry *old_entries)
+ g_free (std_out);
+ g_free (std_err);
+ g_free (cmdline);
+-
+ if (!WIFEXITED(exit_status) || WEXITSTATUS(exit_status) != 0)
+ return;
+-
++
+ new_entries = parse_xdg_dirs (filename);
+ g_unlink (filename);
+ g_free (filename);
+@@ -254,12 +281,7 @@ update_locale (XdgDirEntry *old_entries)
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
+ {
+- char *file;
+-
+- file = g_build_filename (g_get_user_config_dir (),
+- "user-dirs.locale", NULL);
+- g_unlink (file);
+- g_free (file);
++ save_locale ();
+ }
+
+ g_free (new_entries);
+--
+1.8.2.1
+
diff --git a/xdg-user-dirs-gtk.spec b/xdg-user-dirs-gtk.spec
index e5aab60..30525ed 100644
--- a/xdg-user-dirs-gtk.spec
+++ b/xdg-user-dirs-gtk.spec
@@ -1,6 +1,6 @@
Name: xdg-user-dirs-gtk
Version: 0.10
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Gnome integration of special directories
Group: User Interface/Desktops
@@ -8,6 +8,8 @@ License: GPL+
URL: http://freedesktop.org/wiki/Software/xdg-user-dirs
Source0: http://download.gnome.org/sources/xdg-user-dirs-gtk/%{version}/%{name}-%{version}.tar.xz
+# upstream fix
+Patch0: 0001-Make-the-Don-t-ask-again-checkbox-work-properly.patch
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: gtk3-devel
@@ -23,6 +25,7 @@ locale changes.
%prep
%setup -q
+%patch0 -p1
%build
%configure
@@ -42,7 +45,11 @@ desktop-file-validate $RPM_BUILD_ROOT%{_sysconfdir}/xdg/autostart/user-dirs-upda
%{_bindir}/*
%config(noreplace) %{_sysconfdir}/xdg/autostart/user-dirs-update-gtk.desktop
+
%changelog
+* Thu May 30 2013 Matthias Clasen <mclasen at redhat.com> - 0.10-2
+- Make 'Don't ask again' checkbox work properly (#968955)
+
* Wed Feb 06 2013 Kalev Lember <kalevlember at gmail.com> - 0.10-1
- Update to 0.10
More information about the scm-commits
mailing list