[gtk+] gail: Use accessor functions to access GtkWindow



commit fe16bdd8d4411c6f4c25fe2838f0cccba33793af
Author: Javier Jardón <jjardon gnome org>
Date:   Tue Aug 17 15:01:02 2010 +0200

    gail: Use accessor functions to access GtkWindow

 modules/other/gail/gail.c           |   13 +++++++++----
 modules/other/gail/gailutil.c       |    9 ++-------
 modules/other/gail/gailwindow.c     |    4 ++--
 modules/other/gail/tests/ferret.c   |    2 +-
 modules/other/gail/tests/testtext.c |    6 ++----
 5 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 6e97505..5e05d22 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -213,10 +213,15 @@ gail_focus_watcher (GSignalInvocationHint *ihint,
         {
           if (GTK_IS_WINDOW (widget))
             {
+              GtkWidget *focus_widget;
               GtkWindow *window;
+              GtkWindowType type;
 
               window = GTK_WINDOW (widget);
-              if (window->focus_widget)
+              focus_widget = gtk_window_get_focus (window);
+              g_object_get (window, "type", &type, NULL);
+
+              if (focus_widget)
                 {
                   /*
                    * If we already have a potential focus widget set this
@@ -229,15 +234,15 @@ gail_focus_watcher (GSignalInvocationHint *ihint,
                           !focus_before_menu)
                         {
                           void *vp_focus_before_menu = &focus_before_menu;
-                          focus_before_menu = window->focus_widget;
+                          focus_before_menu = focus_widget;
                           g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
                         }
 
                       return TRUE;
                     }
-                  widget = window->focus_widget;
+                  widget = focus_widget;
                 }
-              else if (window->type == GTK_WINDOW_POPUP) 
+              else if (type == GTK_WINDOW_POPUP)
                 {
 	          if (GTK_IS_BIN (widget))
 		    {
diff --git a/modules/other/gail/gailutil.c b/modules/other/gail/gailutil.c
index f784538..c6b8430 100644
--- a/modules/other/gail/gailutil.c
+++ b/modules/other/gail/gailutil.c
@@ -500,8 +500,8 @@ window_removed (AtkObject *atk_obj,
    * Deactivate window if it is still focused and we are removing it. This
    * can happen when a dialog displayed by gok is removed.
    */
-  if (window->is_active &&
-      window->has_toplevel_focus)
+  if (gtk_window_is_active (window) &&
+      gtk_window_has_toplevel_focus (window))
     {
       gchar *signal_name;
       AtkObject *atk_obj;
@@ -556,11 +556,6 @@ configure_event_watcher (GSignalInvocationHint  *hint,
   event = g_value_get_boxed (param_values + 1);
   if (event->type != GDK_CONFIGURE)
     return FALSE;
-  if (GTK_WINDOW (object)->configure_request_count)
-    /*
-     * There is another ConfigureRequest pending so we ignore this one.
-     */
-    return TRUE;
   widget = GTK_WIDGET (object);
   gtk_widget_get_allocation (widget, &allocation);
   if (allocation.x == ((GdkEventConfigure *)event)->x &&
diff --git a/modules/other/gail/gailwindow.c b/modules/other/gail/gailwindow.c
index 88f47a0..0f80a7b 100644
--- a/modules/other/gail/gailwindow.c
+++ b/modules/other/gail/gailwindow.c
@@ -228,7 +228,7 @@ gail_window_real_initialize (AtkObject *obj,
         obj->role = ATK_ROLE_TOOL_TIP;
       else if (GTK_IS_PLUG (widget))
         obj->role = ATK_ROLE_PANEL;
-      else if (GTK_WINDOW (widget)->type == GTK_WINDOW_POPUP)
+      else if (gtk_window_get_window_type (GTK_WINDOW (widget)) == GTK_WINDOW_POPUP)
         obj->role = ATK_ROLE_WINDOW;
       else
         obj->role = ATK_ROLE_FRAME;
@@ -445,7 +445,7 @@ gail_window_ref_state_set (AtkObject *accessible)
 
   window = GTK_WINDOW (widget);
 
-  if (window->has_focus)
+  if (gtk_window_has_toplevel_focus (window) && gtk_window_is_active (window))
     atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
 
   gdk_window = gtk_widget_get_window (widget);
diff --git a/modules/other/gail/tests/ferret.c b/modules/other/gail/tests/ferret.c
index 7750fec..f6f2d37 100644
--- a/modules/other/gail/tests/ferret.c
+++ b/modules/other/gail/tests/ferret.c
@@ -1479,7 +1479,7 @@ _mouse_watcher (GSignalInvocationHint *ihint,
     widget = GTK_WIDGET (object);
     if (GTK_IS_WINDOW (widget))
     {
-        GtkWidget *focus_widget = GTK_WINDOW (widget)->focus_widget;
+        GtkWidget *focus_widget = gtk_window_get_focus (GTK_WINDOW (widget));
         if (focus_widget != NULL)
             widget = focus_widget;
     }
diff --git a/modules/other/gail/tests/testtext.c b/modules/other/gail/tests/testtext.c
index c461006..8f9edd6 100644
--- a/modules/other/gail/tests/testtext.c
+++ b/modules/other/gail/tests/testtext.c
@@ -49,10 +49,8 @@ static void _check_text (AtkObject *in_obj)
       title = NULL;
 
     toplevel = gtk_widget_get_toplevel (widget);
-    if (GTK_IS_WINDOW (toplevel) && GTK_WINDOW (toplevel)->title)
-    {
-      title = GTK_WINDOW (toplevel)->title;
-    }
+    if (GTK_IS_WINDOW (toplevel))
+      title = (gchar *) gtk_window_get_title (GTK_WINDOW (toplevel));
     else
       title = NULL;
   }



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