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.
This commit is contained in:
Sven Neumann 2005-09-02 21:56:20 +00:00 committed by Sven Neumann
parent b1feae9099
commit 5f2904f9c5
3 changed files with 29 additions and 21 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -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

View File

@ -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 *