diff --git a/pluma.spec b/pluma.spec index 0ad155e..51821a0 100644 --- a/pluma.spec +++ b/pluma.spec @@ -16,7 +16,7 @@ Summary: Text editor for the MATE desktop Name: pluma Version: %{branch}.1 %if 0%{?rel_build} -Release: 1%{?dist} +Release: 2%{?dist} %else Release: 0.2%{?git_rel}%{?dist} %endif @@ -30,6 +30,8 @@ URL: http://mate-desktop.org # Source for snapshot-builds. %{!?rel_build:Source0: http://git.mate-desktop.org/%{name}/snapshot/%{name}-%{commit}.tar.xz#/%{git_tar}} +Patch1: pluma_0001-Support-new-location-of-gtk-bookmarks-file.patch + BuildRequires: desktop-file-utils BuildRequires: enchant-devel BuildRequires: libpeas-devel @@ -105,6 +107,8 @@ Development files for mate-text-editor %prep %setup -q%{!?rel_build:n %{name}-%{commit}} +%patch1 -p1 -b .0001 + %if 0%{?rel_build} # for releases #NOCONFIGURE=1 ./autogen.sh @@ -191,6 +195,9 @@ fi %changelog +* Wed Apr 26 2017 Wolfgang Ulbrich - 1.18.1-2 +- use gtk+-3 bookmark location for file-browser-plugin + * Tue Apr 04 2017 Wolfgang Ulbrich - 1.18.1-1 - update to 1.18.1 diff --git a/pluma_0001-Support-new-location-of-gtk-bookmarks-file.patch b/pluma_0001-Support-new-location-of-gtk-bookmarks-file.patch new file mode 100644 index 0000000..f09fb9c --- /dev/null +++ b/pluma_0001-Support-new-location-of-gtk-bookmarks-file.patch @@ -0,0 +1,170 @@ +From 2d8dc45d586f21fe82dd706abc50f27103b75005 Mon Sep 17 00:00:00 2001 +From: Paolo Borelli +Date: Tue, 25 Apr 2017 19:09:42 +0200 +Subject: [PATCH] Support new location of gtk bookmarks file + +The gtk bookmarks file is now in XDG dir, so let's first try there and +otherwise fall back to the old location +--- + plugins/filebrowser/pluma-file-bookmarks-store.c | 133 +++++++++++++++-------- + 1 file changed, 85 insertions(+), 48 deletions(-) + +diff --git a/plugins/filebrowser/pluma-file-bookmarks-store.c b/plugins/filebrowser/pluma-file-bookmarks-store.c +index 073d6bb..bcd550a 100644 +--- a/plugins/filebrowser/pluma-file-bookmarks-store.c ++++ b/plugins/filebrowser/pluma-file-bookmarks-store.c +@@ -494,66 +494,103 @@ add_bookmark (PlumaFileBookmarksStore * model, + return ret; + } + +-static void +-init_bookmarks (PlumaFileBookmarksStore * model) ++static gchar * ++get_bookmarks_file (void) ++{ ++ return g_build_filename (g_get_user_config_dir (), "gtk-3.0", "bookmarks", NULL); ++} ++ ++static gchar * ++get_legacy_bookmarks_file (void) ++{ ++ return g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL); ++} ++ ++static gboolean ++parse_bookmarks_file (PlumaFileBookmarksStore *model, ++ const gchar *bookmarks, ++ gboolean *added) + { +- gchar *bookmarks; + GError *error = NULL; + gchar *contents; + gchar **lines; + gchar **line; +- gboolean added = FALSE; + +- /* Read the bookmarks file */ +- bookmarks = g_build_filename (g_get_home_dir (), +- ".gtk-bookmarks", +- NULL); +- +- if (g_file_get_contents (bookmarks, &contents, NULL, &error)) { +- lines = g_strsplit (contents, "\n", 0); +- +- for (line = lines; *line; ++line) { +- if (**line) { +- gchar *pos; +- gchar *name; +- +- /* CHECK: is this really utf8? */ +- pos = g_utf8_strchr (*line, -1, ' '); +- +- if (pos != NULL) { +- *pos = '\0'; +- name = pos + 1; +- } else { +- name = NULL; +- } +- +- /* the bookmarks file should contain valid +- * URIs, but paranoia is good */ +- if (pluma_utils_is_valid_uri (*line)) { +- added |= add_bookmark (model, name, *line); +- } ++ if (!g_file_get_contents (bookmarks, &contents, NULL, &error)) ++ { ++ /* The bookmarks file doesn't exist (which is perfectly fine) */ ++ g_error_free (error); ++ ++ return FALSE; ++ } ++ ++ lines = g_strsplit (contents, "\n", 0); ++ ++ for (line = lines; *line; ++line) ++ { ++ if (**line) ++ { ++ gchar *pos; ++ gchar *name; ++ ++ /* CHECK: is this really utf8? */ ++ pos = g_utf8_strchr (*line, -1, ' '); ++ ++ if (pos != NULL) ++ { ++ *pos = '\0'; ++ name = pos + 1; ++ } ++ else ++ { ++ name = NULL; ++ } ++ ++ /* the bookmarks file should contain valid ++ * URIs, but paranoia is good */ ++ if (pluma_utils_is_valid_uri (*line)) ++ { ++ *added |= add_bookmark (model, name, *line); + } + } ++ } ++ ++ g_strfreev (lines); ++ g_free (contents); + +- g_strfreev (lines); +- g_free (contents); ++ /* Add a watch */ ++ if (model->priv->bookmarks_monitor == NULL) ++ { ++ GFile *file; + +- /* Add a watch */ +- if (model->priv->bookmarks_monitor == NULL) { +- GFile * file; ++ file = g_file_new_for_path (bookmarks); ++ model->priv->bookmarks_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); ++ g_object_unref (file); + +- file = g_file_new_for_path (bookmarks); +- model->priv->bookmarks_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); +- g_object_unref (file); ++ g_signal_connect (model->priv->bookmarks_monitor, ++ "changed", ++ G_CALLBACK (on_bookmarks_file_changed), ++ model); ++ } + +- g_signal_connect (model->priv->bookmarks_monitor, +- "changed", +- (GCallback)on_bookmarks_file_changed, +- model); +- } +- } else { +- /* The bookmarks file doesn't exist (which is perfectly fine) */ +- g_error_free (error); ++ return TRUE; ++} ++ ++static void ++init_bookmarks (PlumaFileBookmarksStore *model) ++{ ++ gchar *bookmarks; ++ gboolean added = FALSE; ++ ++ bookmarks = get_bookmarks_file (); ++ ++ if (!parse_bookmarks_file (model, bookmarks, &added)) ++ { ++ g_free (bookmarks); ++ ++ /* try the old location (gtk <= 3.4) */ ++ bookmarks = get_legacy_bookmarks_file (); ++ parse_bookmarks_file (model, bookmarks, &added); + } + + if (added) { +-- +2.12.2 +