added GimpUIManagerSetupFunc typedef.
2004-04-26 Michael Natterer <mitch@gimp.org> * app/widgets/widgets-types.h: added GimpUIManagerSetupFunc typedef. * app/widgets/gimpuimanager.[ch]: added the setup_func to the GimpUIManagerUIEntry struct and to gimp_ui_manager_ui_register(). Call the setup_func after creating the UI. Replaced the term "identifier" by "ui_path". * app/widgets/gimpmenufactory.c: ditto. * app/gui/menus.c (menus_init): register the new setup_funcs below. * app/gui/menus.[ch] (menus_open_recent_add) * app/gui/image-menu.[ch] (image_menu_setup2) * app/gui/toolbox-menu.[ch] (toolbox_menu_setup2): new setup_funcs which add the "Open Recent" menu items. * app/actions/file-actions.c: removed "file-open-recent-empty" action because it's not needed. * menus/image-menu.xml * menus/toolbox-menu.xml: removed "file-open-recent-empty" menu items and added <placeholder>s for the "Open Recent" menu items.
This commit is contained in:

committed by
Michael Natterer

parent
b69ddb3993
commit
bb0f359ac4
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2004-04-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/widgets-types.h: added GimpUIManagerSetupFunc typedef.
|
||||
|
||||
* app/widgets/gimpuimanager.[ch]: added the setup_func to the
|
||||
GimpUIManagerUIEntry struct and to gimp_ui_manager_ui_register().
|
||||
Call the setup_func after creating the UI. Replaced the term
|
||||
"identifier" by "ui_path".
|
||||
|
||||
* app/widgets/gimpmenufactory.c: ditto.
|
||||
|
||||
* app/gui/menus.c (menus_init): register the new setup_funcs below.
|
||||
|
||||
* app/gui/menus.[ch] (menus_open_recent_add)
|
||||
* app/gui/image-menu.[ch] (image_menu_setup2)
|
||||
* app/gui/toolbox-menu.[ch] (toolbox_menu_setup2): new setup_funcs
|
||||
which add the "Open Recent" menu items.
|
||||
|
||||
* app/actions/file-actions.c: removed "file-open-recent-empty"
|
||||
action because it's not needed.
|
||||
|
||||
* menus/image-menu.xml
|
||||
* menus/toolbox-menu.xml: removed "file-open-recent-empty" menu
|
||||
items and added <placeholder>s for the "Open Recent" menu items.
|
||||
|
||||
2004-04-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimp.[ch]: removed "locale_domain" and "help_domain"
|
||||
|
@ -59,7 +59,6 @@ static GimpActionEntry file_actions[] =
|
||||
{
|
||||
{ "file-menu", NULL, N_("_File") },
|
||||
{ "file-open-recent-menu", NULL, N_("Open _Recent") },
|
||||
{ "file-open-recent-empty", NULL, N_("(Empty)") },
|
||||
{ "file-acquire-menu", NULL, N_("_Acquire") },
|
||||
|
||||
{ "file-new", GTK_STOCK_NEW,
|
||||
@ -147,9 +146,6 @@ file_actions_setup (GimpActionGroup *group,
|
||||
G_CALLBACK (file_last_opened_cmd_callback),
|
||||
data);
|
||||
|
||||
gimp_action_group_set_action_sensitive (group, "file-open-recent-empty",
|
||||
FALSE);
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
gimp_action_group_set_action_visible (group, entries[i].name, FALSE);
|
||||
@ -229,10 +225,6 @@ file_actions_last_opened_update (GimpContainer *container,
|
||||
|
||||
num_documents = gimp_container_num_children (container);
|
||||
|
||||
gimp_action_group_set_action_visible (group,
|
||||
"file-open-recent-empty",
|
||||
num_documents == 0);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
GtkAction *action;
|
||||
@ -263,10 +255,6 @@ file_actions_last_opened_update (GimpContainer *container,
|
||||
"visible", TRUE,
|
||||
NULL);
|
||||
|
||||
#if 0
|
||||
gimp_help_set_help_data (widget, filename, NULL);
|
||||
#endif
|
||||
|
||||
g_free (filename);
|
||||
g_free (basename);
|
||||
|
||||
|
@ -1135,6 +1135,13 @@ GimpItemFactoryEntry image_menu_entries[] =
|
||||
gint n_image_menu_entries = G_N_ELEMENTS (image_menu_entries);
|
||||
|
||||
|
||||
void
|
||||
image_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path)
|
||||
{
|
||||
menus_open_recent_add (manager, ui_path);
|
||||
}
|
||||
|
||||
void
|
||||
image_menu_setup (GimpItemFactory *factory,
|
||||
gpointer setup_data)
|
||||
|
@ -24,6 +24,9 @@ extern GimpItemFactoryEntry image_menu_entries[];
|
||||
extern gint n_image_menu_entries;
|
||||
|
||||
|
||||
void image_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void image_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data);
|
||||
void image_menu_update (GtkItemFactory *factory,
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpmenufactory.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
|
||||
#include "actions/actions.h"
|
||||
#include "actions/file-commands.h"
|
||||
@ -143,11 +144,11 @@ menus_init (Gimp *gimp)
|
||||
"qmask",
|
||||
NULL,
|
||||
"/toolbox-menubar",
|
||||
"toolbox-menu.xml",
|
||||
"toolbox-menu.xml", toolbox_menu_setup2,
|
||||
"/image-menubar",
|
||||
"image-menu.xml",
|
||||
"image-menu.xml", image_menu_setup2,
|
||||
"/qmask-popup",
|
||||
"qmask-menu.xml",
|
||||
"qmask-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Load>",
|
||||
@ -175,7 +176,7 @@ menus_init (Gimp *gimp)
|
||||
"layers",
|
||||
NULL,
|
||||
"/layers-popup",
|
||||
"layers-menu.xml",
|
||||
"layers-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Channels>",
|
||||
@ -188,7 +189,7 @@ menus_init (Gimp *gimp)
|
||||
"channels",
|
||||
NULL,
|
||||
"/channels-popup",
|
||||
"channels-menu.xml",
|
||||
"channels-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Vectors>",
|
||||
@ -201,7 +202,7 @@ menus_init (Gimp *gimp)
|
||||
"vectors",
|
||||
NULL,
|
||||
"/vectors-popup",
|
||||
"vectors-menu.xml",
|
||||
"vectors-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Dialogs>",
|
||||
@ -214,7 +215,7 @@ menus_init (Gimp *gimp)
|
||||
"dockable",
|
||||
NULL,
|
||||
"/dockable-popup",
|
||||
"dockable-menu.xml",
|
||||
"dockable-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Brushes>",
|
||||
@ -227,7 +228,7 @@ menus_init (Gimp *gimp)
|
||||
"brushes",
|
||||
NULL,
|
||||
"/brushes-popup",
|
||||
"brushes-menu.xml",
|
||||
"brushes-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Patterns>",
|
||||
@ -240,7 +241,7 @@ menus_init (Gimp *gimp)
|
||||
"patterns",
|
||||
NULL,
|
||||
"/patterns-popup",
|
||||
"patterns-menu.xml",
|
||||
"patterns-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Gradients>",
|
||||
@ -253,7 +254,7 @@ menus_init (Gimp *gimp)
|
||||
"gradients",
|
||||
NULL,
|
||||
"/gradients-popup",
|
||||
"gradients-menu.xml",
|
||||
"gradients-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Palettes>",
|
||||
@ -266,7 +267,7 @@ menus_init (Gimp *gimp)
|
||||
"palettes",
|
||||
NULL,
|
||||
"/palettes-popup",
|
||||
"palettes-menu.xml",
|
||||
"palettes-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Fonts>",
|
||||
@ -279,7 +280,7 @@ menus_init (Gimp *gimp)
|
||||
"fonts",
|
||||
NULL,
|
||||
"/fonts-popup",
|
||||
"fonts-menu.xml",
|
||||
"fonts-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Buffers>",
|
||||
@ -292,7 +293,7 @@ menus_init (Gimp *gimp)
|
||||
"buffers",
|
||||
NULL,
|
||||
"/buffers-popup",
|
||||
"buffers-menu.xml",
|
||||
"buffers-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Documents>",
|
||||
@ -305,7 +306,7 @@ menus_init (Gimp *gimp)
|
||||
"documents",
|
||||
NULL,
|
||||
"/documents-popup",
|
||||
"documents-menu.xml",
|
||||
"documents-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Templates>",
|
||||
@ -318,7 +319,7 @@ menus_init (Gimp *gimp)
|
||||
"templates",
|
||||
NULL,
|
||||
"/templates-popup",
|
||||
"templates-menu.xml",
|
||||
"templates-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Images>",
|
||||
@ -331,7 +332,7 @@ menus_init (Gimp *gimp)
|
||||
"images",
|
||||
NULL,
|
||||
"/images-popup",
|
||||
"images-menu.xml",
|
||||
"images-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<GradientEditor>",
|
||||
@ -344,7 +345,7 @@ menus_init (Gimp *gimp)
|
||||
"gradient-editor",
|
||||
NULL,
|
||||
"/gradient-editor-popup",
|
||||
"gradient-editor-menu.xml",
|
||||
"gradient-editor-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<PaletteEditor>",
|
||||
@ -357,7 +358,7 @@ menus_init (Gimp *gimp)
|
||||
"palette-editor",
|
||||
NULL,
|
||||
"/palette-editor-popup",
|
||||
"palette-editor-menu.xml",
|
||||
"palette-editor-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<ColormapEditor>",
|
||||
@ -370,7 +371,7 @@ menus_init (Gimp *gimp)
|
||||
"colormap-editor",
|
||||
NULL,
|
||||
"/colormap-editor-popup",
|
||||
"colormap-editor-menu.xml",
|
||||
"colormap-editor-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<QMask>",
|
||||
@ -383,7 +384,7 @@ menus_init (Gimp *gimp)
|
||||
"qmask",
|
||||
NULL,
|
||||
"/qmask-popup",
|
||||
"qmask-menu.xml",
|
||||
"qmask-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<ErrorConsole>",
|
||||
@ -396,7 +397,7 @@ menus_init (Gimp *gimp)
|
||||
"error-console",
|
||||
NULL,
|
||||
"/error-console-popup",
|
||||
"error-console-menu.xml",
|
||||
"error-console-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<ToolOptions>",
|
||||
@ -410,7 +411,7 @@ menus_init (Gimp *gimp)
|
||||
"tool-options",
|
||||
NULL,
|
||||
"/tool-options-popup",
|
||||
"tool-options-menu.xml",
|
||||
"tool-options-menu.xml", NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -461,6 +462,40 @@ menus_clear (Gimp *gimp)
|
||||
g_print ("TODO: implement menus_clear()\n");
|
||||
}
|
||||
|
||||
void
|
||||
menus_open_recent_add (GimpUIManager *manager,
|
||||
const gchar *ui_path)
|
||||
{
|
||||
gint n_entries;
|
||||
gint merge_id;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
|
||||
g_return_if_fail (ui_path != NULL);
|
||||
|
||||
n_entries = GIMP_GUI_CONFIG (manager->gimp->config)->last_opened_size;
|
||||
|
||||
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
gchar *action_name;
|
||||
gchar *action_path;
|
||||
|
||||
action_name = g_strdup_printf ("file-open-recent-%02d", i + 1);
|
||||
action_path = g_strdup_printf ("%s/file-menu/file-open-recent-menu/file-open-recent-placeholder",
|
||||
ui_path);
|
||||
|
||||
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
|
||||
action_path, action_name, action_name,
|
||||
GTK_UI_MANAGER_MENUITEM,
|
||||
FALSE);
|
||||
|
||||
g_free (action_name);
|
||||
g_free (action_path);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
menus_last_opened_add (GimpItemFactory *item_factory)
|
||||
{
|
||||
|
@ -36,6 +36,9 @@ void menus_restore (Gimp *gimp);
|
||||
void menus_save (Gimp *gimp);
|
||||
void menus_clear (Gimp *gimp);
|
||||
|
||||
void menus_open_recent_add (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void menus_last_opened_add (GimpItemFactory *item_factory);
|
||||
void menus_filters_subdirs_to_top (GtkMenu *menu);
|
||||
|
||||
|
@ -285,6 +285,13 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
|
||||
gint n_toolbox_menu_entries = G_N_ELEMENTS (toolbox_menu_entries);
|
||||
|
||||
|
||||
void
|
||||
toolbox_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path)
|
||||
{
|
||||
menus_open_recent_add (manager, ui_path);
|
||||
}
|
||||
|
||||
void
|
||||
toolbox_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data)
|
||||
|
@ -24,8 +24,11 @@ extern GimpItemFactoryEntry toolbox_menu_entries[];
|
||||
extern gint n_toolbox_menu_entries;
|
||||
|
||||
|
||||
void toolbox_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data);
|
||||
void toolbox_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void toolbox_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data);
|
||||
|
||||
|
||||
#endif /* __TOOLBOX_MENU_H__ */
|
||||
|
@ -1135,6 +1135,13 @@ GimpItemFactoryEntry image_menu_entries[] =
|
||||
gint n_image_menu_entries = G_N_ELEMENTS (image_menu_entries);
|
||||
|
||||
|
||||
void
|
||||
image_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path)
|
||||
{
|
||||
menus_open_recent_add (manager, ui_path);
|
||||
}
|
||||
|
||||
void
|
||||
image_menu_setup (GimpItemFactory *factory,
|
||||
gpointer setup_data)
|
||||
|
@ -24,6 +24,9 @@ extern GimpItemFactoryEntry image_menu_entries[];
|
||||
extern gint n_image_menu_entries;
|
||||
|
||||
|
||||
void image_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void image_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data);
|
||||
void image_menu_update (GtkItemFactory *factory,
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpmenufactory.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
|
||||
#include "actions/actions.h"
|
||||
#include "actions/file-commands.h"
|
||||
@ -143,11 +144,11 @@ menus_init (Gimp *gimp)
|
||||
"qmask",
|
||||
NULL,
|
||||
"/toolbox-menubar",
|
||||
"toolbox-menu.xml",
|
||||
"toolbox-menu.xml", toolbox_menu_setup2,
|
||||
"/image-menubar",
|
||||
"image-menu.xml",
|
||||
"image-menu.xml", image_menu_setup2,
|
||||
"/qmask-popup",
|
||||
"qmask-menu.xml",
|
||||
"qmask-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Load>",
|
||||
@ -175,7 +176,7 @@ menus_init (Gimp *gimp)
|
||||
"layers",
|
||||
NULL,
|
||||
"/layers-popup",
|
||||
"layers-menu.xml",
|
||||
"layers-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Channels>",
|
||||
@ -188,7 +189,7 @@ menus_init (Gimp *gimp)
|
||||
"channels",
|
||||
NULL,
|
||||
"/channels-popup",
|
||||
"channels-menu.xml",
|
||||
"channels-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Vectors>",
|
||||
@ -201,7 +202,7 @@ menus_init (Gimp *gimp)
|
||||
"vectors",
|
||||
NULL,
|
||||
"/vectors-popup",
|
||||
"vectors-menu.xml",
|
||||
"vectors-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Dialogs>",
|
||||
@ -214,7 +215,7 @@ menus_init (Gimp *gimp)
|
||||
"dockable",
|
||||
NULL,
|
||||
"/dockable-popup",
|
||||
"dockable-menu.xml",
|
||||
"dockable-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Brushes>",
|
||||
@ -227,7 +228,7 @@ menus_init (Gimp *gimp)
|
||||
"brushes",
|
||||
NULL,
|
||||
"/brushes-popup",
|
||||
"brushes-menu.xml",
|
||||
"brushes-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Patterns>",
|
||||
@ -240,7 +241,7 @@ menus_init (Gimp *gimp)
|
||||
"patterns",
|
||||
NULL,
|
||||
"/patterns-popup",
|
||||
"patterns-menu.xml",
|
||||
"patterns-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Gradients>",
|
||||
@ -253,7 +254,7 @@ menus_init (Gimp *gimp)
|
||||
"gradients",
|
||||
NULL,
|
||||
"/gradients-popup",
|
||||
"gradients-menu.xml",
|
||||
"gradients-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Palettes>",
|
||||
@ -266,7 +267,7 @@ menus_init (Gimp *gimp)
|
||||
"palettes",
|
||||
NULL,
|
||||
"/palettes-popup",
|
||||
"palettes-menu.xml",
|
||||
"palettes-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Fonts>",
|
||||
@ -279,7 +280,7 @@ menus_init (Gimp *gimp)
|
||||
"fonts",
|
||||
NULL,
|
||||
"/fonts-popup",
|
||||
"fonts-menu.xml",
|
||||
"fonts-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Buffers>",
|
||||
@ -292,7 +293,7 @@ menus_init (Gimp *gimp)
|
||||
"buffers",
|
||||
NULL,
|
||||
"/buffers-popup",
|
||||
"buffers-menu.xml",
|
||||
"buffers-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Documents>",
|
||||
@ -305,7 +306,7 @@ menus_init (Gimp *gimp)
|
||||
"documents",
|
||||
NULL,
|
||||
"/documents-popup",
|
||||
"documents-menu.xml",
|
||||
"documents-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Templates>",
|
||||
@ -318,7 +319,7 @@ menus_init (Gimp *gimp)
|
||||
"templates",
|
||||
NULL,
|
||||
"/templates-popup",
|
||||
"templates-menu.xml",
|
||||
"templates-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<Images>",
|
||||
@ -331,7 +332,7 @@ menus_init (Gimp *gimp)
|
||||
"images",
|
||||
NULL,
|
||||
"/images-popup",
|
||||
"images-menu.xml",
|
||||
"images-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<GradientEditor>",
|
||||
@ -344,7 +345,7 @@ menus_init (Gimp *gimp)
|
||||
"gradient-editor",
|
||||
NULL,
|
||||
"/gradient-editor-popup",
|
||||
"gradient-editor-menu.xml",
|
||||
"gradient-editor-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<PaletteEditor>",
|
||||
@ -357,7 +358,7 @@ menus_init (Gimp *gimp)
|
||||
"palette-editor",
|
||||
NULL,
|
||||
"/palette-editor-popup",
|
||||
"palette-editor-menu.xml",
|
||||
"palette-editor-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<ColormapEditor>",
|
||||
@ -370,7 +371,7 @@ menus_init (Gimp *gimp)
|
||||
"colormap-editor",
|
||||
NULL,
|
||||
"/colormap-editor-popup",
|
||||
"colormap-editor-menu.xml",
|
||||
"colormap-editor-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<QMask>",
|
||||
@ -383,7 +384,7 @@ menus_init (Gimp *gimp)
|
||||
"qmask",
|
||||
NULL,
|
||||
"/qmask-popup",
|
||||
"qmask-menu.xml",
|
||||
"qmask-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<ErrorConsole>",
|
||||
@ -396,7 +397,7 @@ menus_init (Gimp *gimp)
|
||||
"error-console",
|
||||
NULL,
|
||||
"/error-console-popup",
|
||||
"error-console-menu.xml",
|
||||
"error-console-menu.xml", NULL,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory, "<ToolOptions>",
|
||||
@ -410,7 +411,7 @@ menus_init (Gimp *gimp)
|
||||
"tool-options",
|
||||
NULL,
|
||||
"/tool-options-popup",
|
||||
"tool-options-menu.xml",
|
||||
"tool-options-menu.xml", NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -461,6 +462,40 @@ menus_clear (Gimp *gimp)
|
||||
g_print ("TODO: implement menus_clear()\n");
|
||||
}
|
||||
|
||||
void
|
||||
menus_open_recent_add (GimpUIManager *manager,
|
||||
const gchar *ui_path)
|
||||
{
|
||||
gint n_entries;
|
||||
gint merge_id;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
|
||||
g_return_if_fail (ui_path != NULL);
|
||||
|
||||
n_entries = GIMP_GUI_CONFIG (manager->gimp->config)->last_opened_size;
|
||||
|
||||
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
gchar *action_name;
|
||||
gchar *action_path;
|
||||
|
||||
action_name = g_strdup_printf ("file-open-recent-%02d", i + 1);
|
||||
action_path = g_strdup_printf ("%s/file-menu/file-open-recent-menu/file-open-recent-placeholder",
|
||||
ui_path);
|
||||
|
||||
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
|
||||
action_path, action_name, action_name,
|
||||
GTK_UI_MANAGER_MENUITEM,
|
||||
FALSE);
|
||||
|
||||
g_free (action_name);
|
||||
g_free (action_path);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
menus_last_opened_add (GimpItemFactory *item_factory)
|
||||
{
|
||||
|
@ -36,6 +36,9 @@ void menus_restore (Gimp *gimp);
|
||||
void menus_save (Gimp *gimp);
|
||||
void menus_clear (Gimp *gimp);
|
||||
|
||||
void menus_open_recent_add (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void menus_last_opened_add (GimpItemFactory *item_factory);
|
||||
void menus_filters_subdirs_to_top (GtkMenu *menu);
|
||||
|
||||
|
@ -285,6 +285,13 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
|
||||
gint n_toolbox_menu_entries = G_N_ELEMENTS (toolbox_menu_entries);
|
||||
|
||||
|
||||
void
|
||||
toolbox_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path)
|
||||
{
|
||||
menus_open_recent_add (manager, ui_path);
|
||||
}
|
||||
|
||||
void
|
||||
toolbox_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data)
|
||||
|
@ -24,8 +24,11 @@ extern GimpItemFactoryEntry toolbox_menu_entries[];
|
||||
extern gint n_toolbox_menu_entries;
|
||||
|
||||
|
||||
void toolbox_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data);
|
||||
void toolbox_menu_setup2 (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void toolbox_menu_setup (GimpItemFactory *factory,
|
||||
gpointer callback_data);
|
||||
|
||||
|
||||
#endif /* __TOOLBOX_MENU_H__ */
|
||||
|
@ -113,7 +113,7 @@ gimp_menu_factory_finalize (GObject *object)
|
||||
{
|
||||
GimpUIManagerUIEntry *ui_entry = uis->data;
|
||||
|
||||
g_free (ui_entry->identifier);
|
||||
g_free (ui_entry->ui_path);
|
||||
g_free (ui_entry->basename);
|
||||
g_free (ui_entry);
|
||||
}
|
||||
@ -243,10 +243,11 @@ gimp_menu_factory_manager_register (GimpMenuFactory *factory,
|
||||
|
||||
if (! strcmp (entry->identifier, identifier))
|
||||
{
|
||||
const gchar *group;
|
||||
const gchar *ui_identifier;
|
||||
const gchar *ui_basename;
|
||||
va_list args;
|
||||
const gchar *group;
|
||||
const gchar *ui_path;
|
||||
const gchar *ui_basename;
|
||||
GimpUIManagerSetupFunc setup_func;
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (entry->action_groups == NULL);
|
||||
|
||||
@ -262,25 +263,27 @@ gimp_menu_factory_manager_register (GimpMenuFactory *factory,
|
||||
|
||||
entry->action_groups = g_list_reverse (entry->action_groups);
|
||||
|
||||
ui_identifier = va_arg (args, const gchar *);
|
||||
ui_path = va_arg (args, const gchar *);
|
||||
|
||||
while (ui_identifier)
|
||||
while (ui_path)
|
||||
{
|
||||
GimpUIManagerUIEntry *ui_entry;
|
||||
|
||||
ui_basename = va_arg (args, const gchar *);
|
||||
setup_func = va_arg (args, GimpUIManagerSetupFunc);
|
||||
|
||||
ui_entry = g_new0 (GimpUIManagerUIEntry, 1);
|
||||
|
||||
ui_entry->identifier = g_strdup (ui_identifier);
|
||||
ui_entry->ui_path = g_strdup (ui_path);
|
||||
ui_entry->basename = g_strdup (ui_basename);
|
||||
ui_entry->setup_func = setup_func;
|
||||
ui_entry->merge_id = 0;
|
||||
ui_entry->widget = NULL;
|
||||
|
||||
entry->managed_uis = g_list_prepend (entry->managed_uis,
|
||||
ui_entry);
|
||||
|
||||
ui_identifier = va_arg (args, const gchar *);
|
||||
ui_path = va_arg (args, const gchar *);
|
||||
}
|
||||
|
||||
entry->managed_uis = g_list_reverse (entry->managed_uis);
|
||||
@ -337,8 +340,9 @@ gimp_menu_factory_manager_new (GimpMenuFactory *factory,
|
||||
GimpUIManagerUIEntry *ui_entry = list->data;
|
||||
|
||||
gimp_ui_manager_ui_register (manager,
|
||||
ui_entry->identifier,
|
||||
ui_entry->basename);
|
||||
ui_entry->ui_path,
|
||||
ui_entry->basename,
|
||||
ui_entry->setup_func);
|
||||
}
|
||||
|
||||
return manager;
|
||||
|
@ -122,7 +122,7 @@ gimp_ui_manager_finalize (GObject *object)
|
||||
{
|
||||
GimpUIManagerUIEntry *entry = list->data;
|
||||
|
||||
g_free (entry->identifier);
|
||||
g_free (entry->ui_path);
|
||||
g_free (entry->basename);
|
||||
|
||||
if (entry->widget)
|
||||
@ -214,20 +214,22 @@ gimp_ui_manager_update (GimpUIManager *manager,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_ui_manager_ui_register (GimpUIManager *manager,
|
||||
const gchar *identifier,
|
||||
const gchar *basename)
|
||||
gimp_ui_manager_ui_register (GimpUIManager *manager,
|
||||
const gchar *ui_path,
|
||||
const gchar *basename,
|
||||
GimpUIManagerSetupFunc setup_func)
|
||||
{
|
||||
GimpUIManagerUIEntry *entry;
|
||||
|
||||
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
|
||||
g_return_if_fail (identifier != NULL);
|
||||
g_return_if_fail (ui_path != NULL);
|
||||
g_return_if_fail (basename != NULL);
|
||||
|
||||
entry = g_new0 (GimpUIManagerUIEntry, 1);
|
||||
|
||||
entry->identifier = g_strdup (identifier);
|
||||
entry->ui_path = g_strdup (ui_path);
|
||||
entry->basename = g_strdup (basename);
|
||||
entry->setup_func = setup_func;
|
||||
entry->merge_id = 0;
|
||||
entry->widget = NULL;
|
||||
|
||||
@ -241,7 +243,7 @@ gimp_ui_manager_ui_register (GimpUIManager *manager,
|
||||
entry->basename, NULL);
|
||||
|
||||
g_print ("loading menu: %s for %s\n", filename,
|
||||
entry->identifier);
|
||||
entry->ui_path);
|
||||
|
||||
entry->merge_id =
|
||||
gtk_ui_manager_add_ui_from_file (GTK_UI_MANAGER (manager),
|
||||
@ -259,18 +261,18 @@ gimp_ui_manager_ui_register (GimpUIManager *manager,
|
||||
|
||||
GtkWidget *
|
||||
gimp_ui_manager_ui_get (GimpUIManager *manager,
|
||||
const gchar *identifier)
|
||||
const gchar *ui_path)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_UI_MANAGER (manager), NULL);
|
||||
g_return_val_if_fail (identifier != NULL, NULL);
|
||||
g_return_val_if_fail (ui_path != NULL, NULL);
|
||||
|
||||
for (list = manager->registered_uis; list; list = g_list_next (list))
|
||||
{
|
||||
GimpUIManagerUIEntry *entry = list->data;
|
||||
|
||||
if (! strcmp (entry->identifier, identifier))
|
||||
if (! strcmp (entry->ui_path, ui_path))
|
||||
{
|
||||
if (! entry->merge_id)
|
||||
{
|
||||
@ -281,7 +283,7 @@ gimp_ui_manager_ui_get (GimpUIManager *manager,
|
||||
entry->basename, NULL);
|
||||
|
||||
g_print ("loading menu: %s for %s\n", filename,
|
||||
entry->identifier);
|
||||
entry->ui_path);
|
||||
|
||||
entry->merge_id =
|
||||
gtk_ui_manager_add_ui_from_file (GTK_UI_MANAGER (manager),
|
||||
@ -302,10 +304,15 @@ gimp_ui_manager_ui_get (GimpUIManager *manager,
|
||||
{
|
||||
entry->widget =
|
||||
gtk_ui_manager_get_widget (GTK_UI_MANAGER (manager),
|
||||
entry->identifier);
|
||||
entry->ui_path);
|
||||
|
||||
if (entry->widget)
|
||||
g_object_ref (entry->widget);
|
||||
{
|
||||
g_object_ref (entry->widget);
|
||||
|
||||
if (entry->setup_func)
|
||||
entry->setup_func (manager, entry->ui_path);
|
||||
}
|
||||
}
|
||||
|
||||
return entry->widget;
|
||||
@ -313,7 +320,7 @@ gimp_ui_manager_ui_get (GimpUIManager *manager,
|
||||
}
|
||||
|
||||
g_warning ("%s: no entry registered for \"%s\"",
|
||||
G_STRFUNC, identifier);
|
||||
G_STRFUNC, ui_path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -29,10 +29,11 @@ typedef struct _GimpUIManagerUIEntry GimpUIManagerUIEntry;
|
||||
|
||||
struct _GimpUIManagerUIEntry
|
||||
{
|
||||
gchar *identifier;
|
||||
gchar *basename;
|
||||
guint merge_id;
|
||||
GtkWidget *widget;
|
||||
gchar *ui_path;
|
||||
gchar *basename;
|
||||
GimpUIManagerSetupFunc setup_func;
|
||||
guint merge_id;
|
||||
GtkWidget *widget;
|
||||
};
|
||||
|
||||
|
||||
@ -63,22 +64,23 @@ struct _GimpUIManagerClass
|
||||
GType gimp_ui_manager_get_type (void);
|
||||
GimpUIManager * gimp_ui_manager_new (Gimp *gimp);
|
||||
|
||||
void gimp_ui_manager_update (GimpUIManager *manager,
|
||||
gpointer update_data);
|
||||
void gimp_ui_manager_update (GimpUIManager *manager,
|
||||
gpointer update_data);
|
||||
|
||||
void gimp_ui_manager_ui_register (GimpUIManager *manager,
|
||||
const gchar *identifier,
|
||||
const gchar *basename);
|
||||
GtkWidget * gimp_ui_manager_ui_get (GimpUIManager *manager,
|
||||
const gchar *identifier);
|
||||
void gimp_ui_manager_ui_register (GimpUIManager *manager,
|
||||
const gchar *ui_path,
|
||||
const gchar *basename,
|
||||
GimpUIManagerSetupFunc setup_func);
|
||||
GtkWidget * gimp_ui_manager_ui_get (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
void gimp_ui_manager_ui_popup (GimpUIManager *manager,
|
||||
const gchar *ui_path,
|
||||
gpointer popup_data,
|
||||
GtkWidget *parent,
|
||||
GimpMenuPositionFunc position_func,
|
||||
gpointer position_data,
|
||||
GtkDestroyNotify popdown_func);
|
||||
void gimp_ui_manager_ui_popup (GimpUIManager *manager,
|
||||
const gchar *ui_path,
|
||||
gpointer popup_data,
|
||||
GtkWidget *parent,
|
||||
GimpMenuPositionFunc position_func,
|
||||
gpointer position_data,
|
||||
GtkDestroyNotify popdown_func);
|
||||
|
||||
|
||||
#endif /* __GIMP_UI_MANAGER_H__ */
|
||||
|
@ -150,6 +150,9 @@ typedef void (* GimpActionGroupSetupFunc) (GimpActionGroup *factory,
|
||||
typedef void (* GimpActionGroupUpdateFunc) (GimpActionGroup *factory,
|
||||
gpointer data);
|
||||
|
||||
typedef void (* GimpUIManagerSetupFunc) (GimpUIManager *manager,
|
||||
const gchar *ui_path);
|
||||
|
||||
typedef void (* GimpMenuPositionFunc) (GtkMenu *menu,
|
||||
gint *x,
|
||||
gint *y,
|
||||
|
@ -8,7 +8,7 @@
|
||||
<menuitem action="file-new" />
|
||||
<menuitem action="file-open" />
|
||||
<menu action="file-open-recent-menu">
|
||||
<menuitem action="file-open-recent-empty" />
|
||||
<placeholder name="file-open-recent-placeholder" />
|
||||
<separator />
|
||||
<menuitem action="dialogs-document-history" />
|
||||
</menu>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<menuitem action="file-new" />
|
||||
<menuitem action="file-open" />
|
||||
<menu action="file-open-recent-menu">
|
||||
<menuitem action="file-open-recent-empty" />
|
||||
<placeholder name="file-open-recent-placeholder" />
|
||||
<separator />
|
||||
<menuitem action="dialogs-document-history" />
|
||||
</menu>
|
||||
|
Reference in New Issue
Block a user