[gedit/dbus2: 5/9] Fixed parsing file list from gvariant in open method
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/dbus2: 5/9] Fixed parsing file list from gvariant in open method
- Date: Mon, 3 May 2010 15:52:45 +0000 (UTC)
commit c663677d556844310aa4846cc88750fbcb9c50f0
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Mon May 3 00:40:32 2010 +0200
Fixed parsing file list from gvariant in open method
gedit/gedit-dbus.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gedit/gedit-dbus.c b/gedit/gedit-dbus.c
index 98b1249..4a10310 100644
--- a/gedit/gedit-dbus.c
+++ b/gedit/gedit-dbus.c
@@ -420,19 +420,14 @@ handle_service (GeditDBus *dbus)
}
static GSList *
-variant_file_list_to_locations (GVariant *file_list)
+variant_iter_list_to_locations (GVariantIter *iter)
{
+ gchar *uri;
GSList *ret = NULL;
- gsize num = g_variant_n_children (file_list);
- gsize i;
- for (i = 0; i < num; ++i)
+ while (g_variant_iter_loop (iter, "s", &uri))
{
- gchar *uri;
- g_variant_get_child (file_list, i, "s", &uri);
-
ret = g_slist_prepend (ret, g_file_new_for_uri (uri));
- g_free (uri);
}
return g_slist_reverse (ret);
@@ -637,7 +632,7 @@ dbus_handle_open (GeditDBus *dbus,
GVariant *parameters,
GDBusMethodInvocation *invocation)
{
- GVariant *file_list;
+ GVariantIter *file_list;
gchar *charset_encoding;
gint line_position;
gint column_position;
@@ -673,8 +668,8 @@ dbus_handle_open (GeditDBus *dbus,
&viewport_x,
&viewport_y);
- locations = variant_file_list_to_locations (file_list);
- g_variant_unref (file_list);
+ locations = variant_iter_list_to_locations (file_list);
+ g_variant_iter_free (file_list);
if (charset_encoding && *charset_encoding)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]