diff options
author | Ondrej Holy <oholy@redhat.com> | 2015-05-29 13:06:16 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2015-06-01 09:36:30 +0200 |
commit | b78cc85d2dda10e5488cf23cb63008ca339836dc (patch) | |
tree | f61c2c384fb5320ea9216b69c41d4fd85d5ff0c2 /client | |
parent | 95bf3840548e9493d075fdd8b3bcec1fe569cc7a (diff) | |
download | gvfs-b78cc85d2dda10e5488cf23cb63008ca339836dc.tar.gz |
metadata: Get tree from udev via dbus
We don't want to have dependency on udev in client part of gvfs due
to app sandboxing. Thus move the code into the metadata daemon and
get tree name via dbus.
Common code to get metadata proxy has to be moved in metatree code.
Mentioned changes caused that unistd.h is also included in
meta-get-tree.c and cause symbol redeclaration error. Variable
"pause" has to be renamed to avoid this conflict.
Diffstat (limited to 'client')
-rw-r--r-- | client/gdaemonfile.c | 11 | ||||
-rw-r--r-- | client/gdaemonvfs.c | 37 | ||||
-rw-r--r-- | client/gdaemonvfs.h | 6 |
3 files changed, 14 insertions, 40 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c index b744d532..cc9edea8 100644 --- a/client/gdaemonfile.c +++ b/client/gdaemonfile.c @@ -2666,9 +2666,14 @@ set_metadata_attribute (GFile *file, } res = FALSE; - proxy = _g_daemon_vfs_get_metadata_proxy (cancellable, error); - - if (proxy) + proxy = meta_tree_get_metadata_proxy (); + if (proxy == NULL) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Error setting file metadata: %s"), + _("can't get metadata proxy")); + } + else { builder = g_variant_builder_new (G_VARIANT_TYPE_VARDICT); diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c index 6b9612f2..3b0337dc 100644 --- a/client/gdaemonvfs.c +++ b/client/gdaemonvfs.c @@ -76,9 +76,6 @@ G_DEFINE_DYNAMIC_TYPE (GDaemonVfs, g_daemon_vfs, G_TYPE_VFS) static GDaemonVfs *the_vfs = NULL; -G_LOCK_DEFINE_STATIC (metadata_proxy); -static GVfsMetadata *metadata_proxy = NULL; - G_LOCK_DEFINE_STATIC(mount_cache); @@ -1204,31 +1201,6 @@ _g_daemon_vfs_append_metadata_for_set (GVariantBuilder *builder, return res; } -GVfsMetadata * -_g_daemon_vfs_get_metadata_proxy (GCancellable *cancellable, GError **error) -{ - GVfsMetadata *proxy; - - G_LOCK (metadata_proxy); - - proxy = NULL; - if (metadata_proxy == NULL) - { - metadata_proxy = gvfs_metadata_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, - G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, - G_VFS_DBUS_METADATA_NAME, - G_VFS_DBUS_METADATA_PATH, - cancellable, - error); - } - - proxy = metadata_proxy; - - G_UNLOCK (metadata_proxy); - - return proxy; -} - static gboolean g_daemon_vfs_local_file_set_attributes (GVfs *vfs, const char *filename, @@ -1290,9 +1262,12 @@ g_daemon_vfs_local_file_set_attributes (GVfs *vfs, } else { - proxy = _g_daemon_vfs_get_metadata_proxy (NULL, error); + proxy = meta_tree_get_metadata_proxy (); if (proxy == NULL) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("Error setting file metadata: %s"), + _("can't get metadata proxy")); res = FALSE; error = NULL; /* Don't set further errors */ } @@ -1382,7 +1357,7 @@ g_daemon_vfs_local_file_removed (GVfs *vfs, &tree_path); if (tree) { - proxy = _g_daemon_vfs_get_metadata_proxy (NULL, NULL); + proxy = meta_tree_get_metadata_proxy (); if (proxy) { metatreefile = meta_tree_get_filename (tree); @@ -1429,7 +1404,7 @@ g_daemon_vfs_local_file_moved (GVfs *vfs, &tree_path2); if (tree1 && tree2 && tree1 == tree2) { - proxy = _g_daemon_vfs_get_metadata_proxy (NULL, NULL); + proxy = meta_tree_get_metadata_proxy (); if (proxy) { metatreefile = meta_tree_get_filename (tree1); diff --git a/client/gdaemonvfs.h b/client/gdaemonvfs.h index 5d5195d4..e20b619a 100644 --- a/client/gdaemonvfs.h +++ b/client/gdaemonvfs.h @@ -28,7 +28,6 @@ #include "gmounttracker.h" #include "gvfsuriutils.h" #include <metatree.h> -#include <metadata-dbus.h> G_BEGIN_DECLS @@ -77,11 +76,6 @@ int _g_daemon_vfs_append_metadata_for_set (GVariantBuilder *builder GFileAttributeType type, gpointer value); -GVfsMetadata * _g_daemon_vfs_get_metadata_proxy (GCancellable *cancellable, - GError **error); - - - G_END_DECLS #endif /* __G_DAEMON_VFS_H__ */ |