Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
gtk
Commits
fdc40111
Commit
fdc40111
authored
Jun 29, 2011
by
Benjamin Otte
Committed by
Matthias Clasen
Jul 05, 2011
Browse files
a11y: Remove idle handler from menuitem action
parent
3e49e238
Changes
2
Hide whitespace changes
Inline
Side-by-side
gtk/a11y/gailmenuitem.c
View file @
fdc40111
...
...
@@ -49,7 +49,6 @@ static const gchar * gail_menu_item_get_name (AtkObject *obje
static
void
atk_action_interface_init
(
AtkActionIface
*
iface
);
static
gboolean
gail_menu_item_do_action
(
AtkAction
*
action
,
gint
i
);
static
gboolean
idle_do_action
(
gpointer
data
);
static
gint
gail_menu_item_get_n_actions
(
AtkAction
*
action
);
static
const
gchar
*
gail_menu_item_action_get_name
(
AtkAction
*
action
,
gint
i
);
...
...
@@ -444,40 +443,6 @@ atk_action_interface_init (AtkActionIface *iface)
iface
->
get_keybinding
=
gail_menu_item_get_keybinding
;
}
static
gboolean
gail_menu_item_do_action
(
AtkAction
*
action
,
gint
i
)
{
if
(
i
==
0
)
{
GtkWidget
*
item
;
GailMenuItem
*
gail_menu_item
;
item
=
gtk_accessible_get_widget
(
GTK_ACCESSIBLE
(
action
));
if
(
item
==
NULL
)
/* State is defunct */
return
FALSE
;
if
(
!
gtk_widget_get_sensitive
(
item
)
||
!
gtk_widget_get_visible
(
item
))
return
FALSE
;
gail_menu_item
=
GAIL_MENU_ITEM
(
action
);
if
(
gail_menu_item
->
action_idle_handler
)
return
FALSE
;
else
{
gail_menu_item
->
action_idle_handler
=
gdk_threads_add_idle_full
(
G_PRIORITY_DEFAULT_IDLE
,
idle_do_action
,
g_object_ref
(
gail_menu_item
),
(
GDestroyNotify
)
g_object_unref
);
}
return
TRUE
;
}
else
return
FALSE
;
}
static
void
ensure_menus_unposted
(
GailMenuItem
*
menu_item
)
{
...
...
@@ -500,32 +465,40 @@ ensure_menus_unposted (GailMenuItem *menu_item)
}
static
gboolean
idle_do_action
(
gpointer
data
)
gail_menu_item_do_action
(
AtkAction
*
action
,
gint
i
)
{
GtkWidget
*
item
;
GtkWidget
*
item_parent
;
GailMenuI
tem
*
menu_item
;
gboolean
item_mapped
;
if
(
i
==
0
)
{
GtkWidget
*
i
tem
,
*
item_parent
;
gboolean
item_mapped
;
menu_item
=
GAIL_MENU_ITEM
(
data
);
menu_item
->
action_idle_handler
=
0
;
item
=
gtk_accessible_get_widget
(
GTK_ACCESSIBLE
(
menu_item
));
if
(
item
==
NULL
/* State is defunct */
||
!
gtk_widget_get_sensitive
(
item
)
||
!
gtk_widget_get_visible
(
item
))
return
FALSE
;
item
=
gtk_accessible_get_widget
(
GTK_ACCESSIBLE
(
action
));
if
(
item
==
NULL
)
/* State is defunct */
return
FALSE
;
item_parent
=
gtk_widget_get_parent
(
item
);
gtk_menu_shell_select_item
(
GTK_MENU_SHELL
(
item_parent
),
item
);
item_mapped
=
gtk_widget_get_mapped
(
item
);
/*
* This is what is called when <Return> is pressed for a menu item
*/
g_signal_emit_by_name
(
item_parent
,
"activate_current"
,
/*force_hide*/
1
);
if
(
!
item_mapped
)
ensure_menus_unposted
(
menu_item
);
if
(
!
gtk_widget_get_sensitive
(
item
)
||
!
gtk_widget_get_visible
(
item
))
return
FALSE
;
return
FALSE
;
item_parent
=
gtk_widget_get_parent
(
item
);
if
(
!
GTK_IS_MENU_SHELL
(
item_parent
))
return
FALSE
;
gtk_menu_shell_select_item
(
GTK_MENU_SHELL
(
item_parent
),
item
);
item_mapped
=
gtk_widget_get_mapped
(
item
);
/*
* This is what is called when <Return> is pressed for a menu item
*/
g_signal_emit_by_name
(
item_parent
,
"activate_current"
,
/*force_hide*/
1
);
if
(
!
item_mapped
)
ensure_menus_unposted
(
GAIL_MENU_ITEM
(
action
));
return
TRUE
;
}
else
return
FALSE
;
}
static
gint
...
...
@@ -743,12 +716,6 @@ gail_menu_item_finalize (GObject *object)
GailMenuItem
*
menu_item
=
GAIL_MENU_ITEM
(
object
);
g_free
(
menu_item
->
click_keybinding
);
if
(
menu_item
->
action_idle_handler
)
{
g_source_remove
(
menu_item
->
action_idle_handler
);
menu_item
->
action_idle_handler
=
0
;
}
if
(
menu_item
->
textutil
)
{
g_object_unref
(
menu_item
->
textutil
);
...
...
gtk/a11y/gailmenuitem.h
View file @
fdc40111
...
...
@@ -44,7 +44,6 @@ struct _GailMenuItem
gchar
*
text
;
gchar
*
click_keybinding
;
guint
action_idle_handler
;
};
GType
gail_menu_item_get_type
(
void
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment