From: Mark Doffman Date: Wed, 7 May 2008 10:24:46 +0000 (+0100) Subject: NOT TESTED. Partial work to update DRoute. X-Git-Tag: AT_SPI2_ATK_2_12_0~727 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d108a85aa470bdc625540a82074abb9a8d126a5;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git NOT TESTED. Partial work to update DRoute. Removes signals code. Removes introspection code. Removes string properties code. --- diff --git a/libspi/accessible.c b/libspi/accessible.c index 8d33147..7a61524 100644 --- a/libspi/accessible.c +++ b/libspi/accessible.c @@ -42,13 +42,6 @@ impl_get_name (const char *path, DBusMessageIter * iter, void *user_data) return droute_return_v_string (iter, atk_object_get_name (object)); } -static char * -impl_get_name_str (void *datum) -{ - g_assert (ATK_IS_OBJECT (datum)); - return g_strdup (atk_object_get_name ((AtkObject *) datum)); -} - static dbus_bool_t impl_set_name (const char *path, DBusMessageIter * iter, void *user_data) { @@ -68,13 +61,6 @@ impl_get_description (const char *path, DBusMessageIter * iter, return droute_return_v_string (iter, atk_object_get_description (object)); } -static char * -impl_get_description_str (void *datum) -{ - g_assert (ATK_IS_OBJECT (datum)); - return g_strdup (atk_object_get_description ((AtkObject *) datum)); -} - static dbus_bool_t impl_set_description (const char *path, DBusMessageIter * iter, void *user_data) @@ -96,13 +82,6 @@ impl_get_parent (const char *path, DBusMessageIter * iter, void *user_data) FALSE); } -static char * -impl_get_parent_str (void *datum) -{ - g_assert (ATK_IS_OBJECT (datum)); - return spi_dbus_get_path (atk_object_get_parent ((AtkObject *) datum)); -} - static dbus_bool_t impl_get_childCount (const char *path, DBusMessageIter * iter, void *user_data) @@ -116,15 +95,6 @@ impl_get_childCount (const char *path, DBusMessageIter * iter, (object)); } -static char * -impl_get_childCount_str (void *datum) -{ - int count; - g_assert (ATK_IS_OBJECT (datum)); - count = atk_object_get_n_accessible_children ((AtkObject *) datum); - return g_strdup_printf ("%d", count); -} - static DBusMessage * impl_getChildren (DBusConnection * bus, DBusMessage * message, void *user_data) @@ -615,27 +585,26 @@ impl_getApplication (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - //{ DROUTE_METHOD, impl_isEqual, "isEqual", "o,obj,i:b,,o" }, - {DROUTE_METHOD, impl_getChildren, "getChildren", "ao,,o"}, - {DROUTE_METHOD, impl_getIndexInParent, "getIndexInParent", "i,,o"}, - //{ DROUTE_METHOD, impl_getRelationSet, "getRelationSet", "a{uao},,o" }, - {DROUTE_METHOD, impl_getRole, "getRole", "u,,o"}, - {DROUTE_METHOD, impl_getRoleName, "getRoleName", "s,,o"}, - {DROUTE_METHOD, impl_getLocalizedRoleName, "getLocalizedRoleName", "s,,o"}, - {DROUTE_METHOD, impl_getState, "getState", "o,,au"}, - {DROUTE_METHOD, impl_getAttributes, "getAttributes", "as,,o"}, - {DROUTE_METHOD, impl_getApplication, "getApplication", "o,,o"}, - {0, NULL, NULL, NULL} + //{impl_isEqual, "isEqual"}, + {impl_getChildren, "getChildren"}, + {impl_getIndexInParent, "getIndexInParent"}, + //{impl_getRelationSet, "getRelationSet"},,o" }, + {impl_getRole, "getRole"}, + {impl_getRoleName, "getRoleName"}, + {impl_getLocalizedRoleName, "getLocalizedRoleName"}, + {impl_getState, "getState"}, + {impl_getAttributes, "getAttributes"}, + {impl_getApplication, "getApplication"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_name, impl_get_name_str, impl_set_name, NULL, "name", "s"}, - {impl_get_description, impl_get_description_str, impl_set_description, NULL, - "description", "s"}, - {impl_get_parent, impl_get_parent_str, NULL, NULL, "parent", "o"}, - //{ impl_get_childCount, impl_get_childCount_str, NULL, NULL, "childCount", "n" }, - {NULL, impl_get_role_str, NULL, NULL, "role", "u"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {impl_get_name, impl_set_name, "name"}, + {impl_get_description, impl_set_description, "description"}, + {impl_get_parent, NULL, "parent"}, + //{impl_get_childCount, NULL, "childCount"}, + //{NULL, NULL, NULL, "role"}, + {NULL, NULL, NULL} }; void diff --git a/libspi/action.c b/libspi/action.c index 4953384..93a2695 100644 --- a/libspi/action.c +++ b/libspi/action.c @@ -108,9 +108,9 @@ static DBusMessage *impl_doAction(DBusConnection *bus, DBusMessage *message, voi DRouteMethod methods[] = { - { DROUTE_METHOD, impl_getActions, "getActions", "a(sss),,o" }, - { DROUTE_METHOD, impl_doAction, "doAction", "i,index,i:b,,o" }, - { 0, NULL, NULL, NULL } + {impl_getActions, "getActions"}, + {impl_doAction, "doAction"}, + {NULL, NULL } }; void diff --git a/libspi/application.c b/libspi/application.c index 42adeba..f43a000 100644 --- a/libspi/application.c +++ b/libspi/application.c @@ -31,24 +31,12 @@ impl_get_toolkitName (const char *path, DBusMessageIter * iter, return droute_return_v_string (iter, atk_get_toolkit_name ()); } -static char * -impl_get_toolkitName_str (void *datum) -{ - return g_strdup (atk_get_toolkit_name ()); -} - static dbus_bool_t impl_get_version (const char *path, DBusMessageIter * iter, void *user_data) { return droute_return_v_string (iter, atk_get_toolkit_version ()); } -static char * -impl_get_version_str (void *datum) -{ - return g_strdup (atk_get_toolkit_version ()); -} - static dbus_int32_t id; static dbus_bool_t @@ -57,12 +45,6 @@ impl_get_id (const char *path, DBusMessageIter * iter, void *user_data) return droute_return_v_int32 (iter, id); } -static char * -impl_get_id_str (void *datum) -{ - return g_strdup_printf ("%d", id); -} - static dbus_bool_t impl_set_id (const char *path, DBusMessageIter * iter, void *user_data) { @@ -74,46 +56,48 @@ static DBusMessage * impl_registerToolkitEventListener (DBusConnection * bus, DBusMessage * message, void *user_data) { + return NULL; } static DBusMessage * impl_registerObjectEventListener (DBusConnection * bus, DBusMessage * message, void *user_data) { + return NULL; } static DBusMessage * impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data) { + return NULL; } static DBusMessage * impl_resume (DBusConnection * bus, DBusMessage * message, void *user_data) { + return NULL; } static DBusMessage * impl_getLocale (DBusConnection * bus, DBusMessage * message, void *user_data) { + return NULL; } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_registerToolkitEventListener, - "registerToolkitEventListener", "o,listener,i:s,eventName,i"}, - {DROUTE_METHOD, impl_registerObjectEventListener, - "registerObjectEventListener", "o,listener,i:s,eventName,i"}, - {DROUTE_METHOD, impl_pause, "pause", "b,,o"}, - {DROUTE_METHOD, impl_resume, "resume", "b,,o"}, - {DROUTE_METHOD, impl_getLocale, "getLocale", "u,lctype,i:s,,o"}, - {0, NULL, NULL, NULL} + {impl_registerToolkitEventListener, "registerToolkitEventListener"}, + {impl_registerObjectEventListener, "registerObjectEventListener"}, + {impl_pause, "pause"}, + {impl_resume, "resume"}, + {impl_getLocale, "getLocale"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_toolkitName, impl_get_toolkitName_str, NULL, NULL, "toolkitName", - "s"}, - {impl_get_version, impl_get_version_str, NULL, NULL, "version", "s"}, - {impl_get_id, impl_get_id_str, impl_set_id, NULL, "id", "i"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {impl_get_toolkitName, NULL, "toolkitName"}, + {impl_get_version, NULL, "version"}, + {impl_get_id, impl_set_id, "id"}, + {NULL, NULL, NULL} }; static long diff --git a/libspi/component.c b/libspi/component.c index 12b0e2a..53cb3df 100644 --- a/libspi/component.c +++ b/libspi/component.c @@ -292,21 +292,18 @@ impl_getAlpha (DBusConnection * bus, DBusMessage * message, void *user_data) } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_contains, "contains", - "i,x,i:i,y,i:u,coord_type,i:b,,o"}, - {DROUTE_METHOD, impl_getAccessibleAtPoint, "getAccessibleAtPoint", - "i,x,i:i,y,i:u,coord_type,i:o,,o"}, - {DROUTE_METHOD, impl_getExtents, "getExtents", "u,coord_type,i:(uuuu),,o"}, - {DROUTE_METHOD, impl_getPosition, "getPosition", - "i,x,o:i,y,o:u,coord_type,i"}, - {DROUTE_METHOD, impl_getSize, "getSize", "i,width,o:i,height,o"}, - {DROUTE_METHOD, impl_getLayer, "getLayer", "g,,o"}, - {DROUTE_METHOD, impl_getMDIZOrder, "getMDIZOrder", "n,,o"}, - {DROUTE_METHOD, impl_grabFocus, "grabFocus", "b,,o"}, - //{ DROUTE_METHOD, impl_registerFocusHandler, "registerFocusHandler", "o,handler,i" }, - //{ DROUTE_METHOD, impl_deregisterFocusHandler, "deregisterFocusHandler", "o,handler,i" }, - {DROUTE_METHOD, impl_getAlpha, "getAlpha", "d,,o"}, - {0, NULL, NULL, NULL} + {impl_contains, "contains"}, + {impl_getAccessibleAtPoint, "getAccessibleAtPoint"}, + {impl_getExtents, "getExtents"}, + {impl_getPosition, "getPosition"}, + {impl_getSize, "getSize"}, + {impl_getLayer, "getLayer"}, + {impl_getMDIZOrder, "getMDIZOrder"}, + {impl_grabFocus, "grabFocus"}, + //{impl_registerFocusHandler, "registerFocusHandler"}, + //{impl_deregisterFocusHandler, "deregisterFocusHandler"}, + {impl_getAlpha, "getAlpha"}, + {NULL, NULL} }; void diff --git a/libspi/document.c b/libspi/document.c index c43f15e..f4fd592 100644 --- a/libspi/document.c +++ b/libspi/document.c @@ -134,11 +134,10 @@ impl_getAttributes (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getLocale, "getLocale", "s,,o"}, - {DROUTE_METHOD, impl_getAttributeValue, "getAttributeValue", - "s,attributename,i:s,,o"}, - {DROUTE_METHOD, impl_getAttributes, "getAttributes", "as,,o"}, - {0, NULL, NULL, NULL} + {impl_getLocale, "getLocale"}, + {impl_getAttributeValue, "getAttributeValue"}, + {impl_getAttributes, "getAttributes"}, + {NULL, NULL} }; void diff --git a/libspi/droute.c b/libspi/droute.c index 5f01cbe..eb1a24b 100644 --- a/libspi/droute.c +++ b/libspi/droute.c @@ -140,156 +140,6 @@ prop (DBusConnection * bus, DBusMessage * message, DRouteData * data) return DBUS_HANDLER_RESULT_HANDLED; } -static DBusHandlerResult -introspect (DBusConnection * bus, DBusMessage * message, DRouteData * data) -{ - const char *path = dbus_message_get_path (message); - GString *xml; - DRouteInterface *iface_def; - DRouteMethod *method; - DRouteProperty *property; - char *str; - DBusMessage *reply; - GSList *l; - void *datum; - - if (strcmp (dbus_message_get_member (message), "Introspect")) - { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - xml = g_string_new (NULL); - /* below code stolen from dbus-glib */ - g_string_append (xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE); - g_string_append_printf (xml, "\n", path); - - /* We are introspectable, though I guess that was pretty obvious */ - g_string_append_printf (xml, " \n", - DBUS_INTERFACE_INTROSPECTABLE); - g_string_append (xml, " \n"); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_STRING_AS_STRING); - g_string_append (xml, " \n"); - g_string_append (xml, " \n"); - - /* We support get/set/getall properties */ - g_string_append_printf (xml, " \n", - DBUS_INTERFACE_PROPERTIES); - g_string_append (xml, " \n"); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_STRING_AS_STRING); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_STRING_AS_STRING); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_VARIANT_AS_STRING); - g_string_append (xml, " \n"); - g_string_append (xml, " \n"); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_STRING_AS_STRING); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_STRING_AS_STRING); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_VARIANT_AS_STRING); - g_string_append (xml, " \n"); - g_string_append (xml, " \n"); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_STRING_AS_STRING); - g_string_append_printf (xml, - " \n", - DBUS_TYPE_ARRAY_AS_STRING - DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING - DBUS_TYPE_STRING_AS_STRING - DBUS_TYPE_VARIANT_AS_STRING - DBUS_DICT_ENTRY_END_CHAR_AS_STRING); - - g_string_append (xml, " \n"); - g_string_append (xml, " \n"); - /* end of stolen code */ - - for (l = data->interfaces; l; l = g_slist_next (l)) - { - iface_def = (DRouteInterface *) l->data; - if (iface_def->get_datum) - { - datum = (*iface_def->get_datum) (path, data->user_data); - if (!datum) - continue; - } - g_string_append_printf (xml, "\n", - iface_def->name); - if (iface_def->methods) - for (method = iface_def->methods; method->name; method++) - { - const char *p = method->arg_desc; - g_string_append_printf (xml, "<%s name=\"%s\">\n", - (method->type == - DROUTE_METHOD ? "method" : "signal"), - method->name); - while (*p) - { - g_string_append (xml, " 0) - { - g_string_append (xml, "\" name=\""); - g_string_append_len (xml, p, strcspn (p, ",:")); - p += strcspn (p, ","); - } - if (*p == ',') - p++; - g_string_append_printf (xml, "\" direction=\"%s\"/>\n", - (*p == 'o' ? "out" : "in")); - p += strcspn (p, ":"); - if (*p == ':') - p++; - } - g_string_append_printf (xml, "\n", - (method->type == - DROUTE_METHOD ? "method" : "signal")); - } - if (iface_def->properties) - for (property = iface_def->properties; property->name; property++) - { - if (!property->get && !property->set) - continue; - g_string_append_printf (xml, - "\n", - property->name, property->type, - (property->get ? "read" : ""), - (property->set ? "write" : "")); - } - if (iface_def->free_datum) - (*iface_def->free_datum) (datum); - g_string_append (xml, "\n"); - } - if (data->introspect_children) - { - (*data->introspect_children) (path, xml, data->user_data); - } - g_string_append (xml, "\n"); - str = g_string_free (xml, FALSE); - reply = dbus_message_new_method_return (message); - if (reply) - { - dbus_message_append_args (reply, DBUS_TYPE_STRING, &str, - DBUS_TYPE_INVALID); - } - g_free (str); - dbus_connection_send (bus, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; -} - DBusHandlerResult droute_message (DBusConnection * bus, DBusMessage * message, void *user_data) { @@ -311,25 +161,6 @@ droute_message (DBusConnection * bus, DBusMessage * message, void *user_data) return prop_get_all (bus, message, data); return prop (bus, message, data); } - else if (iface && !strcmp (iface, "org.freedesktop.DBus.Introspectable")) - { - return introspect (bus, message, data); - } - else - { - int message_type = dbus_message_get_type (message); - switch (message_type) - { - case DBUS_MESSAGE_TYPE_METHOD_CALL: - type = DROUTE_METHOD; - break; - case DBUS_MESSAGE_TYPE_SIGNAL: - type = DROUTE_SIGNAL; - break; - default: - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - } if (iface) { iface_def = find_iface (data, iface); @@ -338,7 +169,7 @@ droute_message (DBusConnection * bus, DBusMessage * message, void *user_data) if (iface_def->methods) for (method = iface_def->methods; method->func; method++) { - if (method->type == type && !strcmp (method->name, member)) + if (!strcmp (method->name, member)) { reply = (*method->func) (bus, message, @@ -364,7 +195,7 @@ droute_message (DBusConnection * bus, DBusMessage * message, void *user_data) if (iface_def->methods) for (method = iface_def->methods; method->func; method++) { - if (method->type == type && !strcmp (method->name, member)) + if (!strcmp (method->name, member)) { reply = (*method->func) (bus, message, data->user_data); if (reply) diff --git a/libspi/droute.h b/libspi/droute.h index 21a8150..c3006cc 100644 --- a/libspi/droute.h +++ b/libspi/droute.h @@ -30,18 +30,12 @@ typedef DBusMessage *(*DRouteFunction)(DBusConnection *, DBusMessage *, void *); typedef dbus_bool_t (*DRoutePropertyFunction)(const char *, DBusMessageIter *, void *); -typedef char *(*DRoutePropertyStrFunction)(void *); typedef struct _DRouteMethod DRouteMethod; struct _DRouteMethod { - /* DROUTE_(METHOD|SIGNAL) */ - int type; DRouteFunction func; const char *name; - /* arg_desc contains argument information used for introspection. - * It is a colon-delimited string of type,name,dir values */ - const char *arg_desc; dbus_bool_t wants_droute_data; }; @@ -49,11 +43,8 @@ typedef struct _DRouteProperty DRouteProperty; struct _DRouteProperty { DRoutePropertyFunction get; - DRoutePropertyStrFunction get_str; DRoutePropertyFunction set; - DRoutePropertyStrFunction set_str; const char *name; - const char *type; }; typedef void *(*DRouteGetDatumFunction)(const char *, void *); diff --git a/libspi/editabletext.c b/libspi/editabletext.c index 0d7ce58..e0b5ffb 100644 --- a/libspi/editabletext.c +++ b/libspi/editabletext.c @@ -246,18 +246,14 @@ impl_pasteText (DBusConnection * bus, DBusMessage * message, void *user_data) } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_setTextContents, "setTextContents", - "s,newContents,i:b,,o"}, - {DROUTE_METHOD, impl_insertText, "insertText", - "i,position,i:s,text,i:i,length,i:b,,o"}, - {DROUTE_METHOD, impl_setAttributes, "setAttributes", - "s,attributes,i:i,startPos,i:i,endPos,i:b,,o"}, - {DROUTE_METHOD, impl_copyText, "copyText", "i,startPos,i:i,endPos,i"}, - {DROUTE_METHOD, impl_cutText, "cutText", "i,startPos,i:i,endPos,i:b,,o"}, - {DROUTE_METHOD, impl_deleteText, "deleteText", - "i,startPos,i:i,endPos,i:b,,o"}, - {DROUTE_METHOD, impl_pasteText, "pasteText", "i,position,i:b,,o"}, - {0, NULL, NULL, NULL} + {impl_setTextContents, "setTextContents"}, + {impl_insertText, "insertText"}, + {impl_setAttributes, "setAttributes"}, + {impl_copyText, "copyText"}, + {impl_cutText, "cutText"}, + {impl_deleteText, "deleteText"}, + {impl_pasteText, "pasteText"}, + {NULL, NULL} }; void diff --git a/libspi/hyperlink.c b/libspi/hyperlink.c index d719fa8..95a70b3 100644 --- a/libspi/hyperlink.c +++ b/libspi/hyperlink.c @@ -51,14 +51,6 @@ impl_get_nAnchors (const char *path, DBusMessageIter * iter, void *user_data) return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link)); } -static char * -impl_get_nAnchors_str (void *datum) -{ - g_assert (ATK_IS_HYPERLINK (datum)); - return g_strdup_printf ("%d", - atk_hyperlink_get_n_anchors ((AtkHyperlink *) - datum)); -} static dbus_bool_t impl_get_startIndex (const char *path, DBusMessageIter * iter, @@ -70,15 +62,6 @@ impl_get_startIndex (const char *path, DBusMessageIter * iter, return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link)); } -static char * -impl_get_startIndex_str (void *datum) -{ - g_assert (ATK_IS_HYPERLINK (datum)); - return g_strdup_printf ("%d", - atk_hyperlink_get_start_index ((AtkHyperlink *) - datum)); -} - static dbus_bool_t impl_get_endIndex (const char *path, DBusMessageIter * iter, void *user_data) { @@ -88,15 +71,6 @@ impl_get_endIndex (const char *path, DBusMessageIter * iter, void *user_data) return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link)); } -static char * -impl_get_endIndex_str (void *datum) -{ - g_assert (ATK_IS_HYPERLINK (datum)); - return g_strdup_printf ("%d", - atk_hyperlink_get_end_index ((AtkHyperlink *) - datum)); -} - static DBusMessage * impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data) { @@ -170,17 +144,17 @@ impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data) } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getObject, "getObject", "i,i,i:o,,o"}, - {DROUTE_METHOD, impl_getURI, "getURI", "i,i,i:s,,o"}, - {DROUTE_METHOD, impl_isValid, "isValid", "b,,o"}, - {0, NULL, NULL, NULL} + {impl_getObject, "getObject"}, + {impl_getURI, "getURI"}, + {impl_isValid, "isValid"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_nAnchors, impl_get_nAnchors_str, NULL, NULL, "nAnchors"}, - {impl_get_startIndex, impl_get_startIndex_str, NULL, NULL, "startIndex"}, - {impl_get_endIndex, impl_get_endIndex_str, NULL, NULL, "endIndex"}, - {NULL, NULL, NULL, NULL, NULL} + {impl_get_nAnchors, NULL, "nAnchors"}, + {impl_get_startIndex, NULL, "startIndex"}, + {impl_get_endIndex, NULL, "endIndex"}, + {NULL, NULL, NULL} }; void diff --git a/libspi/hypertext.c b/libspi/hypertext.c index f6e0249..332b772 100644 --- a/libspi/hypertext.c +++ b/libspi/hypertext.c @@ -110,11 +110,10 @@ impl_getLinkIndex (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getNLinks, "getNLinks", "i,,o"}, - {DROUTE_METHOD, impl_getLink, "getLink", "i,linkIndex,i:o,,o"}, - {DROUTE_METHOD, impl_getLinkIndex, "getLinkIndex", - "i,characterIndex,i:i,,o"}, - {0, NULL, NULL, NULL} + {impl_getNLinks, "getNLinks"}, + {impl_getLink, "getLink"}, + {impl_getLinkIndex, "getLinkIndex"}, + {NULL, NULL} }; void diff --git a/libspi/image.c b/libspi/image.c index 54e03ce..598ed3b 100644 --- a/libspi/image.c +++ b/libspi/image.c @@ -53,14 +53,6 @@ impl_get_imageDescription (const char *path, DBusMessageIter * iter, atk_image_get_image_description (image)); } -static char * -impl_get_imageDescription_str (void *datum) -{ - AtkImage *image = (AtkImage *) datum; - g_assert (ATK_IS_IMAGE (datum)); - return g_strdup (atk_image_get_image_description (image)); -} - static dbus_bool_t impl_get_imageLocale (const char *path, DBusMessageIter * iter, void *user_data) @@ -71,14 +63,6 @@ impl_get_imageLocale (const char *path, DBusMessageIter * iter, return droute_return_v_string (iter, atk_image_get_image_locale (image)); } -static char * -impl_get_imageLocale_str (void *datum) -{ - AtkImage *image = (AtkImage *) datum; - g_assert (ATK_IS_IMAGE (datum)); - return g_strdup (atk_image_get_image_locale (image)); -} - static DBusMessage * impl_getImageExtents (DBusConnection * bus, DBusMessage * message, void *user_data) @@ -156,20 +140,16 @@ impl_getImageSize (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getImageExtents, "getImageExtents", - "n,coordType,i:(uuuu),,o"}, - {DROUTE_METHOD, impl_getImagePosition, "getImagePosition", - "i,x,o:i,y,o:n,coordType,i"}, - {DROUTE_METHOD, impl_getImageSize, "getImageSize", "i,width,o:i,height,o"}, - {0, NULL, NULL, NULL} + {impl_getImageExtents, "getImageExtents"}, + {impl_getImagePosition, "getImagePosition"}, + {impl_getImageSize, "getImageSize"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_imageDescription, impl_get_imageDescription_str, NULL, NULL, - "imageDescription", "s"}, - {impl_get_imageLocale, impl_get_imageLocale_str, NULL, NULL, "imageLocale", - "s"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {impl_get_imageDescription, NULL, "imageDescription"}, + {impl_get_imageLocale, NULL, "imageLocale"}, + {NULL, NULL, NULL} }; void diff --git a/libspi/selection.c b/libspi/selection.c index 2b3321e..3110c6e 100644 --- a/libspi/selection.c +++ b/libspi/selection.c @@ -251,23 +251,19 @@ impl_deselectChild (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getSelectedChild, "getSelectedChild", - "i,selectedChildIndex,i:o,,o"}, - {DROUTE_METHOD, impl_selectChild, "selectChild", "i,childIndex,i:b,,o"}, - {DROUTE_METHOD, impl_deselectSelectedChild, "deselectSelectedChild", - "i,selectedChildIndex,i:b,,o"}, - {DROUTE_METHOD, impl_isChildSelected, "isChildSelected", - "i,childIndex,i:b,,o"}, - {DROUTE_METHOD, impl_selectAll, "selectAll", "b,,o"}, - {DROUTE_METHOD, impl_clearSelection, "clearSelection", "b,,o"}, - {DROUTE_METHOD, impl_deselectChild, "deselectChild", "i,childIndex,i:b,,o"}, - {0, NULL, NULL, NULL} + {impl_getSelectedChild, "getSelectedChild"}, + {impl_selectChild, "selectChild"}, + {impl_deselectSelectedChild, "deselectSelectedChild"}, + {impl_isChildSelected, "isChildSelected"}, + {impl_selectAll, "selectAll"}, + {impl_clearSelection, "clearSelection"}, + {impl_deselectChild, "deselectChild"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_nSelectedChildren, impl_get_nSelectedChildren_str, NULL, NULL, - "nSelectedChildren"}, - {NULL, NULL, NULL, NULL, NULL} + {impl_get_nSelectedChildren, NULL, "nSelectedChildren"}, + {NULL, NULL, NULL} }; void diff --git a/libspi/table.c b/libspi/table.c index 8fc1d09..958fb93 100644 --- a/libspi/table.c +++ b/libspi/table.c @@ -51,13 +51,6 @@ impl_get_nRows (const char *path, DBusMessageIter * iter, void *user_data) return droute_return_v_int32 (iter, atk_table_get_n_rows (table)); } -static char * -impl_get_nRows_str (void *datum) -{ - g_assert (ATK_IS_TABLE (datum)); - return g_strdup_printf ("%d", atk_table_get_n_rows ((AtkTable *) datum)); -} - static dbus_bool_t impl_get_nColumns (const char *path, DBusMessageIter * iter, void *user_data) { @@ -67,13 +60,6 @@ impl_get_nColumns (const char *path, DBusMessageIter * iter, void *user_data) return droute_return_v_int32 (iter, atk_table_get_n_columns (table)); } -static char * -impl_get_nColumns_str (void *datum) -{ - g_assert (ATK_IS_TABLE (datum)); - return g_strdup_printf ("%d", atk_table_get_n_columns ((AtkTable *) datum)); -} - static dbus_bool_t impl_get_caption (const char *path, DBusMessageIter * iter, void *user_data) { @@ -84,14 +70,6 @@ impl_get_caption (const char *path, DBusMessageIter * iter, void *user_data) FALSE); } -static char * -impl_get_caption_str (void *datum) -{ - AtkTable *table = (AtkTable *) datum; - g_assert (ATK_IS_TABLE (datum)); - return spi_dbus_get_path (atk_table_get_caption (table)); -} - static dbus_bool_t impl_get_summary (const char *path, DBusMessageIter * iter, void *user_data) { @@ -102,14 +80,6 @@ impl_get_summary (const char *path, DBusMessageIter * iter, void *user_data) FALSE); } -static char * -impl_get_summary_str (void *datum) -{ - AtkTable *table = (AtkTable *) datum; - g_assert (ATK_IS_TABLE (datum)); - return spi_dbus_get_path (atk_table_get_summary (table)); -} - static dbus_bool_t impl_get_nSelectedRows (const char *path, DBusMessageIter * iter, void *user_data) @@ -125,18 +95,6 @@ impl_get_nSelectedRows (const char *path, DBusMessageIter * iter, return droute_return_v_int32 (iter, count); } -static char * -impl_get_nSelectedRows_str (void *datum) -{ - gint count; - gint *selected_rows = NULL; - g_assert (ATK_IS_TABLE (datum)); - count = atk_table_get_selected_rows ((AtkTable *) datum, &selected_rows); - if (selected_rows) - g_free (selected_rows); - return g_strdup_printf ("%d", count); -} - static dbus_bool_t impl_get_nSelectedColumns (const char *path, DBusMessageIter * iter, void *user_data) @@ -152,20 +110,6 @@ impl_get_nSelectedColumns (const char *path, DBusMessageIter * iter, return droute_return_v_int32 (iter, count); } -static char * -impl_get_nSelectedColumns_str (void *datum) -{ - gint count; - gint *selected_columns = NULL; - g_assert (ATK_IS_TABLE (datum)); - count = - atk_table_get_selected_columns ((AtkTable *) datum, &selected_columns); - if (selected_columns) - g_free (selected_columns); - return g_strdup_printf ("%d", count); -} - - static DBusMessage * impl_getAccessibleAt (DBusConnection * bus, DBusMessage * message, void *user_data) @@ -725,51 +669,37 @@ impl_getRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getAccessibleAt, "getAccessibleAt", - "i,row,i:i,column,i:o,,o"}, - {DROUTE_METHOD, impl_getIndexAt, "getIndexAt", "i,row,i:i,column,i:i,,o"}, - {DROUTE_METHOD, impl_getRowAtIndex, "getRowAtIndex", "i,index,i:i,,o"}, - {DROUTE_METHOD, impl_getColumnAtIndex, "getColumnAtIndex", - "i,index,i:i,,o"}, - {DROUTE_METHOD, impl_getRowDescription, "getRowDescription", - "i,row,i:s,,o"}, - {DROUTE_METHOD, impl_getColumnDescription, "getColumnDescription", - "i,column,i:s,,o"}, - {DROUTE_METHOD, impl_getRowExtentAt, "getRowExtentAt", - "i,row,i:i,column,i:i,,o"}, - {DROUTE_METHOD, impl_getColumnExtentAt, "getColumnExtentAt", - "i,row,i:i,column,i:i,,o"}, - {DROUTE_METHOD, impl_getRowHeader, "getRowHeader", "i,row,i:o,,o"}, - {DROUTE_METHOD, impl_getColumnHeader, "getColumnHeader", "i,column,i:o,,o"}, - {DROUTE_METHOD, impl_getSelectedRows, "getSelectedRows", "ai,,o"}, - {DROUTE_METHOD, impl_getSelectedColumns, "getSelectedColumns", "ai,,o"}, - {DROUTE_METHOD, impl_isRowSelected, "isRowSelected", "i,row,i:b,,o"}, - {DROUTE_METHOD, impl_isColumnSelected, "isColumnSelected", - "i,column,i:b,,o"}, - {DROUTE_METHOD, impl_isSelected, "isSelected", "i,row,i:i,column,i:b,,o"}, - {DROUTE_METHOD, impl_addRowSelection, "addRowSelection", "i,row,i:b,,o"}, - {DROUTE_METHOD, impl_addColumnSelection, "addColumnSelection", - "i,column,i:b,,o"}, - {DROUTE_METHOD, impl_removeRowSelection, "removeRowSelection", - "i,row,i:b,,o"}, - {DROUTE_METHOD, impl_removeColumnSelection, "removeColumnSelection", - "i,column,i:b,,o"}, - {DROUTE_METHOD, impl_getRowColumnExtentsAtIndex, - "getRowColumnExtentsAtIndex", - "i,index,i:i,row,o:i,col,o:i,row_extents,o:i,col_extents,o:b,is_selected,o:b,,o"}, - {0, NULL, NULL, NULL} + {impl_getAccessibleAt, "getAccessibleAt"}, + {impl_getIndexAt, "getIndexAt"}, + {impl_getRowAtIndex, "getRowAtIndex"}, + {impl_getColumnAtIndex, "getColumnAtIndex"}, + {impl_getRowDescription, "getRowDescription"}, + {impl_getColumnDescription, "getColumnDescription"}, + {impl_getRowExtentAt, "getRowExtentAt"}, + {impl_getColumnExtentAt, "getColumnExtentAt"}, + {impl_getRowHeader, "getRowHeader"}, + {impl_getColumnHeader, "getColumnHeader"}, + {impl_getSelectedRows, "getSelectedRows"}, + {impl_getSelectedColumns, "getSelectedColumns"}, + {impl_isRowSelected, "isRowSelected"}, + {impl_isColumnSelected, "isColumnSelected"}, + {impl_isSelected, "isSelected"}, + {impl_addRowSelection, "addRowSelection"}, + {impl_addColumnSelection, "addColumnSelection"}, + {impl_removeRowSelection, "removeRowSelection"}, + {impl_removeColumnSelection, "removeColumnSelection"}, + {impl_getRowColumnExtentsAtIndex, "getRowColumnExtentsAtIndex"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_nRows, impl_get_nRows_str, NULL, NULL, "nRows", "i"}, - {impl_get_nColumns, impl_get_nColumns_str, NULL, NULL, "nColumns", "i"}, - {impl_get_caption, impl_get_caption_str, NULL, NULL, "caption", "o"}, - {impl_get_summary, impl_get_summary_str, NULL, NULL, "summary", "o"}, - {impl_get_nSelectedRows, impl_get_nSelectedRows_str, NULL, NULL, - "nSelectedRows", "i"}, - {impl_get_nSelectedColumns, impl_get_nSelectedColumns_str, NULL, NULL, - "nSelectedColumns", "i"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {impl_get_nRows, NULL, "nRows"}, + {impl_get_nColumns, NULL, "nColumns"}, + {impl_get_caption, NULL, "caption"}, + {impl_get_summary, NULL, "summary"}, + {impl_get_nSelectedRows, NULL, "nSelectedRows"}, + {impl_get_nSelectedColumns, NULL, "nSelectedColumns"}, + {NULL, NULL, NULL} }; void diff --git a/libspi/text.c b/libspi/text.c index 653e0bd..aa4f7a6 100644 --- a/libspi/text.c +++ b/libspi/text.c @@ -53,15 +53,6 @@ impl_get_characterCount (const char *path, DBusMessageIter * iter, return droute_return_v_int32 (iter, atk_text_get_character_count (text)); } -static char * -impl_get_characterCount_str (void *datum) -{ - g_assert (ATK_IS_TEXT (datum)); - - return g_strdup_printf ("%d", - atk_text_get_character_count ((AtkText *) datum)); -} - static dbus_bool_t impl_get_caretOffset (const char *path, DBusMessageIter * iter, void *user_data) @@ -72,15 +63,6 @@ impl_get_caretOffset (const char *path, DBusMessageIter * iter, return droute_return_v_int32 (iter, atk_text_get_caret_offset (text)); } -static char * -impl_get_caretOffset_str (void *datum) -{ - g_assert (ATK_IS_TEXT (datum)); - - return g_strdup_printf ("%d", - atk_text_get_caret_offset ((AtkText *) datum)); -} - static DBusMessage * impl_getText (DBusConnection * bus, DBusMessage * message, void *user_data) { @@ -848,50 +830,32 @@ impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message, } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getText, "getText", - "i,startOffset,i:i,endOffset,i:s,,o"}, - {DROUTE_METHOD, impl_setCaretOffset, "setCaretOffset", "i,offset,i:b,,o"}, - {DROUTE_METHOD, impl_getTextBeforeOffset, "getTextBeforeOffset", - "i,offset,i:u,type,i:i,startOffset,o:i,endOffset,o:s,,o"}, - {DROUTE_METHOD, impl_getTextAtOffset, "getTextAtOffset", - "i,offset,i:u,type,i:i,startOffset,o:i,endOffset,o:s,,o"}, - {DROUTE_METHOD, impl_getTextAfterOffset, "getTextAfterOffset", - "i,offset,i:u,type,i:i,startOffset,o:i,endOffset,o:s,,o"}, - {DROUTE_METHOD, impl_getAttributeValue, "getAttributeValue", - "i,offset,i:s,attributeName,i:i,startOffset,o:i,endOffset,o:b,defined,o:s,,o"}, - {DROUTE_METHOD, impl_getAttributes, "getAttributes", - "i,offset,i:i,startOffset,o:i,endOffset,o:s,,o"}, - {DROUTE_METHOD, impl_getDefaultAttributes, "getDefaultAttributes", "s,,o"}, - {DROUTE_METHOD, impl_getCharacterExtents, "getCharacterExtents", - "i,offset,i:i,x,o:i,y,o:i,width,o:i,height,o:u,coordType,i"}, - {DROUTE_METHOD, impl_getOffsetAtPoint, "getOffsetAtPoint", - "i,x,i:i,y,i:u,coordType,i:i,,o"}, - {DROUTE_METHOD, impl_getNSelections, "getNSelections", "i,,o"}, - {DROUTE_METHOD, impl_getSelection, "getSelection", - "i,selectionNum,i:i,startOffset,o:i,endOffset,o"}, - {DROUTE_METHOD, impl_addSelection, "addSelection", - "i,startOffset,i:i,endOffset,i:b,,o"}, - {DROUTE_METHOD, impl_removeSelection, "removeSelection", - "i,selectionNum,i:b,,o"}, - {DROUTE_METHOD, impl_setSelection, "setSelection", - "i,selectionNum,i:i,startOffset,i:i,endOffset,i:b,,o"}, - {DROUTE_METHOD, impl_getRangeExtents, "getRangeExtents", - "i,startOffset,i:i,endOffset,i:i,x,o:i,y,o:i,width,o:i,height,o:u,coordType,i"}, - {DROUTE_METHOD, impl_getBoundedRanges, "getBoundedRanges", - "i,x,i:i,y,i:i,width,i:i,height,i:u,coordType,i:u,xClipType,i:u,yClipType,i:a(iisv),,o"}, - {DROUTE_METHOD, impl_getAttributeRun, "getAttributeRun", - "i,offset,i:i,startOffset,o:i,endOffset,o:b,includeDefaults,i:as,,o"}, - {DROUTE_METHOD, impl_getDefaultAttributeSet, "getDefaultAttributeSet", - "as,,o"}, - {0, NULL, NULL, NULL} + {impl_getText, "getText"}, + {impl_setCaretOffset, "setCaretOffset"}, + {impl_getTextBeforeOffset, "getTextBeforeOffset"}, + {impl_getTextAtOffset, "getTextAtOffset"}, + {impl_getTextAfterOffset, "getTextAfterOffset"}, + {impl_getAttributeValue, "getAttributeValue"}, + {impl_getAttributes, "getAttributes"}, + {impl_getDefaultAttributes, "getDefaultAttributes"}, + {impl_getCharacterExtents, "getCharacterExtents"}, + {impl_getOffsetAtPoint, "getOffsetAtPoint"}, + {impl_getNSelections, "getNSelections"}, + {impl_getSelection, "getSelection"}, + {impl_addSelection, "addSelection"}, + {impl_removeSelection, "removeSelection"}, + {impl_setSelection, "setSelection"}, + {impl_getRangeExtents, "getRangeExtents"}, + {impl_getBoundedRanges, "getBoundedRanges"}, + {impl_getAttributeRun, "getAttributeRun"}, + {impl_getDefaultAttributeSet, "getDefaultAttributeSet"}, + {NULL, NULL} }; static DRouteProperty properties[] = { - {impl_get_characterCount, impl_get_characterCount_str, NULL, NULL, - "characterCount", "i"}, - {impl_get_caretOffset, impl_get_caretOffset_str, NULL, NULL, "caretOffset", - "i"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {impl_get_characterCount, NULL, "characterCount"}, + {impl_get_caretOffset, NULL, "caretOffset"}, + {NULL, NULL, NULL} }; void diff --git a/libspi/tree.c b/libspi/tree.c index ae96072..92f7f89 100644 --- a/libspi/tree.c +++ b/libspi/tree.c @@ -162,9 +162,9 @@ impl_getTree (DBusConnection * bus, DBusMessage * message, void *user_data) } static DRouteMethod methods[] = { - {DROUTE_METHOD, impl_getRoot, "getRoot", "o,root,o" }, - {DROUTE_METHOD, impl_getTree, "getTree", "a(ooaoassus),tree,o", TRUE}, - {0, NULL, NULL, NULL} + {impl_getRoot, "getRoot"}, + {impl_getTree, "getTree", TRUE}, + {NULL, NULL} }; void diff --git a/libspi/value.c b/libspi/value.c index 929c484..b022b59 100644 --- a/libspi/value.c +++ b/libspi/value.c @@ -192,17 +192,6 @@ impl_get_minimumValue (const char *path, DBusMessageIter * iter, return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } -static char * -impl_get_minimumValue_str (void *datum) -{ - AtkValue *value = (AtkValue *) datum; - GValue gvalue = { 0, }; - if (!value) - return FALSE; - atk_value_get_minimum_value (value, &gvalue); - return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); -} - static dbus_bool_t impl_get_maximumValue (const char *path, DBusMessageIter * iter, void *user_data) @@ -215,17 +204,6 @@ impl_get_maximumValue (const char *path, DBusMessageIter * iter, return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } -static char * -impl_get_maximumValue_str (void *datum) -{ - AtkValue *value = (AtkValue *) datum; - GValue gvalue = { 0, }; - if (!value) - return FALSE; - atk_value_get_maximum_value (value, &gvalue); - return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); -} - static dbus_bool_t impl_get_minimumIncrement (const char *path, DBusMessageIter * iter, void *user_data) @@ -238,17 +216,6 @@ impl_get_minimumIncrement (const char *path, DBusMessageIter * iter, return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } -static char * -impl_get_minimumIncrement_str (void *datum) -{ - AtkValue *value = (AtkValue *) datum; - GValue gvalue = { 0, }; - if (!value) - return FALSE; - atk_value_get_minimum_value (value, &gvalue); - return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); -} - static dbus_bool_t impl_get_currentValue (const char *path, DBusMessageIter * iter, void *user_data) @@ -261,17 +228,6 @@ impl_get_currentValue (const char *path, DBusMessageIter * iter, return droute_return_v_double (iter, get_double_from_gvalue (&gvalue)); } -static char * -impl_get_currentValue_str (void *datum) -{ - AtkValue *value = (AtkValue *) datum; - GValue gvalue = { 0, }; - if (!value) - return FALSE; - atk_value_get_current_value (value, &gvalue); - return g_strdup_printf ("%lf", get_double_from_gvalue (&gvalue)); -} - static dbus_bool_t impl_set_currentValue (const char *path, DBusMessageIter * iter, void *user_data) @@ -290,15 +246,11 @@ impl_set_currentValue (const char *path, DBusMessageIter * iter, } static DRouteProperty properties[] = { - {impl_get_minimumValue, impl_get_minimumValue_str, NULL, NULL, - "minimumValue", "d"}, - {impl_get_maximumValue, impl_get_maximumValue_str, NULL, NULL, - "maximumValue", "d"}, - {impl_get_minimumIncrement, impl_get_minimumIncrement_str, NULL, NULL, - "minimumIncrement", "d"}, - {impl_get_currentValue, impl_get_currentValue_str, impl_set_currentValue, - NULL, "currentValue", "d"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {impl_get_minimumValue, NULL, "minimumValue"}, + {impl_get_maximumValue, NULL, "maximumValue"}, + {impl_get_minimumIncrement, NULL, "minimumIncrement"}, + {impl_get_currentValue, impl_set_currentValue, "currentValue"}, + {NULL, NULL, NULL} }; void