gimp r25427 - in trunk: . app/actions app/plug-in menus



Author: mitch
Date: Wed Apr  9 11:48:01 2008
New Revision: 25427
URL: http://svn.gnome.org/viewvc/gimp?rev=25427&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/app/actions/edit-actions.c
   trunk/app/actions/file-actions.c
   trunk/app/actions/image-actions.c
   trunk/app/plug-in/gimppluginmanager-menu-branch.c
   trunk/app/plug-in/gimppluginprocedure.c
   trunk/app/plug-in/plug-in-menu-path.c
   trunk/app/plug-in/plug-in-menu-path.h
   trunk/menus/image-menu.xml.in

Modified: trunk/app/actions/edit-actions.c
==============================================================================
--- trunk/app/actions/edit-actions.c	(original)
+++ trunk/app/actions/edit-actions.c	Wed Apr  9 11:48:01 2008
@@ -135,7 +135,7 @@
     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 },

Modified: trunk/app/actions/file-actions.c
==============================================================================
--- trunk/app/actions/file-actions.c	(original)
+++ trunk/app/actions/file-actions.c	Wed Apr  9 11:48:01 2008
@@ -64,8 +64,8 @@
 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,

Modified: trunk/app/actions/image-actions.c
==============================================================================
--- trunk/app/actions/image-actions.c	(original)
+++ trunk/app/actions/image-actions.c	Wed Apr  9 11:48:01 2008
@@ -51,8 +51,6 @@
     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")  },

Modified: trunk/app/plug-in/gimppluginmanager-menu-branch.c
==============================================================================
--- trunk/app/plug-in/gimppluginmanager-menu-branch.c	(original)
+++ trunk/app/plug-in/gimppluginmanager-menu-branch.c	Wed Apr  9 11:48:01 2008
@@ -68,7 +68,7 @@
   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);

Modified: trunk/app/plug-in/gimppluginprocedure.c
==============================================================================
--- trunk/app/plug-in/gimppluginprocedure.c	(original)
+++ trunk/app/plug-in/gimppluginprocedure.c	Wed Apr  9 11:48:01 2008
@@ -475,7 +475,7 @@
 
   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);
 

Modified: trunk/app/plug-in/plug-in-menu-path.c
==============================================================================
--- trunk/app/plug-in/plug-in-menu-path.c	(original)
+++ trunk/app/plug-in/plug-in-menu-path.c	Wed Apr  9 11:48:01 2008
@@ -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 @@
 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 @@
           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 @@
                       menu_path, mapped_path);
 #endif
 
+          g_free (stripped_label);
+
           return mapped_path;
         }
     }
 
+  g_free (stripped_label);
+
   return g_strdup (menu_path);
 }

Modified: trunk/app/plug-in/plug-in-menu-path.h
==============================================================================
--- trunk/app/plug-in/plug-in-menu-path.h	(original)
+++ trunk/app/plug-in/plug-in-menu-path.h	Wed Apr  9 11:48:01 2008
@@ -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__ */

Modified: trunk/menus/image-menu.xml.in
==============================================================================
--- trunk/menus/image-menu.xml.in	(original)
+++ trunk/menus/image-menu.xml.in	Wed Apr  9 11:48:01 2008
@@ -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" />



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]