diff options
-rw-r--r-- | client/gdaemonvfs.c | 8 | ||||
-rw-r--r-- | common/gvfsicon.c | 34 | ||||
-rw-r--r-- | common/gvfsicon.h | 3 | ||||
-rw-r--r-- | configure.ac | 2 |
4 files changed, 46 insertions, 1 deletions
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c index b712b22b..7c7f9a70 100644 --- a/client/gdaemonvfs.c +++ b/client/gdaemonvfs.c @@ -1473,6 +1473,13 @@ g_daemon_vfs_local_file_moved (GVfs *vfs, meta_lookup_cache_free (cache); } +static GIcon * +g_daemon_vfs_deserialize_icon (GVfs *vfs, + GVariant *value) +{ + return g_vfs_icon_deserialize (value); +} + GDBusConnection * _g_daemon_vfs_get_async_bus (void) { @@ -1515,6 +1522,7 @@ g_daemon_vfs_class_init (GDaemonVfsClass *class) vfs_class->local_file_set_attributes = g_daemon_vfs_local_file_set_attributes; vfs_class->local_file_removed = g_daemon_vfs_local_file_removed; vfs_class->local_file_moved = g_daemon_vfs_local_file_moved; + vfs_class->deserialize_icon = g_daemon_vfs_deserialize_icon; } /* Module API */ diff --git a/common/gvfsicon.c b/common/gvfsicon.c index 318440c7..3bacf8c5 100644 --- a/common/gvfsicon.c +++ b/common/gvfsicon.c @@ -272,6 +272,39 @@ g_vfs_icon_from_tokens (gchar **tokens, return icon; } +static GVariant * +g_vfs_icon_serialize (GIcon *icon) +{ + GVfsIcon *vfs_icon = G_VFS_ICON (icon); + + return g_variant_new ("(@ss)", + g_variant_new_take_string (g_mount_spec_to_string (vfs_icon->mount_spec)), + vfs_icon->icon_id); +} + +GIcon * +g_vfs_icon_deserialize (GVariant *value) +{ + const gchar *mount_spec_str; + const gchar *id_str; + GMountSpec *mount_spec; + GIcon *icon; + + if (!g_variant_is_of_type (value, G_VARIANT_TYPE ("(ss)"))) + return NULL; + + g_variant_get (value, "(&s&s)", &mount_spec_str, &id_str); + + mount_spec = g_mount_spec_new_from_string (mount_spec_str, NULL); + if (mount_spec == NULL) + return NULL; + + icon = g_vfs_icon_new (mount_spec, id_str); + g_mount_spec_unref (mount_spec); + + return icon; +} + static void g_vfs_icon_icon_iface_init (GIconIface *iface) { @@ -279,4 +312,5 @@ g_vfs_icon_icon_iface_init (GIconIface *iface) iface->equal = g_vfs_icon_equal; iface->to_tokens = g_vfs_icon_to_tokens; iface->from_tokens = g_vfs_icon_from_tokens; + iface->serialize = g_vfs_icon_serialize; } diff --git a/common/gvfsicon.h b/common/gvfsicon.h index 7ed0935e..1bba7e7c 100644 --- a/common/gvfsicon.h +++ b/common/gvfsicon.h @@ -61,9 +61,12 @@ GType g_vfs_icon_get_type (void) G_GNUC_CONST; GIcon *g_vfs_icon_new (GMountSpec *mount_spec, const gchar *icon_id); +GIcon *g_vfs_icon_deserialize (GVariant *value); + GMountSpec *g_vfs_icon_get_mount_spec (GVfsIcon *vfs_icon); const gchar *g_vfs_icon_get_icon_id (GVfsIcon *vfs_icon); + G_END_DECLS #endif /* __G_VFS_ICON_H__ */ diff --git a/configure.ac b/configure.ac index a63daf7c..ab7c390f 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,7 @@ GTK_DOC_CHECK DISTCHECK_CONFIGURE_FLAGS="--enable-gtk-doc" AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) -PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.35.0 gobject-2.0 gmodule-no-export-2.0 gio-unix-2.0 gio-2.0 ) +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.37.0 gobject-2.0 gmodule-no-export-2.0 gio-unix-2.0 gio-2.0 ) PKG_CHECK_MODULES(DBUS, dbus-1) |