[Xfce4-commits] <thunar:master> Add function to print file reload changes.
Nick Schermer
noreply at xfce.org
Thu Dec 1 19:06:01 CET 2011
Updating branch refs/heads/master
to 05126280ba733053dbac6883ad62f04665529ba3 (commit)
from 6f813ba48553e5b95a83bfa8463b20b8ee4607c4 (commit)
commit 05126280ba733053dbac6883ad62f04665529ba3
Author: Nick Schermer <nick at xfce.org>
Date: Thu Dec 1 19:03:46 2011 +0100
Add function to print file reload changes.
Print the changes of a file before and after reload, this
makes it easier to track looking reloads.
thunar/thunar-folder.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c
index 62015fe..73eb774 100644
--- a/thunar/thunar-folder.c
+++ b/thunar/thunar-folder.c
@@ -29,6 +29,8 @@
#include <thunar/thunar-job.h>
#include <thunar/thunar-private.h>
+#define DEBUG_FILE_CHANGES FALSE
+
/* property identifiers */
@@ -511,6 +513,63 @@ thunar_folder_file_destroyed (ThunarFileMonitor *file_monitor,
+#if DEBUG_FILE_CHANGES
+static void
+thunar_file_infos_equal (ThunarFile *file,
+ GFile *event_file)
+{
+ gchar **attrs;
+ GFileInfo *info1 = G_FILE_INFO (file->info);
+ GFileInfo *info2;
+ guint i;
+ gchar *attr1, *attr2;
+ gboolean printed = FALSE;
+ gchar *bname;
+
+ attrs = g_file_info_list_attributes (info1, NULL);
+ info2 = g_file_query_info (event_file, THUNARX_FILE_INFO_NAMESPACE,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
+ if (info1 != NULL && info2 != NULL)
+ {
+ for (i = 0; attrs[i] != NULL; i++)
+ {
+ if (g_file_info_has_attribute (info2, attrs[i]))
+ {
+ attr1 = g_file_info_get_attribute_as_string (info1, attrs[i]);
+ attr2 = g_file_info_get_attribute_as_string (info2, attrs[i]);
+
+ if (g_strcmp0 (attr1, attr2) != 0)
+ {
+ if (!printed)
+ {
+ bname = g_file_get_basename (event_file);
+ g_print ("%s\n", bname);
+ g_free (bname);
+
+ printed = TRUE;
+ }
+
+ g_print (" %s: %s -> %s\n", attrs[i], attr1, attr2);
+ }
+
+ g_free (attr1);
+ g_free (attr2);
+ }
+ }
+
+ g_object_unref (info2);
+ }
+
+ if (printed)
+ g_print ("\n");
+
+ g_free (attrs);
+}
+#endif
+
+
+
static void
thunar_folder_monitor (GFileMonitor *monitor,
GFile *event_file,
@@ -557,7 +616,12 @@ thunar_folder_monitor (GFileMonitor *monitor,
if (event_type == G_FILE_MONITOR_EVENT_DELETED)
thunar_file_destroy (lp->data);
else
- thunar_file_reload (lp->data);
+ {
+#if DEBUG_FILE_CHANGES
+ thunar_file_infos_equal (lp->data, event_file);
+#endif
+ thunar_file_reload (lp->data);
+ }
}
}
else
More information about the Xfce4-commits
mailing list