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

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
parent 3f2385dc
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>
* app/core/gimpcontainer.[ch]: added new methods
......
......@@ -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"), "<control><shift>V",
N_("From Clipboard"), "<control><shift>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 },
......
......@@ -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,
......
......@@ -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") },
......
......@@ -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);
......
......@@ -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);
......
......@@ -22,7 +22,9 @@
#include <string.h>
#include "glib-object.h"
#include <glib-object.h>
#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[] =
{
{ "<Toolbox>/Xtns/Languages", "<Image>/Filters/Languages" },
{ "<Toolbox>/Xtns/Extensions", "<Image>/Filters/Extensions" },
{ "<Toolbox>/Xtns", "<Image>/Xtns" },
{ "<Toolbox>/Help", "<Image>/Help" },
{ NULL, NULL }
{ "<Toolbox>/Xtns/Languages", NULL, "<Image>/Filters/Languages" },
{ "<Toolbox>/Xtns/Extensions", NULL, "<Image>/Filters/Extensions" },
{ "<Toolbox>/Xtns/Buttons", NULL, "<Image>/File/New/Buttons" },
{ "<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 *
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);
}
......@@ -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__ */
......@@ -5,9 +5,13 @@
<menubar-and-popup action-name="image">
<menu action="file-menu" name="File">
<placeholder name="New">
<menuitem action="image-new" />
</placeholder>
<menuitem action="image-new" />
<menu action="file-new-menu" name="New">
<placeholder name="Acquire">
<menuitem action="edit-paste-as-new" />
</placeholder>
<separator />
</menu>
<placeholder name="Open">
<menuitem action="file-open" />
<menuitem action="file-open-as-layers" />
......@@ -18,7 +22,6 @@
<separator />
<menuitem action="dialogs-document-history" />
</menu>
<menu action="file-acquire-menu" name="Acquire" />
<!-- The debug-menu is automatically excluded for stable releases -->
<menu action="debug-menu" name="Debug">
......@@ -601,6 +604,8 @@
<separator />
</menu>
<separator />
<placeholder name="Menus" />
<separator />
<placeholder name="Languages" />
<placeholder name="Extensions" />
<separator />
......@@ -608,9 +613,6 @@
<placeholder name="Menus" />
<menu action="extensions-menu" name="Xtns">
</menu>
<menu action="help-menu" name="Help">
<menuitem action="help-help" />
<menuitem action="help-context-help" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment