~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to app/actions/vectors-commands.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an 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 <string.h>
 
22
 
 
23
#include <gtk/gtk.h>
 
24
 
 
25
#include "libgimpwidgets/gimpwidgets.h"
 
26
 
 
27
#include "actions-types.h"
 
28
 
 
29
#include "core/gimp.h"
 
30
#include "core/gimpchannel.h"
 
31
#include "core/gimpchannel-select.h"
 
32
#include "core/gimpcontainer.h"
 
33
#include "core/gimpcontext.h"
 
34
#include "core/gimpimage.h"
 
35
#include "core/gimpimage-merge.h"
 
36
#include "core/gimpimage-undo.h"
 
37
#include "core/gimpitemundo.h"
 
38
#include "core/gimpprogress.h"
 
39
#include "core/gimpstrokedesc.h"
 
40
#include "core/gimptoolinfo.h"
 
41
 
 
42
#include "pdb/procedural_db.h"
 
43
 
 
44
#include "plug-in/plug-in-run.h"
 
45
 
 
46
#include "vectors/gimpvectors.h"
 
47
#include "vectors/gimpvectors-export.h"
 
48
#include "vectors/gimpvectors-import.h"
 
49
 
 
50
#include "widgets/gimpaction.h"
 
51
#include "widgets/gimphelp-ids.h"
 
52
 
 
53
#include "display/gimpdisplay.h"
 
54
 
 
55
#include "tools/gimpvectortool.h"
 
56
#include "tools/tool_manager.h"
 
57
 
 
58
#include "dialogs/stroke-dialog.h"
 
59
#include "dialogs/vectors-export-dialog.h"
 
60
#include "dialogs/vectors-import-dialog.h"
 
61
#include "dialogs/vectors-options-dialog.h"
 
62
 
 
63
#include "actions.h"
 
64
#include "vectors-commands.h"
 
65
 
 
66
#include "gimp-intl.h"
 
67
 
 
68
 
 
69
/*  local function prototypes  */
 
70
 
 
71
static void   vectors_new_vectors_response  (GtkWidget            *widget,
 
72
                                             gint                  response_id,
 
73
                                             VectorsOptionsDialog *options);
 
74
static void   vectors_edit_vectors_response (GtkWidget            *widget,
 
75
                                             gint                  response_id,
 
76
                                             VectorsOptionsDialog *options);
 
77
static void   vectors_import_response       (GtkWidget            *widget,
 
78
                                             gint                  response_id,
 
79
                                             VectorsImportDialog  *dialog);
 
80
static void   vectors_export_response       (GtkWidget            *widget,
 
81
                                             gint                  response_id,
 
82
                                             VectorsExportDialog  *dialog);
 
83
 
 
84
 
 
85
/*  private variables  */
 
86
 
 
87
static gchar    *vectors_name               = NULL;
 
88
static gboolean  vectors_import_merge       = FALSE;
 
89
static gboolean  vectors_import_scale       = FALSE;
 
90
static gboolean  vectors_export_active_only = TRUE;
 
91
 
 
92
 
 
93
/*  public functions  */
 
94
 
 
95
void
 
96
vectors_vectors_tool_cmd_callback (GtkAction *action,
 
97
                                   gpointer   data)
 
98
{
 
99
  GimpImage   *gimage;
 
100
  GimpVectors *vectors;
 
101
  GimpTool    *active_tool;
 
102
  return_if_no_vectors (gimage, vectors, data);
 
103
 
 
104
  active_tool = tool_manager_get_active (gimage->gimp);
 
105
 
 
106
  if (! GIMP_IS_VECTOR_TOOL (active_tool))
 
107
    {
 
108
      GimpToolInfo  *tool_info;
 
109
 
 
110
      tool_info = (GimpToolInfo *)
 
111
        gimp_container_get_child_by_name (gimage->gimp->tool_info_list,
 
112
                                          "gimp-vector-tool");
 
113
 
 
114
      if (GIMP_IS_TOOL_INFO (tool_info))
 
115
        {
 
116
          gimp_context_set_tool (action_data_get_context (data), tool_info);
 
117
          active_tool = tool_manager_get_active (gimage->gimp);
 
118
        }
 
119
    }
 
120
 
 
121
  if (GIMP_IS_VECTOR_TOOL (active_tool))
 
122
    gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), vectors);
 
123
}
 
124
 
 
125
void
 
126
vectors_edit_attributes_cmd_callback (GtkAction *action,
 
127
                                      gpointer   data)
 
128
{
 
129
  VectorsOptionsDialog *options;
 
130
  GimpImage            *gimage;
 
131
  GimpVectors          *vectors;
 
132
  GtkWidget            *widget;
 
133
  return_if_no_vectors (gimage, vectors, data);
 
134
  return_if_no_widget (widget, data);
 
135
 
 
136
  options = vectors_options_dialog_new (gimage,
 
137
                                        vectors,
 
138
                                        widget,
 
139
                                        gimp_object_get_name (GIMP_OBJECT (vectors)),
 
140
                                        _("Path Attributes"),
 
141
                                        "gimp-vectors-edit",
 
142
                                        GIMP_STOCK_EDIT,
 
143
                                        _("Edit Path Attributes"),
 
144
                                        GIMP_HELP_PATH_EDIT);
 
145
 
 
146
  g_signal_connect (options->dialog, "response",
 
147
                    G_CALLBACK (vectors_edit_vectors_response),
 
148
                    options);
 
149
 
 
150
  gtk_widget_show (options->dialog);
 
151
}
 
152
 
 
153
void
 
154
vectors_new_cmd_callback (GtkAction *action,
 
155
                          gpointer   data)
 
156
{
 
157
  VectorsOptionsDialog *options;
 
158
  GimpImage            *gimage;
 
159
  GtkWidget            *widget;
 
160
  return_if_no_image (gimage, data);
 
161
  return_if_no_widget (widget, data);
 
162
 
 
163
  options = vectors_options_dialog_new (gimage,
 
164
                                        NULL,
 
165
                                        widget,
 
166
                                        vectors_name ? vectors_name :
 
167
                                        _("New Path"),
 
168
                                        _("New Path"),
 
169
                                        "gimp-vectors-new",
 
170
                                        GIMP_STOCK_PATH,
 
171
                                        _("New Path Options"),
 
172
                                        GIMP_HELP_PATH_NEW);
 
173
 
 
174
  g_signal_connect (options->dialog, "response",
 
175
                    G_CALLBACK (vectors_new_vectors_response),
 
176
                    options);
 
177
 
 
178
  gtk_widget_show (options->dialog);
 
179
}
 
180
 
 
181
void
 
182
vectors_new_last_vals_cmd_callback (GtkAction *action,
 
183
                                    gpointer   data)
 
184
{
 
185
  GimpImage   *gimage;
 
186
  GimpVectors *new_vectors;
 
187
  return_if_no_image (gimage, data);
 
188
 
 
189
  new_vectors = gimp_vectors_new (gimage,
 
190
                                  vectors_name ? vectors_name : _("New Path"));
 
191
 
 
192
  gimp_image_add_vectors (gimage, new_vectors, -1);
 
193
 
 
194
  gimp_image_flush (gimage);
 
195
}
 
196
 
 
197
void
 
198
vectors_raise_cmd_callback (GtkAction *action,
 
199
                            gpointer   data)
 
200
{
 
201
  GimpImage   *gimage;
 
202
  GimpVectors *vectors;
 
203
  return_if_no_vectors (gimage, vectors, data);
 
204
 
 
205
  gimp_image_raise_vectors (gimage, vectors);
 
206
  gimp_image_flush (gimage);
 
207
}
 
208
 
 
209
void
 
210
vectors_raise_to_top_cmd_callback (GtkAction *action,
 
211
                                   gpointer   data)
 
212
{
 
213
  GimpImage   *gimage;
 
214
  GimpVectors *vectors;
 
215
  return_if_no_vectors (gimage, vectors, data);
 
216
 
 
217
  gimp_image_raise_vectors_to_top (gimage, vectors);
 
218
  gimp_image_flush (gimage);
 
219
}
 
220
 
 
221
void
 
222
vectors_lower_cmd_callback (GtkAction *action,
 
223
                            gpointer   data)
 
224
{
 
225
  GimpImage   *gimage;
 
226
  GimpVectors *vectors;
 
227
  return_if_no_vectors (gimage, vectors, data);
 
228
 
 
229
  gimp_image_lower_vectors (gimage, vectors);
 
230
  gimp_image_flush (gimage);
 
231
}
 
232
 
 
233
void
 
234
vectors_lower_to_bottom_cmd_callback (GtkAction *action,
 
235
                                      gpointer   data)
 
236
{
 
237
  GimpImage   *gimage;
 
238
  GimpVectors *vectors;
 
239
  return_if_no_vectors (gimage, vectors, data);
 
240
 
 
241
  gimp_image_lower_vectors_to_bottom (gimage, vectors);
 
242
  gimp_image_flush (gimage);
 
243
}
 
244
 
 
245
void
 
246
vectors_duplicate_cmd_callback (GtkAction *action,
 
247
                                gpointer   data)
 
248
{
 
249
  GimpImage   *gimage;
 
250
  GimpVectors *vectors;
 
251
  GimpVectors *new_vectors;
 
252
  return_if_no_vectors (gimage, vectors, data);
 
253
 
 
254
  new_vectors =
 
255
    GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
 
256
                                       G_TYPE_FROM_INSTANCE (vectors),
 
257
                                       TRUE));
 
258
  gimp_image_add_vectors (gimage, new_vectors, -1);
 
259
  gimp_image_flush (gimage);
 
260
}
 
261
 
 
262
void
 
263
vectors_delete_cmd_callback (GtkAction *action,
 
264
                             gpointer   data)
 
265
{
 
266
  GimpImage   *gimage;
 
267
  GimpVectors *vectors;
 
268
  return_if_no_vectors (gimage, vectors, data);
 
269
 
 
270
  gimp_image_remove_vectors (gimage, vectors);
 
271
  gimp_image_flush (gimage);
 
272
}
 
273
 
 
274
void
 
275
vectors_merge_visible_cmd_callback (GtkAction *action,
 
276
                                    gpointer   data)
 
277
{
 
278
  GimpImage   *gimage;
 
279
  GimpVectors *vectors;
 
280
  return_if_no_vectors (gimage, vectors, data);
 
281
 
 
282
  gimp_image_merge_visible_vectors (gimage);
 
283
  gimp_image_flush (gimage);
 
284
}
 
285
 
 
286
void
 
287
vectors_to_selection_cmd_callback (GtkAction *action,
 
288
                                   gint       value,
 
289
                                   gpointer   data)
 
290
{
 
291
  GimpChannelOps  op;
 
292
  GimpImage      *gimage;
 
293
  GimpVectors    *vectors;
 
294
  return_if_no_vectors (gimage, vectors, data);
 
295
 
 
296
  op = (GimpChannelOps) value;
 
297
 
 
298
  gimp_channel_select_vectors (gimp_image_get_mask (gimage),
 
299
                               _("Path to Selection"),
 
300
                               vectors,
 
301
                               op, TRUE, FALSE, 0, 0);
 
302
  gimp_image_flush (gimage);
 
303
}
 
304
 
 
305
void
 
306
vectors_selection_to_vectors_cmd_callback (GtkAction *action,
 
307
                                           gint       value,
 
308
                                           gpointer   data)
 
309
{
 
310
  GimpImage   *gimage;
 
311
  ProcRecord  *proc_rec;
 
312
  Argument    *args;
 
313
  GimpDisplay *gdisp;
 
314
  return_if_no_image (gimage, data);
 
315
 
 
316
  if (value)
 
317
    proc_rec = procedural_db_lookup (gimage->gimp,
 
318
                                     "plug_in_sel2path_advanced");
 
319
  else
 
320
    proc_rec = procedural_db_lookup (gimage->gimp,
 
321
                                     "plug_in_sel2path");
 
322
 
 
323
  if (! proc_rec)
 
324
    {
 
325
      g_message ("Selection to path procedure lookup failed.");
 
326
      return;
 
327
    }
 
328
 
 
329
  gdisp = gimp_context_get_display (action_data_get_context (data));
 
330
 
 
331
  /*  plug-in arguments as if called by <Image>/Filters/...  */
 
332
  args = g_new (Argument, 3);
 
333
 
 
334
  args[0].arg_type      = GIMP_PDB_INT32;
 
335
  args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
 
336
  args[1].arg_type      = GIMP_PDB_IMAGE;
 
337
  args[1].value.pdb_int = (gint32) gimp_image_get_ID (gimage);
 
338
  args[2].arg_type      = GIMP_PDB_DRAWABLE;
 
339
  args[2].value.pdb_int = -1;  /*  unused  */
 
340
 
 
341
  plug_in_run (gimage->gimp, action_data_get_context (data),
 
342
               gdisp ? GIMP_PROGRESS (gdisp) : NULL,
 
343
               proc_rec, args, 3, FALSE, TRUE,
 
344
               gdisp ? gimp_display_get_ID (gdisp) : 0);
 
345
 
 
346
  g_free (args);
 
347
}
 
348
 
 
349
void
 
350
vectors_stroke_cmd_callback (GtkAction *action,
 
351
                             gpointer   data)
 
352
{
 
353
  GimpImage    *gimage;
 
354
  GimpVectors  *vectors;
 
355
  GimpDrawable *drawable;
 
356
  GtkWidget    *widget;
 
357
  GtkWidget    *dialog;
 
358
  return_if_no_vectors (gimage, vectors, data);
 
359
  return_if_no_widget (widget, data);
 
360
 
 
361
  drawable = gimp_image_active_drawable (gimage);
 
362
 
 
363
  if (! drawable)
 
364
    {
 
365
      g_message (_("There is no active layer or channel to stroke to."));
 
366
      return;
 
367
    }
 
368
 
 
369
  dialog = stroke_dialog_new (GIMP_ITEM (vectors),
 
370
                              _("Stroke Path"),
 
371
                              GIMP_STOCK_PATH_STROKE,
 
372
                              GIMP_HELP_PATH_STROKE,
 
373
                              widget);
 
374
  gtk_widget_show (dialog);
 
375
}
 
376
 
 
377
void
 
378
vectors_stroke_last_vals_cmd_callback (GtkAction *action,
 
379
                                       gpointer   data)
 
380
{
 
381
  GimpImage      *image;
 
382
  GimpVectors    *vectors;
 
383
  GimpDrawable   *drawable;
 
384
  GimpContext    *context;
 
385
  GimpStrokeDesc *desc;
 
386
  return_if_no_vectors (image, vectors, data);
 
387
 
 
388
  drawable = gimp_image_active_drawable (image);
 
389
 
 
390
  if (! drawable)
 
391
    {
 
392
      g_message (_("There is no active layer or channel to stroke to."));
 
393
      return;
 
394
    }
 
395
 
 
396
  context = gimp_get_user_context (image->gimp);
 
397
 
 
398
  desc = g_object_get_data (G_OBJECT (context), "saved-stroke-desc");
 
399
 
 
400
  if (desc)
 
401
    g_object_ref (desc);
 
402
  else
 
403
    desc = gimp_stroke_desc_new (image->gimp, context);
 
404
 
 
405
  gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, desc, FALSE);
 
406
 
 
407
  g_object_unref (desc);
 
408
 
 
409
  gimp_image_flush (image);
 
410
}
 
411
 
 
412
void
 
413
vectors_copy_cmd_callback (GtkAction *action,
 
414
                           gpointer   data)
 
415
{
 
416
  GimpImage   *gimage;
 
417
  GimpVectors *vectors;
 
418
  return_if_no_vectors (gimage, vectors, data);
 
419
 
 
420
#ifdef __GNUC__
 
421
#warning FIXME: need vectors clipboard
 
422
#endif
 
423
}
 
424
 
 
425
void
 
426
vectors_paste_cmd_callback (GtkAction *action,
 
427
                            gpointer   data)
 
428
{
 
429
  GimpImage *gimage;
 
430
  return_if_no_image (gimage, data);
 
431
 
 
432
#ifdef __GNUC__
 
433
#warning FIXME: need vectors clipboard
 
434
#endif
 
435
}
 
436
 
 
437
void
 
438
vectors_import_cmd_callback (GtkAction *action,
 
439
                             gpointer   data)
 
440
{
 
441
  VectorsImportDialog *dialog;
 
442
  GimpImage           *gimage;
 
443
  GtkWidget           *widget;
 
444
  return_if_no_image (gimage, data);
 
445
  return_if_no_widget (widget, data);
 
446
 
 
447
  dialog = vectors_import_dialog_new (gimage, widget,
 
448
                                      vectors_import_merge,
 
449
                                      vectors_import_scale);
 
450
 
 
451
  g_signal_connect (dialog->dialog, "response",
 
452
                    G_CALLBACK (vectors_import_response),
 
453
                    dialog);
 
454
 
 
455
  gtk_widget_show (dialog->dialog);
 
456
}
 
457
 
 
458
void
 
459
vectors_export_cmd_callback (GtkAction *action,
 
460
                             gpointer   data)
 
461
{
 
462
  VectorsExportDialog *dialog;
 
463
  GimpImage           *gimage;
 
464
  GimpVectors         *vectors;
 
465
  GtkWidget           *widget;
 
466
  return_if_no_vectors (gimage, vectors, data);
 
467
  return_if_no_widget (widget, data);
 
468
 
 
469
  dialog = vectors_export_dialog_new (gimage, widget,
 
470
                                      vectors_export_active_only);
 
471
 
 
472
  g_signal_connect (dialog->dialog, "response",
 
473
                    G_CALLBACK (vectors_export_response),
 
474
                    dialog);
 
475
 
 
476
  gtk_widget_show (dialog->dialog);
 
477
}
 
478
 
 
479
void
 
480
vectors_visible_cmd_callback (GtkAction *action,
 
481
                              gpointer   data)
 
482
{
 
483
  GimpImage   *gimage;
 
484
  GimpVectors *vectors;
 
485
  gboolean     visible;
 
486
  return_if_no_vectors (gimage, vectors, data);
 
487
 
 
488
  visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
 
489
 
 
490
  if (visible != gimp_item_get_visible (GIMP_ITEM (vectors)))
 
491
    {
 
492
      GimpUndo *undo;
 
493
      gboolean  push_undo = TRUE;
 
494
 
 
495
      undo = gimp_image_undo_can_compress (gimage, GIMP_TYPE_ITEM_UNDO,
 
496
                                           GIMP_UNDO_ITEM_VISIBILITY);
 
497
 
 
498
      if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (vectors))
 
499
        push_undo = FALSE;
 
500
 
 
501
      gimp_item_set_visible (GIMP_ITEM (vectors), visible, push_undo);
 
502
      gimp_image_flush (gimage);
 
503
    }
 
504
}
 
505
 
 
506
void
 
507
vectors_linked_cmd_callback (GtkAction *action,
 
508
                             gpointer   data)
 
509
{
 
510
  GimpImage   *gimage;
 
511
  GimpVectors *vectors;
 
512
  gboolean     linked;
 
513
  return_if_no_vectors (gimage, vectors, data);
 
514
 
 
515
  linked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
 
516
 
 
517
  if (linked != gimp_item_get_linked (GIMP_ITEM (vectors)))
 
518
    {
 
519
      GimpUndo *undo;
 
520
      gboolean  push_undo = TRUE;
 
521
 
 
522
      undo = gimp_image_undo_can_compress (gimage, GIMP_TYPE_ITEM_UNDO,
 
523
                                           GIMP_UNDO_ITEM_LINKED);
 
524
 
 
525
      if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (vectors))
 
526
        push_undo = FALSE;
 
527
 
 
528
      gimp_item_set_linked (GIMP_ITEM (vectors), linked, push_undo);
 
529
      gimp_image_flush (gimage);
 
530
    }
 
531
}
 
532
 
 
533
 
 
534
/*  private functions  */
 
535
 
 
536
static void
 
537
vectors_new_vectors_response (GtkWidget            *widget,
 
538
                              gint                  response_id,
 
539
                              VectorsOptionsDialog *options)
 
540
{
 
541
  if (response_id == GTK_RESPONSE_OK)
 
542
    {
 
543
      GimpVectors *new_vectors;
 
544
 
 
545
      if (vectors_name)
 
546
        g_free (vectors_name);
 
547
 
 
548
      vectors_name =
 
549
        g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
 
550
 
 
551
      new_vectors = gimp_vectors_new (options->gimage, vectors_name);
 
552
 
 
553
      gimp_image_add_vectors (options->gimage, new_vectors, -1);
 
554
 
 
555
      gimp_image_flush (options->gimage);
 
556
    }
 
557
 
 
558
  gtk_widget_destroy (options->dialog);
 
559
}
 
560
 
 
561
static void
 
562
vectors_edit_vectors_response (GtkWidget            *widget,
 
563
                               gint                  response_id,
 
564
                               VectorsOptionsDialog *options)
 
565
{
 
566
  if (response_id == GTK_RESPONSE_OK)
 
567
    {
 
568
      GimpVectors *vectors = options->vectors;
 
569
      const gchar *new_name;
 
570
 
 
571
      new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
 
572
 
 
573
      if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (vectors))))
 
574
        {
 
575
          gimp_item_rename (GIMP_ITEM (vectors), new_name);
 
576
          gimp_image_flush (options->gimage);
 
577
        }
 
578
    }
 
579
 
 
580
  gtk_widget_destroy (options->dialog);
 
581
}
 
582
 
 
583
static void
 
584
vectors_import_response (GtkWidget           *widget,
 
585
                         gint                 response_id,
 
586
                         VectorsImportDialog *dialog)
 
587
{
 
588
  if (response_id == GTK_RESPONSE_OK)
 
589
    {
 
590
      gchar  *filename;
 
591
      GError *error = NULL;
 
592
 
 
593
      vectors_import_merge = dialog->merge_vectors;
 
594
      vectors_import_scale = dialog->scale_vectors;
 
595
 
 
596
      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
 
597
 
 
598
      if (gimp_vectors_import_file (dialog->image, filename,
 
599
                                    vectors_import_merge, vectors_import_scale,
 
600
                                    -1, &error))
 
601
        {
 
602
          gimp_image_flush (dialog->image);
 
603
        }
 
604
      else
 
605
        {
 
606
          g_message (error->message);
 
607
          g_error_free (error);
 
608
        }
 
609
 
 
610
      g_free (filename);
 
611
    }
 
612
 
 
613
  gtk_widget_destroy (widget);
 
614
}
 
615
 
 
616
static void
 
617
vectors_export_response (GtkWidget           *widget,
 
618
                         gint                 response_id,
 
619
                         VectorsExportDialog *dialog)
 
620
{
 
621
  if (response_id == GTK_RESPONSE_OK)
 
622
    {
 
623
      GimpVectors *vectors = NULL;
 
624
      gchar       *filename;
 
625
      GError      *error   = NULL;
 
626
 
 
627
      vectors_export_active_only = dialog->active_only;
 
628
 
 
629
      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
 
630
 
 
631
      if (vectors_export_active_only)
 
632
        vectors = gimp_image_get_active_vectors (dialog->image);
 
633
 
 
634
      if (! gimp_vectors_export_file (dialog->image, vectors, filename, &error))
 
635
        {
 
636
          g_message (error->message);
 
637
          g_error_free (error);
 
638
        }
 
639
 
 
640
      g_free (filename);
 
641
    }
 
642
 
 
643
  gtk_widget_destroy (widget);
 
644
}