[gvfs/gdbus: 28/30] gdbus: Don't wait for metadata daemon reply on file_moved/removed



commit 550a0a5f89c5920bd003b95fd60d311c7c7d026e
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Mon May 21 12:37:52 2012 +0200

    gdbus: Don't wait for metadata daemon reply on file_moved/removed
    
    We don't need the result, let's make these calls async and retain
    the old behaviour.

 client/gdaemonvfs.c |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 88a6ab9..d8dc923 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -1452,6 +1452,14 @@ g_daemon_vfs_local_file_set_attributes (GVfs       *vfs,
 }
 
 static void
+metadata_remove_cb (GVfsMetadata *proxy,
+                    GAsyncResult *res,
+                    gpointer user_data)
+{
+  gvfs_metadata_call_remove_finish (proxy, res, NULL);
+}
+
+static void
 g_daemon_vfs_local_file_removed (GVfs       *vfs,
 				 const char *filename)
 {
@@ -1473,11 +1481,13 @@ g_daemon_vfs_local_file_removed (GVfs       *vfs,
       if (proxy)
         {
           metatreefile = meta_tree_get_filename (tree);
-          gvfs_metadata_call_remove_sync (proxy,
-                                          metatreefile,
-                                          tree_path,
-                                          NULL,
-                                          NULL);
+          /* we don't care about the result, let's queue the call and don't block */
+          gvfs_metadata_call_remove (proxy,
+                                     metatreefile,
+                                     tree_path,
+                                     NULL,
+                                     (GAsyncReadyCallback) metadata_remove_cb,
+                                     NULL);
         }
       
       meta_tree_unref (tree);
@@ -1488,6 +1498,14 @@ g_daemon_vfs_local_file_removed (GVfs       *vfs,
 }
 
 static void
+metadata_move_cb (GVfsMetadata *proxy,
+                  GAsyncResult *res,
+                  gpointer user_data)
+{
+  gvfs_metadata_call_move_finish (proxy, res, NULL);
+}
+
+static void
 g_daemon_vfs_local_file_moved (GVfs       *vfs,
 			       const char *source,
 			       const char *dest)
@@ -1515,12 +1533,14 @@ g_daemon_vfs_local_file_moved (GVfs       *vfs,
       if (proxy)
         {
           metatreefile = meta_tree_get_filename (tree1);
-          gvfs_metadata_call_move_sync (proxy,
-                                        metatreefile,
-                                        tree_path1,
-                                        tree_path2,
-                                        NULL,
-                                        NULL);
+          /* we don't care about the result, let's queue the call and don't block */
+          gvfs_metadata_call_move (proxy,
+                                   metatreefile,
+                                   tree_path1,
+                                   tree_path2,
+                                   NULL,
+                                   (GAsyncReadyCallback) metadata_move_cb,
+                                   NULL);
         }
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]