X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atspi%2Fatspi-matchrule.c;h=6fb4210711501eb94a9ad40bd0d938afe6358355;hb=3785cfb93aa4a29b70ffdd39686f14d2c8e26b0b;hp=60060bbd67a460c7ed3e0decaa7b48e8be4eaab5;hpb=bbb28bfb926d095e336bb532a9543ad07d2c6649;p=platform%2Fupstream%2Fat-spi2-core.git diff --git a/atspi/atspi-matchrule.c b/atspi/atspi-matchrule.c index 60060bb..6fb4210 100644 --- a/atspi/atspi-matchrule.c +++ b/atspi/atspi-matchrule.c @@ -7,19 +7,19 @@ * Copyright 2010, 2011 Novell, Inc. * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public + * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. */ #include "atspi-private.h" @@ -55,10 +55,14 @@ static void atspi_match_rule_finalize (GObject *object) { AtspiMatchRule *rule = ATSPI_MATCH_RULE (object); + gint i; - /* TODO: Check that interfaces don't leak */ if (rule->interfaces) + { + for (i = 0; i < rule->interfaces->len; i++) + g_free (g_array_index (rule->interfaces, gchar *, i)); g_array_free (rule->interfaces, TRUE); + } if (rule->attributes) g_hash_table_unref (rule->attributes); @@ -81,7 +85,10 @@ atspi_match_rule_class_init (AtspiMatchRuleClass *klass) * @statematchtype: An #AtspiCollectionMatchType specifying how to interpret * @states. * @attributes: (element-type gchar* gchar*): A #GHashTable specifying - * attributes to match. + * attributes to match. To specify multiple attribute values, + * separate each value with a :: If an attribute value contains a :, + * then it can be escaped by preceding it with a \. A backslash can + * likewise be escaped by inserting a double backslash. * @attributematchtype: An #AtspiCollectionMatchType specifying how to * interpret @attributes. * @interfaces: (element-type gchar*): An array of interfaces to match, or @@ -119,9 +126,6 @@ atspi_match_rule_new (AtspiStateSet *states, AtspiMatchRule *rule = g_object_new (ATSPI_TYPE_MATCH_RULE, NULL); int i; - if (!rule) - return NULL; - if (states) rule->states = g_object_ref (states); rule->statematchtype = statematchtype; @@ -142,7 +146,14 @@ atspi_match_rule_new (AtspiStateSet *states, rule->attributematchtype = attributematchtype; if (interfaces) - rule->interfaces = g_array_ref (interfaces); + { + rule->interfaces = g_array_new (TRUE, TRUE, sizeof (gchar *)); + for (i = 0; i < interfaces->len; i++) + { + gchar *val = g_strdup (g_array_index (interfaces, gchar *, i)); + rule->interfaces = g_array_append_val (rule->interfaces, val); + } + } rule->interfacematchtype = interfacematchtype; if (roles) @@ -153,7 +164,7 @@ atspi_match_rule_new (AtspiStateSet *states, if (role < 128) rule->roles [role / 32] |= (1 << (role % 32)); else - g_warning ("Atspi: unexpected role %d\n", role); + g_warning ("AT-SPI: unexpected role %d\n", role); } } else @@ -216,7 +227,8 @@ _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter) if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "{ss}", &iter_dict)) return FALSE; - g_hash_table_foreach (rule->attributes, append_entry, &iter_dict); + if (rule->attributes) + g_hash_table_foreach (rule->attributes, append_entry, &iter_dict); dbus_message_iter_close_container (&iter_struct, &iter_dict); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_attributematchtype);