@@ -265,7 +265,6 @@ namespace Files {
265265 private Gtk . Widget view;
266266 protected Gtk . ScrolledWindow scrolled_window;
267267 private Gtk . Label empty_label;
268- private Gtk . Label hidden_label;
269268 private Gtk . Overlay overlay;
270269 private unowned ClipboardManager clipboard;
271270 protected Files . ListModel model;
@@ -304,33 +303,22 @@ namespace Files {
304303 };
305304
306305 empty_label = new Gtk .Label (slot. get_empty_message ()) {
307- wrap = true
308- };
309- empty_label. get_style_context (). add_class (Granite . STYLE_CLASS_H2_LABEL );
310- empty_label. no_show_all = true ;
311-
312- hidden_label = new Gtk .Label (_(" Hidden files are present" )) {
313- wrap = true
314- };
315- hidden_label. get_style_context (). add_class (Granite . STYLE_CLASS_H3_LABEL );
316- hidden_label. no_show_all = true ;
317-
318- var empty_box = new Gtk .Box (VERTICAL , 0 ) {
319306 halign = CENTER ,
320307 valign = CENTER ,
321308 hexpand = false ,
322309 vexpand = false ,
310+ wrap = true
323311 };
324- empty_box . add (empty_label );
325- empty_box . add (hidden_label) ;
312+ empty_label . get_style_context () . add_class ( Granite . STYLE_CLASS_H2_LABEL );
313+ empty_label . no_show_all = true ;
326314
327315 overlay = new Gtk .Overlay () {
328316 hexpand = true ,
329317 vexpand = true ,
330318 child = scrolled_window
331319 };
332- overlay. add_overlay (empty_box );
333- overlay. set_overlay_pass_through (empty_box , true );
320+ overlay. add_overlay (empty_label );
321+ overlay. set_overlay_pass_through (empty_label , true );
334322 overlay. add_events (Gdk . EventMask . ALL_EVENTS_MASK );
335323
336324 child = overlay;
@@ -950,7 +938,7 @@ namespace Files {
950938 // Only called after initial loading finished, in response to files added due to internal or external
951939 // file operations
952940 private void add_file (Files .File file , Directory dir , bool is_internal = true ) {
953- empty_box . visible = false ;
941+ empty_label . visible = false ;
954942 model. insert_sorted (file, dir);
955943 if (is_internal) { /* This true once view finished loading */
956944 // Do not select until the model has resorted else wrong file is selected
@@ -1064,7 +1052,7 @@ namespace Files {
10641052 public void after_trash_or_delete () {
10651053 /* Need to use Idle else cursor gets reset to null after setting to delete_path */
10661054 Idle . add (() = > {
1067- update_empty_labels ();
1055+ empty_label . visible = slot . directory . is_empty ();
10681056 set_cursor (deleted_path, false , false , false );
10691057 unblock_directory_monitor ();
10701058 return GLib . Source . REMOVE ;
@@ -1363,11 +1351,8 @@ namespace Files {
13631351
13641352 private void on_directory_file_loaded (Directory dir , Files .File file ) {
13651353 // Do not select or sort files added during initial load.
1354+ empty_label. visible = false ;
13661355 model. add_file (file, dir);
1367- if (empty_label. visible) {
1368- update_empty_labels ();
1369- }
1370-
13711356 }
13721357
13731358 private void on_directory_file_changed (Directory dir , Files .File file ) {
@@ -1401,10 +1386,9 @@ namespace Files {
14011386 /* The deleted file could be the whole directory, which is not in the model but that
14021387 * that does not matter. */
14031388 file. exists = false ;
1389+ empty_label. visible = dir. is_empty ();
14041390 model. remove_file (file, dir);
14051391
1406- update_empty_labels ();
1407-
14081392 if (plugins != null ) {
14091393 plugins. update_file_info (file);
14101394 }
@@ -1441,7 +1425,7 @@ namespace Files {
14411425
14421426 // Wait for view to draw so thumbnails and color tags displayed on first sight
14431427 Idle . add (() = > {
1444- update_empty_labels ();
1428+ empty_label . visible = slot . directory . is_empty ();
14451429 thaw_tree ();
14461430 schedule_thumbnail_color_tag_timeout ();
14471431 return Source . REMOVE ;
@@ -2601,11 +2585,6 @@ namespace Files {
26012585 return ;
26022586 }
26032587
2604- private void update_empty_labels () {
2605- empty_label. visible = model. is_empty;
2606- hidden_label. visible = empty_label. visible && ! slot. directory. is_empty ();
2607- }
2608-
26092588 /* * Menu helpers */
26102589
26112590 private void action_set_enabled (GLib .SimpleActionGroup ? action_group , string name , bool enabled ) {
0 commit comments