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

« back to all changes in this revision

Viewing changes to app/core/gimppaintinfo.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
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
28
28
#include "gimppaintinfo.h"
29
29
 
30
30
 
31
 
static void    gimp_paint_info_class_init      (GimpPaintInfoClass *klass);
32
 
static void    gimp_paint_info_init            (GimpPaintInfo      *paint_info);
33
 
 
34
 
static void    gimp_paint_info_finalize        (GObject            *object);
35
 
static gchar * gimp_paint_info_get_description (GimpViewable       *viewable,
36
 
                                                gchar             **tooltip);
37
 
 
38
 
 
39
 
static GimpViewableClass *parent_class = NULL;
40
 
 
41
 
 
42
 
GType
43
 
gimp_paint_info_get_type (void)
44
 
{
45
 
  static GType paint_info_type = 0;
46
 
 
47
 
  if (! paint_info_type)
48
 
    {
49
 
      static const GTypeInfo paint_info_info =
50
 
        {
51
 
          sizeof (GimpPaintInfoClass),
52
 
          (GBaseInitFunc) NULL,
53
 
          (GBaseFinalizeFunc) NULL,
54
 
          (GClassInitFunc) gimp_paint_info_class_init,
55
 
          NULL,         /* class_finalize */
56
 
          NULL,         /* class_data     */
57
 
          sizeof (GimpPaintInfo),
58
 
          0,              /* n_preallocs    */
59
 
          (GInstanceInitFunc) gimp_paint_info_init,
60
 
        };
61
 
 
62
 
      paint_info_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
63
 
                                                "GimpPaintInfo",
64
 
                                                &paint_info_info, 0);
65
 
    }
66
 
 
67
 
  return paint_info_type;
68
 
}
 
31
static void    gimp_paint_info_finalize        (GObject       *object);
 
32
static gchar * gimp_paint_info_get_description (GimpViewable  *viewable,
 
33
                                                gchar        **tooltip);
 
34
 
 
35
 
 
36
G_DEFINE_TYPE (GimpPaintInfo, gimp_paint_info, GIMP_TYPE_VIEWABLE)
 
37
 
 
38
#define parent_class gimp_paint_info_parent_class
 
39
 
69
40
 
70
41
static void
71
42
gimp_paint_info_class_init (GimpPaintInfoClass *klass)
72
43
{
73
 
  GObjectClass      *object_class;
74
 
  GimpViewableClass *viewable_class;
75
 
 
76
 
  object_class   = G_OBJECT_CLASS (klass);
77
 
  viewable_class = GIMP_VIEWABLE_CLASS (klass);
78
 
 
79
 
  parent_class = g_type_class_peek_parent (klass);
 
44
  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
 
45
  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
80
46
 
81
47
  object_class->finalize          = gimp_paint_info_finalize;
82
48
 
95
61
static void
96
62
gimp_paint_info_finalize (GObject *object)
97
63
{
98
 
  GimpPaintInfo *paint_info;
99
 
 
100
 
  paint_info = GIMP_PAINT_INFO (object);
 
64
  GimpPaintInfo *paint_info = GIMP_PAINT_INFO (object);
101
65
 
102
66
  if (paint_info->blurb)
103
67
    {
120
84
{
121
85
  GimpPaintInfo *paint_info = GIMP_PAINT_INFO (viewable);
122
86
 
123
 
  if (tooltip)
124
 
    *tooltip = NULL;
125
 
 
126
87
  return g_strdup (paint_info->blurb);
127
88
}
128
89
 
130
91
gimp_paint_info_new (Gimp        *gimp,
131
92
                     GType        paint_type,
132
93
                     GType        paint_options_type,
133
 
                     const gchar *blurb)
 
94
                     const gchar *identifier,
 
95
                     const gchar *blurb,
 
96
                     const gchar *stock_id)
134
97
{
135
98
  GimpPaintInfo *paint_info;
136
99
 
137
100
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
101
  g_return_val_if_fail (identifier != NULL, NULL);
138
102
  g_return_val_if_fail (blurb != NULL, NULL);
 
103
  g_return_val_if_fail (stock_id != NULL, NULL);
139
104
 
140
105
  paint_info = g_object_new (GIMP_TYPE_PAINT_INFO,
141
 
                             "name", g_type_name (paint_type),
 
106
                             "name",     identifier,
 
107
                             "stock-id", stock_id,
142
108
                             NULL);
143
109
 
144
110
  paint_info->gimp               = gimp;
150
116
 
151
117
  return paint_info;
152
118
}
 
119
 
 
120
void
 
121
gimp_paint_info_set_standard (Gimp          *gimp,
 
122
                              GimpPaintInfo *paint_info)
 
123
{
 
124
  g_return_if_fail (GIMP_IS_GIMP (gimp));
 
125
  g_return_if_fail (! paint_info || GIMP_IS_PAINT_INFO (paint_info));
 
126
 
 
127
  if (paint_info != gimp->standard_paint_info)
 
128
    {
 
129
      if (gimp->standard_paint_info)
 
130
        g_object_unref (gimp->standard_paint_info);
 
131
 
 
132
      gimp->standard_paint_info = paint_info;
 
133
 
 
134
      if (gimp->standard_paint_info)
 
135
        g_object_ref (gimp->standard_paint_info);
 
136
    }
 
137
}
 
138
 
 
139
GimpPaintInfo *
 
140
gimp_paint_info_get_standard (Gimp *gimp)
 
141
{
 
142
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
143
 
 
144
  return gimp->standard_paint_info;
 
145
}