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

« back to all changes in this revision

Viewing changes to app/tools/gimpforegroundselecttoolundo.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
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <gtk/gtk.h>
 
22
 
 
23
#include "tools-types.h"
 
24
 
 
25
#include "gimpforegroundselecttool.h"
 
26
#include "gimpforegroundselecttoolundo.h"
 
27
 
 
28
 
 
29
enum
 
30
{
 
31
  PROP_0,
 
32
  PROP_FOREGROUND_SELECT_TOOL
 
33
};
 
34
 
 
35
 
 
36
static GObject * gimp_foreground_select_tool_undo_constructor  (GType                  type,
 
37
                                                                guint                  n_params,
 
38
                                                                GObjectConstructParam *params);
 
39
static void      gimp_foreground_select_tool_undo_set_property (GObject               *object,
 
40
                                                                guint                  property_id,
 
41
                                                                const GValue          *value,
 
42
                                                                GParamSpec            *pspec);
 
43
static void      gimp_foreground_select_tool_undo_get_property (GObject               *object,
 
44
                                                                guint                  property_id,
 
45
                                                                GValue                *value,
 
46
                                                                GParamSpec            *pspec);
 
47
 
 
48
static void      gimp_foreground_select_tool_undo_pop          (GimpUndo              *undo,
 
49
                                                                GimpUndoMode           undo_mode,
 
50
                                                                GimpUndoAccumulator   *accum);
 
51
static void      gimp_foreground_select_tool_undo_free         (GimpUndo              *undo,
 
52
                                                                GimpUndoMode           undo_mode);
 
53
 
 
54
 
 
55
G_DEFINE_TYPE (GimpForegroundSelectToolUndo, gimp_foreground_select_tool_undo,
 
56
               GIMP_TYPE_UNDO)
 
57
 
 
58
#define parent_class gimp_foreground_select_tool_undo_parent_class
 
59
 
 
60
 
 
61
static void
 
62
gimp_foreground_select_tool_undo_class_init (GimpForegroundSelectToolUndoClass *klass)
 
63
{
 
64
  GObjectClass  *object_class = G_OBJECT_CLASS (klass);
 
65
  GimpUndoClass *undo_class   = GIMP_UNDO_CLASS (klass);
 
66
 
 
67
  object_class->constructor  = gimp_foreground_select_tool_undo_constructor;
 
68
  object_class->set_property = gimp_foreground_select_tool_undo_set_property;
 
69
  object_class->get_property = gimp_foreground_select_tool_undo_get_property;
 
70
 
 
71
  undo_class->pop            = gimp_foreground_select_tool_undo_pop;
 
72
  undo_class->free           = gimp_foreground_select_tool_undo_free;
 
73
 
 
74
  g_object_class_install_property (object_class, PROP_FOREGROUND_SELECT_TOOL,
 
75
                                   g_param_spec_object ("foreground-select-tool",
 
76
                                                        NULL, NULL,
 
77
                                                        GIMP_TYPE_FOREGROUND_SELECT_TOOL,
 
78
                                                        GIMP_PARAM_READWRITE |
 
79
                                                        G_PARAM_CONSTRUCT_ONLY));
 
80
}
 
81
 
 
82
static void
 
83
gimp_foreground_select_tool_undo_init (GimpForegroundSelectToolUndo *undo)
 
84
{
 
85
}
 
86
 
 
87
static GObject *
 
88
gimp_foreground_select_tool_undo_constructor (GType                  type,
 
89
                                              guint                  n_params,
 
90
                                              GObjectConstructParam *params)
 
91
{
 
92
  GObject                      *object;
 
93
  GimpForegroundSelectToolUndo *foreground_select_tool_undo;
 
94
  GimpForegroundSelectTool     *foreground_select_tool;
 
95
 
 
96
  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
 
97
 
 
98
  foreground_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (object);
 
99
 
 
100
  g_assert (GIMP_IS_FOREGROUND_SELECT_TOOL (foreground_select_tool_undo->foreground_select_tool));
 
101
 
 
102
  foreground_select_tool = GIMP_FOREGROUND_SELECT_TOOL (foreground_select_tool_undo->foreground_select_tool);
 
103
 
 
104
  g_object_add_weak_pointer (G_OBJECT (foreground_select_tool_undo->foreground_select_tool),
 
105
                             (gpointer) &foreground_select_tool_undo->foreground_select_tool);
 
106
 
 
107
  return object;
 
108
}
 
109
 
 
110
static void
 
111
gimp_foreground_select_tool_undo_set_property (GObject      *object,
 
112
                                               guint         property_id,
 
113
                                               const GValue *value,
 
114
                                               GParamSpec   *pspec)
 
115
{
 
116
  GimpForegroundSelectToolUndo *foreground_select_tool_undo =
 
117
    GIMP_FOREGROUND_SELECT_TOOL_UNDO (object);
 
118
 
 
119
  switch (property_id)
 
120
    {
 
121
    case PROP_FOREGROUND_SELECT_TOOL:
 
122
      foreground_select_tool_undo->foreground_select_tool =
 
123
        g_value_get_object (value);
 
124
      break;
 
125
 
 
126
    default:
 
127
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
128
      break;
 
129
    }
 
130
}
 
131
 
 
132
static void
 
133
gimp_foreground_select_tool_undo_get_property (GObject    *object,
 
134
                                               guint       property_id,
 
135
                                               GValue     *value,
 
136
                                               GParamSpec *pspec)
 
137
{
 
138
  GimpForegroundSelectToolUndo *foreground_select_tool_undo =
 
139
    GIMP_FOREGROUND_SELECT_TOOL_UNDO (object);
 
140
 
 
141
  switch (property_id)
 
142
    {
 
143
    case PROP_FOREGROUND_SELECT_TOOL:
 
144
      g_value_set_object (value,
 
145
                          foreground_select_tool_undo->foreground_select_tool);
 
146
      break;
 
147
 
 
148
    default:
 
149
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
150
      break;
 
151
    }
 
152
}
 
153
 
 
154
static void
 
155
gimp_foreground_select_tool_undo_pop (GimpUndo              *undo,
 
156
                                      GimpUndoMode           undo_mode,
 
157
                                      GimpUndoAccumulator   *accum)
 
158
{
 
159
  GimpForegroundSelectToolUndo *foreground_select_tool_undo =
 
160
    GIMP_FOREGROUND_SELECT_TOOL_UNDO (undo);
 
161
 
 
162
  GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
 
163
 }
 
164
 
 
165
static void
 
166
gimp_foreground_select_tool_undo_free (GimpUndo     *undo,
 
167
                                       GimpUndoMode  undo_mode)
 
168
{
 
169
  GimpForegroundSelectToolUndo *foreground_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (undo);
 
170
 
 
171
  if (foreground_select_tool_undo->foreground_select_tool)
 
172
    {
 
173
      g_object_remove_weak_pointer (G_OBJECT (foreground_select_tool_undo->foreground_select_tool),
 
174
                                    (gpointer) &foreground_select_tool_undo->foreground_select_tool);
 
175
      foreground_select_tool_undo->foreground_select_tool = NULL;
 
176
    }
 
177
 
 
178
  GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
 
179
}