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

« back to all changes in this revision

Viewing changes to app/widgets/gimpfiledialog.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
 * gimpfiledialog.c
33
33
#include "core/gimpimage.h"
34
34
#include "core/gimpprogress.h"
35
35
 
36
 
#include "config/gimpcoreconfig.h"
37
36
#include "config/gimpguiconfig.h"
38
37
 
39
38
#include "file/file-utils.h"
40
39
 
41
 
#include "plug-in/plug-in-proc-def.h"
42
 
#include "plug-in/plug-ins.h"
 
40
#include "pdb/gimppdb.h"
 
41
 
 
42
#include "plug-in/gimppluginmanager.h"
 
43
#include "plug-in/gimppluginprocedure.h"
43
44
 
44
45
#include "gimpfiledialog.h"
45
46
#include "gimpfileprocview.h"
46
47
#include "gimphelp-ids.h"
 
48
#include "gimpprogressbox.h"
47
49
#include "gimpview.h"
48
50
#include "gimpviewrendererimagefile.h"
49
51
#include "gimpthumbbox.h"
52
54
#include "gimp-intl.h"
53
55
 
54
56
 
55
 
static void  gimp_file_dialog_class_init            (GimpFileDialogClass   *klass);
56
 
static void  gimp_file_dialog_progress_iface_init   (GimpProgressInterface *progress_iface);
 
57
static void    gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface);
57
58
static gboolean gimp_file_dialog_delete_event       (GtkWidget        *widget,
58
59
                                                     GdkEventAny      *event);
59
60
static void     gimp_file_dialog_response           (GtkDialog        *dialog,
70
71
static void     gimp_file_dialog_progress_set_value (GimpProgress     *progress,
71
72
                                                     gdouble           percentage);
72
73
static gdouble  gimp_file_dialog_progress_get_value (GimpProgress     *progress);
 
74
static void     gimp_file_dialog_progress_pulse     (GimpProgress     *progress);
 
75
static guint32  gimp_file_dialog_progress_get_window(GimpProgress     *progress);
73
76
 
74
77
static void     gimp_file_dialog_add_preview        (GimpFileDialog   *dialog,
75
78
                                                     Gimp             *gimp);
98
101
static gchar  * gimp_file_dialog_pattern_from_extension (const gchar  *extension);
99
102
 
100
103
 
101
 
GType
102
 
gimp_file_dialog_get_type (void)
103
 
{
104
 
  static GType dialog_type = 0;
105
 
 
106
 
  if (! dialog_type)
107
 
    {
108
 
      static const GTypeInfo dialog_info =
109
 
      {
110
 
        sizeof (GimpFileDialogClass),
111
 
        (GBaseInitFunc) NULL,
112
 
        (GBaseFinalizeFunc) NULL,
113
 
        (GClassInitFunc) gimp_file_dialog_class_init,
114
 
        NULL,           /* class_finalize */
115
 
        NULL,           /* class_data     */
116
 
        sizeof (GimpFileDialog),
117
 
        0,              /* n_preallocs    */
118
 
        NULL,           /* instance_init  */
119
 
      };
120
 
 
121
 
      static const GInterfaceInfo progress_iface_info =
122
 
      {
123
 
        (GInterfaceInitFunc) gimp_file_dialog_progress_iface_init,
124
 
        NULL,           /* iface_finalize */
125
 
        NULL            /* iface_data     */
126
 
      };
127
 
 
128
 
      dialog_type = g_type_register_static (GTK_TYPE_FILE_CHOOSER_DIALOG,
129
 
                                            "GimpFileDialog",
130
 
                                            &dialog_info, 0);
131
 
 
132
 
      g_type_add_interface_static (dialog_type, GIMP_TYPE_PROGRESS,
133
 
                                   &progress_iface_info);
134
 
    }
135
 
 
136
 
  return dialog_type;
137
 
}
 
104
G_DEFINE_TYPE_WITH_CODE (GimpFileDialog, gimp_file_dialog,
 
105
                         GTK_TYPE_FILE_CHOOSER_DIALOG,
 
106
                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
 
107
                                                gimp_file_dialog_progress_iface_init))
 
108
 
 
109
#define parent_class gimp_file_dialog_parent_class
 
110
 
138
111
 
139
112
static void
140
113
gimp_file_dialog_class_init (GimpFileDialogClass *klass)
148
121
}
149
122
 
150
123
static void
151
 
gimp_file_dialog_progress_iface_init (GimpProgressInterface *progress_iface)
152
 
{
153
 
  progress_iface->start     = gimp_file_dialog_progress_start;
154
 
  progress_iface->end       = gimp_file_dialog_progress_end;
155
 
  progress_iface->is_active = gimp_file_dialog_progress_is_active;
156
 
  progress_iface->set_text  = gimp_file_dialog_progress_set_text;
157
 
  progress_iface->set_value = gimp_file_dialog_progress_set_value;
158
 
  progress_iface->get_value = gimp_file_dialog_progress_get_value;
 
124
gimp_file_dialog_init (GimpFileDialog *dialog)
 
125
{
 
126
}
 
127
 
 
128
static void
 
129
gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface)
 
130
{
 
131
  iface->start      = gimp_file_dialog_progress_start;
 
132
  iface->end        = gimp_file_dialog_progress_end;
 
133
  iface->is_active  = gimp_file_dialog_progress_is_active;
 
134
  iface->set_text   = gimp_file_dialog_progress_set_text;
 
135
  iface->set_value  = gimp_file_dialog_progress_set_value;
 
136
  iface->get_value  = gimp_file_dialog_progress_get_value;
 
137
  iface->pulse      = gimp_file_dialog_progress_pulse;
 
138
  iface->get_window = gimp_file_dialog_progress_get_window;
159
139
}
160
140
 
161
141
static gboolean
175
155
    {
176
156
      file_dialog->canceled = TRUE;
177
157
 
178
 
      if (file_dialog->progress_active && file_dialog->progress_cancelable)
179
 
        gimp_progress_cancel (GIMP_PROGRESS (dialog));
 
158
      if (GIMP_PROGRESS_BOX (file_dialog->progress)->active &&
 
159
          GIMP_PROGRESS_BOX (file_dialog->progress)->cancelable)
 
160
        {
 
161
          gimp_progress_cancel (GIMP_PROGRESS (dialog));
 
162
        }
180
163
    }
181
164
}
182
165
 
186
169
                                 gboolean      cancelable)
187
170
{
188
171
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
189
 
 
190
 
  if (! dialog->progress_active)
191
 
    {
192
 
      GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress);
193
 
 
194
 
      gtk_progress_bar_set_text (bar, message);
195
 
      gtk_progress_bar_set_fraction (bar, 0.0);
196
 
 
197
 
      gtk_widget_show (dialog->progress);
198
 
 
199
 
      dialog->progress_active     = TRUE;
200
 
      dialog->progress_cancelable = cancelable;
201
 
 
202
 
      return progress;
203
 
    }
204
 
 
205
 
  return NULL;
 
172
  GimpProgress   *retval;
 
173
 
 
174
  retval = gimp_progress_start (GIMP_PROGRESS (dialog->progress),
 
175
                                message, cancelable);
 
176
  gtk_widget_show (dialog->progress);
 
177
 
 
178
  return retval;
206
179
}
207
180
 
208
181
static void
210
183
{
211
184
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
212
185
 
213
 
  if (dialog->progress_active)
214
 
    {
215
 
      GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress);
216
 
 
217
 
      gtk_progress_bar_set_text (bar, "");
218
 
      gtk_progress_bar_set_fraction (bar, 0.0);
219
 
 
220
 
      gtk_widget_hide (dialog->progress);
221
 
 
222
 
      dialog->progress_active     = FALSE;
223
 
      dialog->progress_cancelable = FALSE;
224
 
    }
 
186
  gimp_progress_end (GIMP_PROGRESS (dialog->progress));
 
187
  gtk_widget_hide (dialog->progress);
225
188
}
226
189
 
227
190
static gboolean
229
192
{
230
193
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
231
194
 
232
 
  return dialog->progress_active;
 
195
  return gimp_progress_is_active (GIMP_PROGRESS (dialog->progress));
233
196
}
234
197
 
235
198
static void
238
201
{
239
202
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
240
203
 
241
 
  if (dialog->progress_active)
242
 
    {
243
 
      GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress);
244
 
 
245
 
      gtk_progress_bar_set_text (bar, message);
246
 
    }
 
204
  gimp_progress_set_text (GIMP_PROGRESS (dialog->progress), message);
247
205
}
248
206
 
249
207
static void
252
210
{
253
211
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
254
212
 
255
 
  if (dialog->progress_active)
256
 
    {
257
 
      GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress);
258
 
 
259
 
      gtk_progress_bar_set_fraction (bar, percentage);
260
 
    }
 
213
  gimp_progress_set_value (GIMP_PROGRESS (dialog->progress), percentage);
261
214
}
262
215
 
263
216
static gdouble
265
218
{
266
219
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
267
220
 
268
 
  if (dialog->progress_active)
269
 
    {
270
 
      GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress);
271
 
 
272
 
      return gtk_progress_bar_get_fraction (bar);
273
 
    }
274
 
 
275
 
  return 0.0;
 
221
  return gimp_progress_get_value (GIMP_PROGRESS (dialog->progress));
 
222
}
 
223
 
 
224
static void
 
225
gimp_file_dialog_progress_pulse (GimpProgress *progress)
 
226
{
 
227
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
 
228
 
 
229
  gimp_progress_pulse (GIMP_PROGRESS (dialog->progress));
 
230
}
 
231
 
 
232
static guint32
 
233
gimp_file_dialog_progress_get_window (GimpProgress *progress)
 
234
{
 
235
  GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
 
236
 
 
237
  return (guint32) gimp_window_get_native (GTK_WINDOW (dialog));
276
238
}
277
239
 
278
240
 
290
252
  GSList         *file_procs;
291
253
  const gchar    *automatic;
292
254
  const gchar    *automatic_help_id;
 
255
  gboolean        local_only;
293
256
 
294
257
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
295
258
  g_return_val_if_fail (title != NULL, NULL);
300
263
  switch (action)
301
264
    {
302
265
    case GTK_FILE_CHOOSER_ACTION_OPEN:
303
 
      file_procs = gimp->load_procs;
 
266
      file_procs = gimp->plug_in_manager->load_procs;
304
267
      automatic  = _("Automatically Detected");
305
268
      automatic_help_id = GIMP_HELP_FILE_OPEN_BY_EXTENSION;
 
269
 
 
270
      /* FIXME */
 
271
      local_only = (gimp_pdb_lookup_procedure (gimp->pdb,
 
272
                                               "file-uri-load") == NULL);
306
273
      break;
307
274
 
308
275
    case GTK_FILE_CHOOSER_ACTION_SAVE:
309
 
      file_procs = gimp->save_procs;
 
276
      file_procs = gimp->plug_in_manager->save_procs;
310
277
      automatic  = _("By Extension");
311
278
      automatic_help_id = GIMP_HELP_FILE_SAVE_BY_EXTENSION;
 
279
 
 
280
      /* FIXME */
 
281
      local_only = (gimp_pdb_lookup_procedure (gimp->pdb,
 
282
                                               "file-uri-save") == NULL);
312
283
      break;
313
284
 
314
285
    default:
317
288
    }
318
289
 
319
290
  dialog = g_object_new (GIMP_TYPE_FILE_DIALOG,
320
 
                         "title",  title,
321
 
                         "role",   role,
322
 
                         "action", action,
 
291
                         "title",                     title,
 
292
                         "role",                      role,
 
293
                         "action",                    action,
 
294
                         "local-only",                local_only,
 
295
                         "do-overwrite-confirmation", TRUE,
323
296
                         NULL);
324
297
 
325
298
  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
328
301
                          NULL);
329
302
 
330
303
  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
304
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
305
                                           GTK_RESPONSE_OK,
 
306
                                           GTK_RESPONSE_CANCEL,
 
307
                                           -1);
331
308
 
332
309
  gimp_help_connect (GTK_WIDGET (dialog),
333
310
                     gimp_file_dialog_help_func, help_id, dialog);
349
326
      g_signal_connect (button, "clicked",
350
327
                        G_CALLBACK (gimp_file_dialog_help_clicked),
351
328
                        dialog);
 
329
 
 
330
      g_object_set_data (G_OBJECT (dialog), "gimp-dialog-help-button", button);
352
331
    }
353
332
 
354
333
  gimp_file_dialog_add_preview (dialog, gimp);
358
337
  gimp_file_dialog_add_proc_selection (dialog, gimp, file_procs, automatic,
359
338
                                       automatic_help_id);
360
339
 
361
 
  dialog->progress = gtk_progress_bar_new ();
 
340
  dialog->progress = gimp_progress_box_new ();
362
341
  gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), dialog->progress,
363
342
                    FALSE, FALSE, 0);
364
343
 
369
348
gimp_file_dialog_set_sensitive (GimpFileDialog *dialog,
370
349
                                gboolean        sensitive)
371
350
{
 
351
  GList *children;
 
352
  GList *list;
 
353
 
372
354
  g_return_if_fail (GIMP_IS_FILE_DIALOG (dialog));
373
355
 
374
 
  gimp_dialog_set_sensitive (GTK_DIALOG (dialog), sensitive);
 
356
  children =
 
357
    gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox));
 
358
 
 
359
  for (list = children; list; list = g_list_next (list))
 
360
    {
 
361
      /*  skip the last item (the action area) */
 
362
      if (! g_list_next (list))
 
363
        break;
 
364
 
 
365
      gtk_widget_set_sensitive (list->data, sensitive);
 
366
    }
 
367
 
 
368
  g_list_free (children);
 
369
 
 
370
  if (sensitive)
 
371
    gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
 
372
                                       GTK_RESPONSE_CANCEL, sensitive);
 
373
 
 
374
  gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
 
375
                                     GTK_RESPONSE_OK, sensitive);
375
376
 
376
377
  dialog->busy     = ! sensitive;
377
378
  dialog->canceled = FALSE;
378
379
}
379
380
 
380
381
void
381
 
gimp_file_dialog_set_file_proc (GimpFileDialog *dialog,
382
 
                                PlugInProcDef  *file_proc)
 
382
gimp_file_dialog_set_file_proc (GimpFileDialog      *dialog,
 
383
                                GimpPlugInProcedure *file_proc)
383
384
{
384
385
  g_return_if_fail (GIMP_IS_FILE_DIALOG (dialog));
385
386
 
390
391
 
391
392
void
392
393
gimp_file_dialog_set_image (GimpFileDialog *dialog,
393
 
                            GimpImage      *gimage,
394
 
                            gboolean        save_a_copy)
 
394
                            GimpImage      *image,
 
395
                            gboolean        save_a_copy,
 
396
                            gboolean        close_after_saving)
395
397
{
396
398
  const gchar *uri = NULL;
397
399
  gchar       *dirname;
398
400
  gchar       *basename;
399
401
 
400
402
  g_return_if_fail (GIMP_IS_FILE_DIALOG (dialog));
401
 
  g_return_if_fail (GIMP_IS_IMAGE (gimage));
 
403
  g_return_if_fail (GIMP_IS_IMAGE (image));
402
404
 
403
 
  dialog->gimage      = gimage;
404
 
  dialog->save_a_copy = save_a_copy;
 
405
  dialog->image              = image;
 
406
  dialog->save_a_copy        = save_a_copy;
 
407
  dialog->close_after_saving = close_after_saving;
405
408
 
406
409
  if (save_a_copy)
407
 
    uri = g_object_get_data (G_OBJECT (gimage), "gimp-image-save-a-copy");
 
410
    uri = g_object_get_data (G_OBJECT (image), "gimp-image-save-a-copy");
408
411
 
409
412
  if (! uri)
410
 
    uri = gimp_image_get_uri (gimage);
 
413
    uri = gimp_image_get_uri (image);
411
414
 
412
415
  gimp_file_dialog_set_file_proc (dialog, NULL);
413
416
 
 
417
#ifndef G_OS_WIN32
414
418
  dirname  = g_path_get_dirname (uri);
415
 
  basename = file_utils_uri_to_utf8_basename (uri);
 
419
#else
 
420
  /* g_path_get_dirname() is supposed to work on pathnames, not URIs.
 
421
   *
 
422
   * If uri points to a file on the root of a drive
 
423
   * "file:///d:/foo.png", g_path_get_dirname() would return
 
424
   * "file:///d:". (What we really would want is "file:///d:/".) When
 
425
   * this then is passed inside gtk+ to g_filename_from_uri() we get
 
426
   * "d:" which is not an absolute pathname. This currently causes an
 
427
   * assertion failure in gtk+. This scenario occurs if we have opened
 
428
   * an image from the root of a drive and then do Save As.
 
429
   *
 
430
   * Of course, gtk+ shouldn't assert even if we feed it slighly bogus
 
431
   * data, and that problem should be fixed, too. But to get the
 
432
   * correct default current folder in the filechooser combo box, we
 
433
   * need to pass it the proper URI for an absolute path anyway. So
 
434
   * don't use g_path_get_dirname() on file: URIs.
 
435
   */
 
436
  if (g_str_has_prefix (uri, "file:///"))
 
437
    {
 
438
      gchar *filepath = g_filename_from_uri (uri, NULL, NULL);
 
439
      gchar *dirpath  = NULL;
 
440
 
 
441
      if (filepath != NULL)
 
442
        {
 
443
          dirpath = g_path_get_dirname (filepath);
 
444
          g_free (filepath);
 
445
        }
 
446
 
 
447
      if (dirpath != NULL)
 
448
        {
 
449
          dirname = g_filename_to_uri (dirpath, NULL, NULL);
 
450
          g_free (dirpath);
 
451
        }
 
452
      else
 
453
        {
 
454
          dirname = NULL;
 
455
        }
 
456
    }
 
457
  else
 
458
    {
 
459
      dirname = g_path_get_dirname (uri);
 
460
    }
 
461
#endif
 
462
 
 
463
  basename = file_utils_uri_display_basename (uri);
416
464
 
417
465
  if (dirname && strlen (dirname) && strcmp (dirname, "."))
418
 
    gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog),
419
 
                                             dirname);
 
466
    {
 
467
      gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog),
 
468
                                               dirname);
 
469
    }
 
470
  else if (g_object_get_data (G_OBJECT (image), "gimp-image-dirname"))
 
471
    {
 
472
      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
 
473
                                           g_object_get_data (G_OBJECT (image),
 
474
                                                              "gimp-image-dirname"));
 
475
    }
 
476
 
420
477
 
421
478
  gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename);
422
479
 
443
500
                    G_CALLBACK (gimp_file_dialog_update_preview),
444
501
                    dialog);
445
502
 
446
 
  dialog->thumb_box = gimp_thumb_box_new (gimp);
 
503
  dialog->thumb_box = gimp_thumb_box_new (gimp_get_user_context (gimp));
447
504
  gtk_widget_set_sensitive (GTK_WIDGET (dialog->thumb_box), FALSE);
448
505
  gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog),
449
506
                                       dialog->thumb_box);
459
516
                              Gimp           *gimp,
460
517
                              GSList         *file_procs)
461
518
{
462
 
  GtkFileFilter *filter;
 
519
  GtkFileFilter *all;
463
520
  GSList        *list;
464
521
 
465
 
  filter = gtk_file_filter_new ();
466
 
  gtk_file_filter_set_name (filter, _("All Files"));
467
 
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
468
 
  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
469
 
  gtk_file_filter_add_pattern (filter, "*");
 
522
  all = gtk_file_filter_new ();
 
523
  gtk_file_filter_set_name (all, _("All files"));
 
524
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), all);
 
525
  gtk_file_filter_add_pattern (all, "*");
 
526
 
 
527
  all = gtk_file_filter_new ();
 
528
  gtk_file_filter_set_name (all, _("All images"));
 
529
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), all);
470
530
 
471
531
  for (list = file_procs; list; list = g_slist_next (list))
472
532
    {
473
 
      PlugInProcDef *file_proc = list->data;
 
533
      GimpPlugInProcedure *file_proc = list->data;
474
534
 
475
535
      if (file_proc->extensions_list)
476
536
        {
477
 
          const gchar *domain;
478
 
          gchar       *label;
479
 
          GString     *str;
480
 
          GSList      *ext;
481
 
          gint         i;
482
 
 
483
 
          domain = plug_ins_locale_domain (gimp, file_proc->prog, NULL);
484
 
 
485
 
          label = plug_in_proc_def_get_label (file_proc, domain);
486
 
 
487
 
          str = g_string_new (label);
488
 
          g_free (label);
489
 
 
490
 
          filter = gtk_file_filter_new ();
 
537
          GtkFileFilter *filter = gtk_file_filter_new ();
 
538
          GString       *str;
 
539
          GSList        *ext;
 
540
          gint           i;
 
541
 
 
542
          str = g_string_new (gimp_plug_in_procedure_get_label (file_proc));
491
543
 
492
544
/*  an arbitrary limit to keep the file dialog from becoming too wide  */
493
545
#define MAX_EXTENSIONS  4
501
553
 
502
554
              pattern = gimp_file_dialog_pattern_from_extension (extension);
503
555
              gtk_file_filter_add_pattern (filter, pattern);
 
556
              gtk_file_filter_add_pattern (all, pattern);
504
557
              g_free (pattern);
505
558
 
506
559
              if (i == 0)
534
587
          gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
535
588
        }
536
589
    }
 
590
 
 
591
  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), all);
537
592
}
538
593
 
539
594
static void
584
639
gimp_file_dialog_update_preview (GtkFileChooser *chooser,
585
640
                                 GimpFileDialog *dialog)
586
641
{
587
 
  gchar *uri = gtk_file_chooser_get_preview_uri (chooser);
588
 
 
589
 
  gimp_thumb_box_set_uri (GIMP_THUMB_BOX (dialog->thumb_box), uri);
590
 
 
591
 
  g_free (uri);
 
642
  gimp_thumb_box_take_uri (GIMP_THUMB_BOX (dialog->thumb_box),
 
643
                           gtk_file_chooser_get_preview_uri (chooser));
592
644
}
593
645
 
594
646
static void
612
664
 
613
665
  if (gtk_file_chooser_get_action (chooser) == GTK_FILE_CHOOSER_ACTION_SAVE)
614
666
    {
615
 
      PlugInProcDef *proc = dialog->file_proc;
 
667
      GimpPlugInProcedure *proc = dialog->file_proc;
616
668
 
617
669
      if (proc && proc->extensions_list)
618
670
        {
668
720
 
669
721
                  gtk_file_chooser_set_uri (chooser, s->str);
670
722
 
671
 
                  basename = file_utils_uri_to_utf8_basename (s->str);
 
723
                  basename = file_utils_uri_display_basename (s->str);
672
724
                  gtk_file_chooser_set_current_name (chooser, basename);
673
725
                  g_free (basename);
674
726