[gnome-mag/bonobo-less: 5/6] Fix getZoom call for the NULL case. Fix object path in zoom-region.c
- From: Fernando Herrera de las Heras <fherrera src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mag/bonobo-less: 5/6] Fix getZoom call for the NULL case. Fix object path in zoom-region.c
- Date: Mon, 5 Jul 2010 13:26:22 +0000 (UTC)
commit a325cfdf593bf80a22560220d7899c71249ef05d
Author: Fernando Herrera <fherrera onirica com>
Date: Wed Jun 30 13:06:44 2010 +0200
Fix getZoom call for the NULL case. Fix object path in zoom-region.c
magnifier/magnifier.c | 22 ++++++++++++++++------
magnifier/zoom-region.c | 5 +++--
2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/magnifier/magnifier.c b/magnifier/magnifier.c
index 0ab390c..8d08cff 100644
--- a/magnifier/magnifier.c
+++ b/magnifier/magnifier.c
@@ -880,16 +880,26 @@ method_call_cb (GDBusConnection *connection,
int i, len;
len = g_list_length (magnifier->zoom_regions);
- list = g_malloc0 (sizeof (gchar *) * len);
- for (i = 0; i < len; ++i) {
- zoom_region = g_list_nth_data (magnifier->zoom_regions, i);
- list[i] = zoom_region->object_path;
+ if (len > 0) {
+ list = g_malloc0 (sizeof (gchar *) * len);
+ for (i = 0; i < len; ++i) {
+ zoom_region = g_list_nth_data (magnifier->zoom_regions, i);
+ list[i] = zoom_region->object_path;
+ }
+ } else {
+ list = g_malloc0 (sizeof (gchar *) * 2);
+ list[0] = NULL;
}
+
DBG (fprintf (stderr, "Get zoom regions: \t%d\n", len));
- g_dbus_method_invocation_return_value (invocation,
- list != NULL ? g_variant_new_strv ((const gchar * const*)list, len) : g_variant_new ("()"));
+ if (len == 0) {
+ gchar *empty_array = NULL;
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(@as)", g_variant_new_array (G_VARIANT_TYPE_STRING, NULL, 0)));
+ } else
+ g_dbus_method_invocation_return_value (invocation,
+ g_variant_new_strv ((const gchar * const*)list, len));
g_free (list);
} else if (g_strcmp0 (method_name, "addZoomRegion") == 0) {
ZoomRegion *zoom_region;
diff --git a/magnifier/zoom-region.c b/magnifier/zoom-region.c
index 3bb5e7d..c21805d 100644
--- a/magnifier/zoom-region.c
+++ b/magnifier/zoom-region.c
@@ -2928,7 +2928,7 @@ set_property_cb (GDBusConnection *connection,
static const gchar introspection_xml[] =
"<node>"
- "<interface name='org.freedesktop.gnome.Magnifier.ZoomRegion'>"
+ "<interface name='org.gnome.Magnifier.ZoomRegion'>"
"<method name='setMagFactor'>"
"<arg type='d' name='magX' direction='in'/>"
"<arg type='d' name='magY' direction='in'/>"
@@ -3639,7 +3639,8 @@ zoom_region_new (GDBusConnection *connection,
_this_zoom_region->priv->parent = MAGNIFIER (parent);
zoom_region_init_window (_this_zoom_region);
- _this_zoom_region->object_path = g_strdup_printf("/org/freedesktop/gnome/ZoomRegion/%i", zoom_region_number);
+ _this_zoom_region->object_path = g_strdup_printf("/org/gnome/ZoomRegion/%i", zoom_region_number);
+ g_print ("Registering /org/gnome/ZoomRegion/%i", zoom_region_number);
if (!introspection_data)
introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]