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

« back to all changes in this revision

Viewing changes to libgimpwidgets/gimpcolordisplay.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:
22
22
 
23
23
#include "config.h"
24
24
 
 
25
#include <string.h>
 
26
 
25
27
#include <gtk/gtk.h>
26
28
 
 
29
#include "libgimpbase/gimpbase.h"
27
30
#include "libgimpcolor/gimpcolor.h"
 
31
#include "libgimpconfig/gimpconfig.h"
28
32
 
29
33
#include "gimpwidgetstypes.h"
30
34
 
31
35
#include "gimpcolordisplay.h"
 
36
#include "gimpstock.h"
32
37
 
33
38
 
34
39
enum
44
49
};
45
50
 
46
51
 
47
 
static void   gimp_color_display_class_init   (GimpColorDisplayClass *klass);
48
 
static void   gimp_color_display_set_property (GObject           *object,
49
 
                                               guint              property_id,
50
 
                                               const GValue      *value,
51
 
                                               GParamSpec        *pspec);
52
 
static void   gimp_color_display_get_property (GObject           *object,
53
 
                                               guint              property_id,
54
 
                                               GValue            *value,
55
 
                                               GParamSpec        *pspec);
56
 
 
57
 
 
58
 
static GObjectClass *parent_class = NULL;
59
 
 
60
 
static guint  display_signals[LAST_SIGNAL] = { 0 };
61
 
 
62
 
 
63
 
GType
64
 
gimp_color_display_get_type (void)
65
 
{
66
 
  static GType display_type = 0;
67
 
 
68
 
  if (! display_type)
69
 
    {
70
 
      static const GTypeInfo display_info =
71
 
      {
72
 
        sizeof (GimpColorDisplayClass),
73
 
        (GBaseInitFunc) NULL,
74
 
        (GBaseFinalizeFunc) NULL,
75
 
        (GClassInitFunc) gimp_color_display_class_init,
76
 
        NULL,           /* class_finalize */
77
 
        NULL,           /* class_data     */
78
 
        sizeof (GimpColorDisplay),
79
 
        0,              /* n_preallocs    */
80
 
        NULL            /* instance_init  */
81
 
      };
82
 
 
83
 
      display_type = g_type_register_static (G_TYPE_OBJECT,
84
 
                                             "GimpColorDisplay",
85
 
                                             &display_info, 0);
86
 
    }
87
 
 
88
 
  return display_type;
89
 
}
 
52
static void   gimp_color_display_set_property (GObject      *object,
 
53
                                               guint         property_id,
 
54
                                               const GValue *value,
 
55
                                               GParamSpec   *pspec);
 
56
static void   gimp_color_display_get_property (GObject      *object,
 
57
                                               guint         property_id,
 
58
                                               GValue       *value,
 
59
                                               GParamSpec   *pspec);
 
60
 
 
61
 
 
62
G_DEFINE_TYPE_WITH_CODE (GimpColorDisplay, gimp_color_display, G_TYPE_OBJECT,
 
63
                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
64
 
 
65
#define parent_class gimp_color_display_parent_class
 
66
 
 
67
static guint display_signals[LAST_SIGNAL] = { 0 };
 
68
 
90
69
 
91
70
static void
92
71
gimp_color_display_class_init (GimpColorDisplayClass *klass)
93
72
{
94
73
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
95
74
 
96
 
  parent_class = g_type_class_peek_parent (klass);
97
 
 
98
75
  object_class->set_property = gimp_color_display_set_property;
99
76
  object_class->get_property = gimp_color_display_get_property;
100
77
 
101
78
  g_object_class_install_property (object_class, PROP_ENABLED,
102
79
                                   g_param_spec_boolean ("enabled", NULL, NULL,
103
80
                                                         TRUE,
104
 
                                                         G_PARAM_READWRITE |
 
81
                                                         GIMP_PARAM_READWRITE |
105
82
                                                         G_PARAM_CONSTRUCT));
106
83
 
107
84
  display_signals[CHANGED] =
115
92
 
116
93
  klass->name            = "Unnamed";
117
94
  klass->help_id         = NULL;
 
95
  klass->stock_id        = GIMP_STOCK_DISPLAY_FILTER;
118
96
 
119
97
  klass->clone           = NULL;
120
98
  klass->convert         = NULL;
126
104
}
127
105
 
128
106
static void
 
107
gimp_color_display_init (GimpColorDisplay *display)
 
108
{
 
109
}
 
110
 
 
111
static void
129
112
gimp_color_display_set_property (GObject      *object,
130
113
                                 guint         property_id,
131
114
                                 const GValue *value,
181
164
{
182
165
  g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
183
166
 
 
167
  /*  implementing the clone method is deprecated
 
168
   */
184
169
  if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->clone)
185
170
    {
186
171
      GimpColorDisplay *clone = NULL;
193
178
      return clone;
194
179
    }
195
180
 
196
 
  return NULL;
 
181
  return GIMP_COLOR_DISPLAY (gimp_config_duplicate (GIMP_CONFIG (display)));
197
182
}
198
183
 
199
184
void
219
204
  g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
220
205
  g_return_if_fail (state != NULL);
221
206
 
 
207
  /*  implementing the load_state method is deprecated
 
208
   */
222
209
  if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->load_state)
223
 
    GIMP_COLOR_DISPLAY_GET_CLASS (display)->load_state (display, state);
 
210
    {
 
211
      GIMP_COLOR_DISPLAY_GET_CLASS (display)->load_state (display, state);
 
212
    }
 
213
  else
 
214
    {
 
215
      gimp_config_deserialize_string (GIMP_CONFIG (display),
 
216
                                      gimp_parasite_data (state),
 
217
                                      gimp_parasite_data_size (state),
 
218
                                      NULL, NULL);
 
219
    }
224
220
}
225
221
 
226
222
GimpParasite *
227
223
gimp_color_display_save_state (GimpColorDisplay *display)
228
224
{
 
225
  GimpParasite *parasite;
 
226
  gchar        *str;
 
227
 
229
228
  g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
230
229
 
 
230
  /*  implementing the save_state method is deprecated
 
231
   */
231
232
  if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->save_state)
232
 
    return GIMP_COLOR_DISPLAY_GET_CLASS (display)->save_state (display);
233
 
 
234
 
  return NULL;
 
233
    {
 
234
      return GIMP_COLOR_DISPLAY_GET_CLASS (display)->save_state (display);
 
235
    }
 
236
 
 
237
  str = gimp_config_serialize_to_string (GIMP_CONFIG (display), NULL);
 
238
 
 
239
  parasite = gimp_parasite_new ("Display/Proof",
 
240
                                GIMP_PARASITE_PERSISTENT,
 
241
                                strlen (str) + 1, str);
 
242
  g_free (str);
 
243
 
 
244
  return parasite;
235
245
}
236
246
 
237
247
GtkWidget *
250
260
{
251
261
  g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
252
262
 
 
263
  /*  implementing the configure_reset method is deprecated
 
264
   */
253
265
  if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure_reset)
254
 
    GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure_reset (display);
 
266
    {
 
267
      GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure_reset (display);
 
268
    }
 
269
  else
 
270
    {
 
271
      gimp_config_reset (GIMP_CONFIG (display));
 
272
    }
255
273
}
256
274
 
257
275
void