[gvfs] recent: Implement query_info_on_read()



commit 41790cb90f2c4b0c647ea1df211387c9effa6133
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Wed Dec 18 13:59:24 2013 +0200

    recent: Implement query_info_on_read()
    
    Implement query_info_on_read() by proxying to the underlying stream's
    implementation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720806

 daemon/gvfsbackendrecent.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackendrecent.c b/daemon/gvfsbackendrecent.c
index faac338..e9dcfb7 100644
--- a/daemon/gvfsbackendrecent.c
+++ b/daemon/gvfsbackendrecent.c
@@ -21,6 +21,7 @@
 #include "gvfsjobqueryinfo.h"
 #include "gvfsjobenumerate.h"
 #include "gvfsjobseekread.h"
+#include "gvfsjobqueryinforead.h"
 #include "gvfsjobread.h"
 
 typedef GVfsBackendClass GVfsBackendRecentClass;
@@ -200,6 +201,33 @@ recent_backend_seek_on_read (GVfsBackend       *vfs_backend,
   return TRUE;
 }
 
+static void
+recent_backend_query_info_on_read (GVfsBackend           *backend,
+                                   GVfsJobQueryInfoRead  *job,
+                                   GVfsBackendHandle      handle,
+                                   GFileInfo             *info,
+                                   GFileAttributeMatcher *matcher)
+{
+  GError *error = NULL;
+  GFileInfo *real_info;
+
+  real_info = g_file_input_stream_query_info (handle,
+                                              job->attributes,
+                                              G_VFS_JOB (job)->cancellable,
+                                              &error);
+  if (real_info)
+    {
+      g_file_info_copy_into (real_info, info);
+      g_vfs_job_succeeded (G_VFS_JOB (job));
+      g_object_unref (real_info);
+    }
+  else
+    {
+      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+      g_error_free (error);
+    }
+}
+
 static gboolean
 recent_backend_close_read (GVfsBackend       *vfs_backend,
                            GVfsJobCloseRead  *job,
@@ -681,6 +709,7 @@ g_vfs_backend_recent_class_init (GVfsBackendRecentClass *class)
   backend_class->try_open_for_read = recent_backend_open_for_read;
   backend_class->try_read = recent_backend_read;
   backend_class->try_seek_on_read = recent_backend_seek_on_read;
+  backend_class->query_info_on_read = recent_backend_query_info_on_read;
   backend_class->try_close_read = recent_backend_close_read;
   backend_class->try_query_info = recent_backend_query_info;
   backend_class->try_query_fs_info = recent_backend_query_fs_info;


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