]> spindle.queued.net Git - midori/commitdiff
Use GIO to determine backup/ hidden files in Addons
authorChristian Dywan <christian@twotoasts.de>
Mon, 7 Nov 2011 22:09:26 +0000 (23:09 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 7 Nov 2011 23:28:07 +0000 (00:28 +0100)
So Windows-specific behavior is taken into account.

extensions/addons.c

index 7db7ab5f6b06ab6261a4d6f6ead36ce6e0f7107c..f23e042958cfcfca0dbbb1dbc1122c19b34ec2fa 100644 (file)
@@ -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 */