Put declarations at the beginning of the block
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / adaptors / value-adaptor.c
index b3bc550..89f29ff 100644 (file)
@@ -27,7 +27,7 @@
 #include <atk/atk.h>
 #include <droute/droute.h>
 
-#include "common/spi-dbus.h"
+#include "spi-dbus.h"
 #include "introspection.h"
 
 static dbus_bool_t
@@ -115,7 +115,7 @@ impl_get_CurrentValue (DBusMessageIter * iter, void *user_data)
 }
 
 static dbus_bool_t
-impl_set_currentValue (DBusMessageIter * iter, void *user_data)
+impl_set_CurrentValue (DBusMessageIter * iter, void *user_data)
 {
   AtkValue *value = (AtkValue *) user_data;
   GValue src = { 0 };
@@ -148,11 +148,52 @@ impl_set_currentValue (DBusMessageIter * iter, void *user_data)
     }
 }
 
+/* keeping this method around for backwards-compatibility for now; see
+ *  * BGO#652596 */
+static DBusMessage *
+impl_SetCurrentValue (DBusConnection * bus, DBusMessage * message,
+                       void *user_data)
+{
+  AtkValue *value = (AtkValue *) user_data;
+  dbus_bool_t rv;
+  DBusError error;
+  DBusMessage *reply;
+  gdouble dub = 0;
+  GValue new_value = { 0 };
+
+  g_return_val_if_fail (ATK_IS_VALUE (value),
+                        droute_not_yet_handled_error (message));
+
+  dbus_error_init (&error);
+  if (!dbus_message_get_args
+      (message, &error, DBUS_TYPE_DOUBLE, &dub, DBUS_TYPE_INVALID))
+    {
+      return droute_invalid_arguments_error (message);
+    }
+
+  g_value_init (&new_value, G_TYPE_DOUBLE);
+  g_value_set_double (&new_value, dub);
+  rv = atk_value_set_current_value (value, &new_value);
+
+  reply = dbus_message_new_method_return (message);
+  if (reply)
+    {
+      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
+                                DBUS_TYPE_INVALID);
+    }
+  return reply;
+}
+
+static DRouteMethod methods[] = {
+  {impl_SetCurrentValue, "SetCurrentValue"},
+  {NULL, NULL}
+};
+
 static DRouteProperty properties[] = {
   {impl_get_MinimumValue, NULL, "MinimumValue"},
   {impl_get_MaximumValue, NULL, "MaximumValue"},
   {impl_get_MinimumIncrement, NULL, "MinimumIncrement"},
-  {impl_get_CurrentValue, impl_set_currentValue, "CurrentValue"},
+  {impl_get_CurrentValue, impl_set_CurrentValue, "CurrentValue"},
   {NULL, NULL, NULL}
 };
 
@@ -160,5 +201,5 @@ void
 spi_initialize_value (DRoutePath * path)
 {
   droute_path_add_interface (path,
-                             SPI_DBUS_INTERFACE_VALUE, spi_org_a11y_atspi_Value, NULL, properties);
+                             ATSPI_DBUS_INTERFACE_VALUE, spi_org_a11y_atspi_Value, methods, properties);
 };