forked from AuroraMiddleware/gtk
file chooser: Avoid a crash
When right-clicking in an empty folder, you should get a context menu, not a crash. The code for positioning the popover was not handling the eventuality of no row under the pointer. Just position the popover right at the click location in this case. https://bugzilla.gnome.org/show_bug.cgi?id=755021
This commit is contained in:
parent
ee8eb91523
commit
450056cdfe
@ -2312,6 +2312,8 @@ file_list_show_popover (GtkFileChooserWidget *impl,
|
|||||||
|
|
||||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
|
||||||
list = gtk_tree_selection_get_selected_rows (selection, &model);
|
list = gtk_tree_selection_get_selected_rows (selection, &model);
|
||||||
|
if (list)
|
||||||
|
{
|
||||||
path = list->data;
|
path = list->data;
|
||||||
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (priv->browse_files_tree_view), path, NULL, &rect);
|
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (priv->browse_files_tree_view), path, NULL, &rect);
|
||||||
gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (priv->browse_files_tree_view),
|
gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (priv->browse_files_tree_view),
|
||||||
@ -2321,9 +2323,16 @@ file_list_show_popover (GtkFileChooserWidget *impl,
|
|||||||
rect.width = 40;
|
rect.width = 40;
|
||||||
|
|
||||||
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
|
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.x = x;
|
||||||
|
rect.y = y;
|
||||||
|
rect.width = 1;
|
||||||
|
rect.height = 1;
|
||||||
|
}
|
||||||
|
|
||||||
gtk_popover_set_pointing_to (GTK_POPOVER (priv->browse_files_popover), &rect);
|
gtk_popover_set_pointing_to (GTK_POPOVER (priv->browse_files_popover), &rect);
|
||||||
|
|
||||||
gtk_widget_show (priv->browse_files_popover);
|
gtk_widget_show (priv->browse_files_popover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user