1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
#include "glib-object.h"
27
#include "plug-in-types.h"
29
#include "plug-in-menu-path.h"
32
typedef struct _MenuPathMapping MenuPathMapping;
34
struct _MenuPathMapping
36
const gchar *orig_path;
37
const gchar *mapped_path;
41
static const MenuPathMapping menu_path_mappings[] =
43
#ifndef ENABLE_TOOLBOX_MENU
44
{ "<Toolbox>/Xtns", "<Image>/Xtns" },
45
{ "<Toolbox>/Help", "<Image>/Help" }
46
#endif /* ENABLE_TOOLBOX_MENU */
51
plug_in_menu_path_map (const gchar *menu_path)
55
g_return_val_if_fail (menu_path != NULL, NULL);
57
for (i = 0; i < G_N_ELEMENTS (menu_path_mappings); i++)
59
const MenuPathMapping *mapping = &menu_path_mappings[i];
61
if (g_str_has_prefix (menu_path, mapping->orig_path))
63
gint orig_len = strlen (mapping->orig_path);
66
if (strlen (menu_path) > orig_len)
67
mapped_path = g_strconcat (mapping->mapped_path,
71
mapped_path = g_strdup (mapping->mapped_path);
74
g_printerr ("%s: mapped %s to %s\n", G_STRFUNC,
75
menu_path, mapped_path);
82
return g_strdup (menu_path);