Merge lp:~elementary-dev-community/pantheon-files/fix-1086929 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Julián Unrrein
Status: Rejected
Rejected by: Cody Garver
Proposed branch: lp:~elementary-dev-community/pantheon-files/fix-1086929
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 2284 lines (+496/-373)
8 files modified
libcore/gof-directory-async.vala (+76/-46)
src/View/ViewContainer.vala (+2/-0)
src/fm-columns-view.c (+119/-119)
src/fm-directory-view.c (+132/-123)
src/fm-directory-view.h (+57/-57)
src/gof-window-slot.c (+101/-26)
src/gof-window-slot.h (+5/-2)
src/marlin-window-columns.c (+4/-0)
To merge this branch: bzr merge lp:~elementary-dev-community/pantheon-files/fix-1086929
Reviewer Review Type Date Requested Status
David Gomes (community) Needs Fixing
Review via email: mp+183370@code.launchpad.net

Commit message

Make columns automatically size themselves to fit the longest item contained. Fixes bug #1086929.

Description of the change

By Jeremy Wootten

Make columns automatically size themselves to fit the longest item contained. Fixes bug #1086929.

The first column can't be downsized, for now.

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

Special notes:

Manually merge this and use --author flag to give Jeremy credit.

A stable release of Files should be made RIGHT BEFORE this is merged

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

Trunk is now prepared to receive this branch, pending David "Munchor" Gomes' code review.

Revision history for this message
David Gomes (davidgomes) wrote :

Diff line 116 - wrong brace opening style.
Add newline after diff line 135, 164.
Diff lines 983-985 - fix alignent, that is, the '"', the '_', the other '"' and 'N' should be in the same column.
Same thing for diff lines 1549 and after, 2022 and after, 2038 and after, 2121 and 2122.
Remove diff line 2151

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

Rejected because it was submitted as a newer branch that did get merged.

Unmerged revisions

1270. By Jeremy Wootten

Correct some formatting and merge latest trunk

1269. By Jeremy Wootten

Allow manual shrinking of miller columns (except first)

1268. By Jeremy Wootten

escape markup text longest filename

1267. By Jeremy Wootten

Properly autosize cached directories and empty directories, remove unnecessary changes

1266. By Jeremy Wootten

Merged changes from trunk up to rev 1306

1265. By Jeremy Wootten

Check in Miller view before calling autosize_slot

1264. By Jeremy Wootten

Alternative fix 1086929 - for comment

1263. By Jeremy Wootten

Address issues raised in first review

1262. By Jeremy Wootten

Merge from trunk

1261. By Jeremy Wootten

track longest name as required

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 2013-06-30 15:49:02 +0000
3+++ libcore/gof-directory-async.vala 2013-09-01 22:36:03 +0000
4@@ -1,16 +1,16 @@
5-/*
6+/*
7 * Copyright (C) 2011 Marlin Developers
8- *
9+ *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14- *
15+ *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20- *
21+ *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25@@ -29,7 +29,9 @@
26 /* we're looking for particular path keywords like *\/icons* .icons ... */
27 public bool uri_contain_keypath_icons;
28 public int uri_keypath_size = 0;
29-
30+ public string longest_file_name = ""; //for auto-sizing Miller columns
31+ public bool track_longest_name;
32+
33 public enum State {
34 NOT_LOADED,
35 LOADING,
36@@ -38,14 +40,14 @@
37 public State state = State.NOT_LOADED;
38
39 public HashTable<GLib.File,GOF.File> file_hash;
40-
41+
42 public uint files_count = 0;
43-
44+
45 public bool permission_denied = false;
46
47 private Cancellable cancellable;
48 private FileMonitor? monitor = null;
49-
50+
51 private List<GOF.File>? sorted_dirs = null;
52
53 /* signals */
54@@ -77,7 +79,7 @@
55 file = GOF.File.get (location);
56 file.exists = true;
57 cancellable = new Cancellable ();
58-
59+ track_longest_name = false;
60 //query_info_async (file, file_info_available);
61 if (file.info == null)
62 file.query_update ();
63@@ -110,8 +112,8 @@
64 if (is_last) {
65 Async dir = (Async) object;
66 debug ("Async toggle_ref_notify %s", dir.file.uri);
67-
68- if (!dir.removed_from_cache)
69+
70+ if (!dir.removed_from_cache)
71 dir.remove_dir_from_cache ();
72 dir.remove_toggle_ref ((ToggleNotify) toggle_ref_notify);
73 }
74@@ -145,9 +147,10 @@
75 public void load ()
76 {
77 cancellable.reset ();
78+ longest_file_name = "";
79 if (state != State.LOADED) {
80 /* clear directory info if it's not fully loaded */
81- if (state == State.LOADING)
82+ if (state == State.LOADING)
83 clear_directory_info ();
84 if (!file.is_mounted) {
85 mount_mountable.begin ();
86@@ -160,7 +163,7 @@
87 list_directory.begin (location);
88 try {
89 monitor = location.monitor_directory (0);
90- monitor.changed.connect (directory_changed);
91+ monitor.changed.connect (directory_changed);
92 } catch (IOError e) {
93 if (!(e is IOError.NOT_MOUNTED)) {
94 warning ("directory monitor failed: %s %s", e.message, file.uri);
95@@ -173,32 +176,45 @@
96 /* send again the info_available signal for reused directories */
97 if (file.info != null)
98 file.info_available ();
99-
100+
101 bool show_hidden = Preferences.get_default ().pref_show_hidden_files;
102 foreach (GOF.File gof in file_hash.get_values ()) {
103- if (gof.info != null && (!gof.is_hidden || show_hidden))
104+ if (gof.info != null && (!gof.is_hidden || show_hidden)) {
105+ if (track_longest_name)
106+ update_longest_file_name (gof);
107 file_loaded (gof);
108+ }
109 }
110 done_loading ();
111 }
112 }
113
114- public void load_hiddens ()
115+ private void update_longest_file_name (GOF.File gof)
116+ {
117+ if (longest_file_name.length < gof.basename.length)
118+ longest_file_name = gof.basename;
119+ }
120+
121+ public void load_hiddens ()
122 {
123 if (state != State.LOADED) {
124 load ();
125 } else {
126- foreach (GOF.File gof in file_hash.get_values ()) {
127- if (gof != null && gof.info != null && gof.is_hidden)
128+ foreach (GOF.File gof in file_hash.get_values ()) {
129+ if (gof != null && gof.info != null && gof.is_hidden) {
130+ if (track_longest_name)
131+ update_longest_file_name (gof);
132 file_loaded (gof);
133+ }
134 }
135 }
136+ done_loading ();
137 }
138
139- public void update_desktop_files ()
140+ public void update_desktop_files ()
141 {
142 foreach (GOF.File gof in file_hash.get_values ()) {
143- if (gof != null && gof.info != null
144+ if (gof != null && gof.info != null
145 && (!gof.is_hidden || Preferences.get_default ().pref_show_hidden_files)
146 && gof.is_desktop)
147 gof.update_desktop_file ();
148@@ -242,6 +258,7 @@
149 if (files == null)
150 break;
151
152+ bool show_hidden = Preferences.get_default ().pref_show_hidden_files;
153 foreach (var file_info in files)
154 {
155 GLib.File loc = location.get_child ((string) file_info.get_name());
156@@ -255,14 +272,18 @@
157 //debug ("file: %s", gof.name);
158
159 add_to_hash_cache (gof);
160- if (!gof.is_hidden || Preferences.get_default ().pref_show_hidden_files)
161+
162+ if (!gof.is_hidden || show_hidden) {
163+ if (track_longest_name)
164+ update_longest_file_name (gof);
165 file_loaded (gof);
166-
167+ }
168 //mutex.lock ();
169 files_count++;
170 //mutex.unlock ();
171 }
172 }
173+
174 file.exists = true;
175 state = State.LOADED;
176 } catch (Error err) {
177@@ -294,8 +315,8 @@
178
179 private async void query_info_async (GOF.File gof, func_query_info? f = null) {
180 try {
181- gof.info = yield gof.location.query_info_async (gio_attrs,
182- FileQueryInfoFlags.NONE,
183+ gof.info = yield gof.location.query_info_async (gio_attrs,
184+ FileQueryInfoFlags.NONE,
185 Priority.DEFAULT);
186 if (f != null)
187 f (gof);
188@@ -329,8 +350,13 @@
189 /* add to sorted_dirs */
190 sorted_dirs.insert_sorted (gof, GOF.File.compare_by_display_name);
191 }
192+
193+ if (track_longest_name && gof.basename.length > longest_file_name.length) {
194+ longest_file_name = gof.basename;
195+ done_loading ();
196+ }
197 }
198-
199+
200 private void file_info_available (GOF.File gof) {
201 gof.update ();
202 gof.info_available ();
203@@ -353,6 +379,9 @@
204 sorted_dirs.remove (gof);
205 }
206 gof.remove_from_caches ();
207+ if (track_longest_name && gof.basename.length == longest_file_name.length) {
208+ load ();
209+ }
210 }
211
212 private struct fchanges {
213@@ -362,7 +391,7 @@
214 private List <fchanges?> list_fchanges = null;
215 private uint list_fchanges_count = 0;
216 /* number of monitored changes to store after that simply reload the dir */
217- private const uint FCHANGES_MAX = 20;
218+ private const uint FCHANGES_MAX = 20;
219
220 private void directory_changed (GLib.File _file, GLib.File? other_file, FileMonitorEvent event)
221 {
222@@ -393,7 +422,7 @@
223 //message ("file added %s", _file.get_uri ());
224 //notify_file_added (gof);
225 MarlinFile.changes_queue_file_added (_file);
226- break;
227+ break;
228 case FileMonitorEvent.DELETED:
229 //message ("file deleted %s", _file.get_uri ());
230 //notify_file_removed (gof);
231@@ -424,7 +453,7 @@
232 foreach (var fchange in list_fchanges)
233 real_directory_changed (fchange.file, null, fchange.event);
234 }
235- }
236+ }
237 list_fchanges_count = 0;
238 list_fchanges = null;
239 }
240@@ -435,8 +464,8 @@
241 foreach (var loc in files) {
242 GOF.File gof = GOF.File.get (loc);
243 Async? dir = cache_lookup (gof.directory);
244-
245- if (dir != null)
246+
247+ if (dir != null)
248 dir.notify_file_changed (gof);
249 }
250 }
251@@ -446,8 +475,8 @@
252 foreach (var loc in files) {
253 GOF.File gof = GOF.File.get (loc);
254 Async? dir = cache_lookup (gof.directory);
255-
256- if (dir != null)
257+
258+ if (dir != null)
259 dir.notify_file_added (gof);
260 }
261 }
262@@ -457,7 +486,7 @@
263 foreach (var loc in files) {
264 GOF.File gof = GOF.File.get (loc);
265 Async? dir = cache_lookup (gof.directory);
266-
267+
268 if (dir != null) {
269 //message ("notify removed %s", gof.uri);
270 dir.notify_file_removed (gof);
271@@ -480,7 +509,7 @@
272 {
273 return from_gfile (gof.get_target_location ());
274 }
275-
276+
277 public static Async? cache_lookup (GLib.File *file)
278 {
279 Async? cached_dir = null;
280@@ -488,7 +517,7 @@
281 if (directory_cache == null) {
282 directory_cache = new HashTable<GLib.File,GOF.Directory.Async> (GLib.file_hash, GLib.file_equal);
283 }
284-
285+
286 if (directory_cache != null)
287 cached_dir = directory_cache.lookup (file);
288 if (cached_dir != null) {
289@@ -513,14 +542,14 @@
290 {
291 /* we got to increment the dir ref to remove the toggle_ref */
292 this.ref ();
293-
294+
295 removed_from_cache = true;
296 return directory_cache.remove (location);
297 }
298-
299+
300 public bool purge_dir_from_cache () {
301 var removed = remove_dir_from_cache ();
302-
303+
304 /* We have to remove the dir's subfolders from cache too */
305 if (removed) {
306 foreach (var gfile in file_hash.get_keys ()) {
307@@ -529,15 +558,15 @@
308 dir.remove_dir_from_cache ();
309 }
310 }
311-
312+
313 return removed;
314 }
315-
316+
317 public bool has_parent ()
318 {
319 return (file.directory != null);
320 }
321-
322+
323 public GLib.File get_parent ()
324 {
325 return file.directory;
326@@ -549,7 +578,7 @@
327
328 if (file_hash != null)
329 file_hash_count = file_hash.size ();
330-
331+
332 //debug ("is_empty hash sizes file: %u", file_hash_count);
333 if (state == State.LOADED && file_hash_count == 0)
334 return true;
335@@ -566,7 +595,7 @@
336
337 foreach (var gof in file_hash.get_values()) {
338 if (gof.info != null && !gof.is_hidden && gof.is_folder ())
339- sorted_dirs.prepend (gof);
340+ sorted_dirs.prepend (gof);
341 }
342 sorted_dirs.sort (GOF.File.compare_by_display_name);
343
344@@ -600,12 +629,13 @@
345 }
346 thumbs_loaded ();
347 thumbs_thread_runing = false;
348-
349+
350 this.unref ();
351 return null;
352 }
353
354- private int icon_size;
355+ public int icon_size;
356+
357 public void threaded_load_thumbnails (int size)
358 {
359 try {
360@@ -641,7 +671,7 @@
361 timeout_thumbsq = Timeout.add (40, queue_thumbs_timeout_cb);
362 }
363 }
364-
365+
366 private Regex regex_num_size = null;
367
368 private void get_keypath_size ()
369
370=== modified file 'src/View/ViewContainer.vala'
371--- src/View/ViewContainer.vala 2013-06-14 23:37:29 +0000
372+++ src/View/ViewContainer.vala 2013-09-01 22:36:03 +0000
373@@ -204,8 +204,10 @@
374 select_childs.prepend (slot.directory.file.location);
375 }
376 }
377+
378 if (slot != null && slot.directory != null && slot.directory.file.exists) {
379 slot.directory.cancel();
380+ slot.directory.track_longest_name = false;
381 }
382
383 if (nview == ViewMode.MILLER) {
384
385=== modified file 'src/fm-columns-view.c'
386--- src/fm-columns-view.c 2013-08-01 21:24:46 +0000
387+++ src/fm-columns-view.c 2013-09-01 22:36:03 +0000
388@@ -73,17 +73,17 @@
389 static gboolean fm_columns_view_draw(GtkWidget* view_, cairo_t* cr, FMColumnsView* view)
390 {
391 g_return_val_if_fail(FM_IS_COLUMNS_VIEW(view), FALSE);
392-
393+
394 GOFDirectoryAsync *dir = fm_directory_view_get_current_directory (FM_DIRECTORY_VIEW (view));
395
396 if (gof_directory_async_is_empty (dir))
397 {
398 PangoLayout* layout = gtk_widget_create_pango_layout(GTK_WIDGET(view), NULL);
399- gchar *str = g_strconcat("<span size='x-large'>", _("This folder is empty."), "</span>", NULL);
400- pango_layout_set_markup (layout, str, -1);
401-
402+ //gchar *str = g_strconcat("<span size='x-large'>", _("This folder is empty."), "</span>", NULL);
403+ //const gchar *str = FM_DIRECTORY_VIEW (view)->empty_message;
404+ pango_layout_set_markup (layout, FM_DIRECTORY_VIEW (view)->empty_message, -1);
405 PangoRectangle extents;
406- /* Get hayout height and width */
407+ /* Get layout height and width */
408 pango_layout_get_extents(layout, NULL, &extents);
409 gdouble width = pango_units_to_double(extents.width);
410 gdouble height = pango_units_to_double(extents.height);
411@@ -118,7 +118,7 @@
412 /* don't update column if we got a drag_begin started */
413 if (fm_directory_view_is_drag_pending (FM_DIRECTORY_VIEW (view)))
414 return;
415-
416+
417 /* setup the current active slot */
418 fm_directory_view_set_active_slot (FM_DIRECTORY_VIEW (view));
419 fm_directory_view_notify_selection_changed (FM_DIRECTORY_VIEW (view));
420@@ -148,7 +148,7 @@
421 static void
422 row_activated_callback (GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *path, FMColumnsView *view)
423 {
424- g_message ("%s\n", G_STRFUNC);
425+ g_debug ("%s\n", G_STRFUNC);
426 fm_directory_view_activate_selected_items (FM_DIRECTORY_VIEW (view), MARLIN_WINDOW_OPEN_FLAG_NEW_TAB);
427 }
428
429@@ -156,18 +156,18 @@
430 fm_columns_view_freeze_updates (FMColumnsView *view)
431 {
432 /* Make filename-cells editable. */
433- g_object_set (G_OBJECT (view->details->file_name_cell),
434+ g_object_set (G_OBJECT (view->details->file_name_cell),
435 "editable", TRUE, NULL);
436- fm_directory_view_freeze_updates (FM_DIRECTORY_VIEW (view));
437+ fm_directory_view_freeze_updates (FM_DIRECTORY_VIEW (view));
438 }
439
440 static void
441 fm_columns_view_unfreeze_updates (FMColumnsView *view)
442 {
443 /*We're done editing - make the filename-cells readonly again.*/
444- g_object_set (G_OBJECT (view->details->file_name_cell),
445+ g_object_set (G_OBJECT (view->details->file_name_cell),
446 "editable", FALSE, NULL);
447- fm_directory_view_unfreeze_updates (FM_DIRECTORY_VIEW (view));
448+ fm_directory_view_unfreeze_updates (FM_DIRECTORY_VIEW (view));
449 }
450
451 static void
452@@ -176,32 +176,32 @@
453 GError *error,
454 gpointer callback_data)
455 {
456- FMColumnsView *view = FM_COLUMNS_VIEW (callback_data);
457+ FMColumnsView *view = FM_COLUMNS_VIEW (callback_data);
458
459 printf ("%s\n", G_STRFUNC);
460- if (view->details->renaming_file) {
461- view->details->rename_done = TRUE;
462-
463- if (error != NULL) {
464+ if (view->details->renaming_file) {
465+ view->details->rename_done = TRUE;
466+
467+ if (error != NULL) {
468 marlin_dialogs_show_error (GTK_WIDGET (view), error, _("Failed to rename %s to %s"), g_file_info_get_name (file->info), view->details->original_name);
469- /* If the rename failed (or was cancelled), kill renaming_file.
470- * We won't get a change event for the rename, so otherwise
471- * it would stay around forever.
472- */
473+ /* If the rename failed (or was cancelled), kill renaming_file.
474+ * We won't get a change event for the rename, so otherwise
475+ * it would stay around forever.
476+ */
477 g_object_unref (view->details->renaming_file);
478- }
479- }
480-
481- g_object_unref (view);
482+ }
483+ }
484+
485+ g_object_unref (view);
486 }
487
488 static void
489 editable_focus_out_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
490 {
491- FMColumnsView *view = user_data;
492+ FMColumnsView *view = user_data;
493
494- fm_columns_view_unfreeze_updates (view);
495- view->details->editable_widget = NULL;
496+ fm_columns_view_unfreeze_updates (view);
497+ view->details->editable_widget = NULL;
498 }
499
500 static void
501@@ -210,17 +210,17 @@
502 const gchar *path_str,
503 FMColumnsView *col_view)
504 {
505- GtkEntry *entry;
506-
507- entry = GTK_ENTRY (editable);
508- col_view->details->editable_widget = editable;
509-
510- /* Free a previously allocated original_name */
511- g_free (col_view->details->original_name);
512-
513- col_view->details->original_name = g_strdup (gtk_entry_get_text (entry));
514-
515- g_signal_connect (entry, "focus-out-event",
516+ GtkEntry *entry;
517+
518+ entry = GTK_ENTRY (editable);
519+ col_view->details->editable_widget = editable;
520+
521+ /* Free a previously allocated original_name */
522+ g_free (col_view->details->original_name);
523+
524+ col_view->details->original_name = g_strdup (gtk_entry_get_text (entry));
525+
526+ g_signal_connect (entry, "focus-out-event",
527 G_CALLBACK (editable_focus_out_cb), col_view);
528 }
529
530@@ -228,8 +228,8 @@
531 cell_renderer_editing_canceled (GtkCellRendererText *cell,
532 FMColumnsView *view)
533 {
534- view->details->editable_widget = NULL;
535- fm_columns_view_unfreeze_updates (view);
536+ view->details->editable_widget = NULL;
537+ fm_columns_view_unfreeze_updates (view);
538 }
539
540 static void
541@@ -238,43 +238,43 @@
542 const char *new_text,
543 FMColumnsView *view)
544 {
545- GtkTreePath *path;
546- GOFFile *file;
547- GtkTreeIter iter;
548+ GtkTreePath *path;
549+ GOFFile *file;
550+ GtkTreeIter iter;
551
552 printf ("%s\n", G_STRFUNC);
553- view->details->editable_widget = NULL;
554-
555- /* Don't allow a rename with an empty string. Revert to original
556- * without notifying the user.
557- */
558- if (new_text[0] == '\0') {
559- fm_columns_view_unfreeze_updates (view);
560- return;
561- }
562-
563- path = gtk_tree_path_new_from_string (path_str);
564-
565- gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path);
566-
567- gtk_tree_path_free (path);
568-
569- gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
570+ view->details->editable_widget = NULL;
571+
572+ /* Don't allow a rename with an empty string. Revert to original
573+ * without notifying the user.
574+ */
575+ if (new_text[0] == '\0') {
576+ fm_columns_view_unfreeze_updates (view);
577+ return;
578+ }
579+
580+ path = gtk_tree_path_new_from_string (path_str);
581+
582+ gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path);
583+
584+ gtk_tree_path_free (path);
585+
586+ gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
587 FM_LIST_MODEL_FILE_COLUMN, &file, -1);
588
589- /* Only rename if name actually changed */
590- if (strcmp (new_text, view->details->original_name) != 0) {
591- view->details->renaming_file = gof_file_ref (file);
592- view->details->rename_done = FALSE;
593- gof_file_rename (file, new_text, fm_columns_view_rename_callback, g_object_ref (view));
594-
595- g_free (view->details->original_name);
596- view->details->original_name = g_strdup (new_text);
597- }
598-
599- gof_file_unref (file);
600-
601- fm_columns_view_unfreeze_updates (view);
602+ /* Only rename if name actually changed */
603+ if (strcmp (new_text, view->details->original_name) != 0) {
604+ view->details->renaming_file = gof_file_ref (file);
605+ view->details->rename_done = FALSE;
606+ gof_file_rename (file, new_text, fm_columns_view_rename_callback, g_object_ref (view));
607+
608+ g_free (view->details->original_name);
609+ view->details->original_name = g_strdup (new_text);
610+ }
611+
612+ gof_file_unref (file);
613+
614+ fm_columns_view_unfreeze_updates (view);
615 }
616
617 static void
618@@ -282,35 +282,35 @@
619 GOFFile *file,
620 gboolean select_all)
621 {
622- FMColumnsView *col_view;
623- GtkTreeIter iter;
624- GtkTreePath *path;
625- gint start_offset, end_offset;
626-
627- col_view = FM_COLUMNS_VIEW (view);
628-
629- g_message ("%s", G_STRFUNC);
630- /* Select all if we are in renaming mode already */
631- if (col_view->details->file_name_column && col_view->details->editable_widget) {
632- gtk_editable_select_region (GTK_EDITABLE (col_view->details->editable_widget),
633+ FMColumnsView *col_view;
634+ GtkTreeIter iter;
635+ GtkTreePath *path;
636+ gint start_offset, end_offset;
637+
638+ col_view = FM_COLUMNS_VIEW (view);
639+
640+ g_debug ("%s", G_STRFUNC);
641+ /* Select all if we are in renaming mode already */
642+ if (col_view->details->file_name_column && col_view->details->editable_widget) {
643+ gtk_editable_select_region (GTK_EDITABLE (col_view->details->editable_widget),
644 0, -1);
645- return;
646- }
647-
648- if (!fm_list_model_get_first_iter_for_file (col_view->model, file, &iter)) {
649- return;
650- }
651-
652- /* Freeze updates to the view to prevent losing rename focus when the tree view updates */
653- fm_columns_view_freeze_updates (col_view);
654-
655- path = gtk_tree_model_get_path (GTK_TREE_MODEL (col_view->model), &iter);
656-
657- gtk_tree_view_scroll_to_cell (col_view->tree, NULL,
658+ return;
659+ }
660+
661+ if (!fm_list_model_get_first_iter_for_file (col_view->model, file, &iter)) {
662+ return;
663+ }
664+
665+ /* Freeze updates to the view to prevent losing rename focus when the tree view updates */
666+ fm_columns_view_freeze_updates (col_view);
667+
668+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (col_view->model), &iter);
669+
670+ gtk_tree_view_scroll_to_cell (col_view->tree, NULL,
671 col_view->details->file_name_column,
672 TRUE, 0.0, 0.0);
673- /* set cursor also triggers editing-started, where we save the editable widget */
674- /*gtk_tree_view_set_cursor (col_view->tree, path,
675+ /* set cursor also triggers editing-started, where we save the editable widget */
676+ /*gtk_tree_view_set_cursor (col_view->tree, path,
677 col_view->details->file_name_column, TRUE);*/
678 /* sound like set_cursor is not enought to trigger editing-started, we use cursor_on_cell instead */
679 gtk_tree_view_set_cursor_on_cell (col_view->tree, path,
680@@ -318,15 +318,15 @@
681 (GtkCellRenderer *) col_view->details->file_name_cell,
682 TRUE);
683
684- if (col_view->details->editable_widget != NULL) {
685- eel_filename_get_rename_region (col_view->details->original_name,
686+ if (col_view->details->editable_widget != NULL) {
687+ eel_filename_get_rename_region (col_view->details->original_name,
688 &start_offset, &end_offset);
689
690- gtk_editable_select_region (GTK_EDITABLE (col_view->details->editable_widget),
691+ gtk_editable_select_region (GTK_EDITABLE (col_view->details->editable_widget),
692 start_offset, end_offset);
693- }
694+ }
695
696- gtk_tree_path_free (path);
697+ gtk_tree_path_free (path);
698 }
699
700 static void fm_columns_view_select_all(FMDirectoryView *view)
701@@ -460,17 +460,17 @@
702 GtkTreeSelection *selection;
703 GtkTreePath *path;
704
705- g_message ("%s", G_STRFUNC);
706+ g_debug ("%s", G_STRFUNC);
707 if (view->details->pressed_button == event->button && view->details->pressed_button != -1)
708 {
709 view->details->updates_frozen = FALSE;
710 selection = gtk_tree_view_get_selection (tree_view);
711 list_selection_changed_callback (selection, view);
712-
713+
714 /* reset the pressed_button state */
715 view->details->pressed_button = -1;
716 }
717-
718+
719
720 return TRUE;
721 }
722@@ -684,7 +684,7 @@
723 }
724
725 static void
726-fm_columns_view_set_cursor (FMDirectoryView *view, GtkTreePath *path,
727+fm_columns_view_set_cursor (FMDirectoryView *view, GtkTreePath *path,
728 gboolean start_editing, gboolean select)
729 {
730 FMColumnsView *cols_view = FM_COLUMNS_VIEW (view);
731@@ -692,12 +692,12 @@
732
733 /* the treeview select the path by default. */
734 g_signal_handlers_block_by_func (selection, list_selection_changed_callback, cols_view);
735- gtk_tree_view_set_cursor_on_cell (cols_view->tree, path,
736+ gtk_tree_view_set_cursor_on_cell (cols_view->tree, path,
737 cols_view->details->file_name_column,
738 (GtkCellRenderer *) cols_view->details->file_name_cell,
739 start_editing);
740
741- if (!select)
742+ if (!select)
743 gtk_tree_selection_unselect_path (selection, path);
744 g_signal_handlers_unblock_by_func (selection, list_selection_changed_callback, cols_view);
745 }
746@@ -724,7 +724,7 @@
747 }
748
749 static gboolean
750-fm_columns_view_get_visible_range (FMDirectoryView *view,
751+fm_columns_view_get_visible_range (FMDirectoryView *view,
752 GtkTreePath **start_path,
753 GtkTreePath **end_path)
754
755@@ -738,7 +738,7 @@
756 fm_columns_view_zoom_normal (FMDirectoryView *view)
757 {
758 MarlinZoomLevel zoom;
759-
760+
761 zoom = g_settings_get_enum (marlin_column_view_settings, "default-zoom-level");
762 g_settings_set_enum (marlin_column_view_settings, "zoom-level", zoom);
763 }
764@@ -755,7 +755,7 @@
765 gof_file_list_free (view->details->selection);
766
767 g_free (view->details);
768- G_OBJECT_CLASS (fm_columns_view_parent_class)->finalize (object);
769+ G_OBJECT_CLASS (fm_columns_view_parent_class)->finalize (object);
770 }
771
772 static void
773@@ -767,8 +767,8 @@
774 create_and_set_up_tree_view (view);
775
776 //fm_columns_view_click_policy_changed (FM_DIRECTORY_VIEW (view));
777-
778- g_settings_bind (marlin_column_view_settings, "zoom-level",
779+
780+ g_settings_bind (marlin_column_view_settings, "zoom-level",
781 view, "zoom-level", 0);
782 }
783
784@@ -780,7 +780,7 @@
785 gint xpad, ypad;
786
787 gtk_cell_renderer_get_padding (view->icon_renderer, &xpad, &ypad);
788- gtk_cell_renderer_set_fixed_size (view->icon_renderer,
789+ gtk_cell_renderer_set_fixed_size (view->icon_renderer,
790 marlin_zoom_level_to_icon_size (view->zoom_level) + 2 * xpad,
791 marlin_zoom_level_to_icon_size (view->zoom_level) + 2 * ypad);
792 gtk_tree_view_columns_autosize (FM_COLUMNS_VIEW (view)->tree);
793@@ -801,7 +801,7 @@
794 default:
795 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
796 break;
797- }
798+ }
799 }
800
801 static void
802@@ -818,7 +818,7 @@
803 default:
804 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
805 break;
806- }
807+ }
808 }
809 #endif
810
811@@ -835,7 +835,7 @@
812 fm_directory_view_class = FM_DIRECTORY_VIEW_CLASS (klass);
813
814 fm_directory_view_class->sync_selection = fm_columns_view_sync_selection;
815- fm_directory_view_class->get_selection = fm_columns_view_get_selection;
816+ fm_directory_view_class->get_selection = fm_columns_view_get_selection;
817 fm_directory_view_class->get_selection_for_file_transfer = fm_columns_view_get_selection_for_file_transfer;
818 fm_directory_view_class->get_selected_paths = fm_columns_view_get_selected_paths;
819 fm_directory_view_class->select_path = fm_columns_view_select_path;
820
821=== modified file 'src/fm-directory-view.c'
822--- src/fm-directory-view.c 2013-08-01 21:24:46 +0000
823+++ src/fm-directory-view.c 2013-09-01 22:36:03 +0000
824@@ -118,7 +118,7 @@
825 guint thumbnail_source_id;
826 gboolean thumbnailing_scheduled;
827
828- /* Tree path for restoring the selection after selecting and
829+ /* Tree path for restoring the selection after selecting and
830 * deleting an item */
831 GtkTreePath *selection_before_delete;
832 GOFFile *newly_folder_added;
833@@ -229,15 +229,14 @@
834 };
835
836 static gpointer _g_object_ref0 (gpointer self) {
837- return self ? g_object_ref (self) : NULL;
838+ return self ? g_object_ref (self) : NULL;
839 }
840
841-
842 void fm_directory_view_colorize_selection (FMDirectoryView *view, int ncolor)
843 {
844 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
845 g_return_if_fail (tags != NULL);
846-
847+
848 marlin_view_tags_set_color (tags, view, ncolor, NULL, NULL);
849 }
850
851@@ -266,7 +265,7 @@
852 static void
853 file_changed_callback (GOFDirectoryAsync *directory, GOFFile *file, FMDirectoryView *view)
854 {
855- /*if (!file->exists)
856+ /*if (!file->exists)
857 return;*/
858 g_return_if_fail (file != NULL);
859 g_return_if_fail (file->exists);
860@@ -280,7 +279,7 @@
861 static void
862 file_deleted_callback (GOFDirectoryAsync *directory, GOFFile *file, FMDirectoryView *view)
863 {
864- g_debug ("%s %s", G_STRFUNC, file->uri);
865+ g_debug ("%s %s", G_STRFUNC, file->uri);
866 fm_list_model_remove_file (view->model, file, directory);
867 /* Remove from gof-directory-async cache */
868 if (gof_file_is_folder (file)) {
869@@ -291,7 +290,7 @@
870 g_debug ("Remove from gof-directory-async cache %s\n", file->uri);
871 g_object_unref (dir);
872 }
873-
874+
875 if (view->details->slot->mwcols) {
876 /* if in miller view mode, remove any views of subdirectories of deleted directory */
877 gtk_container_foreach (GTK_CONTAINER (view->details->slot->mwcols->active_slot->colpane), (GtkCallback) gtk_widget_destroy, NULL);
878@@ -312,12 +311,17 @@
879 }
880 else
881 dir_action_set_sensitive (view, "Select All", TRUE);
882-
883+
884 MarlinZoomLevel zoom;
885 g_object_get (view, "zoom-level", &zoom, NULL);
886 int size = marlin_zoom_level_to_icon_size (zoom);
887 gof_directory_async_threaded_load_thumbnails (view->details->slot->directory, size);
888 //g_signal_emit (view, signals[DIRECTORY_LOADED], 0, directory);
889+ /* If in Miller view, autosize the column */
890+ if (view->details->slot->ready_to_autosize)
891+ autosize_slot (view->details->slot);
892+ else
893+ view->details->slot->ready_to_autosize = TRUE;
894 }
895
896 static void
897@@ -352,11 +356,11 @@
898 gof_directory_async_load_hiddens (directory);
899 g_signal_handlers_disconnect_by_func (directory, file_loaded_callback, view);
900 } else {
901- /* while the model is cleared and re-loaded we do not want the view to update */
902+ /* while the model is cleared and re-loaded we do not want the view to update */
903 g_signal_handlers_block_by_func (view->model, fm_directory_view_row_deleted, view);
904 g_signal_handlers_block_by_func (view->model, fm_directory_view_restore_selection, view);
905 view->updates_frozen = TRUE;
906-
907+
908 /* clear the model */
909 fm_list_model_clear (view->model);
910
911@@ -365,7 +369,7 @@
912 gof_directory_async_load (directory);
913 g_signal_handlers_disconnect_by_func (directory, file_loaded_callback, view);
914
915- /* re-instate signals and unfreeze view */
916+ /* re-instate signals and unfreeze view */
917 g_signal_handlers_unblock_by_func (view->model, fm_directory_view_row_deleted, view);
918 g_signal_handlers_unblock_by_func (view->model, fm_directory_view_restore_selection, view);
919 view->updates_frozen = FALSE;
920@@ -384,24 +388,24 @@
921 static void
922 fm_directory_view_connect_directory_handlers (FMDirectoryView *view, GOFDirectoryAsync *directory)
923 {
924- g_signal_connect (directory, "file_loaded",
925+ g_signal_connect (directory, "file_loaded",
926 G_CALLBACK (file_loaded_callback), view);
927- g_signal_connect (directory, "file_added",
928+ g_signal_connect (directory, "file_added",
929 G_CALLBACK (file_added_callback), view);
930- g_signal_connect (directory, "file_changed",
931+ g_signal_connect (directory, "file_changed",
932 G_CALLBACK (file_changed_callback), view);
933- g_signal_connect (directory, "file_deleted",
934+ g_signal_connect (directory, "file_deleted",
935 G_CALLBACK (file_deleted_callback), view);
936- g_signal_connect (directory, "done_loading",
937+ g_signal_connect (directory, "done_loading",
938 G_CALLBACK (directory_done_loading_callback), view);
939- g_signal_connect (directory, "thumbs_loaded",
940+ g_signal_connect (directory, "thumbs_loaded",
941 G_CALLBACK (directory_thumbs_loaded_callback), view);
942- g_signal_connect (directory, "icon_changed",
943+ g_signal_connect (directory, "icon_changed",
944 G_CALLBACK (icon_changed_callback), view);
945 }
946
947 static void
948-fm_directory_view_disconnect_directory_handlers (FMDirectoryView *view,
949+fm_directory_view_disconnect_directory_handlers (FMDirectoryView *view,
950 GOFDirectoryAsync *directory)
951 {
952 /*g_signal_handlers_disconnect_by_func (directory, file_loaded_callback, view);*/
953@@ -433,7 +437,7 @@
954
955 if (!fm_directory_view_get_loading (view)) {
956 g_object_get (view, "zoom-level", &zoom, NULL);
957- gof_directory_async_queue_load_thumbnails (view->details->slot->directory,
958+ gof_directory_async_queue_load_thumbnails (view->details->slot->directory,
959 marlin_zoom_level_to_icon_size (zoom));
960 }
961 }
962@@ -488,20 +492,25 @@
963 /* setup the list model */
964 g_signal_connect (view->model, "row-deleted", G_CALLBACK (fm_directory_view_row_deleted), view);
965 g_signal_connect_after (view->model, "row-deleted", G_CALLBACK (fm_directory_view_restore_selection), view);
966-
967+
968 g_signal_connect (view->model, "sort_column_changed", G_CALLBACK (sort_column_changed_callback), view);
969
970 /* connect to size allocation signals for generating thumbnail requests */
971 g_signal_connect_after (G_OBJECT (view), "size-allocate",
972 G_CALLBACK (fm_directory_view_size_allocate), NULL);
973
974- g_signal_connect (G_OBJECT (view), "notify::zoom-level",
975+ g_signal_connect (G_OBJECT (view), "notify::zoom-level",
976 G_CALLBACK (zoom_level_changed), NULL);
977
978 view->details->dir_action_group = NULL;
979 view->details->dir_merge_id = 0;
980 view->details->open_with_action_group = NULL;
981 view->details->open_with_merge_id = 0;
982+ view->empty_message = g_strconcat ("<span size='x-large'>",
983+ _("This folder is empty."),
984+ "</span>",
985+ NULL);
986+
987 }
988
989 static GObject*
990@@ -626,12 +635,12 @@
991 /* release the context menu references */
992 if (view->details->menu_selection) {
993 gpointer old_menuitems = g_object_get_data(G_OBJECT (view->details->menu_selection), "other_selection");
994- g_list_free_full (old_menuitems, (GDestroyNotify) gtk_widget_destroy);
995- g_object_set_data (G_OBJECT (view->details->menu_selection), "other_selection", NULL);
996+ g_list_free_full (old_menuitems, (GDestroyNotify) gtk_widget_destroy);
997+ g_object_set_data (G_OBJECT (view->details->menu_selection), "other_selection", NULL);
998 }
999
1000 g_free (view->details->previewer);
1001-
1002+
1003 if (view->details->newly_folder_added)
1004 g_object_unref (view->details->newly_folder_added);
1005
1006@@ -672,12 +681,12 @@
1007 g_signal_emit_by_name (slot->ctab, "path-changed", location);
1008 }
1009
1010-/* TODO remove screen if we don't create any new windows
1011+/* TODO remove screen if we don't create any new windows
1012 ** (check if we have to) */
1013 static void
1014-fm_directory_view_activate_single_file (FMDirectoryView *view,
1015- GOFFile *file,
1016- GdkScreen *screen,
1017+fm_directory_view_activate_single_file (FMDirectoryView *view,
1018+ GOFFile *file,
1019+ GdkScreen *screen,
1020 MarlinViewWindowOpenFlags flags)
1021 {
1022 GFile *location;
1023@@ -686,7 +695,7 @@
1024 location = gof_file_get_target_location (file);
1025
1026 //g_message ("%s %s %s", G_STRFUNC, file->uri, g_file_get_uri(location));
1027- if (gof_file_is_folder (file))
1028+ if (gof_file_is_folder (file))
1029 {
1030 switch (flags) {
1031 case MARLIN_WINDOW_OPEN_FLAG_NEW_TAB:
1032@@ -758,7 +767,7 @@
1033 }
1034
1035 selection = fm_directory_view_get_selection (view);
1036- /* FIXME only grab the first selection item as gloobus-preview is unable to handle
1037+ /* FIXME only grab the first selection item as gloobus-preview is unable to handle
1038 multiple selection */
1039 if (selection != NULL) {
1040 file = selection->data;
1041@@ -777,34 +786,34 @@
1042 }
1043 }
1044
1045-void
1046+void
1047 fm_directory_view_zoom_normal (FMDirectoryView *view)
1048 {
1049 (*FM_DIRECTORY_VIEW_GET_CLASS (view)->zoom_normal) (view);
1050 }
1051
1052-void
1053+void
1054 fm_directory_view_zoom_in (FMDirectoryView *view)
1055 {
1056 MarlinZoomLevel zoom;
1057
1058 g_object_get (view, "zoom-level", &zoom, NULL);
1059 zoom++;
1060- if (zoom >= MARLIN_ZOOM_LEVEL_SMALLEST
1061+ if (zoom >= MARLIN_ZOOM_LEVEL_SMALLEST
1062 && zoom <= MARLIN_ZOOM_LEVEL_LARGEST)
1063 {
1064 g_object_set (G_OBJECT (view), "zoom-level", zoom, NULL);
1065 }
1066 }
1067
1068-void
1069+void
1070 fm_directory_view_zoom_out (FMDirectoryView *view)
1071 {
1072 MarlinZoomLevel zoom;
1073
1074 g_object_get (view, "zoom-level", &zoom, NULL);
1075 zoom--;
1076- if (zoom >= MARLIN_ZOOM_LEVEL_SMALLEST
1077+ if (zoom >= MARLIN_ZOOM_LEVEL_SMALLEST
1078 && zoom <= MARLIN_ZOOM_LEVEL_LARGEST)
1079 {
1080 g_object_set (view, "zoom-level", zoom, NULL);
1081@@ -816,7 +825,7 @@
1082 GdkEventScroll *event)
1083 {
1084 gdouble total_delta_y = 0;
1085- gdouble delta_x, delta_y;
1086+ gdouble delta_x, delta_y;
1087
1088 if (event->state & GDK_CONTROL_MASK) {
1089 switch (event->direction) {
1090@@ -846,7 +855,7 @@
1091 total_delta_y = 0;
1092 /* emulate scroll up */
1093 fm_directory_view_zoom_in (directory_view);
1094- return TRUE;
1095+ return TRUE;
1096 } else {
1097 /* eat event */
1098 return TRUE;
1099@@ -1013,7 +1022,7 @@
1100 //printf ("%s path %s\n", G_STRFUNC, gtk_tree_path_to_string (path));
1101 /* determine the file for the path */
1102 file = fm_list_model_file_for_path (view->model, path);
1103-
1104+
1105 /* If file == NULL, it means that the path in question is a blank path,
1106 * which can only exist under an expanded empty folder.
1107 * In this case, we set the destination target to that folder. */
1108@@ -1143,13 +1152,13 @@
1109 /* determine the file for the drop position */
1110 file = fm_directory_view_get_drop_file (view, x, y, NULL);
1111 g_debug ("%s XdndDirectSave0 %s", G_STRFUNC, file->uri);
1112-
1113+
1114 if (G_LIKELY (file != NULL))
1115 {
1116 /* determine the file name from the DnD source window */
1117- if (gdk_property_get (gdk_drag_context_get_source_window (context),
1118+ if (gdk_property_get (gdk_drag_context_get_source_window (context),
1119 gdk_atom_intern_static_string ("XdndDirectSave0"),
1120- gdk_atom_intern_static_string ("text/plain"),
1121+ gdk_atom_intern_static_string ("text/plain"),
1122 0, 1024, FALSE, NULL, NULL,
1123 &prop_len, &prop_text) && prop_text != NULL)
1124 {
1125@@ -1191,7 +1200,7 @@
1126 /* release the file reference */
1127 g_object_unref (G_OBJECT (file));
1128 }
1129-
1130+
1131 /* if uri == NULL, we didn't set the property */
1132 if (G_UNLIKELY (uri == NULL))
1133 return FALSE;
1134@@ -1650,7 +1659,7 @@
1135 return TRUE;
1136 }
1137
1138-static gboolean
1139+static gboolean
1140 is_selection_contain_only_folders (GList *selection)
1141 {
1142 GOFFile *file;
1143@@ -1695,7 +1704,7 @@
1144 }
1145
1146 static void
1147-dir_action_set_visible_sensitive (FMDirectoryView *view, const gchar *action_name,
1148+dir_action_set_visible_sensitive (FMDirectoryView *view, const gchar *action_name,
1149 gboolean visible, gboolean sensitive)
1150 {
1151 GtkAction *action;
1152@@ -1802,7 +1811,7 @@
1153
1154 static void
1155 add_application_to_open_with_menu (FMDirectoryView *view,
1156- GAppInfo *application,
1157+ GAppInfo *application,
1158 GList *files,
1159 int index,
1160 const char *menu_placeholder,
1161@@ -1846,7 +1855,7 @@
1162
1163 g_signal_connect_data (action, "activate",
1164 G_CALLBACK (open_with_launch_application_callback),
1165- launch_parameters,
1166+ launch_parameters,
1167 (GClosureNotify)application_launch_parameters_free, 0);
1168
1169 gtk_action_group_add_action (view->details->open_with_action_group,
1170@@ -1895,11 +1904,11 @@
1171 for (l=apps; l != NULL; l=l->next) {
1172 app = (GAppInfo *) l->data;
1173 id1 = g_app_info_get_id (app);
1174- if (id1 != NULL && id2 != NULL
1175- && strcmp (id1, id2) == 0)
1176+ if (id1 != NULL && id2 != NULL
1177+ && strcmp (id1, id2) == 0)
1178 {
1179- g_object_unref (app);
1180- apps = g_list_delete_link (apps, l);
1181+ g_object_unref (app);
1182+ apps = g_list_delete_link (apps, l);
1183 }
1184 }
1185
1186@@ -1925,7 +1934,7 @@
1187 selection = fm_directory_view_get_selection (view);
1188 selection_count = g_list_length (selection);
1189 file = GOF_FILE (selection->data);
1190-
1191+
1192 if (file == NULL) {
1193 update_menus_empty_selection (view);
1194 return;
1195@@ -1988,7 +1997,7 @@
1196 /* Only force displaying the icon if it is an application icon */
1197 gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), app_icon != NULL);
1198
1199- if (app_icon == NULL)
1200+ if (app_icon == NULL)
1201 app_icon = g_themed_icon_new (GTK_STOCK_OPEN);
1202
1203 gtk_action_set_gicon (action, app_icon);
1204@@ -2006,7 +2015,7 @@
1205 g_free (mnemonic);
1206
1207 /* OpenAlternate label update */
1208- if (selection_count > 1)
1209+ if (selection_count > 1)
1210 mnemonic = g_strdup_printf (_("Open in %'d New _Windows"), selection_count);
1211 else
1212 mnemonic = NULL;
1213@@ -2022,8 +2031,8 @@
1214
1215 /* if there s no default app then there s no common possible type to get other applications.
1216 checking the first file is enought to determine if we have a full directory selection
1217- as the only possible common type for a directory is a directory.
1218- We don't want File Managers applications list in the open with menu for a directory(ies)
1219+ as the only possible common type for a directory is a directory.
1220+ We don't want File Managers applications list in the open with menu for a directory(ies)
1221 selection */
1222 if (view->details->open_with_apps != NULL) {
1223 g_list_free_full (view->details->open_with_apps, g_object_unref);
1224@@ -2032,16 +2041,16 @@
1225 if (view->details->default_app != NULL && !gof_file_is_folder (file))
1226 view->details->open_with_apps = marlin_mime_get_applications_for_files (selection);
1227 /* we need to remove the default app from open with menu */
1228- if (view->details->default_app != NULL && !gof_file_is_executable (file))
1229+ if (view->details->default_app != NULL && !gof_file_is_executable (file))
1230 view->details->open_with_apps = filter_default_app (view->details->open_with_apps, view->details->default_app);
1231 for (l = view->details->open_with_apps, index=0; l != NULL && index <10; l=l->next, index++) {
1232- add_application_to_open_with_menu (view,
1233- l->data,
1234+ add_application_to_open_with_menu (view,
1235+ l->data,
1236 selection,
1237 index,
1238 menu_path, popup_path);
1239 }
1240-
1241+
1242 if (selection_count == 1 && !gof_file_is_folder (file))
1243 dir_action_set_visible (view, "OtherApplication", TRUE);
1244 }
1245@@ -2203,7 +2212,7 @@
1246 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
1247 g_return_if_fail (view->model == model);
1248
1249- g_message ("%s", G_STRFUNC);
1250+ g_debug ("%s", G_STRFUNC);
1251 /* Get tree paths of selected files */
1252 selected_paths = (*FM_DIRECTORY_VIEW_GET_CLASS (view)->get_selected_paths) (view);
1253
1254@@ -2220,7 +2229,7 @@
1255 /* Create a copy the path (we're not allowed to modify it in this handler) */
1256 path_copy = gtk_tree_path_copy (path);
1257
1258- /* Remember the selected path so that it can be restored after the row has
1259+ /* Remember the selected path so that it can be restored after the row has
1260 * been removed. If the first row is removed, select the first row after the
1261 * removal, if any other row is removed, select the row before that one */
1262 gtk_tree_path_prev (path_copy);
1263@@ -2238,8 +2247,8 @@
1264 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
1265 g_return_if_fail (view->model == model);
1266
1267- g_message ("%s", G_STRFUNC);
1268- /* Check if there was only one file selected before the row was deleted. The
1269+ g_debug ("%s", G_STRFUNC);
1270+ /* Check if there was only one file selected before the row was deleted. The
1271 * path is set by thunar_standard_view_row_deleted() if this is the case */
1272 if (G_LIKELY (view->details->selection_before_delete != NULL))
1273 {
1274@@ -2257,11 +2266,11 @@
1275 }
1276 }
1277
1278-void
1279+void
1280 fm_directory_view_select_first_for_empty_selection (FMDirectoryView *view)
1281 {
1282 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
1283-
1284+
1285 GList *selection = fm_directory_view_get_selection (view);
1286
1287 if (!selection) {
1288@@ -2273,7 +2282,7 @@
1289 }
1290
1291 #if 0
1292-void
1293+void
1294 fm_directory_view_select_gof_file (FMDirectoryView *view, GOFFile *file)
1295 {
1296 GtkTreeIter iter;
1297@@ -2282,7 +2291,7 @@
1298 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
1299
1300 if (!fm_list_model_get_first_iter_for_file (view->model, file, &iter))
1301- return;
1302+ return;
1303
1304 path = gtk_tree_model_get_path (GTK_TREE_MODEL (view->model), &iter);
1305 (*FM_DIRECTORY_VIEW_GET_CLASS (view)->set_cursor) (view, path, FALSE, TRUE);
1306@@ -2290,7 +2299,7 @@
1307 }
1308 #endif
1309
1310-void
1311+void
1312 fm_directory_view_select_glib_files (FMDirectoryView *view, GList *files)
1313 {
1314 GList *l;
1315@@ -2326,10 +2335,10 @@
1316 error = NULL;
1317 res = g_file_set_attributes_finish (G_FILE (source_object), result, NULL, &error);
1318
1319- if (error != NULL) {
1320+ if (error != NULL) {
1321 g_critical ("%s error, %s", G_STRFUNC, error->message);
1322- g_error_free (error);
1323- }
1324+ g_error_free (error);
1325+ }
1326 }
1327
1328 static void
1329@@ -2354,7 +2363,7 @@
1330 current_dir->file->sort_column_id = sort_column_id;
1331 current_dir->file->sort_order = sort_order;
1332 location = g_object_ref (current_dir->location);
1333- g_file_set_attributes_async (location, info, 0, G_PRIORITY_DEFAULT, NULL,
1334+ g_file_set_attributes_async (location, info, 0, G_PRIORITY_DEFAULT, NULL,
1335 set_metadata_callback, NULL);
1336 g_object_unref (location);
1337 g_object_unref (info);
1338@@ -2395,7 +2404,7 @@
1339 return view->details->slot->directory;
1340 }
1341
1342-static int
1343+static int
1344 fm_directory_view_get_uri_keypath_size (FMDirectoryView *view)
1345 {
1346 GOFDirectoryAsync *dir = fm_directory_view_get_current_directory (view);
1347@@ -2436,8 +2445,8 @@
1348 fm_directory_view_cancel_thumbnailing (view);
1349
1350 /* schedule the timeout handler */
1351- view->details->thumbnail_source_id =
1352- g_timeout_add (175, (GSourceFunc) fm_directory_view_request_thumbnails,
1353+ view->details->thumbnail_source_id =
1354+ g_timeout_add (175, (GSourceFunc) fm_directory_view_request_thumbnails,
1355 view);
1356 }
1357
1358@@ -2481,7 +2490,7 @@
1359 /* only ask thumbnails once per file */
1360 if (file->flags == 0) {
1361 files = g_list_prepend (files, g_object_ref (file));
1362- }
1363+ }
1364
1365 g_object_unref (file);
1366 }
1367@@ -2682,12 +2691,12 @@
1368
1369 locations = g_list_reverse (locations);
1370
1371- if (locations != NULL) {
1372+ if (locations != NULL) {
1373 marlin_file_operations_trash_or_delete (locations,
1374 GTK_WINDOW (view->details->window),
1375 (MarlinDeleteCallback) trash_or_delete_done_cb,
1376 view);
1377- }
1378+ }
1379 else
1380 return;
1381
1382@@ -2709,8 +2718,8 @@
1383 trash_or_delete_files (view, selection, TRUE);
1384 gof_file_list_free (selection);
1385 view->details->selection_was_removed = TRUE;
1386- }
1387- else
1388+ }
1389+ else
1390 return;
1391 }
1392 }
1393@@ -2829,13 +2838,13 @@
1394
1395 slot = GOF_WINDOW_SLOT (g_value_get_object (value));
1396 window = marlin_view_view_container_get_window (MARLIN_VIEW_VIEW_CONTAINER(slot->ctab));
1397-
1398+
1399 view->details->slot = g_object_ref(slot);
1400 view->details->window = window;
1401
1402 g_signal_handlers_block_by_func (view->model, sort_column_changed_callback, view);
1403- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (view->model),
1404- slot->directory->file->sort_column_id,
1405+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (view->model),
1406+ slot->directory->file->sort_column_id,
1407 slot->directory->file->sort_order);
1408 g_signal_handlers_unblock_by_func (view->model, sort_column_changed_callback, view);
1409
1410@@ -2844,15 +2853,15 @@
1411 G_CALLBACK (show_hidden_files_changed), view, 0);
1412 g_signal_connect_object (gof_preferences_get_default (), "notify::interpret-desktop-files",
1413 G_CALLBACK (show_desktop_files_changed), view, 0);
1414-
1415-
1416+
1417+
1418 fm_directory_view_connect_directory_handlers (view, slot->directory);
1419-
1420- g_signal_connect_object (view->details->slot, "active",
1421+
1422+ g_signal_connect_object (view->details->slot, "active",
1423 G_CALLBACK (slot_active), view, 0);
1424- g_signal_connect_object (view->details->slot, "inactive",
1425+ g_signal_connect_object (view->details->slot, "inactive",
1426 G_CALLBACK (slot_inactive), view, 0);
1427-
1428+
1429
1430 break;
1431 case PROP_ZOOM_LEVEL:
1432@@ -2972,7 +2981,7 @@
1433 GtkUIManager *
1434 fm_directory_view_get_ui_manager (FMDirectoryView *view)
1435 {
1436- if (view->details->window == NULL)
1437+ if (view->details->window == NULL)
1438 return NULL;
1439
1440 return MARLIN_VIEW_WINDOW (view->details->window)->ui;
1441@@ -2998,14 +3007,14 @@
1442 }
1443
1444 void
1445-fm_directory_view_notify_item_hovered (FMDirectoryView *view, GtkTreePath *path)
1446+fm_directory_view_notify_item_hovered (FMDirectoryView *view, GtkTreePath *path)
1447 {
1448 GOFFile *file = NULL;
1449
1450- if (path != NULL)
1451+ if (path != NULL)
1452 file = fm_list_model_file_for_path (view->model, path);
1453 g_signal_emit_by_name (MARLIN_VIEW_WINDOW (view->details->window), "item_hovered", file);
1454- if (file != NULL)
1455+ if (file != NULL)
1456 g_object_unref (file);
1457 }
1458
1459@@ -3018,12 +3027,12 @@
1460 view->details->selection_was_removed = FALSE;
1461 if (!gtk_widget_get_realized (GTK_WIDGET (view)))
1462 return;
1463- if (view->updates_frozen)
1464+ if (view->updates_frozen)
1465 return;
1466 /* when we're in column view ignore selection changed from other slot than the active one */
1467- if (view->details->slot->mwcols &&
1468+ if (view->details->slot->mwcols != NULL &&
1469 view->details->slot->mwcols->active_slot != view->details->slot)
1470- return;
1471+ return;
1472
1473 //g_message ("%s %s", G_STRFUNC, view->details->slot->directory->file->uri);
1474 selection = fm_directory_view_get_selection (view);
1475@@ -3036,9 +3045,9 @@
1476 {
1477 fm_directory_view_notify_selection_changed (view);
1478
1479- /* We could optimize this by redrawing only the old and the new
1480+ /* We could optimize this by redrawing only the old and the new
1481 * clipboard selection by emitting row-changed on the model but the icon view
1482- * handle this situation very badly by recomputing all the layout.
1483+ * handle this situation very badly by recomputing all the layout.
1484 */
1485 gtk_widget_queue_draw (GTK_WIDGET (view));
1486 }
1487@@ -3046,7 +3055,7 @@
1488 void
1489 fm_directory_view_set_active_slot (FMDirectoryView *view)
1490 {
1491- g_warning ("%s %s %s", G_STRFUNC,
1492+ g_warning ("%s %s %s", G_STRFUNC,
1493 view->details->slot->mwcols->active_slot->directory->file->uri,
1494 view->details->slot->directory->file->uri
1495 );
1496@@ -3108,7 +3117,7 @@
1497 g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
1498
1499 view->updates_frozen = TRUE;
1500-
1501+
1502 /* disable clipboard actions */
1503 dir_action_set_sensitive (view, "Cut", FALSE);
1504 dir_action_set_sensitive (view, "Copy", FALSE);
1505@@ -3119,7 +3128,7 @@
1506 /* TODO remove this blocker */
1507 /* block thumbnails request on size allocate */
1508 g_signal_handlers_block_by_func (view, fm_directory_view_size_allocate, NULL);
1509-
1510+
1511 /* block clipboard change trigerring update_menus */
1512 g_signal_handlers_block_by_func (view, fm_directory_view_clipboard_changed, NULL);
1513
1514@@ -3139,7 +3148,7 @@
1515
1516 /* unblock thumbnails request on size allocate */
1517 g_signal_handlers_unblock_by_func (view, fm_directory_view_size_allocate, NULL);
1518-
1519+
1520 /* unblock clipboard change trigerring update_menus */
1521 g_signal_handlers_unblock_by_func (view, fm_directory_view_clipboard_changed, NULL);
1522
1523@@ -3255,7 +3264,7 @@
1524 static void
1525 check_newly_file_added_callback (GOFDirectoryAsync *directory, GOFFile *file, FMDirectoryView *view)
1526 {
1527- if (file->is_directory && g_file_equal (file->location, view->details->newly_folder_added->location))
1528+ if (file->is_directory && g_file_equal (file->location, view->details->newly_folder_added->location))
1529 {
1530 g_signal_handlers_disconnect_by_func (directory,
1531 G_CALLBACK (check_newly_file_added_callback),
1532@@ -3267,7 +3276,7 @@
1533 #endif
1534
1535 static gboolean
1536-rename_file_callback (FMDirectoryView *view)
1537+rename_file_callback (FMDirectoryView *view)
1538 {
1539 rename_file (view, view->details->newly_folder_added);
1540 g_object_unref (view->details->newly_folder_added);
1541@@ -3285,9 +3294,9 @@
1542 g_object_unref (view->details->newly_folder_added);
1543 view->details->newly_folder_added = gof_file_get (new_folder);
1544
1545- /*g_signal_connect_data (view->details->slot->directory,
1546- "file_added",
1547- G_CALLBACK (check_newly_file_added_callback),
1548+ /*g_signal_connect_data (view->details->slot->directory,
1549+ "file_added",
1550+ G_CALLBACK (check_newly_file_added_callback),
1551 g_object_ref (view),
1552 (GClosureNotify)g_object_unref,
1553 G_CONNECT_AFTER);*/
1554@@ -3326,7 +3335,7 @@
1555 GOFFile *source)
1556 {
1557 //GdkPoint *pos;
1558- /*NewFolderData *data;
1559+ /*NewFolderData *data;
1560 char *source_uri;*/
1561 char *current_dir_uri;
1562
1563@@ -3351,10 +3360,10 @@
1564 g_return_if_fail (nautilus_file_is_local (source));
1565 g_return_if_fail (nautilus_file_is_local (source));
1566 //pos = context_menu_to_file_operation_position (directory_view);
1567- data = setup_new_folder_data (directory_view);
1568- source_uri = nautilus_file_get_uri (source);
1569+ data = setup_new_folder_data (directory_view);
1570+ source_uri = nautilus_file_get_uri (source);
1571
1572- marlin_file_operations_new_file_from_template (GTK_WIDGET (directory_view),
1573+ marlin_file_operations_new_file_from_template (GTK_WIDGET (directory_view),
1574 pos,
1575 parent_uri != NULL ? parent_uri : container_uri,
1576 NULL,
1577@@ -3421,17 +3430,17 @@
1578 g_assert (selection != NULL);
1579
1580 file = GOF_FILE (selection->data);
1581- gof_file_ref (file);
1582+ gof_file_ref (file);
1583
1584- dialog = gtk_app_chooser_dialog_new (GTK_WINDOW (view->details->window), 0, file->location);
1585+ dialog = gtk_app_chooser_dialog_new (GTK_WINDOW (view->details->window), 0, file->location);
1586 GtkWidget *check_default = gtk_check_button_new_with_label(_("Set as default"));
1587 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), check_default, FALSE, FALSE, 0);
1588- gtk_widget_show_all (dialog);
1589+ gtk_widget_show_all (dialog);
1590
1591 int response = gtk_dialog_run (GTK_DIALOG (dialog));
1592 if(response == GTK_RESPONSE_OK)
1593 {
1594- app = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (GTK_DIALOG (dialog)));
1595+ app = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (GTK_DIALOG (dialog)));
1596 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_default)))
1597 {
1598 GError* error = NULL;
1599@@ -3441,14 +3450,14 @@
1600 g_clear_error (&error);
1601 }
1602 }
1603-
1604+
1605 gof_files_launch_with (selection,
1606 eel_gtk_widget_get_screen (GTK_WIDGET (view)),
1607 app);
1608 }
1609
1610 gtk_widget_destroy (GTK_WIDGET (dialog));
1611- gof_file_unref (file);
1612+ gof_file_unref (file);
1613 }
1614
1615 static void
1616@@ -3457,7 +3466,7 @@
1617 g_assert (FM_IS_DIRECTORY_VIEW (view));
1618
1619 GList *selection = fm_directory_view_get_selection (view);
1620-
1621+
1622 if (selection != NULL) {
1623 /* The reference counts of the selection list's members are incremented,
1624 * so that the members aren't freed by the properties window. */
1625@@ -3534,11 +3543,11 @@
1626 /* tooltip */ N_("Delete each selected item, without moving to the Trash"),
1627 G_CALLBACK (action_delete_callback) },
1628 /* name, stock id */ { "Restore From Trash", NULL,
1629- /* label, accelerator */ N_("_Restore"), NULL,
1630+ /* label, accelerator */ N_("_Restore"), NULL,
1631 NULL,
1632 G_CALLBACK (action_restore_from_trash_callback) },
1633 /* name, stock id */ { "Select All", NULL,
1634- /* label, accelerator */ N_("Select All"), "<control>A",
1635+ /* label, accelerator */ N_("Select All"), "<control>A",
1636 NULL,
1637 G_CALLBACK (action_select_all) },
1638 /* name, stock id */ { "Properties", GTK_STOCK_PROPERTIES,
1639@@ -3554,7 +3563,7 @@
1640 {
1641 GtkUIManager *ui_manager;
1642
1643- if (view->details->window == NULL)
1644+ if (view->details->window == NULL)
1645 return;
1646 if (view->details->dir_action_group == NULL)
1647 return;
1648@@ -3638,7 +3647,7 @@
1649 /* we have to make sure that we add our custom widget once in the menu */
1650 static gboolean selection_menu_builded = FALSE;
1651
1652- if (!selection_menu_builded)
1653+ if (!selection_menu_builded)
1654 {
1655 GtkWidget *item;
1656
1657
1658=== modified file 'src/fm-directory-view.h'
1659--- src/fm-directory-view.h 2013-02-08 00:58:30 +0000
1660+++ src/fm-directory-view.h 2013-09-01 22:36:03 +0000
1661@@ -19,8 +19,8 @@
1662 * Boston, MA 02111-1307, USA.
1663 *
1664 * Authors: Ettore Perazzoli
1665- * Darin Adler <darin@bentspoon.com>
1666- * John Sullivan <sullivan@eazel.com>
1667+ * Darin Adler <darin@bentspoon.com>
1668+ * John Sullivan <sullivan@eazel.com>
1669 * Pavel Cisler <pavel@eazel.com>
1670 */
1671
1672@@ -65,7 +65,7 @@
1673 GtkCellRenderer *name_renderer;
1674 MarlinZoomLevel zoom_level;
1675 gboolean updates_frozen;
1676-
1677+ const gchar* empty_message;
1678 FMDirectoryViewDetails *details;
1679 };
1680
1681@@ -75,24 +75,24 @@
1682 /* The 'clear' signal is emitted to empty the view of its contents.
1683 * It must be replaced by each subclass.
1684 */
1685- // void (* clear) (FMDirectoryView *view);
1686+ // void (* clear) (FMDirectoryView *view);
1687
1688 /* The 'begin_file_changes' signal is emitted before a set of files
1689- * are added to the view. It can be replaced by a subclass to do any
1690+ * are added to the view. It can be replaced by a subclass to do any
1691 * necessary preparation for a set of new files. The default
1692 * implementation does nothing.
1693 */
1694- //void (* begin_file_changes) (FMDirectoryView *view);
1695+ //void (* begin_file_changes) (FMDirectoryView *view);
1696
1697 /* The 'add_file' signal is emitted to add one file to the view.
1698 * It must be replaced by each subclass.
1699 */
1700- void (* add_file) (FMDirectoryView *view,
1701+ void (* add_file) (FMDirectoryView *view,
1702 GOFFile *file,
1703 GOFDirectoryAsync *directory);
1704- void (* directory_loaded) (FMDirectoryView *view,
1705+ void (* directory_loaded) (FMDirectoryView *view,
1706 GOFDirectoryAsync *directory);
1707- void (* sync_selection) (FMDirectoryView *view);
1708+ void (* sync_selection) (FMDirectoryView *view);
1709
1710
1711 #if 0
1712@@ -100,29 +100,29 @@
1713 * including the file being removed.
1714 * It must be replaced by each subclass.
1715 */
1716- void (* file_changed) (FMDirectoryView *view,
1717+ void (* file_changed) (FMDirectoryView *view,
1718 GOFFile *file,
1719 GOFDirectoryAsync *directory);
1720
1721 /* The 'end_file_changes' signal is emitted after a set of files
1722- * are added to the view. It can be replaced by a subclass to do any
1723+ * are added to the view. It can be replaced by a subclass to do any
1724 * necessary cleanup (typically, cleanup for code in begin_file_changes).
1725 * The default implementation does nothing.
1726 */
1727- //void (* end_file_changes) (FMDirectoryView *view);
1728+ //void (* end_file_changes) (FMDirectoryView *view);
1729
1730- //void (* flush_added_files) (FMDirectoryView *view);
1731+ //void (* flush_added_files) (FMDirectoryView *view);
1732
1733 /* The 'begin_loading' signal is emitted before any of the contents
1734- * of a directory are added to the view. It can be replaced by a
1735+ * of a directory are added to the view. It can be replaced by a
1736 * subclass to do any necessary preparation to start dealing with a
1737 * new directory. The default implementation does nothing.
1738 */
1739- void (* begin_loading) (FMDirectoryView *view);
1740+ void (* begin_loading) (FMDirectoryView *view);
1741
1742 /* The 'end_loading' signal is emitted after all of the contents
1743- * of a directory are added to the view. It can be replaced by a
1744- * subclass to do any necessary clean-up. The default implementation
1745+ * of a directory are added to the view. It can be replaced by a
1746+ * subclass to do any necessary clean-up. The default implementation
1747 * does nothing.
1748 *
1749 * If all_files_seen is true, the handler may assume that
1750@@ -132,12 +132,12 @@
1751 * Otherwise, end_loading was emitted due to cancellation,
1752 * which usually means that not all files are available.
1753 */
1754- void (* end_loading) (FMDirectoryView *view,
1755+ void (* end_loading) (FMDirectoryView *view,
1756 gboolean all_files_seen);
1757
1758 /* The 'load_error' signal is emitted when the directory model
1759 * reports an error in the process of monitoring the directory's
1760- * contents. The load error indicates that the process of
1761+ * contents. The load error indicates that the process of
1762 * loading the contents has ended, but the directory is still
1763 * being monitored. The default implementation handles common
1764 * load failures like ACCESS_DENIED.
1765@@ -147,11 +147,11 @@
1766
1767 /* Function pointers that don't have corresponding signals */
1768
1769- /* reset_to_defaults is a function pointer that subclasses must
1770+ /* reset_to_defaults is a function pointer that subclasses must
1771 * override to set sort order, zoom level, etc to match default
1772- * values.
1773+ * values.
1774 */
1775- void (* reset_to_defaults) (FMDirectoryView *view);
1776+ void (* reset_to_defaults) (FMDirectoryView *view);
1777 #endif
1778
1779 /* get_selection is not a signal; it is just a function pointer for
1780@@ -159,7 +159,7 @@
1781 * with a function that returns a newly-allocated GList of
1782 * GOFFile pointers.
1783 */
1784- GList * (* get_selection) (FMDirectoryView *view);
1785+ GList * (* get_selection) (FMDirectoryView *view);
1786
1787 /* get_selection_for_file_transfer is a function pointer for
1788 * subclasses to replace (override). Subclasses must replace it
1789@@ -168,11 +168,11 @@
1790 * that any files in the selection that also has a parent folder
1791 * in the selection is not included.
1792 */
1793- GList * (* get_selection_for_file_transfer)(FMDirectoryView *view);
1794+ GList * (* get_selection_for_file_transfer)(FMDirectoryView *view);
1795
1796 /* Returns the list of currently selected GtkTreePath's, where
1797 * both the list and the items are owned by the caller. */
1798- GList * (* get_selected_paths) (FMDirectoryView *view);
1799+ GList * (* get_selected_paths) (FMDirectoryView *view);
1800
1801 /* Selects the given item */
1802 void (*select_path) (FMDirectoryView *view, GtkTreePath *path);
1803@@ -192,19 +192,19 @@
1804 #if 0
1805 /* select_all is a function pointer that subclasses must override to
1806 * select all of the items in the view */
1807- void (* select_all) (FMDirectoryView *view);
1808+ void (* select_all) (FMDirectoryView *view);
1809
1810 /* set_selection is a function pointer that subclasses must
1811 * override to select the specified items (and unselect all
1812 * others). The argument is a list of GOFFiles. */
1813
1814- void (* set_selection) (FMDirectoryView *view,
1815+ void (* set_selection) (FMDirectoryView *view,
1816 GList *selection);
1817-
1818+
1819 /* invert_selection is a function pointer that subclasses must
1820 * override to invert selection. */
1821
1822- void (* invert_selection) (FMDirectoryView *view);
1823+ void (* invert_selection) (FMDirectoryView *view);
1824
1825 /* Return an array of locations of selected icons in their view. */
1826 //GArray * (* get_selected_icon_locations) (FMDirectoryView *view);
1827@@ -213,12 +213,12 @@
1828
1829 /* bump_zoom_level is a function pointer that subclasses must override
1830 * to change the zoom level of an object. */
1831- /*void (* bump_zoom_level) (FMDirectoryView *view,
1832+ /*void (* bump_zoom_level) (FMDirectoryView *view,
1833 int zoom_increment);*/
1834
1835 /* zoom_to_level is a function pointer that subclasses must override
1836 * to set the zoom level of an object to the specified level. */
1837- /*void (* zoom_to_level) (FMDirectoryView *view,
1838+ /*void (* zoom_to_level) (FMDirectoryView *view,
1839 NautilusZoomLevel level);*/
1840
1841 //NautilusZoomLevel (* get_zoom_level) (FMDirectoryView *view);
1842@@ -229,39 +229,39 @@
1843
1844 /* can_zoom_in is a function pointer that subclasses must override to
1845 * return whether the view is at maximum size (furthest-in zoom level) */
1846- //gboolean (* can_zoom_in) (FMDirectoryView *view);
1847+ //gboolean (* can_zoom_in) (FMDirectoryView *view);
1848
1849 /* can_zoom_out is a function pointer that subclasses must override to
1850 * return whether the view is at minimum size (furthest-out zoom level) */
1851- //gboolean (* can_zoom_out) (FMDirectoryView *view);
1852+ //gboolean (* can_zoom_out) (FMDirectoryView *view);
1853
1854 /* reveal_selection is a function pointer that subclasses may
1855 * override to make sure the selected items are sufficiently
1856 * apparent to the user (e.g., scrolled into view). By default,
1857 * this does nothing.
1858 */
1859- void (* reveal_selection) (FMDirectoryView *view);
1860+ void (* reveal_selection) (FMDirectoryView *view);
1861
1862 /* get_background is a function pointer that subclasses must
1863 * override to return the EelBackground for this view.
1864 */
1865- //GtkWidget * (* get_background_widget) (FMDirectoryView *view);
1866+ //GtkWidget * (* get_background_widget) (FMDirectoryView *view);
1867 #endif
1868
1869 /* merge_menus is a function pointer that subclasses can override to
1870 * add their own menu items to the window's menu bar.
1871 * If overridden, subclasses must call parent class's function.
1872 */
1873- void (* merge_menus) (FMDirectoryView *view);
1874- void (* unmerge_menus) (FMDirectoryView *view);
1875+ void (* merge_menus) (FMDirectoryView *view);
1876+ void (* unmerge_menus) (FMDirectoryView *view);
1877
1878 #if 0
1879 /* update_menus is a function pointer that subclasses can override to
1880 * update the sensitivity or wording of menu items in the menu bar.
1881- * It is called (at least) whenever the selection changes. If overridden,
1882+ * It is called (at least) whenever the selection changes. If overridden,
1883 * subclasses must call parent class's function.
1884 */
1885- //void (* update_menus) (FMDirectoryView *view);
1886+ //void (* update_menus) (FMDirectoryView *view);
1887
1888 /* sort_files is a function pointer that subclasses can override
1889 * to provide a sorting order to determine which files should be
1890@@ -276,7 +276,7 @@
1891 * be displayed with each file. By default, all emblems returned by
1892 * GOFFile are displayed.
1893 */
1894- //char ** (* get_emblem_names_to_exclude) (FMDirectoryView *view);
1895+ //char ** (* get_emblem_names_to_exclude) (FMDirectoryView *view);
1896
1897 /* file_limit_reached is a function pointer that subclasses may
1898 * override to control what happens when a directory is loaded
1899@@ -285,21 +285,21 @@
1900 * display when the user explicitly tried to visit a location that
1901 * they would think of as a normal directory.
1902 */
1903- //void (* file_limit_reached) (FMDirectoryView *view);
1904+ //void (* file_limit_reached) (FMDirectoryView *view);
1905
1906 /* supports_properties is a function pointer that subclasses may
1907 * override to control whether the "Show Properties" menu item
1908- * should be enabled for selected items. The default implementation
1909+ * should be enabled for selected items. The default implementation
1910 * returns TRUE.
1911 */
1912- //gboolean (* supports_properties) (FMDirectoryView *view);
1913+ //gboolean (* supports_properties) (FMDirectoryView *view);
1914
1915 /* supports_zooming is a function pointer that subclasses may
1916 * override to control whether or not the zooming control and
1917 * menu items should be enabled. The default implementation
1918 * returns TRUE.
1919 */
1920- //gboolean (* supports_zooming) (FMDirectoryView *view);
1921+ //gboolean (* supports_zooming) (FMDirectoryView *view);
1922
1923 /* using_manual_layout is a function pointer that subclasses may
1924 * override to control whether or not items can be freely positioned
1925@@ -314,7 +314,7 @@
1926 * default implementation checks the permissions of the
1927 * directory.
1928 */
1929- gboolean (* is_read_only) (FMDirectoryView *view);
1930+ gboolean (* is_read_only) (FMDirectoryView *view);
1931
1932 /* is_empty is a function pointer that subclasses must
1933 * override to report whether the view contains any items.
1934@@ -327,13 +327,13 @@
1935 * user has write permissions for the viewed directory, and whether
1936 * the viewed directory is in the trash.
1937 */
1938- gboolean (* supports_creating_files) (FMDirectoryView *view);
1939+ gboolean (* supports_creating_files) (FMDirectoryView *view);
1940
1941 /* accepts_dragged_files is a function pointer that subclasses may
1942 * override to control whether or not files can be dropped in this
1943 * location. The default implementation returns TRUE.
1944 */
1945- //gboolean (* accepts_dragged_files) (FMDirectoryView *view);
1946+ //gboolean (* accepts_dragged_files) (FMDirectoryView *view);
1947
1948 /*gboolean (* can_rename_file) (FMDirectoryView *view,
1949 GOFFile *file);*/
1950@@ -341,12 +341,12 @@
1951 /* select_all specifies whether the whole filename should be selected
1952 * or only its basename (i.e. everything except the extension)
1953 * */
1954- void (* start_renaming_file) (FMDirectoryView *view,
1955+ void (* start_renaming_file) (FMDirectoryView *view,
1956 GOFFile *file,
1957 gboolean select_all);
1958 #if 0
1959- /*gboolean (* file_still_belongs) (FMDirectoryView *view,
1960- GOFFile *file,
1961+ /*gboolean (* file_still_belongs) (FMDirectoryView *view,
1962+ GOFFile *file,
1963 GOFDirectoryAsync *directory);
1964 */
1965
1966@@ -360,17 +360,17 @@
1967 GdkPoint
1968 *position);*/
1969
1970- /* Preference change callbacks, overriden by icon and list views.
1971+ /* Preference change callbacks, overriden by icon and list views.
1972 * Icon and list views respond by synchronizing to the new preference
1973 * values and forcing an update if appropriate.
1974 */
1975- /*void (* text_attribute_names_changed) (FMDirectoryView *view);
1976- void (* embedded_text_policy_changed) (FMDirectoryView *view);
1977- void (* image_display_policy_changed) (FMDirectoryView *view);
1978- void (* click_policy_changed) (FMDirectoryView *view);
1979- void (* sort_directories_first_changed) (FMDirectoryView *view);
1980+ /*void (* text_attribute_names_changed) (FMDirectoryView *view);
1981+ void (* embedded_text_policy_changed) (FMDirectoryView *view);
1982+ void (* image_display_policy_changed) (FMDirectoryView *view);
1983+ void (* click_policy_changed) (FMDirectoryView *view);
1984+ void (* sort_directories_first_changed) (FMDirectoryView *view);
1985
1986- void (* emblems_changed) (FMDirectoryView *view);
1987+ void (* emblems_changed) (FMDirectoryView *view);
1988
1989 void (* set_is_active) (FMDirectoryView *view,
1990 gboolean
1991
1992=== modified file 'src/gof-window-slot.c'
1993--- src/gof-window-slot.c 2013-06-27 19:34:48 +0000
1994+++ src/gof-window-slot.c 2013-09-01 22:36:03 +0000
1995@@ -46,12 +46,13 @@
1996 {
1997 slot->content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
1998 slot->width = 0;
1999+ slot->ready_to_autosize = FALSE;
2000 GOF_ABSTRACT_SLOT (slot)->extra_location_widgets = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
2001 gtk_box_pack_start (GTK_BOX (slot->content_box), GOF_ABSTRACT_SLOT(slot)->extra_location_widgets, FALSE, FALSE, 0);
2002 }
2003
2004 static void
2005-real_active (GOFWindowSlot *slot)
2006+real_active (GOFWindowSlot *slot)
2007 {
2008 marlin_view_view_container_refresh_slot_info (MARLIN_VIEW_VIEW_CONTAINER (slot->ctab));
2009 }
2010@@ -60,22 +61,22 @@
2011 gof_window_slot_class_init (GOFWindowSlotClass *class)
2012 {
2013 signals[ACTIVE] =
2014- g_signal_new ("active",
2015- G_TYPE_FROM_CLASS (class),
2016- G_SIGNAL_RUN_LAST,
2017- G_STRUCT_OFFSET (GOFWindowSlotClass, active),
2018- NULL, NULL,
2019- g_cclosure_marshal_VOID__VOID,
2020- G_TYPE_NONE, 0);
2021+ g_signal_new ("active",
2022+ G_TYPE_FROM_CLASS (class),
2023+ G_SIGNAL_RUN_LAST,
2024+ G_STRUCT_OFFSET (GOFWindowSlotClass, active),
2025+ NULL, NULL,
2026+ g_cclosure_marshal_VOID__VOID,
2027+ G_TYPE_NONE, 0);
2028
2029 signals[INACTIVE] =
2030- g_signal_new ("inactive",
2031- G_TYPE_FROM_CLASS (class),
2032- G_SIGNAL_RUN_LAST,
2033- G_STRUCT_OFFSET (GOFWindowSlotClass, inactive),
2034- NULL, NULL,
2035- g_cclosure_marshal_VOID__VOID,
2036- G_TYPE_NONE, 0);
2037+ g_signal_new ("inactive",
2038+ G_TYPE_FROM_CLASS (class),
2039+ G_SIGNAL_RUN_LAST,
2040+ G_STRUCT_OFFSET (GOFWindowSlotClass, inactive),
2041+ NULL, NULL,
2042+ g_cclosure_marshal_VOID__VOID,
2043+ G_TYPE_NONE, 0);
2044
2045 G_OBJECT_CLASS (class)->finalize = gof_window_slot_finalize;
2046 class->active = real_active;
2047@@ -87,10 +88,12 @@
2048 GOFWindowSlot *slot = GOF_WINDOW_SLOT (object);
2049
2050 //load_dir_async_cancel(slot->directory);
2051- g_debug ("%s %s\n", G_STRFUNC, slot->directory->file->uri);
2052+ g_debug ("%s %s finalizing\n", G_STRFUNC, slot->directory->file->uri);
2053 //g_warning ("%s %s %u\n", G_STRFUNC, slot->directory->file->uri, G_OBJECT (slot->directory)->ref_count);
2054+ g_signal_handlers_disconnect_by_data (slot->directory, slot);
2055 g_object_unref(slot->directory);
2056 g_object_unref(slot->location);
2057+
2058 G_OBJECT_CLASS (parent_class)->finalize (object);
2059 /* avoid a warning in vala code: slot is freed in ViewContainer */
2060 //slot = NULL;
2061@@ -100,7 +103,7 @@
2062 update_total_width (GtkWidget *widget, GtkAllocation *allocation, void *data)
2063 {
2064 GOFWindowSlot* slot = data;
2065-
2066+
2067 if (slot->mwcols->total_width != 0 && slot->width != allocation->width) {
2068 slot->mwcols->total_width += allocation->width - slot->width;
2069 slot->width = allocation->width;
2070@@ -114,11 +117,11 @@
2071 GtkWidget *hpane = GTK_WIDGET (granite_widgets_thin_paned_new (GTK_ORIENTATION_HORIZONTAL));
2072 gtk_widget_set_hexpand(hpane, TRUE);
2073 gtk_widget_show (hpane);
2074-
2075+
2076 gtk_container_add(GTK_CONTAINER (slot->colpane), hpane);
2077 gtk_widget_show_all(slot->colpane);
2078-
2079- GtkWidget *box1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
2080+
2081+ GtkWidget *box1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
2082 gtk_widget_show_all (box1);
2083
2084 slot->colpane = box1;
2085@@ -131,6 +134,69 @@
2086
2087 gtk_paned_pack1 (GTK_PANED (hpane), column, FALSE, FALSE);
2088 gtk_paned_pack2 (GTK_PANED (hpane), box1, TRUE, FALSE);
2089+
2090+ /* If the directory finished loading before slot was ready then autosize the slot now.
2091+ * Otherwise the slot will be autosized by the directory_done_loading callback
2092+ * This is necessary because the directory loads faster from the cache than from disk
2093+ * On first use the directory loads from disk and we reach here before the directory
2094+ * has finished loading.
2095+ * On subsequent uses, the directory loads from cache before the slot is ready.
2096+ * Whichever finishes first sets slot->ready_to_autosize = TRUE
2097+ * Whichever finds slot->ready_to_autosize = TRUE does the autosizing.
2098+ */
2099+
2100+ if (slot->ready_to_autosize)
2101+ autosize_slot (slot);
2102+ else {
2103+ slot->ready_to_autosize = TRUE;
2104+ }
2105+}
2106+
2107+void autosize_slot (GOFWindowSlot *slot)
2108+{
2109+ g_return_if_fail (GOF_IS_WINDOW_SLOT (slot));
2110+ g_return_if_fail (slot->view_box != NULL);
2111+ g_return_if_fail (GTK_IS_WIDGET (slot->view_box));
2112+ g_return_if_fail (GOF_DIRECTORY_IS_ASYNC (slot->directory));
2113+ g_return_if_fail (slot->mwcols != NULL);
2114+
2115+ PangoLayout* layout = gtk_widget_create_pango_layout (GTK_WIDGET (slot->view_box), NULL);
2116+
2117+ if (gof_directory_async_is_empty (slot->directory))
2118+ pango_layout_set_markup (layout, FM_DIRECTORY_VIEW (slot->view_box)->empty_message, -1);
2119+ else
2120+ pango_layout_set_markup (layout,
2121+ g_markup_escape_text (slot->directory->longest_file_name, -1),
2122+ -1);
2123+
2124+ PangoRectangle extents;
2125+ pango_layout_get_extents (layout, NULL, &extents);
2126+
2127+ gint column_width = (int) pango_units_to_double(extents.width)
2128+ + 2 * slot->directory->icon_size
2129+ + 2 * slot->mwcols->handle_size
2130+ + 12;
2131+
2132+ gint min_width = slot->mwcols->preferred_column_width / 2;
2133+
2134+ if (column_width < min_width)
2135+ column_width = min_width;
2136+ else {
2137+ //TODO make max_width a setting
2138+ gint max_width = 2 * slot->mwcols->preferred_column_width;
2139+ if (column_width > max_width)
2140+ column_width = max_width;
2141+ }
2142+
2143+ if (slot->slot_number == 0)
2144+ gtk_widget_set_size_request (gtk_paned_get_child1 (GTK_PANED (slot->hpane)), column_width, -1);
2145+ else
2146+ gtk_paned_set_position (GTK_PANED (slot->hpane), column_width);
2147+ slot->width = column_width;
2148+
2149+ gtk_widget_show_all (slot->mwcols->colpane);
2150+ gtk_widget_queue_draw (slot->mwcols->colpane);
2151+
2152 }
2153
2154 void
2155@@ -139,10 +205,10 @@
2156 gint current_slot_position = 0;
2157 gint i;
2158 GList* list_slot = slot->mwcols->slot;
2159-
2160+
2161 g_return_if_fail (slot->colpane != NULL);
2162 gtk_container_foreach (GTK_CONTAINER (slot->colpane), (GtkCallback)gtk_widget_destroy, NULL);
2163-
2164+
2165 current_slot_position = g_list_index(slot->mwcols->slot, slot);
2166 if(current_slot_position == -1) {
2167 g_warning ("Can't find the slot you are viewing, this should *not* happen.");
2168@@ -157,9 +223,11 @@
2169 g_list_free (slot->mwcols->slot);
2170 slot->mwcols->slot = l;
2171 }
2172- slot->mwcols->total_width += slot->mwcols->preferred_column_width + 100;
2173- gtk_widget_set_size_request (slot->mwcols->colpane, slot->mwcols->total_width, -1);
2174+
2175 marlin_window_columns_add (slot->mwcols, location);
2176+
2177+ slot->mwcols->total_width += slot->width + 100;
2178+ gtk_widget_set_size_request (slot->mwcols->colpane, slot->mwcols->total_width, -1);
2179 }
2180
2181 GOFWindowSlot *
2182@@ -191,8 +259,10 @@
2183 slot->view_box = GTK_WIDGET (g_object_new (FM_TYPE_ICON_VIEW,
2184 "window-slot", slot, NULL));
2185 gtk_box_pack_start(GTK_BOX (slot->content_box), slot->view_box, TRUE, TRUE, 0);
2186-
2187+
2188 marlin_view_view_container_set_content ((MarlinViewViewContainer *) slot->ctab, slot->content_box);
2189+
2190+ slot->directory->track_longest_name = FALSE;
2191 gof_directory_async_load (slot->directory);
2192 }
2193
2194@@ -207,6 +277,8 @@
2195 "window-slot", slot, NULL));
2196 gtk_box_pack_start (GTK_BOX (slot->content_box), slot->view_box, TRUE, TRUE, 0);
2197 marlin_view_view_container_set_content ((MarlinViewViewContainer *) slot->ctab, slot->content_box);
2198+
2199+ slot->directory->track_longest_name = FALSE;
2200 gof_directory_async_load (slot->directory);
2201 }
2202
2203@@ -224,6 +296,7 @@
2204 {
2205 slot->view_box = GTK_WIDGET (g_object_new (FM_TYPE_COLUMNS_VIEW,
2206 "window-slot", slot, NULL));
2207+ slot->directory->track_longest_name = TRUE;
2208 gof_directory_async_load (slot->directory);
2209 }
2210
2211@@ -233,8 +306,10 @@
2212 {
2213 g_return_if_fail (GOF_IS_WINDOW_SLOT (slot));
2214
2215- if (slot->mwcols)
2216+ if (slot->mwcols != NULL) {
2217 marlin_window_columns_active_slot (slot->mwcols, slot);
2218+ autosize_slot (slot);
2219+ }
2220 }
2221
2222 void
2223
2224=== modified file 'src/gof-window-slot.h'
2225--- src/gof-window-slot.h 2013-06-27 19:34:48 +0000
2226+++ src/gof-window-slot.h 2013-09-01 22:36:03 +0000
2227@@ -25,9 +25,9 @@
2228 #include "marlincore.h"
2229 #include "marlin-window-columns.h"
2230
2231-#define GOF_TYPE_WINDOW_SLOT (gof_window_slot_get_type())
2232+#define GOF_TYPE_WINDOW_SLOT (gof_window_slot_get_type())
2233 #define GOF_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GOF_TYPE_WINDOW_SLOT, GOFWindowSlotClass))
2234-#define GOF_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOF_TYPE_WINDOW_SLOT, GOFWindowSlot))
2235+#define GOF_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOF_TYPE_WINDOW_SLOT, GOFWindowSlot))
2236 #define GOF_IS_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GOF_TYPE_WINDOW_SLOT))
2237 #define GOF_IS_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOF_TYPE_WINDOW_SLOT))
2238 #define GOF_WINDOW_SLOT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOF_TYPE_WINDOW_SLOT, GOFWindowSlotClass))
2239@@ -55,6 +55,8 @@
2240
2241 MarlinWindowColumns *mwcols;
2242 guint width;
2243+ guint slot_number;
2244+ gboolean ready_to_autosize;
2245 };
2246
2247 struct GOFWindowSlotClass {
2248@@ -81,5 +83,6 @@
2249
2250 void gof_window_slot_freeze_updates (GOFWindowSlot *slot);
2251 void gof_window_slot_unfreeze_updates (GOFWindowSlot *slot);
2252+void autosize_slot (GOFWindowSlot *slot);
2253
2254 #endif /* GOF_WINDOW_SLOT_H */
2255
2256=== modified file 'src/marlin-window-columns.c'
2257--- src/marlin-window-columns.c 2013-07-05 18:20:51 +0000
2258+++ src/marlin-window-columns.c 2013-09-01 22:36:03 +0000
2259@@ -110,6 +110,7 @@
2260 GOFWindowSlot *slot = mwcols->active_slot;
2261
2262 gof_window_slot_make_column_view (slot);
2263+ slot->slot_number = 0;
2264
2265 mwcols->colpane = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
2266 slot->colpane = mwcols->colpane;
2267@@ -133,6 +134,7 @@
2268
2269 marlin_view_view_container_set_content ((MarlinViewViewContainer *) mwcols->ctab, mwcols->content_box);
2270
2271+
2272 /* store pane handle size*/
2273 gtk_widget_style_get (GTK_WIDGET (slot->hpane), "handle-size", &mwcols->handle_size, NULL);
2274
2275@@ -156,7 +158,9 @@
2276 marlin_window_columns_add (MarlinWindowColumns *mwcols, GFile *location)
2277 {
2278 GOFWindowSlot *slot = gof_window_slot_new (location, mwcols->ctab);
2279+ slot->width = mwcols->preferred_column_width;
2280 gof_window_slot_make_column_view (slot);
2281+ slot->slot_number = mwcols->active_slot->slot_number +1;
2282 slot->mwcols = mwcols;
2283 slot->colpane = mwcols->active_slot->colpane;
2284 gof_window_column_add (slot, slot->view_box);

Subscribers

People subscribed via source and target branches