Merge lp:~noskcaj/ubuntu/trusty/thunar/lp-1277149 into lp:ubuntu/trusty/thunar

Proposed by Jackson Doak
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~noskcaj/ubuntu/trusty/thunar/lp-1277149
Merge into: lp:ubuntu/trusty/thunar
Diff against target: 267 lines (+244/-0)
4 files modified
debian/changelog (+7/-0)
debian/patches/git-xfdesktop-4.11.patch (+188/-0)
debian/patches/gtk3-bookmarks.patch (+47/-0)
debian/patches/series (+2/-0)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/trusty/thunar/lp-1277149
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
Review via email: mp+205288@code.launchpad.net

Description of the change

Allow thunar to change wallpapers with xfdesktop4 4.11

To post a comment you must log in.
96. By Jackson Doak on 2014-02-07

Add gtk3-bookmarks.patch, use new gtk3 bookmark location

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, looks fine! (Well-written patch headers)

Uploaded.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-12-26 22:09:24 +0000
3+++ debian/changelog 2014-02-07 20:28:18 +0000
4@@ -1,3 +1,10 @@
5+thunar (1.6.3-1ubuntu3) trusty; urgency=medium
6+
7+ * Add git-xfdesktop-4.11.patch. LP: #1277149
8+ * Add gtk3-bookmarks.patch, use new gtk3 bookmark location
9+
10+ -- Jackson Doak <noskcaj@ubuntu.com> Fri, 07 Feb 2014 16:54:48 +1100
11+
12 thunar (1.6.3-1ubuntu2) trusty; urgency=medium
13
14 * Use dh-autoreconf and xdt-autogen to update libtool.m4 for new ports.
15
16=== added file 'debian/patches/git-xfdesktop-4.11.patch'
17--- debian/patches/git-xfdesktop-4.11.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/git-xfdesktop-4.11.patch 2014-02-07 20:28:18 +0000
19@@ -0,0 +1,188 @@
20+Author: Eric Koegel <eric.koegel@gmail.com>
21+Date: Tue, 26 Nov 2013 10:16:21 +0300
22+Description: [PATCH] Update xfconf setting for thunar-wallpaper plugin
23+ Xfdesktop uses a new xfconf format starting with version 4.11.
24+ This patch updates the thunar-wallpaper plugin to set the image
25+ in the new format while continuing to set the old format.
26+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/thunar/+bug/1277149
27+---
28+ plugins/thunar-wallpaper/twp-provider.c | 111 ++++++++++++++++++++++++++++++--
29+ 1 file changed, 106 insertions(+), 5 deletions(-)
30+
31+--- a/plugins/thunar-wallpaper/twp-provider.c
32++++ b/plugins/thunar-wallpaper/twp-provider.c
33+@@ -27,6 +27,7 @@
34+
35+ #include <gdk/gdkx.h>
36+ #include <X11/Xlib.h>
37++#include <X11/Xatom.h>
38+
39+ #include <glib/gi18n.h>
40+
41+@@ -45,6 +46,7 @@ static GList *twp_provider_get_file_acti
42+ GList *files);
43+ static void twp_action_set_wallpaper (GtkAction *action,
44+ gpointer user_data);
45++static gint twp_get_active_workspace_number (GdkScreen *screen);
46+
47+
48+ typedef enum
49+@@ -217,16 +219,23 @@ twp_action_set_wallpaper (GtkAction *act
50+ gint screen_nr = 0;
51+ gint n_monitors;
52+ gint monitor_nr = 0;
53++ gint workspace;
54+ GdkScreen *screen;
55+ gchar *image_path_prop;
56+ gchar *image_show_prop;
57+ gchar *image_style_prop;
58++ gchar *monitor_name;
59+ gchar *file_uri;
60+ gchar *escaped_file_name;
61+ gchar *file_name = NULL;
62+ gchar *hostname = NULL;
63+ gchar *command;
64+
65++ if (n_screens > 1)
66++ screen = gdk_display_get_default_screen (display);
67++ else
68++ screen = gdk_display_get_screen (display, 0);
69++
70+ if (desktop_type != DESKTOP_TYPE_NONE)
71+ {
72+ file_uri = thunarx_file_info_get_uri (file_info);
73+@@ -239,10 +248,6 @@ twp_action_set_wallpaper (GtkAction *act
74+
75+ return;
76+ }
77+- if (n_screens > 1)
78+- screen = gdk_display_get_default_screen (display);
79+- else
80+- screen = gdk_display_get_screen (display, 0);
81+
82+ n_monitors = gdk_screen_get_n_monitors (screen);
83+ if (n_monitors > 1)
84+@@ -252,12 +257,17 @@ twp_action_set_wallpaper (GtkAction *act
85+ g_free(file_uri);
86+ }
87+
88++ workspace = twp_get_active_workspace_number (screen);
89++
90++ monitor_name = gdk_screen_get_monitor_plug_name (screen, monitor_nr);
91++
92+ escaped_file_name = g_shell_quote (file_name);
93+
94+ switch (desktop_type)
95+ {
96+ case DESKTOP_TYPE_XFCE:
97+ g_debug ("set on xfce");
98++ /* This is the format for xfdesktop before 4.11 */
99+ image_path_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-path", screen_nr, monitor_nr);
100+ image_show_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-show", screen_nr, monitor_nr);
101+ image_style_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-style", screen_nr, monitor_nr);
102+@@ -277,6 +287,34 @@ twp_action_set_wallpaper (GtkAction *act
103+ g_free(image_path_prop);
104+ g_free(image_show_prop);
105+ g_free(image_style_prop);
106++
107++ /* This is the format for xfdesktop post 4.11. A workspace number is
108++ * added and the monitor is referred to name. We set both formats so
109++ * that it works as the user expects. */
110++ if (monitor_name)
111++ {
112++ image_path_prop = g_strdup_printf("/backdrop/screen%d/monitor%s/workspace%d/last-image", screen_nr, monitor_name, workspace);
113++ image_style_prop = g_strdup_printf("/backdrop/screen%d/monitor%s/workspace%d/image-style", screen_nr, monitor_name, workspace);
114++ }
115++ else
116++ {
117++ /* gdk_screen_get_monitor_plug_name can return NULL, in those
118++ * instances we fallback to monitor number but still include the
119++ * workspace number */
120++ image_path_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/workspace%d/last-image", screen_nr, monitor_nr, workspace);
121++ image_style_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/workspace%d/image-style", screen_nr, monitor_nr, workspace);
122++ }
123++
124++ command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t string -s %s", image_path_prop, escaped_file_name);
125++ g_spawn_command_line_async (command, NULL);
126++ g_free (command);
127++
128++ command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t int -s 3", image_style_prop);
129++ g_spawn_command_line_async (command, NULL);
130++ g_free (command);
131++
132++ g_free(image_path_prop);
133++ g_free(image_style_prop);
134+ break;
135+
136+ case DESKTOP_TYPE_NAUTILUS:
137+@@ -302,6 +340,69 @@ twp_action_set_wallpaper (GtkAction *act
138+ break;
139+ }
140+
141++ g_free (monitor_name);
142+ g_free (escaped_file_name);
143+- g_free(file_name);
144++ g_free (file_name);
145++}
146++
147++/* Taken from xfce_spawn_get_active_workspace_number in xfce-spawn.c apart of
148++ * the libxfce4ui library.
149++ * http://git.xfce.org/xfce/libxfce4ui/tree/libxfce4ui/xfce-spawn.c#n193
150++ */
151++static gint
152++twp_get_active_workspace_number (GdkScreen *screen)
153++{
154++ GdkWindow *root;
155++ gulong bytes_after_ret = 0;
156++ gulong nitems_ret = 0;
157++ guint *prop_ret = NULL;
158++ Atom _NET_CURRENT_DESKTOP;
159++ Atom _WIN_WORKSPACE;
160++ Atom type_ret = None;
161++ gint format_ret;
162++ gint ws_num = 0;
163++
164++ gdk_error_trap_push ();
165++
166++ root = gdk_screen_get_root_window (screen);
167++
168++ /* determine the X atom values */
169++ _NET_CURRENT_DESKTOP = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_NET_CURRENT_DESKTOP", False);
170++ _WIN_WORKSPACE = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_WIN_WORKSPACE", False);
171++
172++ if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
173++ gdk_x11_get_default_root_xwindow(),
174++ _NET_CURRENT_DESKTOP, 0, 32, False, XA_CARDINAL,
175++ &type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
176++ (gpointer) &prop_ret) != Success)
177++ {
178++ if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
179++ gdk_x11_get_default_root_xwindow(),
180++ _WIN_WORKSPACE, 0, 32, False, XA_CARDINAL,
181++ &type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
182++ (gpointer) &prop_ret) != Success)
183++ {
184++ if (G_UNLIKELY (prop_ret != NULL))
185++ {
186++ XFree (prop_ret);
187++ prop_ret = NULL;
188++ }
189++ }
190++ }
191++
192++ if (G_LIKELY (prop_ret != NULL))
193++ {
194++ if (G_LIKELY (type_ret != None && format_ret != 0))
195++ ws_num = *prop_ret;
196++ XFree (prop_ret);
197++ }
198++
199++#if GTK_CHECK_VERSION (3, 0, 0)
200++ gdk_error_trap_pop_ignored ();
201++#else
202++ if (gdk_error_trap_pop () != 0)
203++ return 0;
204++#endif
205++
206++ return ws_num;
207+ }
208
209=== added file 'debian/patches/gtk3-bookmarks.patch'
210--- debian/patches/gtk3-bookmarks.patch 1970-01-01 00:00:00 +0000
211+++ debian/patches/gtk3-bookmarks.patch 2014-02-07 20:28:18 +0000
212@@ -0,0 +1,47 @@
213+Author: Alistair Buxton <a.j.buxton@gmail.com>
214+Date: Sun, 12 Jan 2014 17:27:30 +0000
215+Description: [PATCH] Use the new Gtk bookmarks location.
216+Bug: https://bugzilla.xfce.org/show_bug.cgi?id=10627
217+
218+---
219+ thunar/thunar-gio-extensions.c | 2 +-
220+ thunar/thunar-util.c | 10 +++++++++-
221+ 2 files changed, 10 insertions(+), 2 deletions(-)
222+
223+--- a/thunar/thunar-gio-extensions.c
224++++ b/thunar/thunar-gio-extensions.c
225+@@ -77,7 +77,7 @@ thunar_g_file_new_for_bookmarks (void)
226+ gchar *filename;
227+ GFile *bookmarks;
228+
229+- filename = g_build_filename (xfce_get_homedir (), ".gtk-bookmarks", NULL);
230++ filename = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "bookmarks", NULL);
231+ bookmarks = g_file_new_for_path (filename);
232+ g_free (filename);
233+
234+--- a/thunar/thunar-util.c
235++++ b/thunar/thunar-util.c
236+@@ -84,6 +84,15 @@ thunar_util_load_bookmarks (GFile
237+
238+ /* append the GTK+ bookmarks (if any) */
239+ fp = fopen (bookmarks_path, "r");
240++ g_free (bookmarks_path);
241++
242++ if (G_UNLIKELY (fp == NULL))
243++ {
244++ bookmarks_path = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL);
245++ fp = fopen(bookmarks_path, "r");
246++ g_free(bookmarks_path);
247++ }
248++
249+ if (G_LIKELY (fp != NULL))
250+ {
251+ while (fgets (line, sizeof (line), fp) != NULL)
252+@@ -119,7 +128,6 @@ thunar_util_load_bookmarks (GFile
253+ fclose (fp);
254+ }
255+
256+- g_free (bookmarks_path);
257+ }
258+
259+
260
261=== modified file 'debian/patches/series'
262--- debian/patches/series 2013-08-15 21:37:17 +0000
263+++ debian/patches/series 2014-02-07 20:28:18 +0000
264@@ -1,1 +1,3 @@
265 01_support-non-multiarch-modules.patch
266+git-xfdesktop-4.11.patch
267+gtk3-bookmarks.patch

Subscribers

People subscribed via source and target branches

to all changes: