add "File/New" submenu and an "Acquire" placeholder inside it. Removed

2008-04-09  Michael Natterer  <mitch@gimp.org>

	* 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
This commit is contained in:
Michael Natterer 2008-04-09 10:48:01 +00:00 committed by Michael Natterer
parent 3f2385dcc2
commit e173c6facb
9 changed files with 92 additions and 21 deletions

View File

@ -1,3 +1,36 @@
2008-04-09 Michael Natterer <mitch@gimp.org>
* 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 <sven@gimp.org> 2008-04-09 Sven Neumann <sven@gimp.org>
* app/core/gimpcontainer.[ch]: added new methods * app/core/gimpcontainer.[ch]: added new methods

View File

@ -135,7 +135,7 @@ static const GimpActionEntry edit_actions[] =
GIMP_HELP_EDIT_PASTE_INTO }, GIMP_HELP_EDIT_PASTE_INTO },
{ "edit-paste-as-new", GIMP_STOCK_PASTE_AS_NEW, { "edit-paste-as-new", GIMP_STOCK_PASTE_AS_NEW,
N_("Paste as New"), "<control><shift>V", N_("From Clipboard"), "<control><shift>V",
N_("Create a new image from the content of the clipboard"), N_("Create a new image from the content of the clipboard"),
G_CALLBACK (edit_paste_as_new_cmd_callback), G_CALLBACK (edit_paste_as_new_cmd_callback),
GIMP_HELP_EDIT_PASTE_AS_NEW }, GIMP_HELP_EDIT_PASTE_AS_NEW },

View File

@ -64,8 +64,8 @@ static void file_actions_close_all_update (GimpContainer *images,
static const GimpActionEntry file_actions[] = static const GimpActionEntry file_actions[] =
{ {
{ "file-menu", NULL, N_("_File") }, { "file-menu", NULL, N_("_File") },
{ "file-new-menu", NULL, N_("Ne_w") },
{ "file-open-recent-menu", NULL, N_("Open _Recent") }, { "file-open-recent-menu", NULL, N_("Open _Recent") },
{ "file-acquire-menu", NULL, N_("Acq_uire") },
{ "file-open", GTK_STOCK_OPEN, { "file-open", GTK_STOCK_OPEN,
N_("_Open..."), NULL, N_("_Open..."), NULL,

View File

@ -51,8 +51,6 @@ static const GimpActionEntry image_actions[] =
N_("Image Menu"), NULL, NULL, NULL, N_("Image Menu"), NULL, NULL, NULL,
GIMP_HELP_IMAGE_WINDOW }, GIMP_HELP_IMAGE_WINDOW },
{ "extensions-menu", NULL, N_("_Xtns") },
{ "image-menu", NULL, N_("_Image") }, { "image-menu", NULL, N_("_Image") },
{ "image-mode-menu", NULL, N_("_Mode") }, { "image-mode-menu", NULL, N_("_Mode") },
{ "image-transform-menu", NULL, N_("_Transform") }, { "image-transform-menu", NULL, N_("_Transform") },

View File

@ -68,7 +68,7 @@ gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
branch = g_slice_new (GimpPlugInMenuBranch); branch = g_slice_new (GimpPlugInMenuBranch);
branch->prog_name = g_strdup (prog_name); 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); branch->menu_label = g_strdup (menu_label);
manager->menu_branches = g_slist_append (manager->menu_branches, branch); manager->menu_branches = g_slist_append (manager->menu_branches, branch);

View File

@ -475,7 +475,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
g_free (basename); 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); proc->menu_paths = g_list_append (proc->menu_paths, mapped_path);

View File

@ -22,7 +22,9 @@
#include <string.h> #include <string.h>
#include "glib-object.h" #include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "plug-in-types.h" #include "plug-in-types.h"
@ -34,27 +36,47 @@ typedef struct _MenuPathMapping MenuPathMapping;
struct _MenuPathMapping struct _MenuPathMapping
{ {
const gchar *orig_path; const gchar *orig_path;
const gchar *label;
const gchar *mapped_path; const gchar *mapped_path;
}; };
static const MenuPathMapping menu_path_mappings[] = static const MenuPathMapping menu_path_mappings[] =
{ {
{ "<Toolbox>/Xtns/Languages", "<Image>/Filters/Languages" }, { "<Toolbox>/Xtns/Languages", NULL, "<Image>/Filters/Languages" },
{ "<Toolbox>/Xtns/Extensions", "<Image>/Filters/Extensions" }, { "<Toolbox>/Xtns/Extensions", NULL, "<Image>/Filters/Extensions" },
{ "<Toolbox>/Xtns", "<Image>/Xtns" },
{ "<Toolbox>/Help", "<Image>/Help" }, { "<Toolbox>/Xtns/Buttons", NULL, "<Image>/File/New/Buttons" },
{ NULL, NULL } { "<Toolbox>/Xtns/Logos", NULL, "<Image>/File/New/Logos" },
{ "<Toolbox>/Xtns/Misc", NULL, "<Image>/File/New/Misc" },
{ "<Toolbox>/Xtns/Patterns", NULL, "<Image>/File/New/Patterns" },
{ "<Toolbox>/Xtns/Web Page Themes", NULL, "<Image>/File/New/Web Page Themes" },
{ "<Toolbox>/Xtns", "Buttons", "<Image>/File/New" },
{ "<Toolbox>/Xtns", "Logos", "<Image>/File/New" },
{ "<Toolbox>/Xtns", "Misc", "<Image>/File/New" },
{ "<Toolbox>/Xtns", "Patterns", "<Image>/File/New" },
{ "<Toolbox>/Xtns", "Web Page Themes", "<Image>/File/New" },
{ "<Toolbox>/Xtns", NULL, "<Image>/Xtns" },
{ "<Toolbox>/Help", NULL, "<Image>/Help" },
{ "<Image>/File/Acquire", NULL, "<Image>/File/New/Acquire" },
{ NULL, NULL, NULL }
}; };
gchar * 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; const MenuPathMapping *mapping;
gchar *stripped_label = NULL;
g_return_val_if_fail (menu_path != NULL, 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++) for (mapping = menu_path_mappings; mapping->orig_path; mapping++)
{ {
if (g_str_has_prefix (menu_path, mapping->orig_path)) 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); gint orig_len = strlen (mapping->orig_path);
gchar *mapped_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) if (strlen (menu_path) > orig_len)
mapped_path = g_strconcat (mapping->mapped_path, mapped_path = g_strconcat (mapping->mapped_path,
menu_path + orig_len, menu_path + orig_len,
@ -74,9 +107,13 @@ plug_in_menu_path_map (const gchar *menu_path)
menu_path, mapped_path); menu_path, mapped_path);
#endif #endif
g_free (stripped_label);
return mapped_path; return mapped_path;
} }
} }
g_free (stripped_label);
return g_strdup (menu_path); return g_strdup (menu_path);
} }

View File

@ -22,7 +22,8 @@
#define __PLUG_IN_MENU_PATH_H__ #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__ */ #endif /* __PLUG_IN_MENU_PATH_H__ */

View File

@ -5,9 +5,13 @@
<menubar-and-popup action-name="image"> <menubar-and-popup action-name="image">
<menu action="file-menu" name="File"> <menu action="file-menu" name="File">
<placeholder name="New"> <menuitem action="image-new" />
<menuitem action="image-new" /> <menu action="file-new-menu" name="New">
</placeholder> <placeholder name="Acquire">
<menuitem action="edit-paste-as-new" />
</placeholder>
<separator />
</menu>
<placeholder name="Open"> <placeholder name="Open">
<menuitem action="file-open" /> <menuitem action="file-open" />
<menuitem action="file-open-as-layers" /> <menuitem action="file-open-as-layers" />
@ -18,7 +22,6 @@
<separator /> <separator />
<menuitem action="dialogs-document-history" /> <menuitem action="dialogs-document-history" />
</menu> </menu>
<menu action="file-acquire-menu" name="Acquire" />
<!-- The debug-menu is automatically excluded for stable releases --> <!-- The debug-menu is automatically excluded for stable releases -->
<menu action="debug-menu" name="Debug"> <menu action="debug-menu" name="Debug">
@ -601,6 +604,8 @@
<separator /> <separator />
</menu> </menu>
<separator /> <separator />
<placeholder name="Menus" />
<separator />
<placeholder name="Languages" /> <placeholder name="Languages" />
<placeholder name="Extensions" /> <placeholder name="Extensions" />
<separator /> <separator />
@ -608,9 +613,6 @@
<placeholder name="Menus" /> <placeholder name="Menus" />
<menu action="extensions-menu" name="Xtns">
</menu>
<menu action="help-menu" name="Help"> <menu action="help-menu" name="Help">
<menuitem action="help-help" /> <menuitem action="help-help" />
<menuitem action="help-context-help" /> <menuitem action="help-context-help" />