Commit 5f2904f9 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/widgets/gimpcontainergridview.c allow to popup menus on empty

2005-09-02  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainertreeview.c: allow to popup menus on
	empty container views using the standard Shift-F10 keybinding.
parent b1feae90
2005-09-02 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainertreeview.c: allow to popup menus on
empty container views using the standard Shift-F10 keybinding.
2005-09-02 Sven Neumann <sven@gimp.org>
* modules/Makefile.am: applied patch that fixes a build issue on
......
......@@ -374,7 +374,13 @@ gimp_container_grid_view_menu_position (GtkMenu *menu,
gint *y,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET (data);
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (data);
GtkWidget *widget;
if (grid_view->selected_item)
widget = GTK_WIDGET (grid_view->selected_item);
else
widget = GTK_WIDGET (grid_view->wrap_box);
gdk_window_get_origin (widget->window, x, y);
......@@ -384,8 +390,16 @@ gimp_container_grid_view_menu_position (GtkMenu *menu,
*y += widget->allocation.y;
}
*x += widget->allocation.width / 2;
*y += widget->allocation.height / 2;
if (grid_view->selected_item)
{
*x += widget->allocation.width / 2;
*y += widget->allocation.height / 2;
}
else
{
*x += widget->style->xthickness;
*y += widget->style->ythickness;
}
gimp_menu_position (menu, x, y);
}
......@@ -395,14 +409,9 @@ gimp_container_grid_view_popup_menu (GtkWidget *widget)
{
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (widget);
if (grid_view->selected_item)
{
return gimp_editor_popup_menu (GIMP_EDITOR (grid_view),
gimp_container_grid_view_menu_position,
grid_view->selected_item);
}
return FALSE;
return gimp_editor_popup_menu (GIMP_EDITOR (widget),
gimp_container_grid_view_menu_position,
grid_view);
}
static gpointer
......
......@@ -380,16 +380,9 @@ gimp_container_tree_view_menu_position (GtkMenu *menu,
static gboolean
gimp_container_tree_view_popup_menu (GtkWidget *widget)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (widget);
if (gtk_tree_selection_get_selected (tree_view->selection, NULL, NULL))
{
return gimp_editor_popup_menu (GIMP_EDITOR (tree_view),
gimp_container_tree_view_menu_position,
tree_view);
}
return FALSE;
return gimp_editor_popup_menu (GIMP_EDITOR (widget),
gimp_container_tree_view_menu_position,
widget);
}
GtkWidget *
......
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