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

« back to all changes in this revision

Viewing changes to app/dialogs/stroke-dialog.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
 * Copyright (C) 2003  Henrik Brix Andersen <brix@gimp.org>
22
22
 
23
23
#include <gtk/gtk.h>
24
24
 
 
25
#include "libgimpconfig/gimpconfig.h"
25
26
#include "libgimpwidgets/gimpwidgets.h"
26
27
 
27
28
#include "dialogs-types.h"
28
29
 
29
 
#include "config/gimpconfig.h"
30
 
#include "config/gimpconfig-utils.h"
31
 
 
32
30
#include "core/gimp.h"
33
31
#include "core/gimpdrawable.h"
34
32
#include "core/gimpimage.h"
39
37
 
40
38
#include "widgets/gimpcontainercombobox.h"
41
39
#include "widgets/gimpcontainerview.h"
42
 
#include "widgets/gimppropwidgets.h"
43
40
#include "widgets/gimpviewabledialog.h"
44
41
#include "widgets/gimpstrokeeditor.h"
45
42
 
66
63
 
67
64
GtkWidget *
68
65
stroke_dialog_new (GimpItem    *item,
 
66
                   GimpContext *context,
69
67
                   const gchar *title,
70
68
                   const gchar *stock_id,
71
69
                   const gchar *help_id,
72
70
                   GtkWidget   *parent)
73
71
{
74
 
  GimpContext    *context;
75
72
  GimpStrokeDesc *desc;
76
73
  GimpStrokeDesc *saved_desc;
77
74
  GimpImage      *image;
84
81
  GtkWidget      *frame;
85
82
 
86
83
  g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
 
84
  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
87
85
  g_return_val_if_fail (stock_id != NULL, NULL);
88
86
  g_return_val_if_fail (help_id != NULL, NULL);
89
87
  g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
90
88
 
91
 
  image   = gimp_item_get_image (item);
92
 
  context = gimp_get_user_context (image->gimp);
 
89
  image = gimp_item_get_image (item);
93
90
 
94
91
  desc = gimp_stroke_desc_new (context->gimp, context);
95
92
 
96
 
  saved_desc = g_object_get_data (G_OBJECT (context), "saved-stroke-desc");
 
93
  saved_desc = g_object_get_data (G_OBJECT (context->gimp),
 
94
                                  "saved-stroke-desc");
97
95
 
98
96
  if (saved_desc)
99
 
    gimp_config_sync (GIMP_CONFIG (saved_desc), GIMP_CONFIG (desc), 0);
 
97
    gimp_config_sync (G_OBJECT (saved_desc), G_OBJECT (desc), 0);
100
98
 
101
 
  dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item),
 
99
  dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item), context,
102
100
                                     title, "gimp-stroke-options",
103
101
                                     stock_id,
104
102
                                     _("Choose Stroke Style"),
112
110
 
113
111
                                     NULL);
114
112
 
 
113
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
114
                                           RESPONSE_RESET,
 
115
                                           GTK_RESPONSE_OK,
 
116
                                           GTK_RESPONSE_CANCEL,
 
117
                                           -1);
 
118
 
115
119
  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
116
120
 
117
121
  g_signal_connect (dialog, "response",
138
142
  paint_radio = g_object_ref (group->data);
139
143
  gtk_container_remove (GTK_CONTAINER (radio_box), paint_radio);
140
144
 
141
 
  gtk_object_sink (GTK_OBJECT (radio_box));
 
145
  g_object_ref_sink (radio_box);
 
146
  g_object_unref (radio_box);
142
147
 
143
148
  {
144
149
    PangoFontDescription *font_desc;
206
211
                              desc->method == GIMP_STROKE_METHOD_PAINT_CORE);
207
212
    g_object_set_data (G_OBJECT (paint_radio), "set_sensitive", hbox);
208
213
 
209
 
    label = gtk_label_new (_("Paint Tool:"));
 
214
    label = gtk_label_new (_("Paint tool:"));
210
215
    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
211
216
    gtk_widget_show (label);
212
217
 
213
 
    combo = gimp_container_combo_box_new (image->gimp->paint_info_list, NULL,
 
218
    combo = gimp_container_combo_box_new (image->gimp->paint_info_list,
 
219
                                          context,
214
220
                                          16, 0);
215
221
    gimp_container_view_select_item (GIMP_CONTAINER_VIEW (combo),
216
222
                                     GIMP_VIEWABLE (desc->paint_info));
217
223
    gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
218
224
    gtk_widget_show (combo);
219
225
 
220
 
    g_signal_connect (combo, "select_item",
 
226
    g_signal_connect (combo, "select-item",
221
227
                      G_CALLBACK (stroke_dialog_paint_info_selected),
222
228
                      desc);
223
229
 
245
251
  desc = g_object_get_data (G_OBJECT (dialog), "gimp-stroke-desc");
246
252
 
247
253
  image   = gimp_item_get_image (item);
248
 
  context = gimp_get_user_context (image->gimp);
 
254
  context = GIMP_VIEWABLE_DIALOG (dialog)->context;
249
255
 
250
256
  switch (response_id)
251
257
    {
272
278
 
273
279
        if (! drawable)
274
280
          {
275
 
            g_message (_("There is no active layer or channel to stroke to."));
 
281
            gimp_message (context->gimp, G_OBJECT (widget),
 
282
                          GIMP_MESSAGE_WARNING,
 
283
                          _("There is no active layer or channel "
 
284
                            "to stroke to."));
276
285
            return;
277
286
          }
278
287
 
279
 
        saved_desc = g_object_get_data (G_OBJECT (context),
 
288
        saved_desc = g_object_get_data (G_OBJECT (context->gimp),
280
289
                                        "saved-stroke-desc");
281
290
 
282
291
        if (saved_desc)
284
293
        else
285
294
          saved_desc = gimp_stroke_desc_new (context->gimp, context);
286
295
 
287
 
        gimp_config_sync (GIMP_CONFIG (desc), GIMP_CONFIG (saved_desc), 0);
 
296
        gimp_config_sync (G_OBJECT (desc), G_OBJECT (saved_desc), 0);
288
297
 
289
 
        g_object_set_data_full (G_OBJECT (context), "saved-stroke-desc",
 
298
        g_object_set_data_full (G_OBJECT (context->gimp), "saved-stroke-desc",
290
299
                                saved_desc,
291
300
                                (GDestroyNotify) g_object_unref);
292
301