[gnome-flashback] desktop: don't show hidden or backup files



commit 0ad4b4ac23fa324b1dbaee674d68792fdb969fa7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Nov 11 21:13:04 2019 +0200

    desktop: don't show hidden or backup files

 gnome-flashback/libdesktop/gf-icon-view.c | 21 +++++++++++++++------
 gnome-flashback/libdesktop/gf-icon.c      | 12 ++++++++++++
 gnome-flashback/libdesktop/gf-icon.h      |  2 ++
 3 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/gnome-flashback/libdesktop/gf-icon-view.c b/gnome-flashback/libdesktop/gf-icon-view.c
index f95884e..df6a102 100644
--- a/gnome-flashback/libdesktop/gf-icon-view.c
+++ b/gnome-flashback/libdesktop/gf-icon-view.c
@@ -54,6 +54,16 @@ struct _GfIconView
 
 G_DEFINE_TYPE (GfIconView, gf_icon_view, GTK_TYPE_EVENT_BOX)
 
+static char *
+get_required_attributes (void)
+{
+  return gf_build_attributes_list (G_FILE_ATTRIBUTE_STANDARD_NAME,
+                                   G_FILE_ATTRIBUTE_STANDARD_ICON,
+                                   G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
+                                   G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP,
+                                   NULL);
+}
+
 static GfIconInfo *
 gf_icon_info_new (GtkWidget *icon)
 {
@@ -121,6 +131,9 @@ add_icons (GfIconView *self)
 
       info = (GfIconInfo *) l->data;
 
+      if (gf_icon_is_hidden (GF_ICON (info->icon)))
+        continue;
+
       if (info->view != NULL)
         continue;
 
@@ -296,9 +309,7 @@ file_created (GfIconView *self,
 
   char *attributes;
 
-  attributes = gf_build_attributes_list (G_FILE_ATTRIBUTE_STANDARD_NAME,
-                                         G_FILE_ATTRIBUTE_STANDARD_ICON,
-                                         NULL);
+  attributes = get_required_attributes ();
 
   g_file_query_info_async (created_file,
                            attributes,
@@ -506,9 +517,7 @@ enumerate_desktop (GfIconView *self)
 {
   char *attributes;
 
-  attributes = gf_build_attributes_list (G_FILE_ATTRIBUTE_STANDARD_NAME,
-                                         G_FILE_ATTRIBUTE_STANDARD_ICON,
-                                         NULL);
+  attributes = get_required_attributes ();
 
   self->cancellable = g_cancellable_new ();
 
diff --git a/gnome-flashback/libdesktop/gf-icon.c b/gnome-flashback/libdesktop/gf-icon.c
index 6fa075f..1239da7 100644
--- a/gnome-flashback/libdesktop/gf-icon.c
+++ b/gnome-flashback/libdesktop/gf-icon.c
@@ -388,6 +388,18 @@ gf_icon_get_file (GfIcon *self)
   return self->file;
 }
 
+gboolean
+gf_icon_is_hidden (GfIcon *self)
+{
+  gboolean hidden;
+  gboolean backup;
+
+  hidden = g_file_info_get_is_hidden (self->info);
+  backup = g_file_info_get_is_backup (self->info);
+
+  return hidden || backup;
+}
+
 void
 gf_icon_set_selected (GfIcon              *self,
                       gboolean             selected,
diff --git a/gnome-flashback/libdesktop/gf-icon.h b/gnome-flashback/libdesktop/gf-icon.h
index faa2e8b..ae43da4 100644
--- a/gnome-flashback/libdesktop/gf-icon.h
+++ b/gnome-flashback/libdesktop/gf-icon.h
@@ -38,6 +38,8 @@ GtkWidget *gf_icon_new          (GFile               *file,
 
 GFile     *gf_icon_get_file     (GfIcon              *self);
 
+gboolean   gf_icon_is_hidden    (GfIcon              *self);
+
 void       gf_icon_set_selected (GfIcon              *self,
                                  gboolean             selected,
                                  GfIconSelectedFlags  flags);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]