[gtk+/refactor: 24/106] Use accessor functions to access GtkCheckMenuItem



commit 11b4a604185998c74710dda576219b3a26f0ddfd
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Jun 2 02:23:10 2010 +0200

    Use accessor functions to access GtkCheckMenuItem

 gtk/gtkimmulticontext.c                   |    2 +-
 gtk/gtkradiomenuitem.c                    |   18 +++++++++++-------
 modules/other/gail/gailcheckmenuitem.c    |    2 +-
 modules/other/gail/gailchecksubmenuitem.c |    2 +-
 modules/other/gail/tests/ferret.c         |   14 +++++++-------
 5 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index cbaebe8..3da16f3 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -511,7 +511,7 @@ static void
 activate_cb (GtkWidget         *menuitem,
 	     GtkIMMulticontext *context)
 {
-  if (GTK_CHECK_MENU_ITEM (menuitem)->active)
+  if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
     {
       const gchar *id = g_object_get_data (G_OBJECT (menuitem), "gtk-context-id");
 
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index 4cbdc0e..feb03b1 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -156,7 +156,7 @@ gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
     }
   else
     {
-      GTK_CHECK_MENU_ITEM (radio_menu_item)->active = TRUE;
+      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (radio_menu_item), TRUE);
       /* gtk_widget_set_state (GTK_WIDGET (radio_menu_item), GTK_STATE_ACTIVE);
        */
     }
@@ -432,6 +432,7 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
   GtkCheckMenuItem *tmp_menu_item;
   GtkAction        *action;
   GSList *tmp_list;
+  gboolean active;
   gint toggled;
 
   action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (menu_item));
@@ -440,7 +441,8 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
 
   toggled = FALSE;
 
-  if (check_menu_item->active)
+  active = gtk_check_menu_item_get_active (check_menu_item);
+  if (active)
     {
       tmp_menu_item = NULL;
       tmp_list = radio_menu_item->group;
@@ -450,7 +452,8 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
 	  tmp_menu_item = tmp_list->data;
 	  tmp_list = tmp_list->next;
 
-	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
+          if (gtk_check_menu_item_get_active (tmp_menu_item) &&
+              tmp_menu_item != check_menu_item)
 	    break;
 
 	  tmp_menu_item = NULL;
@@ -459,13 +462,13 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
       if (tmp_menu_item)
 	{
 	  toggled = TRUE;
-	  check_menu_item->active = !check_menu_item->active;
+          gtk_check_menu_item_set_active (check_menu_item, !active);
 	}
     }
   else
     {
       toggled = TRUE;
-      check_menu_item->active = !check_menu_item->active;
+      gtk_check_menu_item_set_active (check_menu_item, !active);
 
       tmp_list = radio_menu_item->group;
       while (tmp_list)
@@ -473,9 +476,10 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
 	  tmp_menu_item = tmp_list->data;
 	  tmp_list = tmp_list->next;
 
-	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
+          if (gtk_check_menu_item_get_active (tmp_menu_item) &&
+              tmp_menu_item != check_menu_item)
 	    {
-	      gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
+              gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
 	      break;
 	    }
 	}
diff --git a/modules/other/gail/gailcheckmenuitem.c b/modules/other/gail/gailcheckmenuitem.c
index 9ee53ea..c9d2858 100644
--- a/modules/other/gail/gailcheckmenuitem.c
+++ b/modules/other/gail/gailcheckmenuitem.c
@@ -100,7 +100,7 @@ gail_check_menu_item_toggled_gtk (GtkWidget       *widget)
 
   accessible = gtk_widget_get_accessible (widget);
   atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, 
-                                  check_menu_item->active);
+                                  gtk_check_menu_item_get_active (check_menu_item));
 } 
 
 static AtkStateSet*
diff --git a/modules/other/gail/gailchecksubmenuitem.c b/modules/other/gail/gailchecksubmenuitem.c
index f5b7a8d..97f0a7b 100644
--- a/modules/other/gail/gailchecksubmenuitem.c
+++ b/modules/other/gail/gailchecksubmenuitem.c
@@ -97,7 +97,7 @@ gail_check_sub_menu_item_toggled_gtk (GtkWidget       *widget)
 
   accessible = gtk_widget_get_accessible (widget);
   atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, 
-                                  check_menu_item->active);
+                                  gtk_check_menu_item_get_active (check_menu_item));
 } 
 
 static AtkStateSet*
diff --git a/modules/other/gail/tests/ferret.c b/modules/other/gail/tests/ferret.c
index 6eb4b9a..7750fec 100644
--- a/modules/other/gail/tests/ferret.c
+++ b/modules/other/gail/tests/ferret.c
@@ -2610,7 +2610,7 @@ void _action_cb(GtkWidget *widget, gpointer  *userdata)
 void _toggle_terminal(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
        display_ascii = TRUE;
    else
        display_ascii = FALSE;
@@ -2619,7 +2619,7 @@ void _toggle_terminal(GtkCheckMenuItem *checkmenuitem,
 void _toggle_no_signals(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
        no_signals = TRUE;
    else
        no_signals = FALSE;
@@ -2628,7 +2628,7 @@ void _toggle_no_signals(GtkCheckMenuItem *checkmenuitem,
 void _toggle_magnifier(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
        use_magnifier = TRUE;
    else
        use_magnifier = FALSE;
@@ -2637,7 +2637,7 @@ void _toggle_magnifier(GtkCheckMenuItem *checkmenuitem,
 void _toggle_festival(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
        use_festival = TRUE;
    else
        use_festival = FALSE;
@@ -2646,7 +2646,7 @@ void _toggle_festival(GtkCheckMenuItem *checkmenuitem,
 void _toggle_festival_terse(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
      {
         say_role = FALSE;
         say_accel = FALSE;
@@ -2661,7 +2661,7 @@ void _toggle_festival_terse(GtkCheckMenuItem *checkmenuitem,
 void _toggle_trackmouse(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
      {
         mouse_watcher_focus_id =
           atk_add_global_event_listener(_mouse_watcher,
@@ -2685,7 +2685,7 @@ void _toggle_trackmouse(GtkCheckMenuItem *checkmenuitem,
 void _toggle_trackfocus(GtkCheckMenuItem *checkmenuitem,
   gpointer user_data)
 {
-   if (checkmenuitem->active)
+   if (gtk_check_menu_item_get_active (checkmenuitem))
      {
        track_focus = TRUE;
        focus_tracker_id = atk_add_focus_tracker (_print_accessible);



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