~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/help/locales.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
2
 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
 
 *
4
 
 * The GIMP Help plug-in
5
 
 * Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
6
 
 *                         Michael Natterer <mitch@gimp.org>
7
 
 *                         Henrik Brix Andersen <brix@gimp.org>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License as published by
11
 
 * the Free Software Foundation; either version 2 of the License, or
12
 
 * (at your option) any later version.
13
 
 *
14
 
 * This program is distributed in the hope that it will be useful,
15
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 * GNU General Public License for more details.
18
 
 *
19
 
 * You should have received a copy of the GNU General Public License
20
 
 * along with this program; if not, write to the Free Software
21
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
 
 */
23
 
 
24
 
#include "config.h"
25
 
 
26
 
#include <string.h>
27
 
 
28
 
#include <glib.h>
29
 
 
30
 
#include "help.h"
31
 
#include "locales.h"
32
 
 
33
 
 
34
 
GList *
35
 
locales_parse (const gchar *help_locales)
36
 
{
37
 
  GList        *locales = NULL;
38
 
  GList        *list;
39
 
  const gchar  *s;
40
 
  const gchar  *p;
41
 
 
42
 
  g_return_val_if_fail (help_locales != NULL, NULL);
43
 
 
44
 
  /*  split the string at colons, building a list  */
45
 
  s = help_locales;
46
 
  for (p = strchr (s, ':'); p; p = strchr (s, ':'))
47
 
    {
48
 
      gchar *new = g_strndup (s, p - s);
49
 
 
50
 
      locales = g_list_append (locales, new);
51
 
      s = p + 1;
52
 
    }
53
 
 
54
 
  if (*s)
55
 
    locales = g_list_append (locales, g_strdup (s));
56
 
 
57
 
  /*  add locales w/o variants unless they exist already */
58
 
  for (list = locales; list; list = list->next)
59
 
    {
60
 
      s = (const gchar *) list->data;
61
 
      p = strchr (s, '_');
62
 
 
63
 
      if (p)
64
 
        {
65
 
          GList *iter;
66
 
          gchar *new = g_strndup (s, p - s);
67
 
 
68
 
          for (iter = locales; iter; iter = iter->next)
69
 
            if (strcmp ((const gchar *) iter->data, new) == 0)
70
 
              break;
71
 
 
72
 
          if (iter)
73
 
            g_free (new);
74
 
          else
75
 
            locales = g_list_append (locales, new);
76
 
        }
77
 
    }
78
 
 
79
 
  /*  if the list doesn't contain the default domain yet, append it  */
80
 
  for (list = locales; list; list = list->next)
81
 
    if (strcmp ((const gchar *) list->data, GIMP_HELP_DEFAULT_LOCALE) == 0)
82
 
      break;
83
 
 
84
 
  if (! list)
85
 
    locales = g_list_append (locales, g_strdup (GIMP_HELP_DEFAULT_LOCALE));
86
 
 
87
 
#ifdef GIMP_HELP_DEBUG
88
 
  g_printerr ("help: locales: ");
89
 
  for (list = locales; list; list = list->next)
90
 
    g_printerr ("%s ", (const gchar *) list->data);
91
 
  g_printerr ("\n");
92
 
#endif
93
 
 
94
 
  return locales;
95
 
}