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

noreply at xfce.org noreply at xfce.org
Thu Jan 9 04:42:56 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/xfdesktop.

commit 00c5f70a943194c36f73cc15b93ded7d2ac7c71b
Author: Andre Miranda <andreldm at xfce.org>
Date:   Thu Jan 9 00:23:20 2020 -0300

    Replace deprecated G_FILE_MONITOR_EVENT_MOVED (Bug #16342)
---
 src/xfdesktop-file-icon-manager.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 8a00359..1e5d29f 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2680,14 +2680,17 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor     *monitor,
     gchar *filename;
 
     switch(event) {
+#if GLIB_CHECK_VERSION(2, 46, 0)
+        case G_FILE_MONITOR_EVENT_RENAMED:
+        case G_FILE_MONITOR_EVENT_MOVED_IN:
+        case G_FILE_MONITOR_EVENT_MOVED_OUT:
+#else
         case G_FILE_MONITOR_EVENT_MOVED:
+#endif
             XF_DEBUG("got a moved event");
 
             icon = g_hash_table_lookup(fmanager->priv->icons, file);
 
-            file_info = g_file_query_info(other_file, XFDESKTOP_FILE_INFO_NAMESPACE,
-                                          G_FILE_QUERY_INFO_NONE, NULL, NULL);
-
             if(icon) {
                 /* Get the old position so we can use it for the new icon */
                 if(!xfdesktop_icon_get_position(XFDESKTOP_ICON(icon), &row, &col)) {
@@ -2700,6 +2703,13 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor     *monitor,
                 xfdesktop_file_icon_manager_remove_icon(fmanager, icon);
             }
 
+            /* In case of MOVED_OUT, other_file will be NULL */
+            if(other_file == NULL)
+                return;
+
+            file_info = g_file_query_info(other_file, XFDESKTOP_FILE_INFO_NAMESPACE,
+                                            G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
             /* Check to see if there's already an other_file represented on
              * the desktop and remove it so there aren't duplicated icons
              * present. */
@@ -2948,7 +2958,11 @@ xfdesktop_file_icon_manager_files_ready(GFileEnumerator *enumerator,
         /* initialize the file monitor */
         if(!fmanager->priv->monitor) {
             fmanager->priv->monitor = g_file_monitor(fmanager->priv->folder,
+#if GLIB_CHECK_VERSION(2, 46, 0)
+                                                     G_FILE_MONITOR_WATCH_MOVES,
+#else
                                                      G_FILE_MONITOR_SEND_MOVED,
+#endif
                                                      NULL, NULL);
             g_signal_connect(fmanager->priv->monitor, "changed",
                              G_CALLBACK(xfdesktop_file_icon_manager_file_changed),

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


More information about the Xfce4-commits mailing list