~ubuntu-branches/ubuntu/gutsy/gimp/gutsy

« back to all changes in this revision

Viewing changes to app/plug-in/plug-in-menu-path.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-09-30 18:06:49 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20070930180649-f647f0cxj32tgyn3
Tags: 2.4.0~rc3-1ubuntu1
* Resynchronized with Debian.
* Remaining Ubuntu changes:
  - 02_help-message.patch, 03_gimp.desktop.in.in.patch: Distro changes.
  - Weave i18n magic in the rules file.
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - 10_dont_show_wizard.patch: Unused, upstream doesn't call it anymore.
  - Use dh_icons.
* Disabled the print plugin, and removed the Conflicts/Replaces on
  gimp-print.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * plug-in-menu-path.c
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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.
 
19
 */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
#include <string.h>
 
24
 
 
25
#include "glib-object.h"
 
26
 
 
27
#include "plug-in-types.h"
 
28
 
 
29
#include "plug-in-menu-path.h"
 
30
 
 
31
 
 
32
typedef struct _MenuPathMapping MenuPathMapping;
 
33
 
 
34
struct _MenuPathMapping
 
35
{
 
36
  const gchar *orig_path;
 
37
  const gchar *mapped_path;
 
38
};
 
39
 
 
40
 
 
41
static const MenuPathMapping menu_path_mappings[] =
 
42
{
 
43
#ifndef ENABLE_TOOLBOX_MENU
 
44
  { "<Toolbox>/Xtns", "<Image>/Xtns" },
 
45
  { "<Toolbox>/Help", "<Image>/Help" }
 
46
#endif /* ENABLE_TOOLBOX_MENU */
 
47
};
 
48
 
 
49
 
 
50
gchar *
 
51
plug_in_menu_path_map (const gchar *menu_path)
 
52
{
 
53
  gint i;
 
54
 
 
55
  g_return_val_if_fail (menu_path != NULL, NULL);
 
56
 
 
57
  for (i = 0; i < G_N_ELEMENTS (menu_path_mappings); i++)
 
58
    {
 
59
      const MenuPathMapping *mapping = &menu_path_mappings[i];
 
60
 
 
61
      if (g_str_has_prefix (menu_path, mapping->orig_path))
 
62
        {
 
63
          gint   orig_len = strlen (mapping->orig_path);
 
64
          gchar *mapped_path;
 
65
 
 
66
          if (strlen (menu_path) > orig_len)
 
67
            mapped_path = g_strconcat (mapping->mapped_path,
 
68
                                       menu_path + orig_len,
 
69
                                       NULL);
 
70
          else
 
71
            mapped_path = g_strdup (mapping->mapped_path);
 
72
 
 
73
#if 0
 
74
          g_printerr ("%s: mapped %s to %s\n", G_STRFUNC,
 
75
                      menu_path, mapped_path);
 
76
#endif
 
77
 
 
78
          return mapped_path;
 
79
        }
 
80
    }
 
81
 
 
82
  return g_strdup (menu_path);
 
83
}