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

« back to all changes in this revision

Viewing changes to app/core/gimp-parasites.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
 
/* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
 
1
/* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@gimp.org>
2
2
 *
3
3
 * This program is free software; you can redistribute it and/or modify
4
4
 * it under the terms of the GNU General Public License as published by
20
20
#include <glib-object.h>
21
21
 
22
22
#include "libgimpbase/gimpbase.h"
 
23
#include "libgimpconfig/gimpconfig.h"
23
24
 
24
25
#include "core-types.h"
25
26
 
26
 
#include "config/gimpconfig.h"
27
 
#include "config/gimpconfig-error.h"
28
 
 
29
27
#include "gimp.h"
30
28
#include "gimp-parasites.h"
31
29
#include "gimpparasitelist.h"
32
30
 
33
31
 
34
32
void
35
 
gimp_parasite_attach (Gimp         *gimp,
36
 
                      GimpParasite *parasite)
 
33
gimp_parasite_attach (Gimp               *gimp,
 
34
                      const GimpParasite *parasite)
37
35
{
 
36
  g_return_if_fail (GIMP_IS_GIMP (gimp));
 
37
  g_return_if_fail (parasite != NULL);
 
38
 
38
39
  gimp_parasite_list_add (gimp->parasites, parasite);
39
40
}
40
41
 
41
42
void
42
43
gimp_parasite_detach (Gimp        *gimp,
43
 
                      const gchar *name)
 
44
                      const gchar *name)
44
45
{
 
46
  g_return_if_fail (GIMP_IS_GIMP (gimp));
 
47
  g_return_if_fail (name != NULL);
 
48
 
45
49
  gimp_parasite_list_remove (gimp->parasites, name);
46
50
}
47
51
 
48
 
GimpParasite *
 
52
const GimpParasite *
49
53
gimp_parasite_find (Gimp        *gimp,
50
 
                    const gchar *name)
 
54
                    const gchar *name)
51
55
{
 
56
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
57
  g_return_val_if_fail (name != NULL, NULL);
 
58
 
52
59
  return gimp_parasite_list_find (gimp->parasites, name);
53
60
}
54
61
 
55
62
static void
56
63
list_func (const gchar    *key,
57
 
           GimpParasite   *parasite,
58
 
           gchar        ***current)
 
64
           GimpParasite   *parasite,
 
65
           gchar        ***current)
59
66
{
60
67
  *(*current)++ = g_strdup (key);
61
68
}
62
69
 
63
70
gchar **
64
71
gimp_parasite_list (Gimp *gimp,
65
 
                    gint *count)
 
72
                    gint *count)
66
73
{
67
74
  gchar **list;
68
75
  gchar **current;
69
76
 
 
77
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
78
  g_return_val_if_fail (count != NULL, NULL);
 
79
 
70
80
  *count = gimp_parasite_list_length (gimp->parasites);
71
81
 
72
82
  list = current = g_new (gchar *, *count);
82
92
void
83
93
gimp_parasite_shift_parent (GimpParasite *parasite)
84
94
{
85
 
  if (parasite == NULL)
86
 
    return;
 
95
  g_return_if_fail (parasite != NULL);
87
96
 
88
97
  parasite->flags = (parasite->flags >> 8);
89
98
}
101
110
 
102
111
  filename = gimp_personal_rc_file ("parasiterc");
103
112
 
 
113
  if (gimp->be_verbose)
 
114
    g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
 
115
 
104
116
  if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->parasites),
105
 
                                      filename, NULL, &error))
 
117
                                      filename, NULL, &error))
106
118
    {
107
119
      if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
108
 
        g_message (error->message);
 
120
        gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message);
 
121
 
109
122
      g_error_free (error);
110
123
    }
111
124
 
118
131
  const gchar *header =
119
132
    "GIMP parasiterc\n"
120
133
    "\n"
121
 
    "This file will be entirely rewritten every time you quit the gimp.";
 
134
    "This file will be entirely rewritten each time you exit.";
122
135
  const gchar *footer =
123
136
    "end of parasiterc";
124
137
 
130
143
 
131
144
  filename = gimp_personal_rc_file ("parasiterc");
132
145
 
 
146
  if (gimp->be_verbose)
 
147
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
 
148
 
133
149
  if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->parasites),
134
 
                                       filename,
135
 
                                       header, footer, NULL,
136
 
                                       &error))
 
150
                                       filename,
 
151
                                       header, footer, NULL,
 
152
                                       &error))
137
153
    {
138
 
      g_message (error->message);
 
154
      gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message);
139
155
      g_error_free (error);
140
156
    }
141
157