Merge lp:~jeremywootten/pantheon-files/various-fixes-part4 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Cody Garver
Approved revision: 2053
Merged at revision: 2073
Proposed branch: lp:~jeremywootten/pantheon-files/various-fixes-part4
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 245 lines (+53/-22)
7 files modified
libcore/gof-directory-async.vala (+14/-5)
libcore/gof-file.c (+1/-1)
libwidgets/View/BreadcrumbsEntry.vala (+1/-1)
src/View/OverlayBar.vala (+17/-8)
src/View/PropertiesWindow.vala (+4/-0)
src/View/Sidebar.vala (+14/-6)
src/marlin-deep-count.vala (+2/-1)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/various-fixes-part4
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+287325@code.launchpad.net

Commit message

Enable bookmark, create non-existent, drop onto location bar for remote locations; do not show incorrect size for servers and networks.

Description of the change

This branches fixes a number of minor issues around remote folders and networking:
1) Allow bookmarking and navigation to non-folder files on remote locations.
2) Creation of bookmarks by dropping non-folders on remote locations onto sidebar
3) Creation of non-existent folders on remote locations when entered into location bar
4) Do not show "0 bytes" as size for servers on network (lp: 1400731)
5) Fix drop files onto breadcrumbs for remote locations.

To post a comment you must log in.
2053. By Jeremy Wootten

Handle size of network root folders in OverlayBar and PropertiesWindow

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libcore/gof-directory-async.vala'
2--- libcore/gof-directory-async.vala 2016-01-27 19:58:35 +0000
3+++ libcore/gof-directory-async.vala 2016-02-28 13:09:08 +0000
4@@ -157,7 +157,8 @@
5 private async void prepare_directory (GOFFileLoadedFunc? file_loaded_func) {
6 bool success = yield get_file_info ();
7 if (success) {
8- if (is_local && !file.is_folder ()) {
9+ if (!file.is_folder () && !file.is_root_network_folder ()) {
10+ warning ("Trying to load a non-folder - finding parent");
11 var parent = file.is_connected ? location.get_parent () : null;
12 if (parent != null) {
13 file = GOF.File.get (parent);
14@@ -165,9 +166,14 @@
15 location = parent;
16 success = yield get_file_info ();
17 } else {
18+ warning ("Parent is null for file %s", file.uri);
19 success = false;
20 }
21+ } else {
22+
23 }
24+ } else {
25+ warning ("Failed to get file info for file %s", file.uri);
26 }
27 make_ready (success, file_loaded_func); /* Only place that should call this function */
28 }
29@@ -180,7 +186,6 @@
30 if (is_local) {
31 return file.ensure_query_info ();
32 }
33-
34 /* Must be non-local */
35 if (!is_local && !yield check_network ()) {
36 file.is_connected = false;
37@@ -225,10 +230,10 @@
38 }
39 if (success) {
40 debug ("got file info");
41- file.ensure_query_info ();
42+ file.update ();
43 return true;
44 } else {
45- debug ("Failed to get file info for %s", file.uri);
46+ warning ("Failed to get file info for %s", file.uri);
47 return false;
48 }
49 }
50@@ -246,6 +251,7 @@
51 file.is_connected = true;
52 } else {
53 file.is_connected = false;
54+ file.is_mounted = false;
55 warning ("Mount_mountable failed: %s", e.message);
56 if (e is IOError.PERMISSION_DENIED || e is IOError.FAILED_HANDLED) {
57 permission_denied = true;
58@@ -292,7 +298,10 @@
59 private void make_ready (bool ready, GOFFileLoadedFunc? file_loaded_func = null) {
60 can_load = ready;
61 if (!can_load) {
62- debug ("%s cannot load", file.uri);
63+ warning ("%s cannot load. Connected %s, Mounted %s, Exists %s", file.uri,
64+ file.is_connected.to_string (),
65+ file.is_mounted.to_string (),
66+ file.exists.to_string ());
67 state = State.NOT_LOADED; /* ensure state is correct */
68 done_loading ();
69 return;
70
71=== modified file 'libcore/gof-file.c'
72--- libcore/gof-file.c 2016-02-24 10:49:57 +0000
73+++ libcore/gof-file.c 2016-02-28 13:09:08 +0000
74@@ -343,7 +343,7 @@
75 gof_file_update_size (GOFFile *file)
76 {
77 g_free (file->format_size);
78- if (gof_file_is_folder (file))
79+ if (gof_file_is_folder (file) || gof_file_is_root_network_folder (file))
80 file->format_size = g_strdup ("—");
81 else
82 file->format_size = g_format_size (file->size);
83
84=== modified file 'libwidgets/View/BreadcrumbsEntry.vala'
85--- libwidgets/View/BreadcrumbsEntry.vala 2016-01-17 18:33:58 +0000
86+++ libwidgets/View/BreadcrumbsEntry.vala 2016-02-28 13:09:08 +0000
87@@ -489,7 +489,7 @@
88 GOF.File? file;
89 var el = get_element_from_coordinates (x, y);
90 if (el != null) {
91- file = GOF.File.get (GLib.File.new_for_path (get_path_from_element (el)));
92+ file = GOF.File.get (GLib.File.new_for_commandline_arg (get_path_from_element (el)));
93 file.ensure_query_info ();
94 return file;
95 }
96
97=== modified file 'src/View/OverlayBar.vala'
98--- src/View/OverlayBar.vala 2016-01-23 12:05:47 +0000
99+++ src/View/OverlayBar.vala 2016-02-28 13:09:08 +0000
100@@ -159,7 +159,7 @@
101 string str = "";
102 status = "";
103 if (goffile != null) { /* a single file is hovered or selected */
104- if (goffile.is_network_uri_scheme ()) {
105+ if (goffile.is_network_uri_scheme () || goffile.is_root_network_folder ()) {
106 str = goffile.get_display_target_uri ();
107 } else if (!goffile.is_folder ()) {
108 /* if we have an image, see if we can get its resolution */
109@@ -232,9 +232,9 @@
110 string str;
111 cancellable = null;
112
113+ status = "%s - %s (".printf (goffile.info.get_name (), goffile.formated_type);
114+
115 if (deep_counter != null) {
116- status = "%s - %s (".printf (goffile.info.get_name (), goffile.formated_type);
117-
118 if (deep_counter.dirs_count > 0) {
119 str = ngettext (_("%u sub-folder, "), _("%u sub-folders, "), deep_counter.dirs_count);
120 status += str.printf (deep_counter.dirs_count);
121@@ -245,13 +245,22 @@
122 status += str.printf (deep_counter.files_count);
123 }
124
125- status += format_size (deep_counter.total_size);
126+ if (deep_counter.total_size == 0) {
127+ status += _("unknown size");
128+ } else {
129+ status += format_size (deep_counter.total_size);
130+ }
131
132- if (deep_counter.file_not_read > 0)
133- status += " approx - %u files not readable".printf (deep_counter.file_not_read);
134-
135- status += ")";
136+ if (deep_counter.file_not_read > 0) {
137+ if (deep_counter.total_size > 0) {
138+ status += " approx - %u files not readable".printf (deep_counter.file_not_read);
139+ } else {
140+ status += " %u files not readable".printf (deep_counter.file_not_read);
141+ }
142+ }
143 }
144+
145+ status += ")";
146 }
147
148 private void scan_list (GLib.List<GOF.File>? files) {
149
150=== modified file 'src/View/PropertiesWindow.vala'
151--- src/View/PropertiesWindow.vala 2016-02-24 10:49:57 +0000
152+++ src/View/PropertiesWindow.vala 2016-02-28 13:09:08 +0000
153@@ -438,6 +438,10 @@
154 size_warning_image.hide ();
155
156 foreach (GOF.File gof in files) {
157+ if (gof.is_root_network_folder ()) {
158+ size_label.label = _("unknown");
159+ continue;
160+ }
161 if (gof.is_directory) {
162 folder_count++;
163 var d = new Marlin.DeepCount (gof.location);
164
165=== modified file 'src/View/Sidebar.vala'
166--- src/View/Sidebar.vala 2016-02-14 15:22:19 +0000
167+++ src/View/Sidebar.vala 2016-02-28 13:09:08 +0000
168@@ -837,8 +837,11 @@
169 this.store.@get (iter, Column.URI, out uri);
170 if (uri != null) {
171 GOF.File file = GOF.File.get_by_uri (uri);
172- if (file.ensure_query_info ())
173+ if (file.ensure_query_info ()) {
174 file.accepts_drop (drag_list, context, out action);
175+ } else {
176+ warning ("Could not ensure query info for %s when dropping onto sidebar", file.location.get_uri ());
177+ }
178 }
179 }
180
181@@ -924,14 +927,18 @@
182 Gtk.TreeViewDropPosition drop_pos;
183 if (compute_drop_position (tree_view, x, y, out tree_path, out drop_pos)) {
184 Gtk.TreeIter iter;
185- if (!store.get_iter (out iter, tree_path))
186+ if (!store.get_iter (out iter, tree_path)) {
187+ warning ("Could not retrieve tree path after drop onto sidebar");
188 return false;
189+ }
190
191 if (drop_pos == Gtk.TreeViewDropPosition.BEFORE
192 || drop_pos == Gtk.TreeViewDropPosition.AFTER)
193 return process_drop_between (iter, drop_pos, info);
194 else
195 return process_drop_onto (iter, context, info);
196+ } else {
197+ warning ("compute drop position failed after drop onto sidebar");
198 }
199 return false;
200 }
201@@ -1011,8 +1018,7 @@
202 }
203
204 private bool can_accept_file_as_bookmark (GLib.File file) {
205- GLib.FileType ftype = file.query_file_type (GLib.FileQueryInfoFlags.NONE, null);
206- return ftype == GLib.FileType.DIRECTORY;
207+ return file.query_exists (null);
208 }
209
210 private bool can_accept_files_as_bookmarks (List<GLib.File> items) {
211@@ -1028,8 +1034,10 @@
212 }
213
214 private void drop_drag_list (uint position) {
215- if (drag_list == null)
216+ if (drag_list == null) {
217+ warning ("dropped a null drag list");
218 return;
219+ }
220
221 GLib.List<string> uris = null;
222 drag_list.@foreach ((file) => {
223@@ -1109,7 +1117,7 @@
224 path = null;
225 int num_rows = store.iter_n_children (null);
226 if (!tree_view.get_dest_row_at_pos (x, y, out path, out drop_position)) {
227- warning ("compute_drop position dest_row_at_pos UNKNOWN");
228+ warning ("tree_view.get_dest_row_at_pos failed in sidebar");
229 return false;
230 }
231
232
233=== modified file 'src/marlin-deep-count.vala'
234--- src/marlin-deep-count.vala 2015-06-28 18:22:54 +0000
235+++ src/marlin-deep-count.vala 2016-02-28 13:09:08 +0000
236@@ -68,7 +68,8 @@
237 /* Check for sparse file, allocated size will be smaller, for normal files allocated size
238 * includes overhead size so we don't use it for those here
239 */
240- if (allocated_size < file_size && f.get_file_type () != FileType.DIRECTORY)
241+ /* Network files may not have allocated size attribute so ignore zero result */
242+ if (allocated_size > 0 && allocated_size < file_size && f.get_file_type () != FileType.DIRECTORY)
243 file_size = allocated_size;
244
245 total_size += file_size;

Subscribers

People subscribed via source and target branches

to all changes: