Commit 69539fc5 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added GimpMenuPositionFunc typedef.

2003-07-02  Michael Natterer  <mitch@gimp.org>

	* app/widgets/widgets-types.h: added GimpMenuPositionFunc typedef.

	* app/widgets/gimpwidgets-utils.[ch]: made gimp_menu_position()
	a GimpMenuPositionFunc.

	* app/widgets/gimpitemfactory.[ch]
	(gimp_item_factory_popup_with_data): added position_func and
	position_data parameters. Use gimp_menu_position() if no
	position_func is given.

	* app/display/gimpdisplayshell-callbacks.c: removed
	gimp_display_shell_origin_menu_popup() and call
	gimp_item_factory_popup_with_data() directly from
	gimp_display_shell_popup_menu(), using
	gimp_display_shell_origin_menu_position() as position_func.

	* app/widgets/gimpeditor.[ch]: added a GtkWidget::popup_menu()
	implementation so all context menus are keyboard accessible.
	Added "gpointer factory_data" member so the menu can be popped up
	in the right context.

	* app/gui/channels-menu.c
	* app/gui/layers-menu.c
	* app/gui/vectors-menu.c: make them work without an active image
	since they can be popped up at any time now.

	* app/gui/image-menu.c
	* app/gui/toolbox-menu.c: cleanup.

	* app/widgets/gimpcolormapeditor.c
	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimpcontainereditor.c
	* app/widgets/gimpdockbook.c
	* app/widgets/gimperrorconsole.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimppaletteeditor.c: pass NULL, NULL as
	position_func and position_data so the default implementation is
	used.
parent b338b771
2003-07-02 Michael Natterer <mitch@gimp.org>
* app/widgets/widgets-types.h: added GimpMenuPositionFunc typedef.
* app/widgets/gimpwidgets-utils.[ch]: made gimp_menu_position()
a GimpMenuPositionFunc.
* app/widgets/gimpitemfactory.[ch]
(gimp_item_factory_popup_with_data): added position_func and
position_data parameters. Use gimp_menu_position() if no
position_func is given.
* app/display/gimpdisplayshell-callbacks.c: removed
gimp_display_shell_origin_menu_popup() and call
gimp_item_factory_popup_with_data() directly from
gimp_display_shell_popup_menu(), using
gimp_display_shell_origin_menu_position() as position_func.
* app/widgets/gimpeditor.[ch]: added a GtkWidget::popup_menu()
implementation so all context menus are keyboard accessible.
Added "gpointer factory_data" member so the menu can be popped up
in the right context.
* app/gui/channels-menu.c
* app/gui/layers-menu.c
* app/gui/vectors-menu.c: make them work without an active image
since they can be popped up at any time now.
* app/gui/image-menu.c
* app/gui/toolbox-menu.c: cleanup.
* app/widgets/gimpcolormapeditor.c
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimpcontainereditor.c
* app/widgets/gimpdockbook.c
* app/widgets/gimperrorconsole.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimppaletteeditor.c: pass NULL, NULL as
position_func and position_data so the default implementation is
used.
2003-07-02 Sven Neumann <sven@gimp.org>
* plug-ins: more plug-ins adapted to libgimp changes.
......@@ -100,9 +100,6 @@ static void gimp_display_shell_origin_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gpointer data);
static void gimp_display_shell_origin_menu_popup (GimpDisplayShell *shell,
guint button,
guint32 time);
GdkEvent * gimp_display_shell_compress_motion (GimpDisplayShell *shell);
......@@ -366,7 +363,18 @@ gimp_display_shell_check_device_cursor (GimpDisplayShell *shell)
gboolean
gimp_display_shell_popup_menu (GtkWidget *widget)
{
gimp_display_shell_origin_menu_popup (GIMP_DISPLAY_SHELL (widget), 0, 0);
GimpDisplayShell *shell;
shell = GIMP_DISPLAY_SHELL (widget);
gimp_context_set_display (gimp_get_user_context (shell->gdisp->gimage->gimp),
shell->gdisp);
gimp_item_factory_popup_with_data (shell->popup_factory,
shell->gdisp,
gimp_display_shell_origin_menu_position,
shell->origin,
NULL);
return TRUE;
}
......@@ -635,7 +643,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
state |= GDK_BUTTON3_MASK;
gimp_item_factory_popup_with_data (shell->popup_factory,
gdisp,
NULL);
NULL, NULL, NULL);
return_val = TRUE;
break;
......@@ -1264,9 +1272,7 @@ gimp_display_shell_origin_button_press (GtkWidget *widget,
{
if (! shell->gdisp->gimage->gimp->busy && event->button == 1)
{
gimp_display_shell_origin_menu_popup (shell,
event->button,
event->time);
gimp_display_shell_popup_menu (GTK_WIDGET (shell));
}
/* Return TRUE to stop signal emission so the button doesn't grab the
......@@ -1375,7 +1381,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
{
if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 3))
{
gimp_item_factory_popup_with_data (shell->qmask_factory, shell, NULL);
gimp_item_factory_popup_with_data (shell->qmask_factory, shell,
NULL, NULL, NULL);
return TRUE;
}
......@@ -1609,30 +1616,6 @@ gimp_display_shell_origin_menu_position (GtkMenu *menu,
*y -= (GTK_WIDGET (menu)->allocation.height);
}
static void
gimp_display_shell_origin_menu_popup (GimpDisplayShell *shell,
guint button,
guint32 time)
{
GtkItemFactory *factory;
gint x, y;
gimp_context_set_display (gimp_get_user_context (shell->gdisp->gimage->gimp),
shell->gdisp);
factory = GTK_ITEM_FACTORY (shell->popup_factory);
gimp_display_shell_origin_menu_position (GTK_MENU (factory->widget),
&x, &y,
shell->origin);
gtk_item_factory_popup_with_data (factory,
shell->gdisp,
NULL,
x, y,
button, time);
}
/* gimp_display_shell_compress_motion:
*
* This function walks the whole GDK event queue seeking motion events
......
......@@ -108,7 +108,7 @@ void
channels_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage = NULL;
GimpImage *gimage;
GimpChannel *channel = NULL;
gboolean fs = FALSE;
gboolean component = FALSE;
......@@ -119,36 +119,43 @@ channels_menu_update (GtkItemFactory *factory,
{
gimage = GIMP_IMAGE_EDITOR (data)->gimage;
if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1)
component = TRUE;
if (gimage)
{
if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1)
component = TRUE;
}
}
else
{
GList *list;
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
channel = gimp_image_get_active_channel (gimage);
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
if (gimage)
{
if (channel == (GimpChannel *) list->data)
GList *list;
channel = gimp_image_get_active_channel (gimage);
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
if (channel == (GimpChannel *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
}
}
fs = (gimp_image_floating_sel (gimage) != NULL);
if (gimage)
fs = (gimp_image_floating_sel (gimage) != NULL);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Channel...", !fs);
SET_SENSITIVE ("/New Channel...", !fs && gimage);
SET_SENSITIVE ("/Raise Channel", !fs && channel && prev);
SET_SENSITIVE ("/Lower Channel", !fs && channel && next);
SET_SENSITIVE ("/Duplicate Channel", !fs && (channel || component));
......
......@@ -1127,7 +1127,8 @@ image_menu_setup (GimpItemFactory *factory)
{
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
......
......@@ -156,79 +156,81 @@ layers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
GimpLayer *layer = NULL;
gboolean fs = FALSE; /* floating sel */
gboolean ac = FALSE; /* active channel */
gboolean lm = FALSE; /* layer mask */
gboolean lp = FALSE; /* layers present */
gboolean alpha = FALSE; /* alpha channel present */
gboolean indexed = FALSE; /* is indexed */
gboolean next_alpha = FALSE;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
layer = gimp_image_get_active_layer (gimage);
if (gimage)
{
GList *list;
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
layer = gimp_image_get_active_layer (gimage);
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
lp = ! gimp_image_is_empty (gimage);
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
if (layer == (GimpLayer *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
if (layer == (GimpLayer *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Raise Layer", layer && !fs && !ac && alpha && prev);
SET_SENSITIVE ("/Layer to Top", layer && !fs && !ac && alpha && prev);
SET_SENSITIVE ("/Lower Layer", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Lower Layer", layer && !fs && !ac && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom", layer && !fs && !ac && next && next_alpha);
SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Anchor Layer", fs && !ac && gimage && lp);
SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("/Duplicate Layer", layer && !fs && !ac);
SET_SENSITIVE ("/Anchor Layer", layer && fs && !ac);
SET_SENSITIVE ("/Merge Down", layer && !fs && !ac && next);
SET_SENSITIVE ("/Delete Layer", layer && !ac);
SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer Boundary Size...", layer && !ac);
SET_SENSITIVE ("/Layer to Imagesize", layer && !ac);
SET_SENSITIVE ("/Scale Layer...", layer && !ac);
SET_SENSITIVE ("/Add Layer Mask...", !fs && !ac && gimage && !lm && lp && alpha);
SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Add Layer Mask...", layer && !fs && !ac && !lm && alpha);
SET_SENSITIVE ("/Apply Layer Mask", layer && !fs && !ac && lm);
SET_SENSITIVE ("/Delete Layer Mask", layer && !fs && !ac && lm);
SET_SENSITIVE ("/Mask to Selection", layer && !fs && !ac && lm);
SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("/Add Alpha Channel", layer && !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", layer && !fs && !ac && alpha);
SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Edit Layer Attributes...", layer && !fs && !ac);
#undef SET_SENSITIVE
}
......@@ -295,7 +295,8 @@ toolbox_menu_setup (GimpItemFactory *factory)
{
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
......@@ -318,7 +319,8 @@ toolbox_menu_setup (GimpItemFactory *factory)
if (menu && GTK_IS_MENU (menu))
{
for (list = GTK_MENU_SHELL (menu)->children; list;
for (list = GTK_MENU_SHELL (menu)->children;
list;
list = g_list_next (list))
{
GtkMenuItem *menu_item;
......
......@@ -148,37 +148,41 @@ vectors_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpVectors *vectors;
gboolean mask_empty;
gboolean global_buf;
GList *list;
GList *next = NULL;
GList *prev = NULL;
GimpVectors *vectors = NULL;
gboolean mask_empty = TRUE;
gboolean global_buf = FALSE;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
vectors = gimp_image_get_active_vectors (gimage);
if (gimage)
{
GList *list;
mask_empty = gimp_image_mask_is_empty (gimage);
vectors = gimp_image_get_active_vectors (gimage);
global_buf = FALSE;
mask_empty = gimp_image_mask_is_empty (gimage);
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
if (vectors == (GimpVectors *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
global_buf = FALSE;
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
if (vectors == (GimpVectors *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Path...", TRUE);
SET_SENSITIVE ("/New Path...", gimage);
SET_SENSITIVE ("/Raise Path", vectors && prev);
SET_SENSITIVE ("/Lower Path", vectors && next);
SET_SENSITIVE ("/Duplicate Path", vectors);
......@@ -191,7 +195,7 @@ vectors_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Delete Path", vectors);
SET_SENSITIVE ("/Copy Path", vectors);
SET_SENSITIVE ("/Paste Path", global_buf);
SET_SENSITIVE ("/Import Path...", TRUE);
SET_SENSITIVE ("/Import Path...", gimage);
SET_SENSITIVE ("/Export Path...", vectors);
SET_SENSITIVE ("/Path Tool", vectors);
SET_SENSITIVE ("/Edit Path Attributes...", vectors);
......
......@@ -1127,7 +1127,8 @@ image_menu_setup (GimpItemFactory *factory)
{
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
......
......@@ -295,7 +295,8 @@ toolbox_menu_setup (GimpItemFactory *factory)
{
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
......@@ -318,7 +319,8 @@ toolbox_menu_setup (GimpItemFactory *factory)
if (menu && GTK_IS_MENU (menu))
{
for (list = GTK_MENU_SHELL (menu)->children; list;
for (list = GTK_MENU_SHELL (menu)->children;
list;
list = g_list_next (list))
{
GtkMenuItem *menu_item;
......
......@@ -749,7 +749,8 @@ gimp_colormap_preview_button_press (GtkWidget *widget,
case 3:
gimp_colormap_editor_set_index (editor, col);
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
editor, NULL);
GIMP_EDITOR (editor)->item_factory_data,
NULL, NULL, NULL);
return TRUE;
default:
......
......@@ -491,8 +491,8 @@ gimp_component_editor_button_press (GtkWidget *widget,
case 3:
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
editor,
NULL);
GIMP_EDITOR (editor)->item_factory_data,
NULL, NULL, NULL);
break;
default:
......
......@@ -231,11 +231,11 @@ gimp_container_editor_real_context_item (GimpContainerEditor *editor,
if (viewable && gimp_container_have (editor->view->container,
GIMP_OBJECT (viewable)))
{
GimpItemFactory *item_factory;
GimpEditor *gimp_editor = GIMP_EDITOR (editor->view);
item_factory = GIMP_EDITOR (editor->view)->item_factory;
if (item_factory)
gimp_item_factory_popup_with_data (item_factory, editor, NULL);
if (gimp_editor->item_factory)
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
NULL, NULL, NULL);
}
}
......@@ -625,6 +625,7 @@ gimp_dockbook_tab_button_press (GtkWidget *widget,
gimp_item_factory_popup_with_data (dockbook->item_factory,
dockbook,
NULL, NULL,
(GtkDestroyNotify) gimp_dockbook_menu_end);
}
......
......@@ -30,6 +30,7 @@
#include "gimpeditor.h"
#include "gimpdnd.h"
#include "gimpenummenu.h"
#include "gimpitemfactory.h"
#include "gimpmenufactory.h"
......@@ -39,11 +40,13 @@
static void gimp_editor_class_init (GimpEditorClass *klass);
static void gimp_editor_init (GimpEditor *panel);
static void gimp_editor_init (GimpEditor *editor);
static void gimp_editor_destroy (GtkObject *object);
static void gimp_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static gboolean gimp_editor_popup_menu (GtkWidget *widget);
static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor);
......@@ -89,9 +92,10 @@ gimp_editor_class_init (GimpEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_editor_destroy;
object_class->destroy = gimp_editor_destroy;
widget_class->style_set = gimp_editor_style_set;
widget_class->style_set = gimp_editor_style_set;
widget_class->popup_menu = gimp_editor_popup_menu;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("content_spacing",
......@@ -120,9 +124,10 @@ gimp_editor_class_init (GimpEditorClass *klass)
static void
gimp_editor_init (GimpEditor *editor)
{
editor->menu_factory = NULL;
editor->item_factory = NULL;
editor->button_box = NULL;
editor->menu_factory = NULL;
editor->item_factory = NULL;
editor->item_factory_data = NULL;
editor->button_box = NULL;
}
static void
......@@ -189,6 +194,59 @@ gimp_editor_style_set (GtkWidget *widget,
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
}
static void
gimp_editor_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gpointer data)
{
GtkRequisition requisition;
GtkWidget *editor;
gint editor_x;
gint editor_y;
editor = (GtkWidget *) data;
gdk_window_get_origin (editor->window, &editor_x, &editor_y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
*x = editor_x + editor->allocation.x + 2;
*y = editor_y + editor->allocation.y + 2;
if (*x + requisition.width > gdk_screen_width ())
*x -= requisition.width;
if (*x < 0)
*x = 0;
if (*y + requisition.height > gdk_screen_height ())
*y -= requisition.height;
if (*y < 0)
*y = 0;
}
static gboolean
gimp_editor_popup_menu (GtkWidget *widget)
{
GimpEditor *editor;
editor = GIMP_EDITOR (widget);
if (editor->item_factory)
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
gimp_editor_menu_position,
editor,
NULL);
return TRUE;
}
return FALSE;
}
GtkWidget *
gimp_editor_new (void)
{
......@@ -218,6 +276,7 @@ gimp_editor_create_menu (GimpEditor *editor,
GTK_TYPE_MENU,
callback_data,
FALSE);
editor->item_factory_data = callback_data;
}
GtkWidget *
......
......@@ -42,6 +42,7 @@ struct _GimpEditor
GimpMenuFactory *menu_factory;
GimpItemFactory *item_factory;
gpointer item_factory_data;
GtkWidget *button_box;
};
......
......@@ -289,8 +289,11 @@ gimp_error_console_button_press (GtkWidget *widget,
{
if (bevent->button == 3)
{
gimp_item_factory_popup_with_data (GIMP_EDITOR (console)->item_factory,
console, NULL);
GimpEditor *editor = GIMP_EDITOR (console);
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
NULL, NULL, NULL);
return TRUE;
}
......
......@@ -708,8 +708,13 @@ preview_events (GtkWidget *widget,
case 3:
if (GIMP_DATA_EDITOR (editor)->data_editable)
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
editor, NULL);
{
GimpEditor *gimp_editor = GIMP_EDITOR (editor);
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
NULL, NULL, NULL);
}
break;
default:
......@@ -1143,8 +1148,11 @@ control_button_press (GimpGradientEditor *editor,
if (button == 3)
{
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
editor, NULL);
GimpEditor *gimp_editor = GIMP_EDITOR (editor);
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
NULL, NULL, NULL);
return;
}
......
......@@ -376,26 +376,50 @@ gimp_item_factory_update (GimpItemFactory *item_factory,
}
void
gimp_item_factory_popup_with_data (GimpItemFactory *item_factory,
gpointer data,
GtkDestroyNotify popdown_func)
gimp_item_factory_popup_with_data (GimpItemFactory *item_factory,
gpointer popup_data,
GimpMenuPositionFunc position_func,
gpointer position_data,
GtkDestroyNotify popdown_func)
{
gint x, y;
guint button;
guint32 activate_time;
GdkEvent *current_event;
gint x, y;
guint button;
guint32 activate_time;
g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory));
if (item_factory->update_on_popup)
gimp_item_factory_update (item_factory, data);
gimp_item_factory_update (item_factory, popup_data);
gimp_menu_position (GTK_MENU (GTK_ITEM_FACTORY (item_factory)->widget),
&x, &y,
&button,