[gvfs] trash: Don't use try_ for blocking methods



commit 052682c8a22bf8d7c86fb0f086a119dd7fec4c6b
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Tue Dec 17 09:14:48 2013 +0200

    trash: Don't use try_ for blocking methods
    
    Don't use the try_ variants of the GVfsBackend methods for methods that
    could block.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720589

 daemon/gvfsbackendtrash.c |   80 ++++++++++++++++----------------------------
 1 files changed, 29 insertions(+), 51 deletions(-)
---
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c
index 1f6e624..b199d59 100644
--- a/daemon/gvfsbackendtrash.c
+++ b/daemon/gvfsbackendtrash.c
@@ -220,7 +220,7 @@ trash_backend_get_file (GVfsBackendTrash  *backend,
 }
 
 /* ======================= method implementations ======================= */
-static gboolean
+static void
 trash_backend_open_for_read (GVfsBackend        *vfs_backend,
                              GVfsJobOpenForRead *job,
                              const char         *filename)
@@ -251,18 +251,16 @@ trash_backend_open_for_read (GVfsBackend        *vfs_backend,
               g_vfs_job_open_for_read_set_can_seek (job, TRUE);
               g_vfs_job_succeeded (G_VFS_JOB (job));
 
-              return TRUE;
+              return;
             }
         }
     }
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
-
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_read (GVfsBackend       *backend,
                     GVfsJobRead       *job,
                     GVfsBackendHandle  handle,
@@ -280,16 +278,14 @@ trash_backend_read (GVfsBackend       *backend,
       g_vfs_job_read_set_size (job, bytes);
       g_vfs_job_succeeded (G_VFS_JOB (job));
 
-      return TRUE;
+      return;
     }
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
-
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_seek_on_read (GVfsBackend       *backend,
                             GVfsJobSeekRead   *job,
                             GVfsBackendHandle  handle,
@@ -303,16 +299,14 @@ trash_backend_seek_on_read (GVfsBackend       *backend,
       g_vfs_job_seek_read_set_offset (job, g_seekable_tell (handle));
       g_vfs_job_succeeded (G_VFS_JOB (job));
 
-      return TRUE;
+      return;
     }
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
-
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_close_read (GVfsBackend       *backend,
                           GVfsJobCloseRead  *job,
                           GVfsBackendHandle  handle)
@@ -324,15 +318,13 @@ trash_backend_close_read (GVfsBackend       *backend,
       g_vfs_job_succeeded (G_VFS_JOB (job));
       g_object_unref (handle);
 
-      return TRUE;
+      return;
     }
 
   g_object_unref (handle);
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
-
-  return TRUE;
 }
 
 static gboolean
@@ -357,7 +349,7 @@ trash_backend_schedule_thaw (GVfsBackendTrash *backend)
                                             backend);
 }
 
-static gboolean
+static void
 trash_backend_delete (GVfsBackend   *vfs_backend,
                       GVfsJobDelete *job,
                       const char    *filename)
@@ -395,7 +387,7 @@ trash_backend_delete (GVfsBackend   *vfs_backend,
                   g_vfs_job_succeeded (G_VFS_JOB (job));
                   trash_item_unref (item);
 
-                  return TRUE;
+                  return;
                 }
             }
 
@@ -405,11 +397,9 @@ trash_backend_delete (GVfsBackend   *vfs_backend,
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
-  
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_pull (GVfsBackend           *vfs_backend,
                     GVfsJobPull           *job,
                     const gchar           *source,
@@ -462,7 +452,7 @@ trash_backend_pull (GVfsBackend           *vfs_backend,
                   trash_item_unref (item);
                   g_object_unref (real);
 
-                  return TRUE;
+                  return;
                 }
             }
 
@@ -474,8 +464,6 @@ trash_backend_pull (GVfsBackend           *vfs_backend,
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
-  
-  return TRUE;
 }
 
 static void
@@ -633,7 +621,7 @@ trash_backend_enumerate_non_root (GVfsBackendTrash      *backend,
   g_error_free (error);
 }
 
-static gboolean
+static void
 trash_backend_enumerate (GVfsBackend           *vfs_backend,
                          GVfsJobEnumerate      *job,
                          const char            *filename,
@@ -651,11 +639,9 @@ trash_backend_enumerate (GVfsBackend           *vfs_backend,
                                       attribute_matcher, flags);
   else
     trash_backend_enumerate_root (backend, job, attribute_matcher, flags);
-
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_mount (GVfsBackend  *vfs_backend,
                      GVfsJobMount *job,
                      GMountSpec   *mount_spec,
@@ -673,11 +659,9 @@ trash_backend_mount (GVfsBackend  *vfs_backend,
   backend->watcher = trash_watcher_new (backend->root);
 
   g_vfs_job_succeeded (G_VFS_JOB (job));
-
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_query_info (GVfsBackend           *vfs_backend,
                           GVfsJobQueryInfo      *job,
                           const char            *filename,
@@ -718,7 +702,7 @@ trash_backend_query_info (GVfsBackend           *vfs_backend,
               trash_item_unref (item);
               g_object_unref (real_info);
 
-              return TRUE;
+              return;
             }
 
           trash_item_unref (item);
@@ -752,8 +736,6 @@ trash_backend_query_info (GVfsBackend           *vfs_backend,
 
       g_vfs_job_succeeded (G_VFS_JOB (job));
     }
-
-  return TRUE;
 }
 
 static gboolean
@@ -780,7 +762,7 @@ trash_backend_query_fs_info (GVfsBackend           *vfs_backend,
   return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_create_dir_monitor (GVfsBackend          *vfs_backend,
                                   GVfsJobCreateMonitor *job,
                                   const char           *filename,
@@ -797,11 +779,9 @@ trash_backend_create_dir_monitor (GVfsBackend          *vfs_backend,
   g_vfs_job_create_monitor_set_monitor (job, monitor);
   g_vfs_job_succeeded (G_VFS_JOB (job));
   g_object_unref (monitor);
-
-  return TRUE;
 }
 
-static gboolean
+static void
 trash_backend_create_file_monitor (GVfsBackend          *vfs_backend,
                                    GVfsJobCreateMonitor *job,
                                    const char           *filename,
@@ -818,8 +798,6 @@ trash_backend_create_file_monitor (GVfsBackend          *vfs_backend,
   g_vfs_job_create_monitor_set_monitor (job, monitor);
   g_vfs_job_succeeded (G_VFS_JOB (job));
   g_object_unref (monitor);
-
-  return TRUE;
 }
 
 static void
@@ -867,16 +845,16 @@ g_vfs_backend_trash_class_init (GVfsBackendTrashClass *class)
 
   gobject_class->finalize = trash_backend_finalize;
 
-  backend_class->try_mount = trash_backend_mount;
-  backend_class->try_open_for_read = trash_backend_open_for_read;
-  backend_class->try_read = trash_backend_read;
-  backend_class->try_seek_on_read = trash_backend_seek_on_read;
-  backend_class->try_close_read = trash_backend_close_read;
-  backend_class->try_query_info = trash_backend_query_info;
+  backend_class->mount = trash_backend_mount;
+  backend_class->open_for_read = trash_backend_open_for_read;
+  backend_class->read = trash_backend_read;
+  backend_class->seek_on_read = trash_backend_seek_on_read;
+  backend_class->close_read = trash_backend_close_read;
+  backend_class->query_info = trash_backend_query_info;
   backend_class->try_query_fs_info = trash_backend_query_fs_info;
-  backend_class->try_enumerate = trash_backend_enumerate;
-  backend_class->try_delete = trash_backend_delete;
-  backend_class->try_pull = trash_backend_pull;
-  backend_class->try_create_dir_monitor = trash_backend_create_dir_monitor;
-  backend_class->try_create_file_monitor = trash_backend_create_file_monitor;
+  backend_class->enumerate = trash_backend_enumerate;
+  backend_class->delete = trash_backend_delete;
+  backend_class->pull = trash_backend_pull;
+  backend_class->create_dir_monitor = trash_backend_create_dir_monitor;
+  backend_class->create_file_monitor = trash_backend_create_file_monitor;
 }


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