[gnome-mag/bonobo-less: 4/6] implement isActive and try to fix getZoomRegions



commit 25c59abcaf031cadb4a150c4944a20b863164d87
Author: Fernando Herrera <fherrera onirica com>
Date:   Sat Jun 26 15:33:02 2010 +0200

    implement isActive and try to fix getZoomRegions

 magnifier/magnifier.c       |   14 ++++++++++++--
 xml/org.gnome.Magnifier.xml |   12 ++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/magnifier/magnifier.c b/magnifier/magnifier.c
index 282dd54..0ab390c 100644
--- a/magnifier/magnifier.c
+++ b/magnifier/magnifier.c
@@ -809,7 +809,14 @@ method_call_cb (GDBusConnection       *connection,
 {
 	Magnifier *magnifier = MAGNIFIER (user_data);
 
-	if (g_strcmp0 (method_name, "fullScreenCapable") == 0) {
+	if (g_strcmp0 (method_name, "isActive") == 0) {
+		gboolean retval = TRUE;
+		if (magnifier->zoom_regions == NULL) {
+			retval = FALSE;
+		}
+		g_dbus_method_invocation_return_value (invocation,
+						       g_variant_new ("(b)", retval));
+	} else if (g_strcmp0 (method_name, "fullScreenCapable") == 0) {
 		gboolean retval = FALSE;
 
 		if ((strcmp (magnifier->source_display_name,
@@ -882,7 +889,7 @@ method_call_cb (GDBusConnection       *connection,
 		DBG (fprintf (stderr, "Get zoom regions: \t%d\n", len));
 
 		g_dbus_method_invocation_return_value (invocation,
-						       g_variant_new_strv ((const gchar * const*)list, len));
+						       list != NULL ? g_variant_new_strv ((const gchar * const*)list, len) : g_variant_new ("()"));
 		g_free (list);
 	} else if (g_strcmp0 (method_name, "addZoomRegion") == 0) {
 		ZoomRegion *zoom_region;
@@ -1091,6 +1098,9 @@ set_property_cb (GDBusConnection *connection,
 static const gchar introspection_xml[] =
 "<node>"
   "<interface name='org.gnome.Magnifier'>"
+    "<method name='isActive'>"
+      "<arg type='b' name='b-ret' direction='out'/>"
+    "</method>"
     "<method name='fullScreenCapable'>"
       "<arg type='b' name='b-ret' direction='out'/>"
     "</method>"
diff --git a/xml/org.gnome.Magnifier.xml b/xml/org.gnome.Magnifier.xml
index 6874707..8a3b340 100755
--- a/xml/org.gnome.Magnifier.xml
+++ b/xml/org.gnome.Magnifier.xml
@@ -7,6 +7,18 @@
       </p>
     </tp:docstring>
 
+    <method name="isActive">
+      <tp:docstring>
+        <p>
+          Consult if the Magnifier can is active.
+        </p>
+      </tp:docstring>
+      <arg type="b" name="b-ret" direction="out">
+      	<annotation name="org.freedesktop.DBus.GLib.ReturnVal" value="" />
+        <tp:docstring>TRUE if it is active or FALSE otherwise.</tp:docstring>
+      </arg>
+    </method>
+
     <method name="fullScreenCapable">
       <tp:docstring>
         <p>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]