Drop some grandiosity from the AtkAction implementation
There is only one action here, no need to pretend otherwise.
This commit is contained in:
parent
625947f9f2
commit
26a040e81b
@ -7079,41 +7079,20 @@ static gpointer accessible_item_parent_class;
|
|||||||
|
|
||||||
static GType gtk_icon_view_item_accessible_get_type (void);
|
static GType gtk_icon_view_item_accessible_get_type (void);
|
||||||
|
|
||||||
enum {
|
|
||||||
ACTION_ACTIVATE,
|
|
||||||
LAST_ACTION
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
AtkObject parent;
|
AtkObject parent;
|
||||||
|
|
||||||
GtkIconViewItem *item;
|
GtkIconViewItem *item;
|
||||||
|
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
AtkStateSet *state_set;
|
AtkStateSet *state_set;
|
||||||
|
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
GtkTextBuffer *text_buffer;
|
GtkTextBuffer *text_buffer;
|
||||||
|
gchar *action_description;
|
||||||
gchar *action_descriptions[LAST_ACTION];
|
|
||||||
gchar *image_description;
|
gchar *image_description;
|
||||||
guint action_idle_handler;
|
guint action_idle_handler;
|
||||||
} GtkIconViewItemAccessible;
|
} GtkIconViewItemAccessible;
|
||||||
|
|
||||||
static const gchar *const gtk_icon_view_item_accessible_action_names[] =
|
|
||||||
{
|
|
||||||
"activate",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const gchar *const gtk_icon_view_item_accessible_action_descriptions[] =
|
|
||||||
{
|
|
||||||
"Activate item",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
typedef struct _GtkIconViewItemAccessibleClass
|
typedef struct _GtkIconViewItemAccessibleClass
|
||||||
{
|
{
|
||||||
AtkObjectClass parent_class;
|
AtkObjectClass parent_class;
|
||||||
@ -7149,7 +7128,7 @@ gtk_icon_view_item_accessible_action_do_action (AtkAction *action,
|
|||||||
{
|
{
|
||||||
GtkIconViewItemAccessible *item;
|
GtkIconViewItemAccessible *item;
|
||||||
|
|
||||||
if (i < 0 || i >= LAST_ACTION)
|
if (i != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
|
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
|
||||||
@ -7160,24 +7139,16 @@ gtk_icon_view_item_accessible_action_do_action (AtkAction *action,
|
|||||||
if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
|
if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case ACTION_ACTIVATE:
|
|
||||||
if (!item->action_idle_handler)
|
if (!item->action_idle_handler)
|
||||||
item->action_idle_handler = gdk_threads_add_idle (gtk_icon_view_item_accessible_idle_do_action, item);
|
item->action_idle_handler = gdk_threads_add_idle (gtk_icon_view_item_accessible_idle_do_action, item);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_icon_view_item_accessible_action_get_n_actions (AtkAction *action)
|
gtk_icon_view_item_accessible_action_get_n_actions (AtkAction *action)
|
||||||
{
|
{
|
||||||
return LAST_ACTION;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
@ -7186,25 +7157,25 @@ gtk_icon_view_item_accessible_action_get_description (AtkAction *action,
|
|||||||
{
|
{
|
||||||
GtkIconViewItemAccessible *item;
|
GtkIconViewItemAccessible *item;
|
||||||
|
|
||||||
if (i < 0 || i >= LAST_ACTION)
|
if (i != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
|
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
|
||||||
|
|
||||||
if (item->action_descriptions[i])
|
if (item->action_description)
|
||||||
return item->action_descriptions[i];
|
return item->action_description;
|
||||||
else
|
else
|
||||||
return gtk_icon_view_item_accessible_action_descriptions[i];
|
return "Activate item";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
gtk_icon_view_item_accessible_action_get_name (AtkAction *action,
|
gtk_icon_view_item_accessible_action_get_name (AtkAction *action,
|
||||||
gint i)
|
gint i)
|
||||||
{
|
{
|
||||||
if (i < 0 || i >= LAST_ACTION)
|
if (i != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return gtk_icon_view_item_accessible_action_names[i];
|
return "activate";
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -7214,14 +7185,13 @@ gtk_icon_view_item_accessible_action_set_description (AtkAction *action,
|
|||||||
{
|
{
|
||||||
GtkIconViewItemAccessible *item;
|
GtkIconViewItemAccessible *item;
|
||||||
|
|
||||||
if (i < 0 || i >= LAST_ACTION)
|
if (i != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
|
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action);
|
||||||
|
|
||||||
g_free (item->action_descriptions[i]);
|
g_free (item->action_description);
|
||||||
|
item->action_description = g_strdup (description);
|
||||||
item->action_descriptions[i] = g_strdup (description);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -8199,8 +8169,6 @@ gtk_icon_view_item_accessible_set_visibility (GtkIconViewItemAccessible *item,
|
|||||||
static void
|
static void
|
||||||
gtk_icon_view_item_accessible_object_init (GtkIconViewItemAccessible *item)
|
gtk_icon_view_item_accessible_object_init (GtkIconViewItemAccessible *item)
|
||||||
{
|
{
|
||||||
gint i;
|
|
||||||
|
|
||||||
item->state_set = atk_state_set_new ();
|
item->state_set = atk_state_set_new ();
|
||||||
|
|
||||||
atk_state_set_add_state (item->state_set, ATK_STATE_ENABLED);
|
atk_state_set_add_state (item->state_set, ATK_STATE_ENABLED);
|
||||||
@ -8209,9 +8177,7 @@ gtk_icon_view_item_accessible_object_init (GtkIconViewItemAccessible *item)
|
|||||||
atk_state_set_add_state (item->state_set, ATK_STATE_SELECTABLE);
|
atk_state_set_add_state (item->state_set, ATK_STATE_SELECTABLE);
|
||||||
atk_state_set_add_state (item->state_set, ATK_STATE_VISIBLE);
|
atk_state_set_add_state (item->state_set, ATK_STATE_VISIBLE);
|
||||||
|
|
||||||
for (i = 0; i < LAST_ACTION; i++)
|
item->action_description = NULL;
|
||||||
item->action_descriptions[i] = NULL;
|
|
||||||
|
|
||||||
item->image_description = NULL;
|
item->image_description = NULL;
|
||||||
|
|
||||||
item->action_idle_handler = 0;
|
item->action_idle_handler = 0;
|
||||||
@ -8221,9 +8187,6 @@ static void
|
|||||||
gtk_icon_view_item_accessible_finalize (GObject *object)
|
gtk_icon_view_item_accessible_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GtkIconViewItemAccessible *item;
|
GtkIconViewItemAccessible *item;
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE (object));
|
|
||||||
|
|
||||||
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (object);
|
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (object);
|
||||||
|
|
||||||
@ -8236,9 +8199,7 @@ gtk_icon_view_item_accessible_finalize (GObject *object)
|
|||||||
if (item->text_buffer)
|
if (item->text_buffer)
|
||||||
g_object_unref (item->text_buffer);
|
g_object_unref (item->text_buffer);
|
||||||
|
|
||||||
for (i = 0; i < LAST_ACTION; i++)
|
g_free (item->action_description);
|
||||||
g_free (item->action_descriptions[i]);
|
|
||||||
|
|
||||||
g_free (item->image_description);
|
g_free (item->image_description);
|
||||||
|
|
||||||
if (item->action_idle_handler)
|
if (item->action_idle_handler)
|
||||||
@ -8573,11 +8534,6 @@ gtk_icon_view_accessible_set_adjustment (AtkObject *accessible,
|
|||||||
GtkIconViewAccessible *view = (GtkIconViewAccessible*)accessible;
|
GtkIconViewAccessible *view = (GtkIconViewAccessible*)accessible;
|
||||||
GtkAdjustment **old_adj_ptr;
|
GtkAdjustment **old_adj_ptr;
|
||||||
|
|
||||||
/* Adjustments are set for the first time in constructor and priv is not
|
|
||||||
* initialized at that time, so skip this first setting. */
|
|
||||||
if (!view)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
if (view->old_hadj == adjustment)
|
if (view->old_hadj == adjustment)
|
||||||
@ -9014,7 +8970,6 @@ gtk_icon_view_accessible_ref_accessible_at_point (AtkComponent *component,
|
|||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
/* State is defunct */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
icon_view = GTK_ICON_VIEW (widget);
|
icon_view = GTK_ICON_VIEW (widget);
|
||||||
@ -9047,7 +9002,6 @@ gtk_icon_view_accessible_add_selection (AtkSelection *selection,
|
|||||||
icon_view = GTK_ICON_VIEW (widget);
|
icon_view = GTK_ICON_VIEW (widget);
|
||||||
|
|
||||||
item = g_list_nth_data (icon_view->priv->items, i);
|
item = g_list_nth_data (icon_view->priv->items, i);
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user