Use accessor functions to access GtkCheckMenuItem

This commit is contained in:
Javier Jardón 2010-06-02 02:23:10 +02:00
parent 72f515a0f3
commit 94fd7a3502
5 changed files with 21 additions and 17 deletions

View File

@ -511,7 +511,7 @@ static void
activate_cb (GtkWidget *menuitem, activate_cb (GtkWidget *menuitem,
GtkIMMulticontext *context) 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"); const gchar *id = g_object_get_data (G_OBJECT (menuitem), "gtk-context-id");

View File

@ -156,7 +156,7 @@ gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
} }
else 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); /* 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; GtkCheckMenuItem *tmp_menu_item;
GtkAction *action; GtkAction *action;
GSList *tmp_list; GSList *tmp_list;
gboolean active;
gint toggled; gint toggled;
action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (menu_item)); action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (menu_item));
@ -440,7 +441,8 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
toggled = FALSE; toggled = FALSE;
if (check_menu_item->active) active = gtk_check_menu_item_get_active (check_menu_item);
if (active)
{ {
tmp_menu_item = NULL; tmp_menu_item = NULL;
tmp_list = radio_menu_item->group; 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_menu_item = tmp_list->data;
tmp_list = tmp_list->next; 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; break;
tmp_menu_item = NULL; tmp_menu_item = NULL;
@ -459,13 +462,13 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
if (tmp_menu_item) if (tmp_menu_item)
{ {
toggled = TRUE; toggled = TRUE;
check_menu_item->active = !check_menu_item->active; gtk_check_menu_item_set_active (check_menu_item, !active);
} }
} }
else else
{ {
toggled = TRUE; 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; tmp_list = radio_menu_item->group;
while (tmp_list) while (tmp_list)
@ -473,9 +476,10 @@ gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
tmp_menu_item = tmp_list->data; tmp_menu_item = tmp_list->data;
tmp_list = tmp_list->next; 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; break;
} }
} }

View File

@ -100,7 +100,7 @@ gail_check_menu_item_toggled_gtk (GtkWidget *widget)
accessible = gtk_widget_get_accessible (widget); accessible = gtk_widget_get_accessible (widget);
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, atk_object_notify_state_change (accessible, ATK_STATE_CHECKED,
check_menu_item->active); gtk_check_menu_item_get_active (check_menu_item));
} }
static AtkStateSet* static AtkStateSet*

View File

@ -97,7 +97,7 @@ gail_check_sub_menu_item_toggled_gtk (GtkWidget *widget)
accessible = gtk_widget_get_accessible (widget); accessible = gtk_widget_get_accessible (widget);
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, atk_object_notify_state_change (accessible, ATK_STATE_CHECKED,
check_menu_item->active); gtk_check_menu_item_get_active (check_menu_item));
} }
static AtkStateSet* static AtkStateSet*

View File

@ -2610,7 +2610,7 @@ void _action_cb(GtkWidget *widget, gpointer *userdata)
void _toggle_terminal(GtkCheckMenuItem *checkmenuitem, void _toggle_terminal(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
display_ascii = TRUE; display_ascii = TRUE;
else else
display_ascii = FALSE; display_ascii = FALSE;
@ -2619,7 +2619,7 @@ void _toggle_terminal(GtkCheckMenuItem *checkmenuitem,
void _toggle_no_signals(GtkCheckMenuItem *checkmenuitem, void _toggle_no_signals(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
no_signals = TRUE; no_signals = TRUE;
else else
no_signals = FALSE; no_signals = FALSE;
@ -2628,7 +2628,7 @@ void _toggle_no_signals(GtkCheckMenuItem *checkmenuitem,
void _toggle_magnifier(GtkCheckMenuItem *checkmenuitem, void _toggle_magnifier(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
use_magnifier = TRUE; use_magnifier = TRUE;
else else
use_magnifier = FALSE; use_magnifier = FALSE;
@ -2637,7 +2637,7 @@ void _toggle_magnifier(GtkCheckMenuItem *checkmenuitem,
void _toggle_festival(GtkCheckMenuItem *checkmenuitem, void _toggle_festival(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
use_festival = TRUE; use_festival = TRUE;
else else
use_festival = FALSE; use_festival = FALSE;
@ -2646,7 +2646,7 @@ void _toggle_festival(GtkCheckMenuItem *checkmenuitem,
void _toggle_festival_terse(GtkCheckMenuItem *checkmenuitem, void _toggle_festival_terse(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
{ {
say_role = FALSE; say_role = FALSE;
say_accel = FALSE; say_accel = FALSE;
@ -2661,7 +2661,7 @@ void _toggle_festival_terse(GtkCheckMenuItem *checkmenuitem,
void _toggle_trackmouse(GtkCheckMenuItem *checkmenuitem, void _toggle_trackmouse(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
{ {
mouse_watcher_focus_id = mouse_watcher_focus_id =
atk_add_global_event_listener(_mouse_watcher, atk_add_global_event_listener(_mouse_watcher,
@ -2685,7 +2685,7 @@ void _toggle_trackmouse(GtkCheckMenuItem *checkmenuitem,
void _toggle_trackfocus(GtkCheckMenuItem *checkmenuitem, void _toggle_trackfocus(GtkCheckMenuItem *checkmenuitem,
gpointer user_data) gpointer user_data)
{ {
if (checkmenuitem->active) if (gtk_check_menu_item_get_active (checkmenuitem))
{ {
track_focus = TRUE; track_focus = TRUE;
focus_tracker_id = atk_add_focus_tracker (_print_accessible); focus_tracker_id = atk_add_focus_tracker (_print_accessible);