Skip to content

Commit e5e898e

Browse files
authored
Fix destination icon in file conflict dialog (#2656)
Co-authored-by: Leo <lenemter@gmail.com> Fixes #695 (finally) Gets destination image the same way as source icon; in file ready callback. Improves code style by moving code out or create function to construct clause.
1 parent f146424 commit e5e898e

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

libcore/FileConflictDialog.vala

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ public class Files.FileConflictDialog : Granite.MessageDialog {
3636
NEWEST
3737
}
3838

39+
public Files.File source { private get; construct; }
40+
public Files.File destination { private get; construct; }
41+
public Files.File dest_dir { private get; construct; }
42+
3943
private string conflict_name;
4044
private Gtk.Entry rename_entry;
4145
private Gtk.Button replace_button;
4246
private Gtk.Button keep_newest_button;
4347
private Gtk.CheckButton apply_all_checkbutton;
4448

45-
private Files.File source;
46-
private Files.File destination;
47-
private Files.File dest_dir;
48-
4949
private Gtk.Image source_image;
5050
private Gtk.Label source_size_label;
5151
private Gtk.Label source_type_label;
@@ -58,32 +58,13 @@ public class Files.FileConflictDialog : Granite.MessageDialog {
5858

5959
public FileConflictDialog (Gtk.Window parent, GLib.File _source, GLib.File _destination, GLib.File _dest_dir) {
6060
Object (
61+
source: Files.File.@get (_source),
62+
destination: Files.File.@get (_destination),
63+
dest_dir: Files.File.@get (_dest_dir),
6164
title: _("File conflict"),
6265
transient_for: parent,
6366
resizable: false
6467
);
65-
66-
source = Files.File.@get (_source);
67-
destination = Files.File.@get (_destination);
68-
destination.query_update ();
69-
var thumbnailer = Files.Thumbnailer.get ();
70-
thumbnailer.finished.connect (() => {
71-
destination_image.gicon = destination.get_icon_pixbuf (64, get_scale_factor (),
72-
Files.File.IconFlags.USE_THUMBNAILS);
73-
});
74-
75-
thumbnailer.queue_file (destination, null);
76-
destination_size_label.label = destination.format_size;
77-
destination_time_label.label = destination.formated_modified;
78-
79-
dest_dir = Files.File.@get (_dest_dir);
80-
81-
var files = new GLib.List<Files.File> ();
82-
files.prepend (source);
83-
files.prepend (destination);
84-
files.prepend (dest_dir);
85-
86-
new Files.CallWhenReady (files, file_list_ready_cb);
8768
}
8869

8970
construct {
@@ -268,6 +249,13 @@ public class Files.FileConflictDialog : Granite.MessageDialog {
268249
replace_button.show ();
269250
}
270251
});
252+
253+
var files = new GLib.List<Files.File> ();
254+
files.prepend (source);
255+
files.prepend (destination);
256+
files.prepend (dest_dir);
257+
258+
new Files.CallWhenReady (files, file_list_ready_cb);
271259
}
272260

273261
private void file_list_ready_cb (GLib.List<Files.File> files) {
@@ -318,9 +306,15 @@ public class Files.FileConflictDialog : Granite.MessageDialog {
318306
}
319307

320308
secondary_label.label = "%s %s".printf (message, message_extra);
309+
321310
source_image.gicon = source.get_icon_pixbuf (64, get_scale_factor (), Files.File.IconFlags.USE_THUMBNAILS);
322311
source_size_label.label = source.format_size;
323312
source_time_label.label = source.formated_modified;
313+
314+
destination_image.gicon = destination.get_icon_pixbuf (64, get_scale_factor (), Files.File.IconFlags.USE_THUMBNAILS);
315+
destination_size_label.label = destination.format_size;
316+
destination_time_label.label = destination.formated_modified;
317+
324318
if (should_show_type && src_ftype != null) {
325319
source_type_label.label = src_ftype;
326320
} else {

0 commit comments

Comments
 (0)