Verified Commit 0c7b2692 authored by Iain Lane's avatar Iain Lane

fr-window: Position the Shift-F10 menu at the selected row

...rather than the location of the mouse cursor

This is the approach taken by nautilus, and it means the menu is at a
more sensible place.
parent 05c69880
......@@ -5,7 +5,7 @@ project('file-roller', 'c',
)
glib_version = '>=2.36'
gtk_version = '>=3.16.0'
gtk_version = '>=3.22.0'
nautilus_version = '>=2.22.2'
json_glib_version = '>=0.14.0'
libnotify_version = '>=0.4.3'
......
......@@ -4833,16 +4833,39 @@ key_press_cb (GtkWidget *widget,
case GDK_KEY_F10:
if (event->state & GDK_SHIFT_MASK) {
GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->list_view));
GList *selected_rows;
GtkTreePath *first_selected_row_path;
GtkTreeView *tree_view;
GdkRectangle rect;
GdkWindow *win;
tree_view = GTK_TREE_VIEW (window->priv->list_view);
win = gtk_tree_view_get_bin_window (tree_view);
selection = gtk_tree_view_get_selection (tree_view);
selected_rows = gtk_tree_selection_get_selected_rows (selection,
&window->priv->list_store);
if (selection == NULL)
return GDK_EVENT_PROPAGATE;
gtk_menu_popup (GTK_MENU (window->priv->file_popup_menu),
NULL, NULL, NULL,
window,
3,
GDK_CURRENT_TIME);
if (selected_rows == NULL)
return GDK_EVENT_PROPAGATE;
first_selected_row_path = (GtkTreePath *) selected_rows->data;
gtk_tree_view_get_cell_area (tree_view,
first_selected_row_path,
NULL,
&rect);
g_list_free_full (selected_rows, (GDestroyNotify) gtk_tree_path_free);
gtk_menu_popup_at_rect (GTK_MENU (window->priv->file_popup_menu),
win,
&rect,
GDK_GRAVITY_SOUTH_WEST,
GDK_GRAVITY_NORTH_WEST,
(const GdkEvent *) event);
retval = GDK_EVENT_STOP;
}
break;
......
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