]> git.pld-linux.org Git - packages/gvfs.git/blob - set_attributes_from_info-v1.patch
fix samba meson option
[packages/gvfs.git] / set_attributes_from_info-v1.patch
1 https://bugzilla.gnome.org/show_bug.cgi?id=527339
2
3 diff -urN gvfs-1.14.0.new/client/gdaemonfile.c gvfs-1.14.0/client/gdaemonfile.c
4 --- gvfs-1.14.0.new/client/gdaemonfile.c        2012-09-30 22:04:15.383736541 +0200
5 +++ gvfs-1.14.0/client/gdaemonfile.c    2012-09-30 23:02:25.536442767 +0200
6 @@ -2679,6 +2679,51 @@
7    return TRUE;
8  }
9  
10 +static gboolean
11 +g_daemon_file_set_attributes_from_info (GFile *file,
12 +                                       GFileInfo *info,
13 +                                       GFileQueryInfoFlags flags,
14 +                                       GCancellable *cancellable,
15 +                                       GError **error)
16 +{
17 +  GVfsDBusMount *proxy;
18 +  char *path;
19 +  gboolean res;
20 +  GError *my_error;
21 +
22 + retry:
23 +  proxy = create_proxy_for_file (file, NULL, &path, NULL, cancellable, error);
24 +  if (proxy == NULL)
25 +    return FALSE;
26 +
27 +  my_error = NULL;
28 +  res = gvfs_dbus_mount_call_set_attributes_from_info_sync (proxy,
29 +                                                           path,
30 +                                                           flags,
31 +                                                           _g_dbus_append_file_info (info),
32 +                                                           cancellable,
33 +                                                           &my_error);
34 +  g_free (path);
35 +
36 +  if (! res)
37 +    {
38 +      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
39 +        _g_dbus_send_cancelled_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy)));
40 +      else
41 +      if (g_error_matches (my_error, G_VFS_ERROR, G_VFS_ERROR_RETRY))
42 +       {
43 +         g_clear_error (&my_error);
44 +         g_object_unref (proxy);
45 +         goto retry;
46 +       }
47 +      _g_propagate_error_stripped (error, my_error);
48 +      return FALSE;
49 +    }
50 +
51 +  g_object_unref (proxy);
52 +
53 +  return TRUE;
54 +}
55  
56  typedef struct
57  {
58 @@ -3698,6 +3743,7 @@
59    iface->query_settable_attributes = g_daemon_file_query_settable_attributes;
60    iface->query_writable_namespaces = g_daemon_file_query_writable_namespaces;
61    iface->set_attribute = g_daemon_file_set_attribute;
62 +  iface->set_attributes_from_info = g_daemon_file_set_attributes_from_info;
63    iface->make_symbolic_link = g_daemon_file_make_symbolic_link;
64    iface->monitor_dir = g_daemon_file_monitor_dir;
65    iface->monitor_file = g_daemon_file_monitor_file;
66 diff -urN gvfs-1.14.0.new/common/org.gtk.vfs.xml gvfs-1.14.0/common/org.gtk.vfs.xml
67 --- gvfs-1.14.0.new/common/org.gtk.vfs.xml      2012-09-30 22:04:15.377066577 +0200
68 +++ gvfs-1.14.0/common/org.gtk.vfs.xml  2012-09-30 22:56:26.665247761 +0200
69 @@ -314,6 +314,11 @@
70        <arg type='u' name='flags' direction='in'/>
71        <arg type='(suv)' name='attribute' direction='in'/>
72      </method>
73 +    <method name="SetAttributesFromInfo">
74 +      <arg type='ay' name='path_data' direction='in'/>
75 +      <arg type='u' name='flags' direction='in'/>
76 +      <arg type='a(suv)' name='info' direction='in'/>
77 +    </method>
78      <method name="QuerySettableAttributes">
79        <arg type='ay' name='path_data' direction='in'/>
80        <arg type='a(suu)' name='list' direction='out'/>
81 diff -urN gvfs-1.14.0.new/daemon/gvfsbackend.c gvfs-1.14.0/daemon/gvfsbackend.c
82 --- gvfs-1.14.0.new/daemon/gvfsbackend.c        2012-09-30 22:04:15.393741487 +0200
83 +++ gvfs-1.14.0/daemon/gvfsbackend.c    2012-09-30 23:40:33.814046064 +0200
84 @@ -55,6 +55,7 @@
85  #include <gvfsjobpush.h>
86  #include <gvfsjobpull.h>
87  #include <gvfsjobsetattribute.h>
88 +#include <gvfsjobsetattributesfrominfo.h>
89  #include <gvfsjobqueryattributes.h>
90  #include <gvfsdbus.h>
91  
92 @@ -271,6 +272,7 @@
93    g_signal_connect (skeleton, "handle-query-settable-attributes", G_CALLBACK (g_vfs_job_query_settable_attributes_new_handle), data);
94    g_signal_connect (skeleton, "handle-query-writable-namespaces", G_CALLBACK (g_vfs_job_query_writable_namespaces_new_handle), data);
95    g_signal_connect (skeleton, "handle-set-attribute", G_CALLBACK (g_vfs_job_set_attribute_new_handle), data);
96 +  g_signal_connect (skeleton, "handle-set-attributes-from-info", G_CALLBACK (g_vfs_job_set_attributes_from_info_new_handle), data);
97    g_signal_connect (skeleton, "handle-poll-mountable", G_CALLBACK (g_vfs_job_poll_mountable_new_handle), data);
98    g_signal_connect (skeleton, "handle-start-mountable", G_CALLBACK (g_vfs_job_start_mountable_new_handle), data);
99    g_signal_connect (skeleton, "handle-stop-mountable", G_CALLBACK (g_vfs_job_stop_mountable_new_handle), data);
100 diff -urN gvfs-1.14.0.new/daemon/gvfsbackend.h gvfs-1.14.0/daemon/gvfsbackend.h
101 --- gvfs-1.14.0.new/daemon/gvfsbackend.h        2012-09-30 22:04:15.387071523 +0200
102 +++ gvfs-1.14.0/daemon/gvfsbackend.h    2012-09-30 23:08:49.801027687 +0200
103 @@ -72,6 +72,7 @@
104  typedef struct _GVfsJobPush             GVfsJobPush;
105  typedef struct _GVfsJobPull             GVfsJobPull;
106  typedef struct _GVfsJobSetAttribute     GVfsJobSetAttribute;
107 +typedef struct _GVfsJobSetAttributesFromInfo     GVfsJobSetAttributesFromInfo;
108  typedef struct _GVfsJobQueryAttributes  GVfsJobQueryAttributes;
109  typedef struct _GVfsJobCreateMonitor    GVfsJobCreateMonitor;
110  
111 @@ -396,6 +397,17 @@
112                                  GFileAttributeType type,
113                                  gpointer value_p,
114                                  GFileQueryInfoFlags flags);
115 +  void (*set_attributes_from_info) (GVfsBackend *backend,
116 +                                GVfsJobSetAttributesFromInfo *job,
117 +                                const char *filename,
118 +                                GFileInfo *info,
119 +                                GFileQueryInfoFlags flags);
120 +  gboolean (*try_set_attributes_from_info) (GVfsBackend *backend,
121 +                                GVfsJobSetAttributesFromInfo *job,
122 +                                const char *filename,
123 +                                GFileInfo *info,
124 +                                GFileQueryInfoFlags flags);
125 +
126    void     (*create_dir_monitor)(GVfsBackend *backend,
127                                  GVfsJobCreateMonitor *job,
128                                  const char *filename,
129 diff -urN gvfs-1.14.0.new/daemon/gvfsbackendsftp.c gvfs-1.14.0/daemon/gvfsbackendsftp.c
130 --- gvfs-1.14.0.new/daemon/gvfsbackendsftp.c    2012-09-30 22:04:15.390406505 +0200
131 +++ gvfs-1.14.0/daemon/gvfsbackendsftp.c        2012-09-30 23:48:52.948008785 +0200
132 @@ -4575,9 +4575,38 @@
133    g_file_attribute_info_list_add (list,
134                                   G_FILE_ATTRIBUTE_UNIX_MODE,
135                                   G_FILE_ATTRIBUTE_TYPE_UINT32,
136 -                                 G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE |
137                                   G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED);
138 +  /* G_FILE_INFO_COPY_WHEN_MOVED to ensure that this is copied when
139 +     G_FILE_COPY_ALL_METADATA flag is set, but is not copied by default */
140 +  g_file_attribute_info_list_add (list,
141 +                                  G_FILE_ATTRIBUTE_TIME_ACCESS,
142 +                                 G_FILE_ATTRIBUTE_TYPE_UINT32,
143 +                                 G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED);
144 +  g_file_attribute_info_list_add (list,
145 +                                  G_FILE_ATTRIBUTE_TIME_CHANGED,
146 +                                  G_FILE_ATTRIBUTE_TYPE_UINT32,
147 +                                  G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED);
148 +  /* do not make uid/gid settable: it will cause massive problems
149 +     when G_FILE_COPY_ALL_METADATA is set. */
150 +
151 +  g_vfs_job_query_attributes_set_list (job, list);
152 +  g_vfs_job_succeeded (G_VFS_JOB (job));
153 +  g_file_attribute_info_list_unref (list);
154    
155 +  return TRUE;
156 +}
157 +
158 +static gboolean
159 +try_query_writable_namespaces (GVfsBackend *backend,
160 +                              GVfsJobQueryAttributes *job,
161 +                              const char *filename)
162 +{
163 +  GFileAttributeInfoList *list;
164 +
165 +  list = g_file_attribute_info_list_new ();
166 +
167 +  /* generally, we don't have any writable namespaces */
168 +
169    g_vfs_job_query_attributes_set_list (job, list);
170    g_vfs_job_succeeded (G_VFS_JOB (job));
171    g_file_attribute_info_list_unref (list);
172 @@ -4612,6 +4641,8 @@
173    GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
174    GDataOutputStream *command;
175  
176 +  /* atime and mtime must be set in a single sftp command. Therefore, to set them,
177 +     you must use try_set_attributes_from_info () */
178    if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) != 0)
179      {
180        g_vfs_job_failed (G_VFS_JOB (job),
181 @@ -4640,6 +4671,103 @@
182  }
183  
184  static void
185 +set_attributes_from_info_reply (GVfsBackendSftp *backend,
186 +                               int reply_type,
187 +                               GDataInputStream *reply,
188 +                               guint32 len,
189 +                               GVfsJob *job,
190 +                               gpointer user_data)
191 +{
192 +  if (reply_type == SSH_FXP_STATUS)
193 +    result_from_status (job, reply, -1, -1);
194 +  else 
195 +    g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_FAILED,
196 +                     _("Invalid reply received"));
197 +}
198 +
199 +static gboolean
200 +try_set_attributes_from_info (GVfsBackend *backend,
201 +                             GVfsJobSetAttributesFromInfo *job,
202 +                             const char *filename,
203 +                             GFileInfo *info,
204 +                             GFileQueryInfoFlags flags)
205 +{
206 +  GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
207 +  GDataOutputStream *command;
208 +  char **attributes;
209 +  int i;
210 +  guint64 tmp64;
211 +  guint32 sftp_attributes = 0, sftp_mode, sftp_atime, sftp_mtime;
212 +  gboolean is_atime_set = FALSE, is_mtime_set = FALSE;
213 +
214 +  attributes = g_file_info_list_attributes (info, NULL);
215 +  for (i=0; attributes[i]; i++)
216 +    {
217 +      if (!strcmp (attributes[i], G_FILE_ATTRIBUTE_UNIX_MODE) )
218 +        {
219 +          sftp_attributes |= SSH_FILEXFER_ATTR_PERMISSIONS;
220 +          sftp_mode = 0777 & g_file_info_get_attribute_uint32 (info, attributes[i]);
221 +        }
222 +      else if (!strcmp (attributes[i], G_FILE_ATTRIBUTE_TIME_ACCESS) )
223 +        {
224 +          sftp_attributes |= SSH_FILEXFER_ATTR_ACMODTIME;
225 +          /* assume year < 2107 */
226 +          sftp_atime = g_file_info_get_attribute_uint64 (info, attributes[i]); 
227 +          is_atime_set = TRUE;
228 +        }
229 +      else if (!strcmp (attributes[i], G_FILE_ATTRIBUTE_TIME_CHANGED) )
230 +        {
231 +          sftp_attributes |= SSH_FILEXFER_ATTR_ACMODTIME;
232 +          /* assume year < 2107 */
233 +          sftp_mtime = g_file_info_get_attribute_uint64 (info, attributes[i]);
234 +          is_mtime_set = TRUE;
235 +        }
236 +      else
237 +        g_vfs_job_failed (G_VFS_JOB (job),
238 +                         G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
239 +                         _("Operation unsupported"));
240 +    }
241 +  g_strfreev (attributes);
242 +
243 +  /* must set atime and mtime in a single command */
244 +  if ( (is_atime_set && !is_mtime_set) || (is_mtime_set && !is_atime_set))
245 +    {
246 +      sftp_attributes &= ~SSH_FILEXFER_ATTR_ACMODTIME;
247 +      g_vfs_job_failed (G_VFS_JOB (job),
248 +                        G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
249 +                        _("Operation unsupported"));
250 +    }
251 +
252 +  if (sftp_attributes)
253 +    {
254 +      command = new_command_stream (op_backend,SSH_FXP_SETSTAT);
255 +      put_string (command, filename);
256 +      g_data_output_stream_put_uint32 (command, sftp_attributes, NULL, NULL);
257 +
258 +      if (sftp_attributes & SSH_FILEXFER_ATTR_PERMISSIONS)
259 +        g_data_output_stream_put_uint32 (command, sftp_mode, NULL, NULL);
260 +      if (sftp_attributes & SSH_FILEXFER_ATTR_ACMODTIME)
261 +        {
262 +          g_data_output_stream_put_uint32 (command, sftp_atime, NULL, NULL);
263 +          g_data_output_stream_put_uint32 (command, sftp_mtime, NULL, NULL);
264 +        }
265 +
266 +      queue_command_stream_and_free (op_backend, command, set_attributes_from_info_reply, G_VFS_JOB (job), NULL);
267 +    }
268 +  else
269 +    {
270 +      if (!i)
271 +        /* no attributes to set - return success */
272 +        g_vfs_job_succeeded (G_VFS_JOB (job));
273 +      else
274 +        g_vfs_job_failed (G_VFS_JOB (job),
275 +                          G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
276 +                          _("Operation unsupported"));
277 +    }
278 +  return TRUE;
279 +}
280 +
281 +static void
282  g_vfs_backend_sftp_class_init (GVfsBackendSftpClass *klass)
283  {
284    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
285 @@ -4672,5 +4800,7 @@
286    backend_class->try_delete = try_delete;
287    backend_class->try_set_display_name = try_set_display_name;
288    backend_class->try_query_settable_attributes = try_query_settable_attributes;
289 +  backend_class->try_query_writable_namespaces = try_query_writable_namespaces;
290    backend_class->try_set_attribute = try_set_attribute;
291 +  backend_class->try_set_attributes_from_info = try_set_attributes_from_info;
292    backend_class->try_push = try_push;
293 diff -urN gvfs-1.14.0.new/daemon/gvfsjobsetattributesfrominfo.c gvfs-1.14.0/daemon/gvfsjobsetattributesfrominfo.c
294 --- gvfs-1.14.0.new/daemon/gvfsjobsetattributesfrominfo.c       1970-01-01 01:00:00.000000000 +0100
295 +++ gvfs-1.14.0/daemon/gvfsjobsetattributesfrominfo.c   2012-09-30 23:32:41.529938013 +0200
296 @@ -0,0 +1,190 @@
297 +/* GVFS - GNOME virtual filesystem layer
298 + *
299 + * Copyright (C) 2008 Alexandre Rostovtsev
300 + *
301 + * This library is free software; you can redistribute it and/or
302 + * modify it under the terms of the GNU Lesser General Public
303 + * License as published by the Free Software Foundation; either
304 + * version 2 of the License, or (at your option) any later version.
305 + *
306 + * This library is distributed in the hope that it will be useful,
307 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
308 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
309 + * Lesser General Public License for more details.
310 + *
311 + * You should have received a copy of the GNU Lesser General
312 + * Public License along with this library; if not, write to the
313 + * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
314 + * Boston, MA 02111-1307, USA.
315 + *
316 + * Author: Alexandre Rostovtsev <tetromino@gmail.com>
317 + */
318 +
319 +#include <config.h>
320 +
321 +#include <unistd.h>
322 +#include <sys/types.h>
323 +#include <sys/socket.h>
324 +#include <sys/un.h>
325 +
326 +#include <glib.h>
327 +#include <glib/gi18n.h>
328 +#include <gio/gio.h>
329 +#include "gvfsjobmove.h"
330 +#include "gvfsdaemonprotocol.h"
331 +#include "gvfsjobsetattribute.h"
332 +#include "gvfsjobsetattributesfrominfo.h"
333 +
334 +G_DEFINE_TYPE (GVfsJobSetAttributesFromInfo, g_vfs_job_set_attributes_from_info, G_VFS_TYPE_JOB_DBUS)
335 +
336 +typedef struct _GVfsJobSetAttributesFromInfoPrivate GVfsJobSetAttributesFromInfoPrivate;
337 +struct _GVfsJobSetAttributesFromInfoPrivate {
338 +    gboolean dispose_has_run;
339 +};
340 +
341 +#define G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_GET_PRIVATE(o) \
342 +  (G_TYPE_INSTANCE_GET_PRIVATE ((o), G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO, GVfsJobSetAttributesFromInfoPrivate))
343 +
344 +static void         run          (GVfsJob        *job);
345 +static gboolean     try          (GVfsJob        *job);
346 +static void         create_reply (GVfsJob               *job,
347 +                                  GVfsDBusMount         *object,
348 +                                  GDBusMethodInvocation *invocation);
349 +
350 +static void
351 +g_vfs_job_set_attributes_from_info_dispose (GObject *object)
352 +{
353 +  GVfsJobSetAttributesFromInfo *job;
354 +  GVfsJobSetAttributesFromInfoPrivate *priv;
355 +
356 +  job = G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO (object);
357 +  priv = G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_GET_PRIVATE (object);
358 +
359 +  if (priv->dispose_has_run)
360 +    return;
361 +
362 +  priv->dispose_has_run = TRUE;
363 +
364 +  g_object_unref (job->info);
365 +
366 +  if (G_OBJECT_CLASS (g_vfs_job_set_attributes_from_info_parent_class)->dispose)
367 +    (*G_OBJECT_CLASS (g_vfs_job_set_attributes_from_info_parent_class)->dispose) (object);
368 +}
369 +
370 +static void
371 +g_vfs_job_set_attributes_from_info_finalize (GObject *object)
372 +{
373 +  GVfsJobSetAttributesFromInfo *job;
374 +
375 +  job = G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO (object);
376 +
377 +  g_free (job->filename);
378 +
379 +  if (G_OBJECT_CLASS (g_vfs_job_set_attributes_from_info_parent_class)->finalize)
380 +    (*G_OBJECT_CLASS (g_vfs_job_set_attributes_from_info_parent_class)->finalize) (object);
381 +}
382 +
383 +static void
384 +g_vfs_job_set_attributes_from_info_class_init (GVfsJobSetAttributesFromInfoClass *klass)
385 +{
386 +  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
387 +  GVfsJobClass *job_class = G_VFS_JOB_CLASS (klass);
388 +  GVfsJobDBusClass *job_dbus_class = G_VFS_JOB_DBUS_CLASS (klass);
389 +
390 +  gobject_class->dispose = g_vfs_job_set_attributes_from_info_dispose;
391 +  gobject_class->finalize = g_vfs_job_set_attributes_from_info_finalize;
392 +  job_class->run = run;
393 +  job_class->try = try;
394 +  job_dbus_class->create_reply = create_reply;
395 +
396 +  g_type_class_add_private (klass, sizeof (GVfsJobSetAttributesFromInfoPrivate));
397 +}
398 +
399 +static void
400 +g_vfs_job_set_attributes_from_info_init (GVfsJobSetAttributesFromInfo *job)
401 +{
402 +  GVfsJobSetAttributesFromInfoPrivate *priv;
403 +
404 +  job->info = NULL;
405 +  priv = G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_GET_PRIVATE (job);
406 +  priv->dispose_has_run = FALSE;
407 +}
408 +
409 +gboolean
410 +g_vfs_job_set_attributes_from_info_new_handle (GVfsDBusMount *object,
411 +                                              GDBusMethodInvocation *invocation,
412 +                                              const char *arg_path_data,
413 +                                              guint arg_flags,
414 +                                              GVariant *arg_info,
415 +                                              GVfsBackend *backend)
416 +{
417 +  GVfsJobSetAttributesFromInfo *job;
418 +  GFileInfo *info = NULL;
419 +  
420 +  if (g_vfs_backend_invocation_first_handler (object, invocation, backend))
421 +    return TRUE;
422 +
423 +  if ( !(info = _g_dbus_get_file_info (arg_info, NULL)) )
424 +    {
425 +      g_dbus_method_invocation_return_error_literal (invocation,
426 +                                                     G_IO_ERROR,
427 +                                                     G_IO_ERROR_INVALID_ARGUMENT,
428 +                                                     _("Invalid dbus message"));
429 +      return TRUE;
430 +    }
431 +
432 +  job = g_object_new (G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO,
433 +                      "object", object,
434 +                      "invocation", invocation,
435 +                      NULL);
436 +
437 +  job->backend = backend;
438 +  job->filename = g_strdup (arg_path_data);
439 +  job->info = info;
440 +  job->flags = arg_flags;
441 +
442 +  g_vfs_job_source_new_job (G_VFS_JOB_SOURCE (backend), G_VFS_JOB (job));
443 +  g_object_unref (job);
444 +
445 +  return TRUE;
446 +}
447 +
448 +static void
449 +run (GVfsJob *job)
450 +{
451 +  GVfsJobSetAttributesFromInfo *op_job = G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO (job);
452 +  GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend);
453 +
454 +  if (class->set_attributes_from_info == NULL)
455 +    {
456 +      /* TODO : try to fallback using class->set_attribute */
457 +      g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
458 +                      _("Operation not supported by backend"));
459 +      return;
460 +    }
461 +  class->set_attributes_from_info (op_job->backend, op_job, op_job->filename, op_job->info, op_job->flags);
462 +}
463 +
464 +static gboolean
465 +try (GVfsJob *job)
466 +{
467 +  GVfsJobSetAttributesFromInfo *op_job = G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO (job);
468 +  GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend);
469 +
470 +  if (class->try_set_attributes_from_info == NULL)
471 +    {
472 +      /* TODO : try to fallback using class->try_set_attribute */
473 +      return FALSE;
474 +    }
475 +
476 +  return class->try_set_attributes_from_info (op_job->backend, op_job, op_job->filename, op_job->info, op_job->flags);
477 +}
478 +
479 +/* Might be called on an i/o thread */
480 +static void
481 +create_reply (GVfsJob *job,
482 +             GVfsDBusMount *object,
483 +             GDBusMethodInvocation *invocation)
484 +{
485 +    gvfs_dbus_mount_complete_set_attributes_from_info (object, invocation);
486 +}
487 diff -urN gvfs-1.14.0.new/daemon/gvfsjobsetattributesfrominfo.h gvfs-1.14.0/daemon/gvfsjobsetattributesfrominfo.h
488 --- gvfs-1.14.0.new/daemon/gvfsjobsetattributesfrominfo.h       1970-01-01 01:00:00.000000000 +0100
489 +++ gvfs-1.14.0/daemon/gvfsjobsetattributesfrominfo.h   2012-09-30 23:42:51.086635731 +0200
490 @@ -0,0 +1,75 @@
491 +/* GIO - GLib Input, Output and Streaming Library
492 + * 
493 + * Copyright (C) 2006-2007 Red Hat, Inc.
494 + *
495 + * This library is free software; you can redistribute it and/or
496 + * modify it under the terms of the GNU Lesser General Public
497 + * License as published by the Free Software Foundation; either
498 + * version 2 of the License, or (at your option) any later version.
499 + *
500 + * This library is distributed in the hope that it will be useful,
501 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
502 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
503 + * Lesser General Public License for more details.
504 + *
505 + * You should have received a copy of the GNU Lesser General
506 + * Public License along with this library; if not, write to the
507 + * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
508 + * Boston, MA 02111-1307, USA.
509 + *
510 + * Author: Alexandre Rostovtsev <tetromino@gmail.com>
511 + */
512 +
513 +#ifndef __G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_H__
514 +#define __G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_H__
515 +
516 +#include <gio/gio.h>
517 +#include <gvfsjob.h>
518 +#include <gvfsjobdbus.h>
519 +#include <gvfsbackend.h>
520 +
521 +G_BEGIN_DECLS
522 +
523 +#define G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO \
524 +       (g_vfs_job_set_attributes_from_info_get_type ())
525 +#define G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO(o) \
526 +       (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO, GVfsJobSetAttributesFromInfo))
527 +#define G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_CLASS(k) \
528 +       (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO, GVfsJobSetAttributesFromInfoClass))
529 +#define G_VFS_IS_JOB_SET_ATTRIBUTES_FROM_INFO(o) \
530 +       (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO))
531 +#define G_VFS_IS_JOB_SET_ATTRIBUTES_FROM_INFO_CLASS(k) \
532 +       (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO))
533 +#define G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_GET_CLASS(o) \
534 +       (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_JOB_SET_ATTRIBUTES_FROM_INFO, GVfsJobSetAttributesFromInfoClass))
535 +
536 +typedef struct _GVfsJobSetAttributesFromInfoClass   GVfsJobSetAttributesFromInfoClass;
537 +
538 +struct _GVfsJobSetAttributesFromInfo
539 +{
540 +  GVfsJobDBus parent_instance;
541 +
542 +  GVfsBackend *backend;
543 +
544 +  char *filename;
545 +  GFileInfo *info;
546 +  GFileQueryInfoFlags flags;
547 +};
548 +
549 +struct _GVfsJobSetAttributesFromInfoClass
550 +{
551 +  GVfsJobDBusClass parent_class;
552 +};
553 +
554 +GType g_vfs_job_set_attributes_from_info_get_type (void) G_GNUC_CONST;
555 +
556 +gboolean g_vfs_job_set_attributes_from_info_new_handle (GVfsDBusMount         *object,
557 +                                                        GDBusMethodInvocation *invocation,
558 +                                                        const gchar           *arg_path_data,
559 +                                                        guint                  arg_flags,
560 +                                                        GVariant              *arg_info,
561 +                                                        GVfsBackend           *backend);
562 +
563 +G_END_DECLS
564 +
565 +#endif /* __G_VFS_JOB_SET_ATTRIBUTES_FROM_INFO_H__ */
566 diff -urN gvfs-1.14.0.new/daemon/Makefile.am gvfs-1.14.0/daemon/Makefile.am
567 --- gvfs-1.14.0.new/daemon/Makefile.am  2012-09-30 22:04:15.400411451 +0200
568 +++ gvfs-1.14.0/daemon/Makefile.am      2012-09-30 23:39:57.067578418 +0200
569 @@ -181,6 +181,7 @@
570         gvfsjobmakedirectory.c gvfsjobmakedirectory.h \
571         gvfsjobmakesymlink.c gvfsjobmakesymlink.h \
572         gvfsjobsetattribute.c gvfsjobsetattribute.h \
573 +       gvfsjobsetattributesfrominfo.c gvfsjobsetattributesfrominfo.h \
574         gvfsjobqueryattributes.c gvfsjobqueryattributes.h \
575         gvfsjobcreatemonitor.c gvfsjobcreatemonitor.h \
576         gvfskeyring.h gvfskeyring.c \
This page took 0.124493 seconds and 3 git commands to generate.