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

« back to all changes in this revision

Viewing changes to app/widgets/gimpimageeditor.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
30
30
#include "gimpuimanager.h"
31
31
 
32
32
 
33
 
static void   gimp_image_editor_class_init (GimpImageEditorClass *klass);
34
 
static void   gimp_image_editor_init       (GimpImageEditor      *editor);
35
 
static void   gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface);
 
33
static void   gimp_image_editor_docked_iface_init (GimpDockedInterface *iface);
36
34
 
37
35
static void   gimp_image_editor_set_context    (GimpDocked       *docked,
38
36
                                                GimpContext      *context);
39
37
static void   gimp_image_editor_destroy        (GtkObject        *object);
40
38
static void   gimp_image_editor_real_set_image (GimpImageEditor  *editor,
41
 
                                                GimpImage        *gimage);
42
 
static void   gimp_image_editor_image_flush    (GimpImage        *gimage,
 
39
                                                GimpImage        *image);
 
40
static void   gimp_image_editor_image_flush    (GimpImage        *image,
43
41
                                                GimpImageEditor  *editor);
44
42
 
45
43
 
46
 
static GimpEditorClass *parent_class = NULL;
47
 
 
48
 
 
49
 
GType
50
 
gimp_image_editor_get_type (void)
51
 
{
52
 
  static GType type = 0;
53
 
 
54
 
  if (! type)
55
 
    {
56
 
      static const GTypeInfo editor_info =
57
 
      {
58
 
        sizeof (GimpImageEditorClass),
59
 
        (GBaseInitFunc) NULL,
60
 
        (GBaseFinalizeFunc) NULL,
61
 
        (GClassInitFunc) gimp_image_editor_class_init,
62
 
        NULL,           /* class_finalize */
63
 
        NULL,           /* class_data     */
64
 
        sizeof (GimpImageEditor),
65
 
        0,              /* n_preallocs    */
66
 
        (GInstanceInitFunc) gimp_image_editor_init,
67
 
      };
68
 
      static const GInterfaceInfo docked_iface_info =
69
 
      {
70
 
        (GInterfaceInitFunc) gimp_image_editor_docked_iface_init,
71
 
        NULL,           /* iface_finalize */
72
 
        NULL            /* iface_data     */
73
 
      };
74
 
 
75
 
      type = g_type_register_static (GIMP_TYPE_EDITOR,
76
 
                                     "GimpImageEditor",
77
 
                                     &editor_info, 0);
78
 
 
79
 
      g_type_add_interface_static (type, GIMP_TYPE_DOCKED,
80
 
                                   &docked_iface_info);
81
 
    }
82
 
 
83
 
  return type;
84
 
}
 
44
G_DEFINE_TYPE_WITH_CODE (GimpImageEditor, gimp_image_editor, GIMP_TYPE_EDITOR,
 
45
                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
 
46
                                                gimp_image_editor_docked_iface_init))
 
47
 
 
48
#define parent_class gimp_image_editor_parent_class
 
49
 
85
50
 
86
51
static void
87
52
gimp_image_editor_class_init (GimpImageEditorClass *klass)
88
53
{
89
54
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
90
55
 
91
 
  parent_class = g_type_class_peek_parent (klass);
92
 
 
93
56
  object_class->destroy = gimp_image_editor_destroy;
94
57
 
95
58
  klass->set_image      = gimp_image_editor_real_set_image;
98
61
static void
99
62
gimp_image_editor_init (GimpImageEditor *editor)
100
63
{
101
 
  editor->gimage = NULL;
 
64
  editor->image = NULL;
102
65
 
103
66
  gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
104
67
}
105
68
 
106
69
static void
107
 
gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface)
 
70
gimp_image_editor_docked_iface_init (GimpDockedInterface *iface)
108
71
{
109
 
  docked_iface->set_context = gimp_image_editor_set_context;
 
72
  iface->set_context = gimp_image_editor_set_context;
110
73
}
111
74
 
112
75
static void
125
88
 
126
89
  if (context)
127
90
    {
128
 
      g_signal_connect_swapped (context, "image_changed",
 
91
      g_signal_connect_swapped (context, "image-changed",
129
92
                                G_CALLBACK (gimp_image_editor_set_image),
130
93
                                editor);
131
94
 
140
103
{
141
104
  GimpImageEditor *editor = GIMP_IMAGE_EDITOR (object);
142
105
 
143
 
  if (editor->gimage)
 
106
  if (editor->image)
144
107
    gimp_image_editor_set_image (editor, NULL);
145
108
 
146
109
  GTK_OBJECT_CLASS (parent_class)->destroy (object);
148
111
 
149
112
static void
150
113
gimp_image_editor_real_set_image (GimpImageEditor *editor,
151
 
                                  GimpImage       *gimage)
 
114
                                  GimpImage       *image)
152
115
{
153
 
  if (editor->gimage)
154
 
    g_signal_handlers_disconnect_by_func (editor->gimage,
 
116
  if (editor->image)
 
117
    g_signal_handlers_disconnect_by_func (editor->image,
155
118
                                          gimp_image_editor_image_flush,
156
119
                                          editor);
157
120
 
158
 
  editor->gimage = gimage;
 
121
  editor->image = image;
159
122
 
160
 
  if (editor->gimage)
161
 
    g_signal_connect (editor->gimage, "flush",
 
123
  if (editor->image)
 
124
    g_signal_connect (editor->image, "flush",
162
125
                      G_CALLBACK (gimp_image_editor_image_flush),
163
126
                      editor);
164
127
 
165
 
  gtk_widget_set_sensitive (GTK_WIDGET (editor), gimage != NULL);
 
128
  gtk_widget_set_sensitive (GTK_WIDGET (editor), image != NULL);
166
129
}
167
130
 
168
131
 
170
133
 
171
134
void
172
135
gimp_image_editor_set_image (GimpImageEditor *editor,
173
 
                             GimpImage       *gimage)
 
136
                             GimpImage       *image)
174
137
{
175
138
  g_return_if_fail (GIMP_IS_IMAGE_EDITOR (editor));
176
 
  g_return_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage));
 
139
  g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
177
140
 
178
 
  if (gimage != editor->gimage)
 
141
  if (image != editor->image)
179
142
    {
180
 
      GIMP_IMAGE_EDITOR_GET_CLASS (editor)->set_image (editor, gimage);
 
143
      GIMP_IMAGE_EDITOR_GET_CLASS (editor)->set_image (editor, image);
181
144
 
182
145
      if (GIMP_EDITOR (editor)->ui_manager)
183
146
        gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
185
148
    }
186
149
}
187
150
 
 
151
GimpImage *
 
152
gimp_image_editor_get_image (GimpImageEditor *editor)
 
153
{
 
154
  g_return_val_if_fail (GIMP_IS_IMAGE_EDITOR (editor), NULL);
 
155
 
 
156
  return editor->image;
 
157
}
 
158
 
188
159
 
189
160
/*  private functions  */
190
161
 
191
162
static void
192
 
gimp_image_editor_image_flush (GimpImage       *gimage,
 
163
gimp_image_editor_image_flush (GimpImage       *image,
193
164
                               GimpImageEditor *editor)
194
165
{
195
166
  if (GIMP_EDITOR (editor)->ui_manager)