Commit 1efb7a14 authored by Iain Holmes's avatar Iain Holmes

Remove the array type for the accuracy

parent 1c47a095
......@@ -46,7 +46,7 @@ gc_iface_address_base_init (gpointer klass)
G_TYPE_NONE, 3,
G_TYPE_INT,
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
dbus_g_type_get_collection ("GPtrArray", GEOCLUE_ACCURACY_TYPE));
GEOCLUE_ACCURACY_TYPE);
dbus_g_object_type_install_info (gc_iface_address_get_type (),
&dbus_glib_gc_iface_address_object_info);
}
......
......@@ -53,7 +53,7 @@ gc_iface_position_base_init (gpointer klass)
G_TYPE_DOUBLE,
G_TYPE_DOUBLE,
G_TYPE_DOUBLE,
dbus_g_type_get_collection ("GPtrArray", GEOCLUE_ACCURACY_TYPE));
GEOCLUE_ACCURACY_TYPE);
dbus_g_object_type_install_info (gc_iface_position_get_type (),
&dbus_glib_gc_iface_position_object_info);
......
......@@ -35,11 +35,8 @@ geoclue_accuracy_new (GeoclueAccuracyLevel level,
double horizontal_accuracy,
double vertical_accuracy)
{
GPtrArray *accuracy;
GValue accuracy_struct = {0, };
accuracy = g_ptr_array_new ();
g_value_init (&accuracy_struct, GEOCLUE_ACCURACY_TYPE);
g_value_take_boxed (&accuracy_struct,
dbus_g_type_specialized_construct
......@@ -50,9 +47,8 @@ geoclue_accuracy_new (GeoclueAccuracyLevel level,
1, horizontal_accuracy,
2, vertical_accuracy,
G_MAXUINT);
g_ptr_array_add (accuracy, g_value_get_boxed (&accuracy_struct));
return (GeoclueAccuracy *) accuracy;
return (GeoclueAccuracy *) g_value_get_boxed (&accuracy_struct);
}
/**
......@@ -64,18 +60,11 @@ geoclue_accuracy_new (GeoclueAccuracyLevel level,
void
geoclue_accuracy_free (GeoclueAccuracy *accuracy)
{
GPtrArray *arr;
int i;
if (!accuracy) {
return;
}
arr = (GPtrArray *) accuracy;
for (i = 0; i < arr->len; i++) {
g_boxed_free (GEOCLUE_ACCURACY_TYPE,
g_ptr_array_index (arr, i));
}
g_ptr_array_free (arr, TRUE);
g_boxed_free (GEOCLUE_ACCURACY_TYPE, accuracy);
}
/**
......@@ -93,11 +82,8 @@ geoclue_accuracy_get_details (GeoclueAccuracy *accuracy,
double *vertical_accuracy)
{
GValueArray *vals;
GPtrArray *arr = (GPtrArray *) accuracy;
g_assert (arr->pdata != NULL);
vals = arr->pdata[0];
vals = accuracy;
if (level != NULL) {
*level = g_value_get_int (g_value_array_get_nth (vals, 0));
}
......@@ -123,8 +109,7 @@ geoclue_accuracy_set_details (GeoclueAccuracy *accuracy,
double horizontal_accuracy,
double vertical_accuracy)
{
GPtrArray *arr = (GPtrArray *) accuracy;
GValueArray *vals = arr->pdata[0];
GValueArray *vals = accuracy;
g_value_set_int (g_value_array_get_nth (vals, 0), level);
g_value_set_double (g_value_array_get_nth (vals, 1),
......
......@@ -18,7 +18,7 @@ G_BEGIN_DECLS
#define GEOCLUE_ACCURACY_TYPE (dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_INVALID))
typedef GPtrArray GeoclueAccuracy;
typedef GValueArray GeoclueAccuracy;
GeoclueAccuracy *geoclue_accuracy_new (GeoclueAccuracyLevel level,
double horizontal_accuracy,
......
......@@ -77,7 +77,7 @@ constructor (GType type,
dbus_g_proxy_add_signal (provider->proxy, "AddressChanged",
G_TYPE_INT,
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
dbus_g_type_get_collection ("GPtrArray", GEOCLUE_ACCURACY_TYPE),
GEOCLUE_ACCURACY_TYPE,
G_TYPE_INVALID);
dbus_g_proxy_connect_signal (provider->proxy, "AddressChanged",
G_CALLBACK (address_changed),
......
......@@ -58,7 +58,7 @@ position_changed (DBusGProxy *proxy,
double latitude,
double longitude,
double altitude,
GPtrArray *accuracy,
GValueArray *accuracy,
GeocluePosition *position)
{
g_signal_emit (position, signals[POSITION_CHANGED], 0, fields,
......@@ -80,7 +80,7 @@ constructor (GType type,
dbus_g_proxy_add_signal (provider->proxy, "PositionChanged",
G_TYPE_INT, G_TYPE_INT, G_TYPE_DOUBLE,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
dbus_g_type_get_collection ("GPtrArray", GEOCLUE_ACCURACY_TYPE),
GEOCLUE_ACCURACY_TYPE,
G_TYPE_INVALID);
dbus_g_proxy_connect_signal (provider->proxy, "PositionChanged",
G_CALLBACK (position_changed),
......
......@@ -7,13 +7,13 @@
<arg name="address" type="a{ss}" direction="out" />
<arg name="accuracy" type="a(idd)" direction="out" />
<arg name="accuracy" type="(idd)" direction="out" />
</method>
<signal name="AddressChanged">
<arg type="i" name="timestamp" />
<arg type="a{ss}" name="address" />
<arg type="a(idd)" name="accuracy" />
<arg type="(idd)" name="accuracy" />
</signal>
</interface>
</node>
......@@ -10,7 +10,7 @@
<arg name="longitude" type="d" direction="out" />
<arg name="altitude" type="d" direction="out" />
<arg name="accuracy" type="a(idd)" direction="out" />
<arg name="accuracy" type="(idd)" direction="out" />
</method>
</interface>
</node>
......@@ -16,7 +16,7 @@
<arg type="d" name="longitude" direction="out" />
<arg type="d" name="altitude" direction="out" />
<arg name="accuracy" type="a(idd)" direction="out" />
<arg name="accuracy" type="(idd)" direction="out" />
</method>
<signal name="PositionChanged">
......@@ -26,7 +26,7 @@
<arg type="d" name="longitude" />
<arg type="d" name="altitude" />
<arg type="a(idd)" name="accuracy" />
<arg type="(idd)" name="accuracy" />
</signal>
</interface>
</node>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment