Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix activating items with no focused item #749

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions src/exo/exo-icon-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -3213,12 +3213,14 @@ exo_icon_view_real_activate_cursor_item (ExoIconView *icon_view)
GtkTreePath *path;
GtkCellRendererMode mode;
ExoIconViewCellInfo *info = NULL;
GList *items;
gint i;

if (!icon_view->priv->cursor_item)
return FALSE;

info = g_list_nth_data (icon_view->priv->cell_list,
icon_view->priv->cursor_cell);
if (icon_view->priv->cursor_item)
{
info = g_list_nth_data (icon_view->priv->cell_list,
icon_view->priv->cursor_cell);
}

if (info)
{
Expand All @@ -3240,11 +3242,27 @@ exo_icon_view_real_activate_cursor_item (ExoIconView *icon_view)
}
}

path = gtk_tree_path_new_from_indices (g_list_index (icon_view->priv->items, icon_view->priv->cursor_item), -1);
exo_icon_view_item_activated (icon_view, path);
gtk_tree_path_free (path);
if (icon_view->priv->cursor_item)
{
path = gtk_tree_path_new_from_indices (g_list_index (icon_view->priv->items, icon_view->priv->cursor_item), -1);
exo_icon_view_item_activated (icon_view, path);
gtk_tree_path_free (path);
return TRUE;
}

return TRUE;
// there might be selected items even if none are focused - activate the first one
for (i = 0, items = icon_view->priv->items; items != NULL; ++i, items = items->next)
{
if (EXO_ICON_VIEW_ITEM (items->data)->selected)
{
path = gtk_tree_path_new_from_indices (i, -1);
exo_icon_view_item_activated (icon_view, path);
gtk_tree_path_free (path);
return TRUE;
}
}

return FALSE;
}


Expand Down