Commit 2980659a authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Add api for setting the layer

Add api for setting the component layer, instead of open-coding
the object data key, and use it.
parent e1463ab5
......@@ -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 *
......
......@@ -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;
......
......@@ -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
......
......@@ -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__ */
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment