Commit 10718425 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

remember and ref the created widgets. Added gimp_ui_manager_ui_popup()

2004-04-22  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpuimanager.[ch]: remember and ref the created
	widgets.  Added gimp_ui_manager_ui_popup() which pops up a GtkMenu
	with a custom GimpMenuPositionFunc and a GtkDestroyNotify which is
	called on popdown.

	* app/widgets/gimpmenufactory.c (gimp_menu_factory_finalize):
	don't forget to free the list of managed UIs.

	* app/widgets/gimpdockable.[ch]
	* app/widgets/gimpdockbook.[ch]
	* app/widgets/gimpdocked.[ch]
	* app/widgets/gimpeditor.[ch]: added GimpUIManager stuff parallel
	to the to-be-removed GtkItemFactory stuff.

	* app/widgets/gimpcolormapeditor.c
	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimpcontainereditor.c
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimperrorconsole.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimppaletteeditor.c
	* app/widgets/gimptooloptionseditor.c: changed accordingly and added
	#if 0'ed code which actually uses all the UI managers.

	* app/display/gimpdisplay.c
	* app/display/gimpdisplayshell.c
	* app/gui/gui-vtable.c: disabled some gimp_ui_manager_update()
	calls because they were invoking toggle and radio callbacks
	which still have the wrong signature.
parent 505698be
2004-04-22 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpuimanager.[ch]: remember and ref the created
widgets. Added gimp_ui_manager_ui_popup() which pops up a GtkMenu
with a custom GimpMenuPositionFunc and a GtkDestroyNotify which is
called on popdown.
* app/widgets/gimpmenufactory.c (gimp_menu_factory_finalize):
don't forget to free the list of managed UIs.
* app/widgets/gimpdockable.[ch]
* app/widgets/gimpdockbook.[ch]
* app/widgets/gimpdocked.[ch]
* app/widgets/gimpeditor.[ch]: added GimpUIManager stuff parallel
to the to-be-removed GtkItemFactory stuff.
* app/widgets/gimpcolormapeditor.c
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimpcontainereditor.c
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainertreeview.c
* app/widgets/gimperrorconsole.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimppaletteeditor.c
* app/widgets/gimptooloptionseditor.c: changed accordingly and added
#if 0'ed code which actually uses all the UI managers.
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell.c
* app/gui/gui-vtable.c: disabled some gimp_ui_manager_update()
calls because they were invoking toggle and radio callbacks
which still have the wrong signature.
2004-04-22 Sven Neumann <sven@gimp.org>
* plug-ins/gflare/gflare.c: ported the last plug-in from
......
......@@ -512,7 +512,9 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
GimpContext *user_context;
gimp_item_factory_update (shell->menubar_factory, shell);
#if 0
gimp_ui_manager_update (shell->menubar_manager, shell);
#endif
user_context = gimp_get_user_context (gdisp->gimage->gimp);
......
......@@ -512,7 +512,9 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
GimpContext *user_context;
gimp_item_factory_update (shell->menubar_factory, shell);
#if 0
gimp_ui_manager_update (shell->menubar_manager, shell);
#endif
user_context = gimp_get_user_context (gdisp->gimage->gimp);
......
......@@ -486,7 +486,9 @@ gimp_display_shell_real_scaled (GimpDisplayShell *shell)
/* update the <Image>/View/Zoom menu */
gimp_item_factory_update (shell->menubar_factory, shell);
#if 0
gimp_ui_manager_update (shell->menubar_manager, shell);
#endif
user_context = gimp_get_user_context (shell->gdisp->gimage->gimp);
......@@ -672,12 +674,32 @@ gimp_display_shell_new (GimpDisplay *gdisp,
if (shell->options->show_menubar)
gtk_widget_show (menubar);
/* make sure we can activate accels even if the menubar is invisible
* (see http://bugzilla.gnome.org/show_bug.cgi?id=137151)
*/
g_signal_connect (menubar, "can-activate-accel",
G_CALLBACK (gtk_true),
NULL);
/* active display callback */
g_signal_connect (menubar, "button_press_event",
G_CALLBACK (gimp_display_shell_events),
shell);
g_signal_connect (menubar, "button_release_event",
G_CALLBACK (gimp_display_shell_events),
shell);
g_signal_connect (menubar, "key_press_event",
G_CALLBACK (gimp_display_shell_events),
shell);
#if 0
menubar = gimp_ui_manager_ui_create (shell->menubar_manager,
"/image-menubar");
menubar = gimp_ui_manager_ui_get (shell->menubar_manager,
"/image-menubar");
gtk_ui_manager_ensure_update (GTK_UI_MANAGER (shell->menubar_manager));
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, FALSE, 0);
gtk_widget_show (menubar);
#endif
if (shell->options->show_menubar)
gtk_widget_show (menubar);
/* make sure we can activate accels even if the menubar is invisible
* (see http://bugzilla.gnome.org/show_bug.cgi?id=137151)
......@@ -696,6 +718,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
g_signal_connect (menubar, "key_press_event",
G_CALLBACK (gimp_display_shell_events),
shell);
#endif
/* another vbox for everything except the statusbar */
disp_vbox = gtk_vbox_new (FALSE, 1);
......
......@@ -199,8 +199,11 @@ gui_display_new (GimpImage *gimage,
gimp_context_set_display (gimp_get_user_context (gimage->gimp), gdisp);
gimp_item_factory_update (shell->menubar_factory, shell);
#if 0
gimp_ui_manager_update (shell->menubar_manager, shell);
#else
gimp_item_factory_update (shell->menubar_factory, shell);
#endif
return GIMP_OBJECT (gdisp);
}
......
......@@ -56,6 +56,7 @@
#include "gimphelp-ids.h"
#include "gimpitemfactory.h"
#include "gimpmenufactory.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gui/color-notebook.h"
......@@ -753,10 +754,20 @@ gimp_colormap_preview_button_press (GtkWidget *widget,
case 3:
gimp_colormap_editor_set_index (editor, col);
#if 0
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_ui_popup (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->ui_identifier,
GIMP_EDITOR (editor)->ui_manager,
GTK_WIDGET (editor),
NULL, NULL, NULL);
#else
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
GIMP_EDITOR (editor)->item_factory_data,
GIMP_EDITOR (editor)->popup_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
#endif
return TRUE;
default:
......
......@@ -36,6 +36,7 @@
#include "gimpitemfactory.h"
#include "gimpmenufactory.h"
#include "gimppreviewrendererimage.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
......@@ -520,10 +521,20 @@ gimp_component_editor_button_press (GtkWidget *widget,
break;
case 3:
#if 0
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->popup_data);
gimp_ui_manager_ui_popup (GIMP_EDITOR (editor)->ui_manager,
GIMP_EDITOR (editor)->ui_identifier,
GIMP_EDITOR (editor)->popup_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
#else
gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory,
GIMP_EDITOR (editor)->item_factory_data,
GIMP_EDITOR (editor)->popup_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
#endif
break;
default:
......
......@@ -38,6 +38,7 @@
#include "gimpitemfactory.h"
#include "gimpmenufactory.h"
#include "gimppreviewrenderer.h"
#include "gimpuimanager.h"
static void gimp_container_editor_class_init (GimpContainerEditorClass *klass);
......@@ -66,7 +67,9 @@ static void gimp_container_editor_set_context (GimpDocked *docke
GimpContext *context,
GimpContext *prev_context);
static GimpItemFactory * gimp_container_editor_get_menu (GimpDocked *docked,
gpointer *item_factory_data);
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier);
static GtkVBoxClass *parent_class = NULL;
......@@ -263,11 +266,25 @@ gimp_container_editor_real_context_item (GimpContainerEditor *editor,
{
GimpEditor *gimp_editor = GIMP_EDITOR (editor->view);
#if 0
if (gimp_editor->ui_manager)
{
gimp_ui_manager_update (gimp_editor->ui_manager,
gimp_editor->popup_data);
gimp_ui_manager_ui_popup (gimp_editor->ui_manager,
gimp_editor->ui_identifier,
gimp_editor->popup_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
return;
}
#else
if (gimp_editor->item_factory)
gimp_item_factory_popup_with_data (gimp_editor->item_factory,
gimp_editor->item_factory_data,
gimp_editor->popup_data,
GTK_WIDGET (editor),
NULL, NULL, NULL);
#endif
}
}
......@@ -294,11 +311,13 @@ gimp_container_editor_set_context (GimpDocked *docked,
}
static GimpItemFactory *
gimp_container_editor_get_menu (GimpDocked *docked,
gpointer *item_factory_data)
gimp_container_editor_get_menu (GimpDocked *docked,
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked);
return gimp_docked_get_menu (GIMP_DOCKED (editor->view),
item_factory_data);
return gimp_docked_get_menu (GIMP_DOCKED (editor->view), popup_data,
manager, ui_identifier);
}
......@@ -37,6 +37,7 @@
#include "gimpitemfactory.h"
#include "gimppreview.h"
#include "gimppreviewrenderer.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gtkhwrapbox.h"
......@@ -376,15 +377,34 @@ gimp_container_grid_view_popup_menu (GtkWidget *widget)
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (widget);
GimpEditor *editor = GIMP_EDITOR (widget);
if (editor->item_factory && grid_view->selected_item)
if (grid_view->selected_item)
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
GTK_WIDGET (editor),
gimp_container_grid_view_menu_position,
grid_view->selected_item,
NULL);
return TRUE;
#if 0
if (editor->ui_manager)
{
gimp_ui_manager_update (editor->ui_manager,
editor->popup_data);
gimp_ui_manager_ui_popup (editor->ui_manager,
editor->ui_identifier,
editor->popup_data,
GTK_WIDGET (editor),
gimp_container_grid_view_menu_position,
grid_view->selected_item,
NULL);
return TRUE;
}
#else
if (editor->item_factory)
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->popup_data,
GTK_WIDGET (editor),
gimp_container_grid_view_menu_position,
grid_view->selected_item,
NULL);
return TRUE;
}
#endif
}
return FALSE;
......
......@@ -40,6 +40,7 @@
#include "gimpdnd.h"
#include "gimpitemfactory.h"
#include "gimppreviewrenderer.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
......@@ -353,16 +354,34 @@ gimp_container_tree_view_popup_menu (GtkWidget *widget)
tree_view = GIMP_CONTAINER_TREE_VIEW (widget);
editor = GIMP_EDITOR (widget);
if (editor->item_factory &&
gtk_tree_selection_get_selected (tree_view->selection, NULL, NULL))
if (gtk_tree_selection_get_selected (tree_view->selection, NULL, NULL))
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->item_factory_data,
GTK_WIDGET (editor),
gimp_container_tree_view_menu_position,
editor,
NULL);
return TRUE;
#if 0
if (editor->ui_manager)
{
gimp_ui_manager_update (editor->ui_manager,
editor->popup_data);
gimp_ui_manager_ui_popup (editor->ui_manager,
editor->ui_identifier,
editor->popup_data,
GTK_WIDGET (editor),
gimp_container_tree_view_menu_position,
editor,
NULL);
return TRUE;
}
#endif
if (editor->item_factory)
{
gimp_item_factory_popup_with_data (editor->item_factory,
editor->popup_data,
GTK_WIDGET (editor),
gimp_container_tree_view_menu_position,
editor,
NULL);
return TRUE;
}
}
return FALSE;
......
......@@ -36,6 +36,7 @@
#include "gimpdockbook.h"
#include "gimpdocked.h"
#include "gimpitemfactory.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
......@@ -802,15 +803,19 @@ gimp_dockable_set_context (GimpDockable *dockable,
}
GimpItemFactory *
gimp_dockable_get_menu (GimpDockable *dockable,
gpointer *item_factory_data)
gimp_dockable_get_menu (GimpDockable *dockable,
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier)
{
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
g_return_val_if_fail (item_factory_data != NULL, NULL);
g_return_val_if_fail (popup_data != NULL, NULL);
g_return_val_if_fail (manager != NULL, NULL);
g_return_val_if_fail (ui_identifier != NULL, NULL);
if (GTK_BIN (dockable)->child)
return gimp_docked_get_menu (GIMP_DOCKED (GTK_BIN (dockable)->child),
item_factory_data);
popup_data, manager, ui_identifier);
return NULL;
}
......@@ -900,13 +905,28 @@ static void
gimp_dockable_menu_end (GimpDockable *dockable)
{
GimpItemFactory *dialog_item_factory;
gpointer dialog_item_factory_data;
gpointer dialog_popup_data;
GimpUIManager *dialog_ui_manager;
const gchar *dialog_ui_identifier;
dialog_item_factory = gimp_dockable_get_menu (dockable,
&dialog_item_factory_data);
&dialog_popup_data,
&dialog_ui_manager,
&dialog_ui_identifier);
#if 0
if (dialog_ui_manager)
{
GtkWidget *child_menu_widget;
child_menu_widget = gimp_ui_manager_ui_get (dialog_ui_manager,
dialog_ui_identifier);
gtk_menu_detach (GTK_MENU (child_menu_widget));
}
#else
if (dialog_item_factory)
gtk_menu_detach (GTK_MENU (GTK_ITEM_FACTORY (dialog_item_factory)->widget));
#endif
/* release gimp_dockable_show_menu()'s references */
g_object_set_data (G_OBJECT (dockable), GIMP_DOCKABLE_DETACH_REF_KEY, NULL);
......@@ -917,17 +937,81 @@ static gboolean
gimp_dockable_show_menu (GimpDockable *dockable)
{
GimpItemFactory *dockbook_item_factory;
GimpUIManager *dockbook_ui_manager;
GimpItemFactory *dialog_item_factory;
gpointer dialog_item_factory_data;
gpointer dialog_popup_data;
GimpUIManager *dialog_ui_manager;
const gchar *dialog_ui_identifier;
dockbook_item_factory = dockable->dockbook->item_factory;
dockbook_ui_manager = dockable->dockbook->ui_manager;
if (! dockbook_item_factory)
return FALSE;
dialog_item_factory = gimp_dockable_get_menu (dockable,
&dialog_item_factory_data);
&dialog_popup_data,
&dialog_ui_manager,
&dialog_ui_identifier);
#if 0
if (dialog_ui_manager)
{
GtkAction *parent_menu_action;
GtkAction *child_menu_action;
GtkWidget *parent_menu_widget;
GtkWidget *child_menu_widget;
const gchar *label;
parent_menu_action =
gtk_ui_manager_get_action (GTK_UI_MANAGER (dockbook_ui_manager),
"/dockable-popup/dockable-menu");
child_menu_action =
gtk_ui_manager_get_action (GTK_UI_MANAGER (dialog_ui_manager),
dialog_ui_identifier);
g_object_get (child_menu_action,
"label", &label,
NULL);
g_object_set (parent_menu_action,
"label", label,
"stock-id", dockable->stock_id,
"visible", TRUE,
NULL);
parent_menu_widget =
gtk_ui_manager_get_widget (GTK_UI_MANAGER (dockbook_ui_manager),
"/dockable-popup/dockable-menu");
child_menu_widget =
gimp_ui_manager_ui_get (dialog_ui_manager,
dialog_ui_identifier);
if (! GTK_IS_MENU (child_menu_widget))
{
g_warning ("%s: child_menu_widget (%p) is not a GtkMenu",
G_STRFUNC, child_menu_widget);
return FALSE;
}
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent_menu_widget),
child_menu_widget);
gimp_ui_manager_update (dialog_ui_manager, dialog_popup_data);
}
else
{
GtkAction *parent_menu_action;
parent_menu_action =
gtk_ui_manager_get_action (GTK_UI_MANAGER (dockbook_ui_manager),
"/dockable-popup/dockable-menu");
g_object_set (parent_menu_action, "visible", FALSE, NULL);
}
#else
if (dialog_item_factory)
{
GtkWidget *dialog_menu_widget;
......@@ -952,14 +1036,15 @@ gimp_dockable_show_menu (GimpDockable *dockable)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (dialog_menu_widget),
GTK_ITEM_FACTORY (dialog_item_factory)->widget);
gimp_item_factory_update (dialog_item_factory,
dialog_item_factory_data);
gimp_ui_manager_update (dialog_ui_manager, dialog_popup_data);
gimp_item_factory_update (dialog_item_factory, dialog_popup_data);
}
else
{
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (dockbook_item_factory),
"/dialog-menu", FALSE);
}
#endif
/* an item factory callback may destroy both dockable and dockbook,
* so reference them for gimp_dockable_menu_end()
......@@ -969,12 +1054,22 @@ gimp_dockable_show_menu (GimpDockable *dockable)
g_object_ref (dockable->dockbook),
g_object_unref);
#if 0
gimp_ui_manager_update (dockbook_ui_manager, dockable);
gimp_ui_manager_ui_popup (dockbook_ui_manager, "/dockable-popup",
dockable,
GTK_WIDGET (dockable),
gimp_dockable_menu_position, dockable,
(GtkDestroyNotify) gimp_dockable_menu_end);
#else
gimp_item_factory_popup_with_data (dockbook_item_factory,
dockable,
GTK_WIDGET (dockable),
gimp_dockable_menu_position,
dockable,
(GtkDestroyNotify) gimp_dockable_menu_end);
#endif
return TRUE;
}
......
......@@ -80,7 +80,12 @@ GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable,
void gimp_dockable_set_context (GimpDockable *dockable,
GimpContext *context);
GimpItemFactory * gimp_dockable_get_menu (GimpDockable *dockable,
gpointer *item_factory_data);
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier);
GimpUIManager * gimp_dockable_get_manager (GimpDockable *dockable,
gpointer *manager_data,
const gchar **ui_identifier);
void gimp_dockable_detach (GimpDockable *dockable);
......
......@@ -201,6 +201,7 @@ gimp_dockbook_init (GimpDockbook *dockbook)
{
dockbook->dock = NULL;
dockbook->item_factory = NULL;
dockbook->ui_manager = NULL;
gtk_notebook_popup_enable (GTK_NOTEBOOK (dockbook));
gtk_notebook_set_scrollable (GTK_NOTEBOOK (dockbook), TRUE);
......@@ -222,6 +223,12 @@ gimp_dockbook_finalize (GObject *object)
dockbook->item_factory = NULL;
}
if (dockbook->ui_manager)
{
g_object_unref (dockbook->ui_manager);
dockbook->ui_manager = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -321,6 +328,11 @@ gimp_dockbook_new (GimpMenuFactory *menu_factory)
dockbook,
FALSE);
dockbook->ui_manager = gimp_menu_factory_manager_new (menu_factory,
"<Dialogs>",
dockbook,
FALSE);
gimp_help_connect (GTK_WIDGET (dockbook), gimp_dockbook_help_func,
GIMP_HELP_DOCK, dockbook);
......
......@@ -42,6 +42,7 @@ struct _GimpDockbook
GimpDock *dock;
GimpItemFactory *item_factory;
GimpUIManager *ui_manager;
};
struct _GimpDockbookClass
......
......@@ -144,33 +144,22 @@ gimp_docked_get_preview (GimpDocked *docked,
}
GimpItemFactory *
gimp_docked_get_menu (GimpDocked *docked,
gpointer *item_factory_data)
gimp_docked_get_menu (GimpDocked *docked,
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier)
{
GimpDockedInterface *docked_iface;
g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL);
g_return_val_if_fail (item_factory_data != NULL, NULL);
g_return_val_if_fail (popup_data != NULL, NULL);
g_return_val_if_fail (manager != NULL, NULL);
g_return_val_if_fail (ui_identifier != NULL, NULL);
docked_iface = GIMP_DOCKED_GET_INTERFACE (docked);
#if 0
g_print ("gimp_docked_get_menu: docked = %p\n"
"iface->set_aux_info = %p\n"
"iface->get_aux_info = %p\n"
"iface->get_preview = %p\n"
"iface->set_context = %p\n"
"iface->get_menu = %p\n\n",
docked,
docked_iface->set_aux_info,
docked_iface->get_aux_info,
docked_iface->get_preview,
docked_iface->set_context,
docked_iface->get_menu);
#endif
if (docked_iface->get_menu)
return docked_iface->get_menu (docked, item_factory_data);
return docked_iface->get_menu (docked, popup_data, manager, ui_identifier);
return NULL;
}
......
......@@ -45,7 +45,9 @@ struct _GimpDockedInterface
GimpContext *context,
GtkIconSize size);
GimpItemFactory * (* get_menu) (GimpDocked *docked,
gpointer *item_factory_data);
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier);
gchar * (* get_title) (GimpDocked *docked);
void (* set_context) (GimpDocked *docked,
......@@ -66,7 +68,9 @@ GtkWidget * gimp_docked_get_preview (GimpDocked *docked,
GimpContext *context,
GtkIconSize size);
GimpItemFactory * gimp_docked_get_menu (GimpDocked *docked,
gpointer *item_factory_data);
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_idenfier);
gchar * gimp_docked_get_title (GimpDocked *docked);
void gimp_docked_set_context (GimpDocked *docked,
......
......@@ -48,7 +48,9 @@ static void gimp_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static GimpItemFactory * gimp_editor_get_menu (GimpDocked *docked,
gpointer *item_factory_data);
gpointer *popup_data,
GimpUIManager **manager,
const gchar **ui_identifier);
static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor);
......@@ -135,11 +137,12 @@ gimp_editor_class_init (GimpEditorClass *klass)
static void
gimp_editor_init (GimpEditor *editor)
{
editor->menu_factory = NULL;
editor->item_factory = NULL;
editor->ui_manager = NULL;
editor->item_factory_data = NULL;
editor->button_box = NULL;
editor->menu_factory = NULL;
editor->item_factory = NULL;
editor->ui_manager = NULL;
editor->ui_identifier = NULL;
editor->popup_data = NULL;
editor->button_box = NULL;
}
static void
......@@ -165,6 +168,12 @@ gimp_editor_destroy (GtkObject *object)
editor->ui_manager = NULL;
}
if (editor->ui_identifier)
{
g_free (editor->ui_identifier);
editor->ui_identifier = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
......@@ -187,12 +196,16 @@ gimp_editor_style_set (GtkWidget *widget,
}
static GimpItemFactory *
gimp_editor_get_menu (GimpDocked *docked,
gpointer *item_factory_data)
gimp_editor_get_menu (GimpDocked *docked,
gpointer *popup_data,
GimpUIManager **ui_manager,
const gchar **ui_identifier)
{
GimpEditor *editor = GIMP_EDITOR (docked);
*item_factory_data = editor->item_factory_data;
*ui_manager = editor->ui_manager;
*ui_identifier = editor->ui_identifier;
*popup_data = editor->popup_data;
return editor->item_factory;
}
......@@ -228,8 +241,6 @@ gimp_editor_create_menu (GimpEditor *editor,
GTK_TYPE_MENU,
callback_data,
FALSE);
editor->item_factory_data = callback_data;
if (editor->ui_manager)
g_object_unref (editor->ui_manager);
......@@ -237,6 +248,13 @@ gimp_editor_create_menu (GimpEditor *editor,
menu_identifier,
callback_data,
FALSE);
if (editor->ui_identifier)
g_free (editor->ui_identifier);
editor->ui_identifier = g_strdup (ui_identifier);
editor->popup_data = callback_data;
}