Merge lp:~jeremywootten/pantheon-files/fix-1028637 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: David Gomes
Approved revision: 1409
Merged at revision: 1474
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1028637
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 250 lines (+74/-8)
6 files modified
libcore/marlin-file-operations.c (+0/-1)
src/fm-columns-view.c (+6/-1)
src/fm-directory-view.c (+40/-5)
src/fm-icon-view.c (+11/-1)
src/fm-list-view.c (+11/-0)
src/marlin-clipboard-manager.c (+6/-0)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1028637
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Cody Garver (community) Needs Fixing
Review via email: mp+205487@code.launchpad.net

This proposal supersedes a proposal from 2014-01-10.

Commit message

When files are pasted or dropped into a view they are added to the current selection and appear highlighted. Files added other ways, e.g. from the command line or saved from another application are not affected.

Description of the change

When files are pasted or dropped into a view they are added to the current selection and appear highlighted. Files added other ways, e.g. from the command line or saved from another application are not affected.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote : Posted in a previous version of this proposal

You've got design approval! Been waiting for this feature for a while :D

Revision history for this message
David Gomes (davidgomes) wrote : Posted in a previous version of this proposal

>return (g_list_length (manager->files));
Wouldn't just
>return g_list_length (manager->files);
be better? In terms of code style of course.

Also, diff line 17 doesn't seem to be working.

Other than that, I approve of it, I'll just have to test it.

review: Needs Fixing
Revision history for this message
Jeremy Wootten (jeremywootten) wrote : Posted in a previous version of this proposal

Thanks. Not sure where the extra parentheses came from, now - I'll remove.
 Diff line 17 was for testing and can be removed. I await the results of
your testing with interest.

On 15 January 2014 01:31, David Gomes <email address hidden> wrote:

> Review: Needs Fixing
>
> >return (g_list_length (manager->files));
> Wouldn't just
> >return g_list_length (manager->files);
> be better? In terms of code style of course.
>
> Also, diff line 17 doesn't seem to be working.
>
> Other than that, I approve of it, I'll just have to test it.
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1028637/+merge/201174
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1028637.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Jeremy Wootten (jeremywootten) wrote : Posted in a previous version of this proposal

OK, removed extra parentheses and debugging message. Also added a comment.

On 15 January 2014 01:31, David Gomes <email address hidden> wrote:

> Review: Needs Fixing
>
> >return (g_list_length (manager->files));
> Wouldn't just
> >return g_list_length (manager->files);
> be better? In terms of code style of course.
>
> Also, diff line 17 doesn't seem to be working.
>
> Other than that, I approve of it, I'll just have to test it.
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1028637/+merge/201174
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1028637.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Cody Garver (codygarver) wrote : Posted in a previous version of this proposal

Focus is set to the file you copied AND the file you pasted, is that really the desired behavior? To reproduce:

copy file1
paste file1 so that it becomes file2
observe file1 AND file2 are selected
optional: continue pasting and you will observe all copies are selected at once

Revision history for this message
Jeremy Wootten (jeremywootten) wrote : Posted in a previous version of this proposal

At the moment, any existing selection in the target directory is not
cleared (intentionally). The pasted file is added to the existing
selection. So if you are copying and pasting files into the same directory
using Ctrl-C and Ctrl-V you will get the behaviour you observed. If you use
the right-click menu you won't because this clears the current selection in
the source directory (even in trunk).

 The current behaviour in trunk is that any existing selection in the
target directory is not cleared by pasting with Ctrl-V or by drag & drop
but the pasted files are not selected.

It should be straightforward to change this if the consensus is that the
desired behaviour would be to clear the existing selection in the target
directory.

On 17 January 2014 12:18, Cody Garver <email address hidden> wrote:

> Focus is set to the file you copied AND the file you pasted, is that
> really the desired behavior? To reproduce:
>
> copy file1
> paste file1 so that it becomes file2
> observe file1 AND file2 are selected
> optional: continue pasting and you will observe all copies are selected at
> once
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1028637/+merge/201174
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1028637.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Jeremy Wootten (jeremywootten) wrote : Posted in a previous version of this proposal

A new version has just been uploaded that clears any existing selection
before selecting the pasted/dropped files. This also fixes a problem with
the previous version caused when some of the files expected to arrive had
been skipped. Files pasted/dropped directly into a view are selected.
 Those added indirectly (e.g. from the terminal or by dropping onto a
bookmark or folder icon) are not.

On 17 January 2014 12:18, Cody Garver <email address hidden> wrote:

> Focus is set to the file you copied AND the file you pasted, is that
> really the desired behavior? To reproduce:
>
> copy file1
> paste file1 so that it becomes file2
> observe file1 AND file2 are selected
> optional: continue pasting and you will observe all copies are selected at
> once
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1028637/+merge/201174
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1028637.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Cody Garver (codygarver) wrote :

Needs trunk merged in and conflicts resolved

Revision history for this message
Cody Garver (codygarver) wrote :

And remove commented out code

review: Needs Fixing
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

OK, trunk has moved on a lot since this branch was first proposed.

Regarding the commented out code, I am not sure what the etiquette is with
respect to removing other people's debugging messages. That's why I only
commented them out - they were causing a lot of "noise" in the terminal.

In my view, the trunk code should only contain messages that are useful
warnings or critical error messages - there are a number of messages in the
code at the moment that are not useful or warn of things that are not
really errors. I try to take out any messages I have inserted during
debugging before proposing for merge.

On 24 March 2014 04:12, Cody Garver <email address hidden> wrote:

> Review: Needs Fixing
>
> And remove commented out code
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1028637/+merge/205487
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1028637.
>

1409. By Jeremy Wootten

Merged changes from trunk and remove commented out code

Revision history for this message
David Gomes (davidgomes) :
review: Approve
Revision history for this message
Cody Garver (codygarver) wrote :

Jeremy you are the main Files contributor at this time.

We liberated this project from someone else.

So your opinion on how code should go is almost as important as the design team. Fire at will.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Thanks Cody, although there have been several other contributors recently
which is good to see.

On 16 April 2014 22:27, Cody Garver <email address hidden> wrote:

> Jeremy you are the main Files contributor at this time.
>
> We liberated this project from someone else.
>
> So your opinion on how code should go is almost as important as the design
> team. Fire at will.
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1028637/+merge/205487
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1028637.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libcore/marlin-file-operations.c'
2--- libcore/marlin-file-operations.c 2014-01-07 22:25:32 +0000
3+++ libcore/marlin-file-operations.c 2014-03-24 20:45:22 +0000
4@@ -4700,7 +4700,6 @@
5 gpointer done_callback_data)
6 {
7 CopyMoveJob *job;
8-
9 job = op_job_new (JOB_COPY, CopyMoveJob, parent_window);
10 //job->desktop_location = marlin_get_desktop_location ();
11 job->done_callback = done_callback;
12
13=== modified file 'src/fm-columns-view.c'
14--- src/fm-columns-view.c 2014-03-18 20:00:44 +0000
15+++ src/fm-columns-view.c 2014-03-24 20:45:22 +0000
16@@ -329,7 +329,12 @@
17
18 static void fm_columns_view_unselect_all(FMDirectoryView *view)
19 {
20- gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (FM_COLUMNS_VIEW (view)->tree));
21+ g_return_if_fail (FM_IS_COLUMNS_VIEW (view));
22+
23+ GtkTreeSelection *selection;
24+ selection = gtk_tree_view_get_selection (FM_COLUMNS_VIEW (view)->tree);
25+ if (selection)
26+ gtk_tree_selection_unselect_all (selection);
27 }
28
29 static gboolean
30
31=== modified file 'src/fm-directory-view.c'
32--- src/fm-directory-view.c 2014-03-16 18:08:56 +0000
33+++ src/fm-directory-view.c 2014-03-24 20:45:22 +0000
34@@ -128,6 +128,8 @@
35 GtkWidget *menu_selection;
36 GtkWidget *menu_background;
37
38+ gboolean select_added_files;
39+
40 /* Support for zoom by smooth scrolling */
41 gdouble total_delta_y;
42 };
43@@ -249,6 +251,10 @@
44 fm_directory_view_add_file (FMDirectoryView *view, GOFFile *file, GOFDirectoryAsync *directory)
45 {
46 fm_list_model_add_file (view->model, file, directory);
47+
48+ if (view->details->select_added_files)
49+ fm_directory_view_add_to_selection_gof_file (view, file);
50+
51 }
52
53 static void
54@@ -257,6 +263,7 @@
55 if (file)
56 g_debug ("%s %s %u\n", G_STRFUNC, file->uri, G_OBJECT (file)->ref_count);
57 //g_debug ("%s %s\n", G_STRFUNC, file->uri);
58+ view->details->select_added_files = FALSE;
59 g_signal_emit (view, signals[ADD_FILE], 0, file, directory);
60 }
61
62@@ -462,6 +469,7 @@
63 view->details->newly_folder_added = NULL;
64 view->details->open_with_apps = NULL;
65 view->details->default_app = NULL;
66+ view->details->select_added_files = FALSE;
67 view->details->total_delta_y = 0;
68
69 /* create a thumbnailer */
70@@ -1394,6 +1402,8 @@
71 if (G_LIKELY (action != 0))
72 {
73 printf ("%s perform action %d\n", G_STRFUNC, action);
74+
75+ prepare_to_select_added_files (view);
76 succeed = marlin_dnd_perform (GTK_WIDGET (view),
77 file,
78 view->details->drop_file_list,
79@@ -1462,7 +1472,6 @@
80 GOFFile *file = NULL;
81 GdkAtom target;
82
83- printf ("%s\n", G_STRFUNC);
84 /* request the drop data on-demand (if we don't have it already) */
85 if (G_UNLIKELY (!view->details->drop_data_ready))
86 {
87@@ -1529,7 +1538,6 @@
88 {
89 /* check whether we can drop at (x,y) */
90 //TODO
91- printf ("check whether we can drop at (x,y)\n");
92 fm_directory_view_get_dest_actions (view, context, x, y, timestamp, NULL);
93 }
94
95@@ -2376,6 +2384,21 @@
96 }
97
98 void
99+fm_directory_view_add_to_selection_gof_file (FMDirectoryView *view, GOFFile *file)
100+{
101+ GtkTreeIter iter;
102+ GtkTreePath *path;
103+
104+ g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
105+ if (!fm_list_model_get_first_iter_for_file (view->model, file, &iter))
106+ return;
107+
108+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (view->model), &iter);
109+ (*FM_DIRECTORY_VIEW_GET_CLASS (view)->select_path) (view, path);
110+ gtk_tree_path_free (path);
111+}
112+
113+void
114 fm_directory_view_select_glib_files (FMDirectoryView *view, GList *files)
115 {
116 GList *l;
117@@ -3169,6 +3192,17 @@
118 return (*FM_DIRECTORY_VIEW_GET_CLASS (view)->get_selection) (view);
119 }
120
121+void
122+prepare_to_select_added_files (FMDirectoryView *view)
123+{
124+ g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
125+
126+ if (fm_directory_view_get_selection (view))
127+ (*FM_DIRECTORY_VIEW_GET_CLASS (view)->unselect_all) (view);
128+
129+ view->details->select_added_files = TRUE;
130+}
131+
132 GList *
133 fm_directory_view_get_selection_for_file_transfer (FMDirectoryView *view)
134 {
135@@ -3257,13 +3291,13 @@
136 {
137 GFile *current_directory;
138
139- //g_message ("%s", G_STRFUNC);
140 g_return_if_fail (GTK_IS_ACTION (action));
141 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
142
143 current_directory = view->details->slot->location;
144 if (G_LIKELY (current_directory != NULL))
145 {
146+ prepare_to_select_added_files (view);
147 marlin_clipboard_manager_paste_files (view->clipboard, current_directory,
148 GTK_WIDGET (view), NULL);
149 //TODO evalutate
150@@ -3276,14 +3310,15 @@
151 {
152 GOFFile *file;
153
154- //g_message ("%s", G_STRFUNC);
155 g_return_if_fail (GTK_IS_ACTION (action));
156 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
157
158 /* determine the first selected file and verify that it's a folder */
159 file = g_list_nth_data (fm_directory_view_get_selection (view), 0);
160- if (G_LIKELY (file != NULL && gof_file_is_folder (file)))
161+ if (G_LIKELY (file != NULL && gof_file_is_folder (file))) {
162+ prepare_to_select_added_files (view);
163 marlin_clipboard_manager_paste_files (view->clipboard, gof_file_get_target_location (file), GTK_WIDGET (view), NULL);
164+ }
165 }
166
167 static void
168
169=== modified file 'src/fm-icon-view.c'
170--- src/fm-icon-view.c 2014-02-09 09:45:35 +0000
171+++ src/fm-icon-view.c 2014-03-24 20:45:22 +0000
172@@ -19,13 +19,14 @@
173
174 #include <fm-icon-view.h>
175 #include "fm-directory-view.h"
176+#include "fm-abstract-icon-view.h"
177 #include "marlin-global-preferences.h"
178 #include "eel-i18n.h"
179
180 static AtkObject *fm_icon_view_get_accessible (GtkWidget *widget);
181 static void fm_icon_view_zoom_normal (FMDirectoryView *view);
182 static void fm_icon_view_zoom_level_changed (FMDirectoryView *view);
183-
184+static void fm_icon_view_unselect_all (FMDirectoryView *view);
185
186 G_DEFINE_TYPE (FMIconView, fm_icon_view, FM_TYPE_ABSTRACT_ICON_VIEW)
187
188@@ -46,6 +47,15 @@
189 fm_directory_view_class = FM_DIRECTORY_VIEW_CLASS (klass);
190 fm_directory_view_class->zoom_normal = fm_icon_view_zoom_normal;
191 fm_directory_view_class->zoom_level_changed = fm_icon_view_zoom_level_changed;
192+ fm_directory_view_class->unselect_all = fm_icon_view_unselect_all;
193+}
194+
195+static void
196+fm_icon_view_unselect_all (FMDirectoryView *icon_view)
197+{
198+ g_return_if_fail (FM_IS_ICON_VIEW (icon_view));
199+
200+ exo_icon_view_unselect_all (FM_ABSTRACT_ICON_VIEW (icon_view)->icons);
201 }
202
203 static void
204
205=== modified file 'src/fm-list-view.c'
206--- src/fm-list-view.c 2014-02-17 22:00:43 +0000
207+++ src/fm-list-view.c 2014-03-24 20:45:22 +0000
208@@ -774,6 +774,16 @@
209 gtk_tree_selection_select_all (gtk_tree_view_get_selection (FM_LIST_VIEW (view)->tree));
210 }
211
212+static void fm_list_view_unselect_all(FMDirectoryView *view)
213+{
214+ g_return_if_fail (FM_IS_LIST_VIEW (view));
215+
216+ GtkTreeSelection *selection;
217+ selection = gtk_tree_view_get_selection (FM_LIST_VIEW (view)->tree);
218+ if (selection)
219+ gtk_tree_selection_unselect_all (selection);
220+}
221+
222 static void
223 fm_list_view_get_selection_for_file_transfer_foreach_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
224 {
225@@ -971,6 +981,7 @@
226 fm_directory_view_class->get_selected_paths = fm_list_view_get_selected_paths;
227 fm_directory_view_class->select_path = fm_list_view_select_path;
228 fm_directory_view_class->select_all = fm_list_view_select_all;
229+ fm_directory_view_class->unselect_all = fm_list_view_unselect_all;
230 fm_directory_view_class->set_cursor = fm_list_view_set_cursor;
231
232 fm_directory_view_class->get_path_at_pos = fm_list_view_get_path_at_pos;
233
234=== modified file 'src/marlin-clipboard-manager.c'
235--- src/marlin-clipboard-manager.c 2013-08-10 20:15:26 +0000
236+++ src/marlin-clipboard-manager.c 2014-03-24 20:45:22 +0000
237@@ -655,7 +655,13 @@
238 return (manager->files_cutted && g_list_find (manager->files, file) != NULL);
239 }
240
241+guint
242+marlin_clipboard_manager_count_files (MarlinClipboardManager *manager)
243+{
244+ g_return_val_if_fail (MARLIN_IS_CLIPBOARD_MANAGER (manager), 0);
245
246+ return g_list_length (manager->files);
247+}
248
249 /**
250 * marlin_clipboard_manager_copy_files:

Subscribers

People subscribed via source and target branches

to all changes: