[Xfce4-commits] <midori:master> Use GIO to determine backup/ hidden files in Addons

Christian Dywan noreply at xfce.org
Tue Nov 8 00:30:02 CET 2011


Updating branch refs/heads/master
         to 49317da35c8309afaa39c8a06a46c10124ad51b4 (commit)
       from 0c611f8d6a2b94b849ceac8fc20c533f2d98e323 (commit)

commit 49317da35c8309afaa39c8a06a46c10124ad51b4
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Nov 7 23:09:26 2011 +0100

    Use GIO to determine backup/ hidden files in Addons
    
    So Windows-specific behavior is taken into account.

 extensions/addons.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/extensions/addons.c b/extensions/addons.c
index 7db7ab5..f23e042 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -1781,13 +1781,19 @@ addons_directory_monitor_changed (GFileMonitor*     monitor,
                                   GFileMonitorEvent flags,
                                   MidoriExtension*  extension)
 {
-    char* basename;
+    GFileInfo* info;
     GSource* source;
 
-    basename = g_file_get_basename (child);
-    if (g_str_has_prefix (basename, ".") ||
-        g_str_has_suffix (basename, "~")) /* Hidden or temporary files */
-        return;
+    info = g_file_query_info (child,
+        "standard::is-hidden,standard::is-backup", 0, NULL, NULL);
+    if (info != NULL)
+    {
+        gboolean hidden = g_file_info_get_is_hidden (info)
+                       || g_file_info_get_is_backup (info);
+        g_object_unref (info);
+        if (hidden)
+            return;
+    }
 
     /* We receive a lot of change events, so we use a timeout to trigger
        elements update only once */


More information about the Xfce4-commits mailing list