Merge lp:~3v1n0/nautilus/add-timestamp-operations into lp:~ubuntu-desktop/nautilus/ubuntu

Proposed by Marco Trevisan (Treviño) on 2015-11-26
Status: Merged
Merged at revision: 482
Proposed branch: lp:~3v1n0/nautilus/add-timestamp-operations
Merge into: lp:~ubuntu-desktop/nautilus/ubuntu
Diff against target: 377 lines (+362/-0)
2 files modified
debian/changelog (+3/-0)
debian/patches/20_add_timestamp_to_operations.patch (+359/-0)
To merge this branch: bzr merge lp:~3v1n0/nautilus/add-timestamp-operations
Reviewer Review Type Date Requested Status
Sebastien Bacher 2015-11-26 Approve on 2015-12-01
Review via email: mp+278748@code.launchpad.net

Commit message

debian/patches/20_add_timestamp_to_operations.patch:
    - Add *WithTimestamp dbus methods for file operations that
      might trigger a dialog, that should be presented with time.

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

Thanks, would be nice if you could open an upstream bug for discussion though otherwise it's likely going to stand as a distro patch for ever...

review: Approve
480. By Marco Trevisan (Treviño) on 2015-11-30

debian/patches/20_add_timestamp_to_operations.patch:
    - Add *WithTimestamp dbus methods for file operations that
      might trigger a dialog, that should be presented with time.

Sebastien Bacher (seb128) wrote :

thanks

review: Approve
Sebastien Bacher (seb128) wrote :

you probably meant to include the patch in the serie as well right? ;-) I'm fixing that when merging

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 2015-11-27 17:48:29 +0000
3+++ debian/changelog 2015-11-30 11:16:09 +0000
4@@ -111,6 +111,9 @@
5 * debian/patches/19_unity_open_location_xid.patch:
6 - ensure that the active location is always the first listed
7 - only use window xid on X11
8+ * debian/patches/20_add_timestamp_to_operations.patch:
9+ - Add *WithTimestamp dbus methods for file operations that
10+ might trigger a dialog, that should be presented with time.
11
12 -- Sebastien Bacher <seb128@ubuntu.com> Mon, 09 Nov 2015 16:09:54 +0100
13
14
15=== added file 'debian/patches/20_add_timestamp_to_operations.patch'
16--- debian/patches/20_add_timestamp_to_operations.patch 1970-01-01 00:00:00 +0000
17+++ debian/patches/20_add_timestamp_to_operations.patch 2015-11-30 11:16:09 +0000
18@@ -0,0 +1,359 @@
19+Description: Add *WithTimestamp dbus methods for file operations that
20+ might trigger a dialog, that should be presented with event time.
21+
22+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1445595
23+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=758833
24+Forwarded: yes
25+Author: Marco Trevisan <marco@ubuntu.com>
26+
27+Index: nautilus-3.18.1/data/dbus-interfaces.xml
28+===================================================================
29+--- nautilus-3.18.1.orig/data/dbus-interfaces.xml 2015-11-26 19:19:25.924710569 +0100
30++++ nautilus-3.18.1/data/dbus-interfaces.xml 2015-11-26 19:19:42.764707913 +0100
31+@@ -27,13 +27,28 @@
32+ <arg type='as' name='SourceFilesURIList' direction='in'/>
33+ <arg type='s' name='DestinationDirectoryURI' direction='in'/>
34+ </method>
35++ <method name='CopyURIsWithTimestamp'>
36++ <arg type='as' name='SourceFilesURIList' direction='in'/>
37++ <arg type='s' name='DestinationDirectoryURI' direction='in'/>
38++ <arg type='u' name='EventTimestamp' direction='in'/>
39++ </method>
40+ <method name='EmptyTrash'>
41+ </method>"
42++ <method name='EmptyTrashWithTimestamp'>
43++ <arg type='u' name='EventTimestamp' direction='in'/>
44++ </method>"
45+ <method name='CopyFile'>
46+ <arg type='s' name='SourceFileURI' direction='in'/>
47+ <arg type='s' name='SourceDisplayName' direction='in'/>
48+ <arg type='s' name='DestinationDirectoryURI' direction='in'/>
49+ <arg type='s' name='DestinationDisplayName' direction='in'/>
50+ </method>
51++ <method name='CopyFileWithTimestamp'>
52++ <arg type='s' name='SourceFileURI' direction='in'/>
53++ <arg type='s' name='SourceDisplayName' direction='in'/>
54++ <arg type='s' name='DestinationDirectoryURI' direction='in'/>
55++ <arg type='s' name='DestinationDisplayName' direction='in'/>
56++ <arg type='u' name='EventTimestamp' direction='in'/>
57++ </method>
58+ </interface>
59+ </node>
60+Index: nautilus-3.18.1/libnautilus-private/nautilus-file-operations.c
61+===================================================================
62+--- nautilus-3.18.1.orig/libnautilus-private/nautilus-file-operations.c 2015-11-26 18:30:10.458026076 +0100
63++++ nautilus-3.18.1/libnautilus-private/nautilus-file-operations.c 2015-11-26 21:50:44.854900005 +0100
64+@@ -72,6 +72,7 @@
65+ GtkWindow *parent_window;
66+ int screen_num;
67+ guint inhibit_cookie;
68++ guint32 action_timestamp;
69+ NautilusProgressInfo *progress;
70+ GCancellable *cancellable;
71+ GHashTable *skip_files;
72+@@ -1061,7 +1062,8 @@
73+ const char *details_text;
74+ const char **button_titles;
75+ gboolean show_all;
76+-
77++ guint32 timestamp;
78++
79+ int result;
80+ } RunSimpleDialogData;
81+
82+@@ -1104,7 +1106,8 @@
83+ }
84+
85+ /* Run it. */
86+- result = gtk_dialog_run (GTK_DIALOG (dialog));
87++ gtk_window_present_with_time (GTK_WINDOW (dialog), data->timestamp);
88++ result = gtk_dialog_run (GTK_DIALOG (dialog));
89+
90+ while ((result == GTK_RESPONSE_NONE || result == GTK_RESPONSE_DELETE_EVENT) && data->ignore_close_box) {
91+ result = gtk_dialog_run (GTK_DIALOG (dialog));
92+@@ -1145,6 +1148,7 @@
93+ data->secondary_text = secondary_text;
94+ data->details_text = details_text;
95+ data->show_all = show_all;
96++ data->timestamp = job->action_timestamp;
97+
98+ ptr_array = g_ptr_array_new ();
99+ while ((button_title = va_arg (varargs, const char *)) != NULL) {
100+@@ -5065,6 +5069,26 @@
101+ NautilusCopyCallback done_callback,
102+ gpointer done_callback_data)
103+ {
104++ nautilus_file_operations_copy_file_with_time (source_file,
105++ target_dir,
106++ source_display_name,
107++ new_name,
108++ parent_window,
109++ GDK_CURRENT_TIME,
110++ done_callback,
111++ done_callback_data);
112++}
113++
114++void
115++nautilus_file_operations_copy_file_with_time (GFile *source_file,
116++ GFile *target_dir,
117++ const gchar *source_display_name,
118++ const gchar *new_name,
119++ GtkWindow *parent_window,
120++ guint32 timestamp,
121++ NautilusCopyCallback done_callback,
122++ gpointer done_callback_data)
123++{
124+ CopyMoveJob *job;
125+
126+ job = op_job_new (CopyMoveJob, parent_window);
127+@@ -5077,6 +5101,7 @@
128+ nautilus_progress_info_set_destination (((CommonJob *)job)->progress, target_dir);
129+ job->target_name = g_strdup (new_name);
130+ job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, NULL);
131++ ((CommonJob *)job)->action_timestamp = timestamp;
132+
133+ if (source_display_name != NULL) {
134+ gchar *path;
135+@@ -5104,6 +5129,24 @@
136+ NautilusCopyCallback done_callback,
137+ gpointer done_callback_data)
138+ {
139++ nautilus_file_operations_copy_with_time (files,
140++ relative_item_points,
141++ target_dir,
142++ parent_window,
143++ GDK_CURRENT_TIME,
144++ done_callback,
145++ done_callback_data);
146++}
147++
148++void
149++nautilus_file_operations_copy_with_time (GList *files,
150++ GArray *relative_item_points,
151++ GFile *target_dir,
152++ GtkWindow *parent_window,
153++ guint32 timestamp,
154++ NautilusCopyCallback done_callback,
155++ gpointer done_callback_data)
156++{
157+ CopyMoveJob *job;
158+
159+ job = op_job_new (CopyMoveJob, parent_window);
160+@@ -5112,6 +5155,7 @@
161+ job->done_callback_data = done_callback_data;
162+ job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
163+ job->destination = g_object_ref (target_dir);
164++ ((CommonJob *)job)->action_timestamp = timestamp;
165+ /* Need to indicate the destination for the operation notification open
166+ * button. */
167+ nautilus_progress_info_set_destination (((CommonJob *)job)->progress, target_dir);
168+@@ -6933,6 +6977,13 @@
169+ void
170+ nautilus_file_operations_empty_trash (GtkWidget *parent_view)
171+ {
172++ nautilus_file_operations_empty_trash_with_time (parent_view, GDK_CURRENT_TIME);
173++}
174++
175++void
176++nautilus_file_operations_empty_trash_with_time (GtkWidget *parent_view,
177++ guint32 timestamp)
178++{
179+ EmptyTrashJob *job;
180+ GtkWindow *parent_window;
181+
182+@@ -6945,6 +6996,7 @@
183+ job->trash_dirs = g_list_prepend (job->trash_dirs,
184+ g_file_new_for_uri ("trash:"));
185+ job->should_confirm = TRUE;
186++ ((CommonJob *)job)->action_timestamp = timestamp;
187+
188+ inhibit_power_manager ((CommonJob *)job, _("Emptying Trash"));
189+
190+Index: nautilus-3.18.1/libnautilus-private/nautilus-file-operations.h
191+===================================================================
192+--- nautilus-3.18.1.orig/libnautilus-private/nautilus-file-operations.h 2015-10-06 18:14:05.000000000 +0200
193++++ nautilus-3.18.1/libnautilus-private/nautilus-file-operations.h 2015-11-26 19:31:35.176748423 +0100
194+@@ -62,7 +62,17 @@
195+ GtkWindow *parent_window,
196+ NautilusCopyCallback done_callback,
197+ gpointer done_callback_data);
198++void nautilus_file_operations_copy_file_with_time (GFile *source_file,
199++ GFile *target_dir,
200++ const gchar *source_display_name,
201++ const gchar *new_name,
202++ GtkWindow *parent_window,
203++ guint32 timestamp,
204++ NautilusCopyCallback done_callback,
205++ gpointer done_callback_data);
206+ void nautilus_file_operations_empty_trash (GtkWidget *parent_view);
207++void nautilus_file_operations_empty_trash_with_time (GtkWidget *parent_view,
208++ guint32 timestamp);
209+ void nautilus_file_operations_new_folder (GtkWidget *parent_view,
210+ GdkPoint *target_point,
211+ const char *parent_dir_uri,
212+@@ -126,6 +136,13 @@
213+ GtkWindow *parent_window,
214+ NautilusCopyCallback done_callback,
215+ gpointer done_callback_data);
216++void nautilus_file_operations_copy_with_time (GList *files,
217++ GArray *relative_item_points,
218++ GFile *target_dir,
219++ GtkWindow *parent_window,
220++ guint32 timestamp,
221++ NautilusCopyCallback done_callback,
222++ gpointer done_callback_data);
223+ void nautilus_file_operations_move (GList *files,
224+ GArray *relative_item_points,
225+ GFile *target_dir,
226+Index: nautilus-3.18.1/src/nautilus-dbus-manager.c
227+===================================================================
228+--- nautilus-3.18.1.orig/src/nautilus-dbus-manager.c 2015-11-26 18:47:10.601389709 +0100
229++++ nautilus-3.18.1/src/nautilus-dbus-manager.c 2015-11-26 22:01:09.410791504 +0100
230+@@ -57,13 +57,12 @@
231+ G_OBJECT_CLASS (nautilus_dbus_manager_parent_class)->dispose (object);
232+ }
233+
234+-static gboolean
235+-handle_copy_file (NautilusDBusFileOperations *object,
236+- GDBusMethodInvocation *invocation,
237+- const gchar *source_uri,
238+- const gchar *source_display_name,
239+- const gchar *dest_dir_uri,
240+- const gchar *dest_name)
241++static void
242++copy_file (const gchar *source_uri,
243++ const gchar *source_display_name,
244++ const gchar *dest_dir_uri,
245++ const gchar *dest_name,
246++ guint32 timestamp)
247+ {
248+ GFile *source_file, *target_dir;
249+ const gchar *target_name = NULL, *source_name = NULL;
250+@@ -82,16 +81,41 @@
251+
252+ g_object_unref (source_file);
253+ g_object_unref (target_dir);
254++}
255++
256++static gboolean
257++handle_copy_file (NautilusDBusFileOperations *object,
258++ GDBusMethodInvocation *invocation,
259++ const gchar *source_uri,
260++ const gchar *source_display_name,
261++ const gchar *dest_dir_uri,
262++ const gchar *dest_name)
263++{
264++ copy_file (source_uri, source_display_name, dest_dir_uri, dest_name, GDK_CURRENT_TIME);
265+
266+ nautilus_dbus_file_operations_complete_copy_file (object, invocation);
267+ return TRUE; /* invocation was handled */
268+ }
269+
270+ static gboolean
271+-handle_copy_uris (NautilusDBusFileOperations *object,
272+- GDBusMethodInvocation *invocation,
273+- const gchar **sources,
274+- const gchar *destination)
275++handle_copy_file_with_timestamp (NautilusDBusFileOperations *object,
276++ GDBusMethodInvocation *invocation,
277++ const gchar *source_uri,
278++ const gchar *source_display_name,
279++ const gchar *dest_dir_uri,
280++ const gchar *dest_name,
281++ guint32 timestamp)
282++{
283++ copy_file (source_uri, source_display_name, dest_dir_uri, dest_name, timestamp);
284++
285++ nautilus_dbus_file_operations_complete_copy_file_with_timestamp (object, invocation);
286++ return TRUE; /* invocation was handled */
287++}
288++
289++static void
290++copy_uris (const gchar **sources,
291++ const gchar *destination,
292++ guint32 timestamp)
293+ {
294+ GList *source_files = NULL;
295+ GFile *dest_dir;
296+@@ -103,18 +127,40 @@
297+ source_files = g_list_prepend (source_files,
298+ g_file_new_for_uri (sources[idx]));
299+
300+- nautilus_file_operations_copy (source_files, NULL,
301+- dest_dir,
302+- NULL, NULL, NULL);
303++ nautilus_file_operations_copy_with_time (source_files, NULL,
304++ dest_dir,
305++ NULL,
306++ timestamp,
307++ NULL, NULL);
308+
309+ g_list_free_full (source_files, g_object_unref);
310+ g_object_unref (dest_dir);
311++}
312+
313++static gboolean
314++handle_copy_uris (NautilusDBusFileOperations *object,
315++ GDBusMethodInvocation *invocation,
316++ const gchar **sources,
317++ const gchar *destination)
318++{
319++ copy_uris (sources, destination, GDK_CURRENT_TIME);
320+ nautilus_dbus_file_operations_complete_copy_uris (object, invocation);
321+ return TRUE; /* invocation was handled */
322+ }
323+
324+ static gboolean
325++handle_copy_uris_with_timestamp (NautilusDBusFileOperations *object,
326++ GDBusMethodInvocation *invocation,
327++ const gchar **sources,
328++ const gchar *destination,
329++ guint32 timestamp)
330++{
331++ copy_uris (sources, destination, timestamp);
332++ nautilus_dbus_file_operations_complete_copy_uris_with_timestamp (object, invocation);
333++ return TRUE;
334++}
335++
336++static gboolean
337+ handle_empty_trash (NautilusDBusFileOperations *object,
338+ GDBusMethodInvocation *invocation)
339+ {
340+@@ -124,6 +170,17 @@
341+ return TRUE; /* invocation was handled */
342+ }
343+
344++static gboolean
345++handle_empty_trash_with_timestamp (NautilusDBusFileOperations *object,
346++ GDBusMethodInvocation *invocation,
347++ guint32 timestamp)
348++{
349++ nautilus_file_operations_empty_trash_with_time (NULL, timestamp);
350++
351++ nautilus_dbus_file_operations_complete_empty_trash_with_timestamp (object, invocation);
352++ return TRUE; /* invocation was handled */
353++}
354++
355+ static void
356+ nautilus_dbus_manager_init (NautilusDBusManager *self)
357+ {
358+@@ -141,6 +198,19 @@
359+ "handle-empty-trash",
360+ G_CALLBACK (handle_empty_trash),
361+ self);
362++
363++ g_signal_connect (self->file_operations,
364++ "handle-copy-uris-with-timestamp",
365++ G_CALLBACK (handle_copy_uris_with_timestamp),
366++ self);
367++ g_signal_connect (self->file_operations,
368++ "handle-copy-file-with-timestamp",
369++ G_CALLBACK (handle_copy_file_with_timestamp),
370++ self);
371++ g_signal_connect (self->file_operations,
372++ "handle-empty-trash-with-timestamp",
373++ G_CALLBACK (handle_empty_trash_with_timestamp),
374++ self);
375+ }
376+
377+ static void

Subscribers

People subscribed via source and target branches

to all changes: