Replace _getIndexOfDisplayedActor with a function in OverflowList
Said function in genericDisplay.js was returning the index of the actor based upon its position in the entire list, while everywhere else indexes relative to the currently displayed page were used. This made actions in the details pane break (bug #590949), so I replace it with a new function in shell-overflow-list.c, shell_overflow_list_get_actor_index, which is page based.
This commit is contained in:
@ -386,3 +386,40 @@ shell_overflow_list_get_displayed_actor (ShellOverflowList *self,
|
||||
|
||||
return iter->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_overflow_list_get_actor_index:
|
||||
* @self:
|
||||
* @actor: a child of the list
|
||||
*
|
||||
* Returns the index on the current page of the given actor.
|
||||
*
|
||||
* Return value: index of @actor in
|
||||
* the currently visible page
|
||||
*/
|
||||
int
|
||||
shell_overflow_list_get_actor_index (ShellOverflowList *self,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
GList *children, *iter;
|
||||
int i;
|
||||
|
||||
children = clutter_container_get_children (CLUTTER_CONTAINER (self));
|
||||
|
||||
if (children == NULL)
|
||||
return NULL;
|
||||
|
||||
iter = g_list_nth (children, (self->priv->page) * self->priv->items_per_page);
|
||||
|
||||
int result = -1;
|
||||
for (i = 0; iter; iter = iter->next, i++)
|
||||
if (iter->data == actor)
|
||||
{
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ struct _ShellOverflowListClass
|
||||
GType shell_overflow_list_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterActor *shell_overflow_list_get_displayed_actor (ShellOverflowList *list, guint index);
|
||||
int shell_overflow_list_get_actor_index (ShellOverflowList *list, ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Reference in New Issue
Block a user