Add api for setting the layer

Add api for setting the component layer, instead of open-coding
the object data key, and use it.
This commit is contained in:
Matthias Clasen 2011-07-03 15:34:06 -04:00
parent e1463ab57c
commit 2980659ab1
5 changed files with 17 additions and 7 deletions

View File

@ -32,8 +32,7 @@ gtk_menu_accessible_initialize (AtkObject *obj,
obj->role = ATK_ROLE_MENU;
g_object_set_data (G_OBJECT (obj), "atk-component-layer",
GINT_TO_POINTER (ATK_LAYER_POPUP));
gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP);
}
static AtkObject *

View File

@ -62,7 +62,7 @@ gtk_menu_item_accessible_initialize (AtkObject *obj,
atk_object_set_parent (obj, gtk_widget_get_accessible (parent_widget));
}
g_object_set_data (G_OBJECT (obj), "atk-component-layer", GINT_TO_POINTER (ATK_LAYER_POPUP));
gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP);
if (GTK_IS_TEAROFF_MENU_ITEM (data))
obj->role = ATK_ROLE_TEAR_OFF_MENU_ITEM;

View File

@ -133,8 +133,6 @@ gtk_widget_accessible_initialize (AtkObject *obj,
g_signal_connect (accessible, "focus-event", G_CALLBACK (focus_event), NULL);
g_object_set_data (G_OBJECT (obj), "atk-component-layer", GINT_TO_POINTER (ATK_LAYER_WIDGET));
obj->role = ATK_ROLE_UNKNOWN;
}
@ -651,7 +649,17 @@ gtk_widget_accessible_get_layer (AtkComponent *component)
layer = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (component), "atk-component-layer"));
return (AtkLayer) layer;
if (layer == 0)
return ATK_LAYER_WIDGET;
else
return (AtkLayer) layer;
}
void
gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible,
AtkLayer layer)
{
g_object_set_data (G_OBJECT (accessible), "atk-component-layer", GINT_TO_POINTER (layer));
}
static gboolean

View File

@ -58,6 +58,9 @@ struct _GtkWidgetAccessibleClass
GType gtk_widget_accessible_get_type (void);
void gtk_widget_accessible_set_layer (GtkWidgetAccessible *obj,
AtkLayer layer);
G_END_DECLS
#endif /* __GTK_WIDGET_ACCESSIBLE_H__ */

View File

@ -114,7 +114,7 @@ gtk_window_accessible_initialize (AtkObject *obj,
ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->initialize (obj, data);
g_signal_connect (data, "window_state_event", G_CALLBACK (window_state_event_cb), NULL);
g_object_set_data (G_OBJECT (obj), "atk-component-layer", GINT_TO_POINTER (ATK_LAYER_WINDOW));
gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_WINDOW);
if (GTK_IS_FILE_CHOOSER_DIALOG (widget))
obj->role = ATK_ROLE_FILE_CHOOSER;