From e173c6facbbdcdfe02f91f46966028efb73bf880 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 9 Apr 2008 10:48:01 +0000 Subject: [PATCH] add "File/New" submenu and an "Acquire" placeholder inside it. Removed 2008-04-09 Michael Natterer * menus/image-menu.xml.in: add "File/New" submenu and an "Acquire" placeholder inside it. Removed "File/Acquire". Removed the "Xtns" menu. * app/plug-in/plug-in-menu-path.[ch] (plug_in_menu_path_map): add "menu_label" parameter and add support for mapping around individual menu items while preserving their translation and mnemonics. Add mappings for the known menus from "Xtns" and map them to "File/New". Map everything else in "Xtns" to "Filters/Extensions". * app/plug-in/gimppluginmanager-menu-branch.c (gimp_plug_in_manager_add_menu_branch): pass the menu_label so menu branches can be mapped with their translation. * app/plug-in/gimppluginprocedure.c (gimp_plug_in_procedure_add_menu_path): pass NULL because mapping menu items which have no submenu makes no sense and is redundant. * app/actions/image-actions.c: remove the "Xtns" menu action. * app/actions/file-actions.c: add action for the "File/New" menu and removed the "File/Acquire" action. * app/actions/edit-actions.c: rename "Paste as New" to "From Clipboard". * menus/image-menu.xml.in: add the "From Clipboard" action to the "File/New" menu. svn path=/trunk/; revision=25427 --- ChangeLog | 33 +++++++++++++ app/actions/edit-actions.c | 2 +- app/actions/file-actions.c | 2 +- app/actions/image-actions.c | 2 - app/plug-in/gimppluginmanager-menu-branch.c | 2 +- app/plug-in/gimppluginprocedure.c | 2 +- app/plug-in/plug-in-menu-path.c | 51 ++++++++++++++++++--- app/plug-in/plug-in-menu-path.h | 3 +- menus/image-menu.xml.in | 16 ++++--- 9 files changed, 92 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4d00e8b9a..b07ba515c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2008-04-09 Michael Natterer + + * menus/image-menu.xml.in: add "File/New" submenu and an "Acquire" + placeholder inside it. Removed "File/Acquire". Removed the "Xtns" + menu. + + * app/plug-in/plug-in-menu-path.[ch] (plug_in_menu_path_map): + add "menu_label" parameter and add support for mapping around + individual menu items while preserving their translation and + mnemonics. Add mappings for the known menus from "Xtns" and map + them to "File/New". + + Map everything else in "Xtns" to "Filters/Extensions". + + * app/plug-in/gimppluginmanager-menu-branch.c + (gimp_plug_in_manager_add_menu_branch): pass the menu_label so + menu branches can be mapped with their translation. + + * app/plug-in/gimppluginprocedure.c + (gimp_plug_in_procedure_add_menu_path): pass NULL because mapping + menu items which have no submenu makes no sense and is redundant. + + * app/actions/image-actions.c: remove the "Xtns" menu action. + + * app/actions/file-actions.c: add action for the "File/New" menu + and removed the "File/Acquire" action. + + * app/actions/edit-actions.c: rename "Paste as New" to + "From Clipboard". + + * menus/image-menu.xml.in: add the "From Clipboard" action to the + "File/New" menu. + 2008-04-09 Sven Neumann * app/core/gimpcontainer.[ch]: added new methods diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c index be2967859e..9be442fea5 100644 --- a/app/actions/edit-actions.c +++ b/app/actions/edit-actions.c @@ -135,7 +135,7 @@ static const GimpActionEntry edit_actions[] = GIMP_HELP_EDIT_PASTE_INTO }, { "edit-paste-as-new", GIMP_STOCK_PASTE_AS_NEW, - N_("Paste as New"), "V", + N_("From Clipboard"), "V", N_("Create a new image from the content of the clipboard"), G_CALLBACK (edit_paste_as_new_cmd_callback), GIMP_HELP_EDIT_PASTE_AS_NEW }, diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c index fe5d0dfa26..0d017e8e55 100644 --- a/app/actions/file-actions.c +++ b/app/actions/file-actions.c @@ -64,8 +64,8 @@ static void file_actions_close_all_update (GimpContainer *images, static const GimpActionEntry file_actions[] = { { "file-menu", NULL, N_("_File") }, + { "file-new-menu", NULL, N_("Ne_w") }, { "file-open-recent-menu", NULL, N_("Open _Recent") }, - { "file-acquire-menu", NULL, N_("Acq_uire") }, { "file-open", GTK_STOCK_OPEN, N_("_Open..."), NULL, diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c index 2b275a9761..015b993322 100644 --- a/app/actions/image-actions.c +++ b/app/actions/image-actions.c @@ -51,8 +51,6 @@ static const GimpActionEntry image_actions[] = N_("Image Menu"), NULL, NULL, NULL, GIMP_HELP_IMAGE_WINDOW }, - { "extensions-menu", NULL, N_("_Xtns") }, - { "image-menu", NULL, N_("_Image") }, { "image-mode-menu", NULL, N_("_Mode") }, { "image-transform-menu", NULL, N_("_Transform") }, diff --git a/app/plug-in/gimppluginmanager-menu-branch.c b/app/plug-in/gimppluginmanager-menu-branch.c index 3c95408eae..b6d6eb9991 100644 --- a/app/plug-in/gimppluginmanager-menu-branch.c +++ b/app/plug-in/gimppluginmanager-menu-branch.c @@ -68,7 +68,7 @@ gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager, branch = g_slice_new (GimpPlugInMenuBranch); branch->prog_name = g_strdup (prog_name); - branch->menu_path = plug_in_menu_path_map (menu_path); + branch->menu_path = plug_in_menu_path_map (menu_path, menu_label); branch->menu_label = g_strdup (menu_label); manager->menu_branches = g_slist_append (manager->menu_branches, branch); diff --git a/app/plug-in/gimppluginprocedure.c b/app/plug-in/gimppluginprocedure.c index c049895ccc..37ad86d9c6 100644 --- a/app/plug-in/gimppluginprocedure.c +++ b/app/plug-in/gimppluginprocedure.c @@ -475,7 +475,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc, g_free (basename); - mapped_path = plug_in_menu_path_map (menu_path); + mapped_path = plug_in_menu_path_map (menu_path, NULL); proc->menu_paths = g_list_append (proc->menu_paths, mapped_path); diff --git a/app/plug-in/plug-in-menu-path.c b/app/plug-in/plug-in-menu-path.c index f69d3a3a41..b0d80c8762 100644 --- a/app/plug-in/plug-in-menu-path.c +++ b/app/plug-in/plug-in-menu-path.c @@ -22,7 +22,9 @@ #include -#include "glib-object.h" +#include + +#include "libgimpbase/gimpbase.h" #include "plug-in-types.h" @@ -34,27 +36,47 @@ typedef struct _MenuPathMapping MenuPathMapping; struct _MenuPathMapping { const gchar *orig_path; + const gchar *label; const gchar *mapped_path; }; static const MenuPathMapping menu_path_mappings[] = { - { "/Xtns/Languages", "/Filters/Languages" }, - { "/Xtns/Extensions", "/Filters/Extensions" }, - { "/Xtns", "/Xtns" }, - { "/Help", "/Help" }, - { NULL, NULL } + { "/Xtns/Languages", NULL, "/Filters/Languages" }, + { "/Xtns/Extensions", NULL, "/Filters/Extensions" }, + + { "/Xtns/Buttons", NULL, "/File/New/Buttons" }, + { "/Xtns/Logos", NULL, "/File/New/Logos" }, + { "/Xtns/Misc", NULL, "/File/New/Misc" }, + { "/Xtns/Patterns", NULL, "/File/New/Patterns" }, + { "/Xtns/Web Page Themes", NULL, "/File/New/Web Page Themes" }, + + { "/Xtns", "Buttons", "/File/New" }, + { "/Xtns", "Logos", "/File/New" }, + { "/Xtns", "Misc", "/File/New" }, + { "/Xtns", "Patterns", "/File/New" }, + { "/Xtns", "Web Page Themes", "/File/New" }, + + { "/Xtns", NULL, "/Xtns" }, + { "/Help", NULL, "/Help" }, + { "/File/Acquire", NULL, "/File/New/Acquire" }, + { NULL, NULL, NULL } }; gchar * -plug_in_menu_path_map (const gchar *menu_path) +plug_in_menu_path_map (const gchar *menu_path, + const gchar *menu_label) { const MenuPathMapping *mapping; + gchar *stripped_label = NULL; g_return_val_if_fail (menu_path != NULL, NULL); + if (menu_label) + stripped_label = gimp_strip_uline (menu_label); + for (mapping = menu_path_mappings; mapping->orig_path; mapping++) { if (g_str_has_prefix (menu_path, mapping->orig_path)) @@ -62,6 +84,17 @@ plug_in_menu_path_map (const gchar *menu_path) gint orig_len = strlen (mapping->orig_path); gchar *mapped_path; + /* if the mapping has a label, only map if the passed label + * is identical and the paths' lengths match exactly. + */ + if (mapping->label && + (! stripped_label || + strlen (menu_path) != orig_len || + strcmp (mapping->label, stripped_label))) + { + continue; + } + if (strlen (menu_path) > orig_len) mapped_path = g_strconcat (mapping->mapped_path, menu_path + orig_len, @@ -74,9 +107,13 @@ plug_in_menu_path_map (const gchar *menu_path) menu_path, mapped_path); #endif + g_free (stripped_label); + return mapped_path; } } + g_free (stripped_label); + return g_strdup (menu_path); } diff --git a/app/plug-in/plug-in-menu-path.h b/app/plug-in/plug-in-menu-path.h index 549cb1dd2f..f98578f9dd 100644 --- a/app/plug-in/plug-in-menu-path.h +++ b/app/plug-in/plug-in-menu-path.h @@ -22,7 +22,8 @@ #define __PLUG_IN_MENU_PATH_H__ -gchar * plug_in_menu_path_map (const gchar *menu_path); +gchar * plug_in_menu_path_map (const gchar *menu_path, + const gchar *menu_label); #endif /* __PLUG_IN_MENU_PATH_H__ */ diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index ac38aa2e7c..e0b1abe8c8 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -5,9 +5,13 @@ - - - + + + + + + + @@ -18,7 +22,6 @@ - @@ -601,6 +604,8 @@ + + @@ -608,9 +613,6 @@ - - -