[Xfce4-commits] [xfce/thunar] 01/01: Replace deprecated G_FILE_MONITOR_EVENT_MOVED (Bug #16328)

noreply at xfce.org noreply at xfce.org
Sun Jan 5 21:02:14 CET 2020


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar.

commit e19c5698de676cf2bdbf6bb70013e3266852a9c8
Author: Andre Miranda <andreldm at xfce.org>
Date:   Wed Jan 1 19:30:10 2020 -0300

    Replace deprecated G_FILE_MONITOR_EVENT_MOVED (Bug #16328)
---
 thunar/thunar-file.c   | 20 +++++++++++++++++++-
 thunar/thunar-folder.c | 14 ++++++++++++--
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 1ac9a1e..b647251 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -800,7 +800,13 @@ thunar_file_monitor (GFileMonitor     *monitor,
   if (g_file_equal (event_path, file->gfile))
     {
       /* the event occurred for the monitored ThunarFile */
+#if GLIB_CHECK_VERSION (2, 46, 0)
+      if (event_type == G_FILE_MONITOR_EVENT_RENAMED ||
+          event_type == G_FILE_MONITOR_EVENT_MOVED_IN ||
+          event_type == G_FILE_MONITOR_EVENT_MOVED_OUT)
+#else
       if (event_type == G_FILE_MONITOR_EVENT_MOVED)
+#endif
         {
           G_LOCK (file_rename_mutex);
           thunar_file_monitor_moved (file, other_path);
@@ -816,7 +822,13 @@ thunar_file_monitor (GFileMonitor     *monitor,
       /* The event did not occur for the monitored ThunarFile, but for
          a file that is contained in ThunarFile which is actually a
          directory. */
+#if GLIB_CHECK_VERSION (2, 46, 0)
+      if (event_type == G_FILE_MONITOR_EVENT_RENAMED ||
+          event_type == G_FILE_MONITOR_EVENT_MOVED_IN ||
+          event_type == G_FILE_MONITOR_EVENT_MOVED_OUT)
+#else
       if (event_type == G_FILE_MONITOR_EVENT_MOVED)
+#endif
         {
           /* reload the target file if cached */
           if (other_path == NULL)
@@ -3950,7 +3962,13 @@ thunar_file_watch (ThunarFile *file)
       file_watch->watch_count = 1;
 
       /* create a file or directory monitor */
-      file_watch->monitor = g_file_monitor (file->gfile, G_FILE_MONITOR_WATCH_MOUNTS | G_FILE_MONITOR_SEND_MOVED, NULL, &error);
+      file_watch->monitor = g_file_monitor (file->gfile, G_FILE_MONITOR_WATCH_MOUNTS |
+#if GLIB_CHECK_VERSION (2, 46, 0)
+                                            G_FILE_MONITOR_WATCH_MOVES, NULL, &error);
+#else
+                                            G_FILE_MONITOR_SEND_MOVED, NULL, &error);
+#endif
+
       if (G_UNLIKELY (file_watch->monitor == NULL))
         {
           g_debug ("Failed to create file monitor: %s", error->message);
diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c
index 16c825e..7acd0f1 100644
--- a/thunar/thunar-folder.c
+++ b/thunar/thunar-folder.c
@@ -139,7 +139,12 @@ thunar_folder_constructed (GObject *object)
   GError       *error  = NULL;
 
   folder->monitor = g_file_monitor_directory (thunar_file_get_file (folder->corresponding_file),
-                                          G_FILE_MONITOR_SEND_MOVED, NULL, &error);
+#if GLIB_CHECK_VERSION (2, 46, 0)
+                                              G_FILE_MONITOR_WATCH_MOVES, NULL, &error);
+#else
+                                              G_FILE_MONITOR_SEND_MOVED, NULL, &error);
+#endif
+
   if (G_LIKELY (folder->monitor != NULL))
       g_signal_connect (folder->monitor, "changed", G_CALLBACK (thunar_folder_monitor), folder);
   else
@@ -795,8 +800,13 @@ thunar_folder_monitor (GFileMonitor     *monitor,
                   g_object_unref (destroyed);
                 }
             }
-
+#if GLIB_CHECK_VERSION (2, 46, 0)
+          else if (event_type == G_FILE_MONITOR_EVENT_RENAMED ||
+                   event_type == G_FILE_MONITOR_EVENT_MOVED_IN ||
+                   event_type == G_FILE_MONITOR_EVENT_MOVED_OUT)
+#else
           else if (event_type == G_FILE_MONITOR_EVENT_MOVED)
+#endif
             {
               /* destroy the old file and update the new one */
               thunar_file_destroy (lp->data);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list