Add check that role is actually being changed. Do not emit notification
authorPadraig O'Briain <padraig.obriain@sun.com>
Fri, 7 Mar 2003 08:36:20 +0000 (08:36 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Fri, 7 Mar 2003 08:36:20 +0000 (08:36 +0000)
2003-03-07  Padraig O'Briain  <padraig.obriain@sun.com>

* atk/atkobject.c (atk_object_set_role): Add check that role is
actually being changed. Do not emit notification for initial
role setting. (bug #107710)

ChangeLog
atk/atkobject.c

index 47de5db..35c2629 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-07  Padraig O'Briain  <padraig.obriain@sun.com>
+
+       * atk/atkobject.c (atk_object_set_role): Add check that role is
+       actually being changed. Do not emit notification for initial
+       role setting. (bug #107710)
+
 2003-03-06  Padraig O'Briain  <padraig.obriain@sun.com>
 
        * atk/atkrelationset.c: Current returning of FALSE to 0 in function 
index c63c7ef..31bbc65 100755 (executable)
@@ -762,14 +762,21 @@ atk_object_set_role (AtkObject *accessible,
                      AtkRole   role)
 {
   AtkObjectClass *klass;
+  AtkRole old_role;
 
   g_return_if_fail (ATK_IS_OBJECT (accessible));
 
   klass = ATK_OBJECT_GET_CLASS (accessible);
   if (klass->set_role)
     {
-      (klass->set_role) (accessible, role);
-      g_object_notify (G_OBJECT (accessible), atk_object_name_property_role);
+      old_role = atk_object_get_role (accessible);
+      if (old_role != role)
+        {
+          (klass->set_role) (accessible, role);
+          if (old_role != ATK_ROLE_UNKNOWN)
+          /* Do not notify for initial role setting */
+            g_object_notify (G_OBJECT (accessible), atk_object_name_property_role);
+        }
     }
 }