mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 07:04:29 +00:00
menuitems: Use submenuitem accessible exclusively
Submenus can come and go, so we cannot use an accessible that doesn't allow for that. Also, this fixes a rather large refleak.
This commit is contained in:
parent
70b8f8f7ef
commit
552113131c
@ -103,24 +103,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_IT
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
|
||||
gtk_check_menu_item_activatable_interface_init))
|
||||
|
||||
static AtkObject *
|
||||
gtk_check_menu_item_get_accessible (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
/* FIXME this is not really right, submenus can come and go */
|
||||
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
|
||||
object = g_object_new (GTK_TYPE_CHECK_SUBMENU_ITEM_ACCESSIBLE, NULL);
|
||||
else
|
||||
object = g_object_new (GTK_TYPE_CHECK_MENU_ITEM_ACCESSIBLE, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
|
||||
{
|
||||
@ -169,7 +151,8 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
widget_class->draw = gtk_check_menu_item_draw;
|
||||
widget_class->get_accessible = gtk_check_menu_item_get_accessible;
|
||||
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CHECK_SUBMENU_ITEM_ACCESSIBLE);
|
||||
|
||||
menu_item_class->activate = gtk_check_menu_item_activate;
|
||||
menu_item_class->hide_on_activate = FALSE;
|
||||
|
@ -209,24 +209,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkMenuItem, gtk_menu_item, GTK_TYPE_BIN,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
|
||||
gtk_menu_item_activatable_interface_init))
|
||||
|
||||
static AtkObject *
|
||||
gtk_menu_item_get_accessible (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
/* FIXME this is not really right, submenus can come and go */
|
||||
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
|
||||
object = g_object_new (GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE, NULL);
|
||||
else
|
||||
object = g_object_new (GTK_TYPE_MENU_ITEM_ACCESSIBLE, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
||||
{
|
||||
@ -254,7 +236,8 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
||||
widget_class->get_preferred_width = gtk_menu_item_get_preferred_width;
|
||||
widget_class->get_preferred_height = gtk_menu_item_get_preferred_height;
|
||||
widget_class->get_preferred_height_for_width = gtk_menu_item_get_preferred_height_for_width;
|
||||
widget_class->get_accessible = gtk_menu_item_get_accessible;
|
||||
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE);
|
||||
|
||||
container_class->forall = gtk_menu_item_forall;
|
||||
|
||||
|
@ -394,24 +394,6 @@ gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item)
|
||||
return radio_menu_item->priv->group;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_radio_menu_item_get_accessible (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
/* FIXME this is not really right, submenus can come and go */
|
||||
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
|
||||
object = g_object_new (GTK_TYPE_RADIO_SUBMENU_ITEM_ACCESSIBLE, NULL);
|
||||
else
|
||||
object = g_object_new (GTK_TYPE_RADIO_MENU_ITEM_ACCESSIBLE, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
|
||||
{
|
||||
@ -427,7 +409,8 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
|
||||
gobject_class->get_property = gtk_radio_menu_item_get_property;
|
||||
|
||||
widget_class->destroy = gtk_radio_menu_item_destroy;
|
||||
widget_class->get_accessible = gtk_radio_menu_item_get_accessible;
|
||||
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_RADIO_SUBMENU_ITEM_ACCESSIBLE);
|
||||
|
||||
menu_item_class->activate = gtk_radio_menu_item_activate;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user