diff options
author | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 11:14:42 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 11:14:42 +0000 |
commit | 81299f3ae88f4eba4d456742b5d626e9bc9b4220 (patch) | |
tree | 9482462c2ed2a461cd085c0e5b7e1feaa7999197 /common/gmountspec.c | |
parent | d36c5665264b43302d739f9d2a0babb8e6c6353f (diff) | |
download | gvfs-81299f3ae88f4eba4d456742b5d626e9bc9b4220.tar.gz |
Initial client side work for new mount tracker
Original git commit by Alexander Larsson <alex@greebo.(none)> at 1170091175 +0100
svn path=/trunk/; revision=277
Diffstat (limited to 'common/gmountspec.c')
-rw-r--r-- | common/gmountspec.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/common/gmountspec.c b/common/gmountspec.c index aa9b172d..294d801f 100644 --- a/common/gmountspec.c +++ b/common/gmountspec.c @@ -23,6 +23,7 @@ g_mount_spec_new (const char *type) GMountSpec *spec; spec = g_new0 (GMountSpec, 1); + spec->ref_count = 1; spec->items = g_array_new (FALSE, TRUE, sizeof (GMountSpecItem)); if (type != NULL) @@ -133,8 +134,9 @@ g_mount_spec_from_dbus (DBusMessageIter *iter) } void -g_mount_spec_to_dbus (DBusMessageIter *iter, - GMountSpec *spec) +g_mount_spec_to_dbus_with_path (DBusMessageIter *iter, + GMountSpec *spec, + const char *path) { DBusMessageIter spec_iter, array_iter, item_iter; int i; @@ -145,7 +147,7 @@ g_mount_spec_to_dbus (DBusMessageIter *iter, &spec_iter)) _g_dbus_oom (); - _g_dbus_message_iter_append_cstring (&spec_iter, spec->mount_prefix?spec->mount_prefix:""); + _g_dbus_message_iter_append_cstring (&spec_iter, path ? path : ""); if (!dbus_message_iter_open_container (&spec_iter, DBUS_TYPE_ARRAY, @@ -183,6 +185,13 @@ g_mount_spec_to_dbus (DBusMessageIter *iter, } +void +g_mount_spec_to_dbus (DBusMessageIter *iter, + GMountSpec *spec) +{ + g_mount_spec_to_dbus_with_path (iter, spec, spec->mount_prefix); +} + static gboolean items_equal (GArray *a, GArray *b) @@ -226,11 +235,19 @@ path_has_prefix (const char *path, } gboolean -g_mount_spec_match (GMountSpec *mount, - GMountSpec *path) +g_mount_spec_match_with_path (GMountSpec *mount, + GMountSpec *spec, + const char *path) { - if (items_equal (mount->items, path->items) && - path_has_prefix (path->mount_prefix, mount->mount_prefix)) + if (items_equal (mount->items, spec->items) && + path_has_prefix (path, mount->mount_prefix)) return TRUE; return FALSE; } + +gboolean +g_mount_spec_match (GMountSpec *mount, + GMountSpec *path) +{ + return g_mount_spec_match_with_path (mount, path, path->mount_prefix); +} |