[gtk+] menuitems: Use submenuitem accessible exclusively
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] menuitems: Use submenuitem accessible exclusively
- Date: Wed, 6 Jul 2011 16:47:17 +0000 (UTC)
commit 552113131cedf405d2e935bf9e163539a2f30856
Author: Benjamin Otte <otte redhat com>
Date: Wed Jul 6 18:43:07 2011 +0200
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.
gtk/gtkcheckmenuitem.c | 21 ++-------------------
gtk/gtkmenuitem.c | 21 ++-------------------
gtk/gtkradiomenuitem.c | 21 ++-------------------
3 files changed, 6 insertions(+), 57 deletions(-)
---
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 27465f5..66c078f 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -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;
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 3bb0da8..7566bad 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -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;
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index a17a0ee..e596976 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]