~canonical-dx-team/ubuntu/maverick/gtk+2.0/menuproxy

« back to all changes in this revision

Viewing changes to gtk/gtkfilechooser.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-05-04 12:24:25 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20070504122425-0m8midgzrp40y8w2
Tags: 2.10.12-1ubuntu1
* Sync with Debian
* New upstream version:
  Fixed bugs:
  - 379414 file chooser warnings when changing path in the entry
  - 418585 GtkFileChooserDefault sizing code is not DPI independent
  - 419568 Crash in search if start with special letter
  - 435062 build dies with icon cache validation
  - 379399 Segfault to call gtk_print_operation_run twice.
  - 387889 cups backend has problems when there are too many printers
  - 418531 invalid read to gtkicontheme.c gtk_icon_theme_lookup_icon...
  - 423916 crash in color scheme code
  - 424042 Segmentation fault while quickly pressing Alt+arrows
  - 415260 Protect against negative indices when setting values in G...
  - 419171 XGetVisualInfo() may not set nxvisuals
  - 128852 Gdk cursors don't look good on win32
  - 344657 Ctrl-H doesn't toggle "Show Hidden Files" setting
  - 345345 PrintOperation::paginate is not emitted for class handler
  - 347567 GtkPrintOperation::end-print is not emitted if it's cance...
  - 369112 gtk_ui_manager_add_ui should accept unnamed separator
  - 392015 Selected menu item invisible on Windows Vista
  - 399253 MS-Windows Theme Bottom Tab placement rendering glitches
  - 399425 gtk_input_dialog_fill_axes() adds child to gtkscrolledwin...
  - 403251 [patch] little memory leak in GtkPrintJob
  - 403267 [patch] memory leak in GtkPageSetupUnixDialog
  - 403470 MS-Windows Theme tab placement other than on top leaks a ...
  - 404506 Windows system fonts that have multi-byte font names cann...
  - 405089 Incorrect window placement for GtkEventBox private window
  - 405515 Minor leak in gtkfilesystemmodel.c
  - 405539 gdk_pixbuf_save() for PNG saver can return FALSE without ...
  - 415681 gdk_window_clear_area includes an extra line and column o...
  - 418219 GtkRecentChooser should apply filter before sorting and c...
  - 418403 Scroll to printer after selecting it from settings
  - 421985 _gtk_print_operation_platform_backend_launch_preview
  - 421990 gtk_print_job_get_surface
  - 421993 gtk_print_operation_init
  - 423064 Conditional jump or move depends on uninitialised value(s...
  - 423722 Fix printing header in gtk-demo
  - 424168 gtk_print_operation_run on async preview
  - 425655 Don't install gtk+-unix-print-2.0.pc on non-UNIX platforms
  - 425786 GDK segfaults if XineramaQueryScreens fails
  - 428665 Lpr Backend gets stuck in infinite loop during gtk_enumer...
  - 429902 GtkPrintOperation leaks cairo contextes
  - 431997 First delay of GdkPixbufAnimationIter is wrong
  - 433242 Inconsistent scroll arrow position calculations
  - 433972 Placing gtk.Expander inside a gtk.TextView() changes gtk....
  - 434261 _gtk_toolbar_elide_underscores incorrectly handles some s...
  - 383354 ctrl-L should make 'Location' entry disappear
  - 418673 gtk_recent_manager_add_item
  - 429732 gtk_accel_group_finalize accesses invalid memory
  - 435028 WM_CLIENT_LEADER is wrong on the leader_window
  - 431067 Background of the header window is not updated
  - 338843 add recent files support inside the ui manager
  - 148535 add drop shadow to menus, tooltips, etc. under Windows XP
* debian/control.in:
  - Conflicts on ubuntulooks (<= 0.9.11-1)
* debian/patches/15_default-fallback-icon-theme.patch:
  - patch from Debian, fallback on gnome icon theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GTK - The GIMP Toolkit
 
2
 * gtkfilechooser.c: Abstract interface for file selector GUIs
 
3
 * Copyright (C) 2003, Red Hat, Inc.
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the
 
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#include <config.h>
 
22
#include "gtkfilechooser.h"
 
23
#include "gtkfilechooserprivate.h"
 
24
#include "gtkfilesystem.h"
 
25
#include "gtkintl.h"
 
26
#include "gtktypebuiltins.h"
 
27
#include "gtkprivate.h"
 
28
#include "gtkmarshalers.h"
 
29
#include "gtkalias.h"
 
30
 
 
31
static void gtk_file_chooser_class_init (gpointer g_iface);
 
32
 
 
33
static GtkFilePath *gtk_file_chooser_get_path         (GtkFileChooser *chooser);
 
34
 
 
35
GType
 
36
gtk_file_chooser_get_type (void)
 
37
{
 
38
  static GType file_chooser_type = 0;
 
39
 
 
40
  if (!file_chooser_type)
 
41
    {
 
42
      file_chooser_type = g_type_register_static_simple (G_TYPE_INTERFACE,
 
43
                                                         I_("GtkFileChooser"),
 
44
                                                         sizeof (GtkFileChooserIface),
 
45
                                                         (GClassInitFunc) gtk_file_chooser_class_init,
 
46
                                                         0, NULL, 0);
 
47
      
 
48
      g_type_interface_add_prerequisite (file_chooser_type, GTK_TYPE_WIDGET);
 
49
    }
 
50
 
 
51
  return file_chooser_type;
 
52
}
 
53
 
 
54
static gboolean
 
55
confirm_overwrite_accumulator (GSignalInvocationHint *ihint,
 
56
                               GValue                *return_accu,
 
57
                               const GValue          *handler_return,
 
58
                               gpointer               dummy)
 
59
{
 
60
  gboolean continue_emission;
 
61
  GtkFileChooserConfirmation conf;
 
62
 
 
63
  conf = g_value_get_enum (handler_return);
 
64
  g_value_set_enum (return_accu, conf);
 
65
  continue_emission = (conf == GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM);
 
66
 
 
67
  return continue_emission;
 
68
}
 
69
 
 
70
static void
 
71
gtk_file_chooser_class_init (gpointer g_iface)
 
72
{
 
73
  GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
 
74
 
 
75
  /**
 
76
   * GtkFileChooser::current-folder-changed
 
77
   * @chooser: the object which received the signal.
 
78
   *
 
79
   * This signal is emitted when the current folder in a #GtkFileChooser
 
80
   * changes.  This can happen due to the user performing some action that
 
81
   * changes folders, such as selecting a bookmark or visiting a folder on the
 
82
   * file list.  It can also happen as a result of calling a function to
 
83
   * explicitly change the current folder in a file chooser.
 
84
   *
 
85
   * Normally you do not need to connect to this signal, unless you need to keep
 
86
   * track of which folder a file chooser is showing.
 
87
   *
 
88
   * See also:  gtk_file_chooser_set_current_folder(),
 
89
   * gtk_file_chooser_get_current_folder(),
 
90
   * gtk_file_chooser_set_current_folder_uri(),
 
91
   * gtk_file_chooser_get_current_folder_uri().
 
92
   */
 
93
  g_signal_new (I_("current-folder-changed"),
 
94
                iface_type,
 
95
                G_SIGNAL_RUN_LAST,
 
96
                G_STRUCT_OFFSET (GtkFileChooserIface, current_folder_changed),
 
97
                NULL, NULL,
 
98
                g_cclosure_marshal_VOID__VOID,
 
99
                G_TYPE_NONE, 0);
 
100
 
 
101
  /**
 
102
   * GtkFileChooser::selection-changed
 
103
   * @chooser: the object which received the signal.
 
104
   *
 
105
   * This signal is emitted when there is a change in the set of selected files
 
106
   * in a #GtkFileChooser.  This can happen when the user modifies the selection
 
107
   * with the mouse or the keyboard, or when explicitly calling functions to
 
108
   * change the selection.
 
109
   *
 
110
   * Normally you do not need to connect to this signal, as it is easier to wait
 
111
   * for the file chooser to finish running, and then to get the list of
 
112
   * selected files using the functions mentioned below.
 
113
   *
 
114
   * See also: gtk_file_chooser_select_filename(),
 
115
   * gtk_file_chooser_unselect_filename(), gtk_file_chooser_get_filename(),
 
116
   * gtk_file_chooser_get_filenames(), gtk_file_chooser_select_uri(),
 
117
   * gtk_file_chooser_unselect_uri(), gtk_file_chooser_get_uri(),
 
118
   * gtk_file_chooser_get_uris().
 
119
   */
 
120
  g_signal_new (I_("selection-changed"),
 
121
                iface_type,
 
122
                G_SIGNAL_RUN_LAST,
 
123
                G_STRUCT_OFFSET (GtkFileChooserIface, selection_changed),
 
124
                NULL, NULL,
 
125
                g_cclosure_marshal_VOID__VOID,
 
126
                G_TYPE_NONE, 0);
 
127
 
 
128
  /**
 
129
   * GtkFileChooser::update-preview
 
130
   * @chooser: the object which received the signal.
 
131
   *
 
132
   * This signal is emitted when the preview in a file chooser should be
 
133
   * regenerated.  For example, this can happen when the currently selected file
 
134
   * changes.  You should use this signal if you want your file chooser to have
 
135
   * a preview widget.
 
136
   *
 
137
   * Once you have installed a preview widget with
 
138
   * gtk_file_chooser_set_preview_widget(), you should update it when this
 
139
   * signal is emitted.  You can use the functions
 
140
   * gtk_file_chooser_get_preview_filename() or
 
141
   * gtk_file_chooser_get_preview_uri() to get the name of the file to preview.
 
142
   * Your widget may not be able to preview all kinds of files; your callback
 
143
   * must call gtk_file_chooser_set_preview_wiget_active() to inform the file
 
144
   * chooser about whether the preview was generated successfully or not.
 
145
   *
 
146
   * Please see the example code in <xref linkend="gtkfilechooser-preview"/>.
 
147
   *
 
148
   * See also: gtk_file_chooser_set_preview_widget(),
 
149
   * gtk_file_chooser_set_preview_widget_active(),
 
150
   * gtk_file_chooser_set_use_preview_label(),
 
151
   * gtk_file_chooser_get_preview_filename(),
 
152
   * gtk_file_chooser_get_preview_uri().
 
153
   */
 
154
  g_signal_new (I_("update-preview"),
 
155
                iface_type,
 
156
                G_SIGNAL_RUN_LAST,
 
157
                G_STRUCT_OFFSET (GtkFileChooserIface, update_preview),
 
158
                NULL, NULL,
 
159
                g_cclosure_marshal_VOID__VOID,
 
160
                G_TYPE_NONE, 0);
 
161
 
 
162
  /**
 
163
   * GtkFileChooser::file-activated
 
164
   * @chooser: the object which received the signal.
 
165
   *
 
166
   * This signal is emitted when the user "activates" a file in the file
 
167
   * chooser.  This can happen by double-clicking on a file in the file list, or
 
168
   * by pressing <keycap>Enter</keycap>.
 
169
   *
 
170
   * Normally you do not need to connect to this signal.  It is used internally
 
171
   * by #GtkFileChooserDialog to know when to activate the default button in the
 
172
   * dialog.
 
173
   *
 
174
   * See also: gtk_file_chooser_get_filename(),
 
175
   * gtk_file_chooser_get_filenames(), gtk_file_chooser_get_uri(),
 
176
   * gtk_file_chooser_get_uris().
 
177
   */
 
178
  g_signal_new (I_("file-activated"),
 
179
                iface_type,
 
180
                G_SIGNAL_RUN_LAST,
 
181
                G_STRUCT_OFFSET (GtkFileChooserIface, file_activated),
 
182
                NULL, NULL,
 
183
                g_cclosure_marshal_VOID__VOID,
 
184
                G_TYPE_NONE, 0);
 
185
 
 
186
  /* Documented in the docbook files */
 
187
  g_signal_new (I_("confirm-overwrite"),
 
188
                iface_type,
 
189
                G_SIGNAL_RUN_LAST,
 
190
                G_STRUCT_OFFSET (GtkFileChooserIface, confirm_overwrite),
 
191
                confirm_overwrite_accumulator, NULL,
 
192
                _gtk_marshal_ENUM__VOID,
 
193
                GTK_TYPE_FILE_CHOOSER_CONFIRMATION, 0);
 
194
  
 
195
  g_object_interface_install_property (g_iface,
 
196
                                       g_param_spec_enum ("action",
 
197
                                                          P_("Action"),
 
198
                                                          P_("The type of operation that the file selector is performing"),
 
199
                                                          GTK_TYPE_FILE_CHOOSER_ACTION,
 
200
                                                          GTK_FILE_CHOOSER_ACTION_OPEN,
 
201
                                                          GTK_PARAM_READWRITE));
 
202
  g_object_interface_install_property (g_iface,
 
203
                                       g_param_spec_string ("file-system-backend",
 
204
                                                            P_("File System Backend"),
 
205
                                                            P_("Name of file system backend to use"),
 
206
                                                            NULL, 
 
207
                                                            GTK_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
208
  g_object_interface_install_property (g_iface,
 
209
                                       g_param_spec_object ("filter",
 
210
                                                            P_("Filter"),
 
211
                                                            P_("The current filter for selecting which files are displayed"),
 
212
                                                            GTK_TYPE_FILE_FILTER,
 
213
                                                            GTK_PARAM_READWRITE));
 
214
  g_object_interface_install_property (g_iface,
 
215
                                       g_param_spec_boolean ("local-only",
 
216
                                                             P_("Local Only"),
 
217
                                                             P_("Whether the selected file(s) should be limited to local file: URLs"),
 
218
                                                             TRUE,
 
219
                                                             GTK_PARAM_READWRITE));
 
220
  g_object_interface_install_property (g_iface,
 
221
                                       g_param_spec_object ("preview-widget",
 
222
                                                            P_("Preview widget"),
 
223
                                                            P_("Application supplied widget for custom previews."),
 
224
                                                            GTK_TYPE_WIDGET,
 
225
                                                            GTK_PARAM_READWRITE));
 
226
  g_object_interface_install_property (g_iface,
 
227
                                       g_param_spec_boolean ("preview-widget-active",
 
228
                                                             P_("Preview Widget Active"),
 
229
                                                             P_("Whether the application supplied widget for custom previews should be shown."),
 
230
                                                             TRUE,
 
231
                                                             GTK_PARAM_READWRITE));
 
232
  g_object_interface_install_property (g_iface,
 
233
                                       g_param_spec_boolean ("use-preview-label",
 
234
                                                             P_("Use Preview Label"),
 
235
                                                             P_("Whether to display a stock label with the name of the previewed file."),
 
236
                                                             TRUE,
 
237
                                                             GTK_PARAM_READWRITE));
 
238
  g_object_interface_install_property (g_iface,
 
239
                                       g_param_spec_object ("extra-widget",
 
240
                                                            P_("Extra widget"),
 
241
                                                            P_("Application supplied widget for extra options."),
 
242
                                                            GTK_TYPE_WIDGET,
 
243
                                                            GTK_PARAM_READWRITE));
 
244
  g_object_interface_install_property (g_iface,
 
245
                                       g_param_spec_boolean ("select-multiple",
 
246
                                                             P_("Select Multiple"),
 
247
                                                             P_("Whether to allow multiple files to be selected"),
 
248
                                                             FALSE,
 
249
                                                             GTK_PARAM_READWRITE));
 
250
  
 
251
  g_object_interface_install_property (g_iface,
 
252
                                       g_param_spec_boolean ("show-hidden",
 
253
                                                             P_("Show Hidden"),
 
254
                                                             P_("Whether the hidden files and folders should be displayed"),
 
255
                                                             FALSE,
 
256
                                                             GTK_PARAM_READWRITE));
 
257
 
 
258
  /**
 
259
   * GtkFileChooser:do-overwrite-confirmation:
 
260
   * 
 
261
   * Whether a file chooser in %GTK_FILE_CHOOSER_ACTION_SAVE mode
 
262
   * will present an overwrite confirmation dialog if the user
 
263
   * selects a file name that already exists.
 
264
   *
 
265
   * Since: 2.8
 
266
   */
 
267
  g_object_interface_install_property (g_iface,
 
268
                                       g_param_spec_boolean ("do-overwrite-confirmation",
 
269
                                                             P_("Do overwrite confirmation"),
 
270
                                                             P_("Whether a file chooser in save mode "
 
271
                                                                "will present an overwrite confirmation dialog "
 
272
                                                                "if necessary."),
 
273
                                                             FALSE,
 
274
                                                             GTK_PARAM_READWRITE));
 
275
}
 
276
 
 
277
/**
 
278
 * gtk_file_chooser_error_quark:
 
279
 *
 
280
 * Registers an error quark for #GtkFileChooser if necessary.
 
281
 * 
 
282
 * Return value: The error quark used for #GtkFileChooser errors.
 
283
 *
 
284
 * Since: 2.4
 
285
 **/
 
286
GQuark
 
287
gtk_file_chooser_error_quark (void)
 
288
{
 
289
  return g_quark_from_static_string ("gtk-file-chooser-error-quark");
 
290
}
 
291
 
 
292
/**
 
293
 * gtk_file_chooser_set_action:
 
294
 * @chooser: a #GtkFileChooser
 
295
 * @action: the action that the file selector is performing
 
296
 * 
 
297
 * Sets the type of operation that the chooser is performing; the
 
298
 * user interface is adapted to suit the selected action. For example,
 
299
 * an option to create a new folder might be shown if the action is
 
300
 * %GTK_FILE_CHOOSER_ACTION_SAVE but not if the action is
 
301
 * %GTK_FILE_CHOOSER_ACTION_OPEN.
 
302
 *
 
303
 * Since: 2.4
 
304
 **/
 
305
void
 
306
gtk_file_chooser_set_action (GtkFileChooser       *chooser,
 
307
                             GtkFileChooserAction  action)
 
308
{
 
309
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
310
 
 
311
  g_object_set (chooser, "action", action, NULL);
 
312
}
 
313
 
 
314
/**
 
315
 * gtk_file_chooser_get_action:
 
316
 * @chooser: a #GtkFileChooser
 
317
 * 
 
318
 * Gets the type of operation that the file chooser is performing; see
 
319
 * gtk_file_chooser_set_action().
 
320
 * 
 
321
 * Return value: the action that the file selector is performing
 
322
 *
 
323
 * Since: 2.4
 
324
 **/
 
325
GtkFileChooserAction
 
326
gtk_file_chooser_get_action (GtkFileChooser *chooser)
 
327
{
 
328
  GtkFileChooserAction action;
 
329
  
 
330
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
331
 
 
332
  g_object_get (chooser, "action", &action, NULL);
 
333
 
 
334
  return action;
 
335
}
 
336
 
 
337
/**
 
338
 * gtk_file_chooser_set_local_only:
 
339
 * @chooser: a #GtkFileChooser
 
340
 * @local_only: %TRUE if only local files can be selected
 
341
 * 
 
342
 * Sets whether only local files can be selected in the
 
343
 * file selector. If @local_only is %TRUE (the default),
 
344
 * then the selected file are files are guaranteed to be
 
345
 * accessible through the operating systems native file
 
346
 * file system and therefore the application only
 
347
 * needs to worry about the filename functions in
 
348
 * #GtkFileChooser, like gtk_file_chooser_get_filename(),
 
349
 * rather than the URI functions like
 
350
 * gtk_file_chooser_get_uri(),
 
351
 *
 
352
 * Since: 2.4
 
353
 **/
 
354
void
 
355
gtk_file_chooser_set_local_only (GtkFileChooser *chooser,
 
356
                                 gboolean        local_only)
 
357
{
 
358
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
359
 
 
360
  g_object_set (chooser, "local-only", local_only, NULL);
 
361
}
 
362
 
 
363
/**
 
364
 * gtk_file_chooser_get_local_only:
 
365
 * @chooser: a #GtkFileChoosre
 
366
 * 
 
367
 * Gets whether only local files can be selected in the
 
368
 * file selector. See gtk_file_chooser_set_local_only()
 
369
 * 
 
370
 * Return value: %TRUE if only local files can be selected.
 
371
 *
 
372
 * Since: 2.4
 
373
 **/
 
374
gboolean
 
375
gtk_file_chooser_get_local_only (GtkFileChooser *chooser)
 
376
{
 
377
  gboolean local_only;
 
378
  
 
379
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
380
 
 
381
  g_object_get (chooser, "local-only", &local_only, NULL);
 
382
 
 
383
  return local_only;
 
384
}
 
385
 
 
386
/**
 
387
 * gtk_file_chooser_set_select_multiple:
 
388
 * @chooser: a #GtkFileChooser
 
389
 * @select_multiple: %TRUE if multiple files can be selected.
 
390
 * 
 
391
 * Sets whether multiple files can be selected in the file selector.  This is
 
392
 * only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN or
 
393
 * GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.  
 
394
 *
 
395
 * Since: 2.4
 
396
 **/
 
397
void
 
398
gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser,
 
399
                                      gboolean        select_multiple)
 
400
{
 
401
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
402
 
 
403
  g_object_set (chooser, "select-multiple", select_multiple, NULL);
 
404
}
 
405
 
 
406
/**
 
407
 * gtk_file_chooser_get_select_multiple:
 
408
 * @chooser: a #GtkFileChooser
 
409
 * 
 
410
 * Gets whether multiple files can be selected in the file
 
411
 * selector. See gtk_file_chooser_set_select_multiple().
 
412
 * 
 
413
 * Return value: %TRUE if multiple files can be selected.
 
414
 *
 
415
 * Since: 2.4
 
416
 **/
 
417
gboolean
 
418
gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser)
 
419
{
 
420
  gboolean select_multiple;
 
421
  
 
422
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
423
 
 
424
  g_object_get (chooser, "select-multiple", &select_multiple, NULL);
 
425
 
 
426
  return select_multiple;
 
427
}
 
428
 
 
429
/**
 
430
 * gtk_file_chooser_get_filename:
 
431
 * @chooser: a #GtkFileChooser
 
432
 * 
 
433
 * Gets the filename for the currently selected file in
 
434
 * the file selector. If multiple files are selected,
 
435
 * one of the filenames will be returned at random.
 
436
 *
 
437
 * If the file chooser is in folder mode, this function returns the selected
 
438
 * folder.
 
439
 * 
 
440
 * Return value: The currently selected filename, or %NULL
 
441
 *  if no file is selected, or the selected file can't
 
442
 *  be represented with a local filename. Free with g_free().
 
443
 *
 
444
 * Since: 2.4
 
445
 **/
 
446
gchar *
 
447
gtk_file_chooser_get_filename (GtkFileChooser *chooser)
 
448
{
 
449
  GtkFileSystem *file_system;
 
450
  GtkFilePath *path;
 
451
  gchar *result = NULL;
 
452
  
 
453
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
454
 
 
455
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
456
  path = gtk_file_chooser_get_path (chooser);
 
457
  if (path)
 
458
    {
 
459
      result = gtk_file_system_path_to_filename (file_system, path);
 
460
      gtk_file_path_free (path);
 
461
    }
 
462
 
 
463
  return result;
 
464
}
 
465
 
 
466
/**
 
467
 * gtk_file_chooser_set_filename:
 
468
 * @chooser: a #GtkFileChooser
 
469
 * @filename: the filename to set as current
 
470
 * 
 
471
 * Sets @filename as the current filename for the file chooser, by changing
 
472
 * to the file's parent folder and actually selecting the file in list.  If
 
473
 * the @chooser is in #GTK_FILE_CHOOSER_ACTION_SAVE mode, the file's base name
 
474
 * will also appear in the dialog's file name entry.
 
475
 *
 
476
 * If the file name isn't in the current folder of @chooser, then the current
 
477
 * folder of @chooser will be changed to the folder containing @filename. This
 
478
 * is equivalent to a sequence of gtk_file_chooser_unselect_all() followed by
 
479
 * gtk_file_chooser_select_filename().
 
480
 *
 
481
 * Note that the file must exist, or nothing will be done except
 
482
 * for the directory change.
 
483
 *
 
484
 * If you are implementing a <guimenuitem>File/Save As...</guimenuitem> dialog, you
 
485
 * should use this function if you already have a file name to which the user may save; for example,
 
486
 * when the user opens an existing file and then does <guimenuitem>File/Save As...</guimenuitem>
 
487
 * on it.  If you don't have a file name already &mdash; for example, if the user just created
 
488
 * a new file and is saving it for the first time, do not call this function.  Instead, use
 
489
 * something similar to this:
 
490
 *
 
491
 * <programlisting>
 
492
 * if (document_is_new)
 
493
 *   {
 
494
 *     /<!-- -->* the user just created a new document *<!-- -->/
 
495
 *     gtk_file_chooser_set_current_folder (chooser, default_folder_for_saving);
 
496
 *     gtk_file_chooser_set_current_name (chooser, "Untitled document");
 
497
 *   }
 
498
 * else
 
499
 *   {
 
500
 *     /<!-- -->* the user edited an existing document *<!-- -->/ 
 
501
 *     gtk_file_chooser_set_filename (chooser, existing_filename);
 
502
 *   }
 
503
 * </programlisting>
 
504
 * 
 
505
 * Return value: %TRUE if both the folder could be changed and the file was
 
506
 * selected successfully, %FALSE otherwise.
 
507
 *
 
508
 * Since: 2.4
 
509
 **/
 
510
gboolean
 
511
gtk_file_chooser_set_filename (GtkFileChooser *chooser,
 
512
                               const gchar    *filename)
 
513
{
 
514
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
515
 
 
516
  gtk_file_chooser_unselect_all (chooser);
 
517
  return gtk_file_chooser_select_filename (chooser, filename);
 
518
}
 
519
 
 
520
/**
 
521
 * gtk_file_chooser_select_filename:
 
522
 * @chooser: a #GtkFileChooser
 
523
 * @filename: the filename to select
 
524
 * 
 
525
 * Selects a filename. If the file name isn't in the current
 
526
 * folder of @chooser, then the current folder of @chooser will
 
527
 * be changed to the folder containing @filename.
 
528
 *
 
529
 * Return value: %TRUE if both the folder could be changed and the file was
 
530
 * selected successfully, %FALSE otherwise.
 
531
 *
 
532
 * Since: 2.4
 
533
 **/
 
534
gboolean
 
535
gtk_file_chooser_select_filename (GtkFileChooser *chooser,
 
536
                                  const gchar    *filename)
 
537
{
 
538
  GtkFileSystem *file_system;
 
539
  GtkFilePath *path;
 
540
  gboolean result;
 
541
  
 
542
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
543
  g_return_val_if_fail (filename != NULL, FALSE);
 
544
 
 
545
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
546
 
 
547
  path = gtk_file_system_filename_to_path (file_system, filename);
 
548
  if (path)
 
549
    {
 
550
      result = _gtk_file_chooser_select_path (chooser, path, NULL);
 
551
      gtk_file_path_free (path);
 
552
    }
 
553
  else
 
554
    result = FALSE;
 
555
 
 
556
  return result;
 
557
}
 
558
 
 
559
/**
 
560
 * gtk_file_chooser_unselect_filename:
 
561
 * @chooser: a #GtkFileChooser
 
562
 * @filename: the filename to unselect
 
563
 * 
 
564
 * Unselects a currently selected filename. If the filename
 
565
 * is not in the current directory, does not exist, or
 
566
 * is otherwise not currently selected, does nothing.
 
567
 *
 
568
 * Since: 2.4
 
569
 **/
 
570
void
 
571
gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
 
572
                                    const char     *filename)
 
573
{
 
574
  GtkFileSystem *file_system;
 
575
  GtkFilePath *path;
 
576
  
 
577
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
578
  g_return_if_fail (filename != NULL);
 
579
 
 
580
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
581
 
 
582
  path = gtk_file_system_filename_to_path (file_system, filename);
 
583
  if (path)
 
584
    {
 
585
      _gtk_file_chooser_unselect_path (chooser, path);
 
586
      gtk_file_path_free (path);
 
587
    }
 
588
}
 
589
 
 
590
/* Converts a list of GtkFilePath* to a list of strings using the specified function */
 
591
static GSList *
 
592
file_paths_to_strings (GtkFileSystem *fs,
 
593
                       GSList        *paths,
 
594
                       gchar *      (*convert_func) (GtkFileSystem *fs, const GtkFilePath *path))
 
595
{
 
596
  GSList *strings;
 
597
 
 
598
  strings = NULL;
 
599
 
 
600
  for (; paths; paths = paths->next)
 
601
    {
 
602
      GtkFilePath *path;
 
603
      gchar *string;
 
604
 
 
605
      path = paths->data;
 
606
      string = (* convert_func) (fs, path);
 
607
 
 
608
      if (string)
 
609
        strings = g_slist_prepend (strings, string);
 
610
    }
 
611
 
 
612
  return g_slist_reverse (strings);
 
613
}
 
614
 
 
615
/**
 
616
 * gtk_file_chooser_get_filenames:
 
617
 * @chooser: a #GtkFileChooser
 
618
 * 
 
619
 * Lists all the selected files and subfolders in the current folder of
 
620
 * @chooser. The returned names are full absolute paths. If files in the current
 
621
 * folder cannot be represented as local filenames they will be ignored. (See
 
622
 * gtk_file_chooser_get_uris())
 
623
 * 
 
624
 * Return value: a #GSList containing the filenames of all selected
 
625
 *   files and subfolders in the current folder. Free the returned list
 
626
 *   with g_slist_free(), and the filenames with g_free().
 
627
 *
 
628
 * Since: 2.4
 
629
 **/
 
630
GSList *
 
631
gtk_file_chooser_get_filenames (GtkFileChooser *chooser)
 
632
{
 
633
  GtkFileSystem *file_system;
 
634
  GSList *paths;
 
635
  GSList *result;
 
636
  
 
637
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
638
 
 
639
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
640
  paths = _gtk_file_chooser_get_paths (chooser);
 
641
 
 
642
  result = file_paths_to_strings (file_system, paths, gtk_file_system_path_to_filename);
 
643
  gtk_file_paths_free (paths);
 
644
  return result;
 
645
}
 
646
 
 
647
/**
 
648
 * gtk_file_chooser_set_current_folder:
 
649
 * @chooser: a #GtkFileChooser
 
650
 * @filename: the full path of the new current folder
 
651
 * 
 
652
 * Sets the current folder for @chooser from a local filename.
 
653
 * The user will be shown the full contents of the current folder,
 
654
 * plus user interface elements for navigating to other folders.
 
655
 *
 
656
 * Return value: %TRUE if the folder could be changed successfully, %FALSE
 
657
 * otherwise.
 
658
 *
 
659
 * Since: 2.4
 
660
 **/
 
661
gboolean
 
662
gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
 
663
                                     const gchar    *filename)
 
664
{
 
665
  GtkFileSystem *file_system;
 
666
  GtkFilePath *path;
 
667
  gboolean result;
 
668
  
 
669
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
670
  g_return_val_if_fail (filename != NULL, FALSE);
 
671
 
 
672
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
673
 
 
674
  path = gtk_file_system_filename_to_path (file_system, filename);
 
675
  if (path)
 
676
    {
 
677
      result = _gtk_file_chooser_set_current_folder_path (chooser, path, NULL);
 
678
      gtk_file_path_free (path);
 
679
    }
 
680
  else
 
681
    result = FALSE;
 
682
 
 
683
  return result;
 
684
}
 
685
 
 
686
/**
 
687
 * gtk_file_chooser_get_current_folder:
 
688
 * @chooser: a #GtkFileChooser
 
689
 * 
 
690
 * Gets the current folder of @chooser as a local filename.
 
691
 * See gtk_file_chooser_set_current_folder().
 
692
 *
 
693
 * Note that this is the folder that the file chooser is currently displaying
 
694
 * (e.g. "/home/username/Documents"), which is <emphasis>not the same</emphasis>
 
695
 * as the currently-selected folder if the chooser is in
 
696
 * #GTK_FILE_CHOOSER_SELECT_FOLDER mode
 
697
 * (e.g. "/home/username/Documents/selected-folder/".  To get the
 
698
 * currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
 
699
 * usual way to get the selection.
 
700
 * 
 
701
 * Return value: the full path of the current folder, or %NULL if the current
 
702
 * path cannot be represented as a local filename.  Free with g_free().  This
 
703
 * function will also return %NULL if the file chooser was unable to load the
 
704
 * last folder that was requested from it; for example, as would be for calling
 
705
 * gtk_file_chooser_set_current_folder() on a nonexistent folder.
 
706
 *
 
707
 * Since: 2.4
 
708
 **/
 
709
gchar *
 
710
gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
 
711
{
 
712
  GtkFileSystem *file_system;
 
713
  GtkFilePath *path;
 
714
  gchar *filename;
 
715
  
 
716
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
717
 
 
718
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
719
 
 
720
  path = _gtk_file_chooser_get_current_folder_path (chooser);
 
721
  if (!path)
 
722
    return NULL;
 
723
 
 
724
  filename = gtk_file_system_path_to_filename (file_system, path);
 
725
  gtk_file_path_free (path);
 
726
 
 
727
  return filename;
 
728
}
 
729
 
 
730
/**
 
731
 * gtk_file_chooser_set_current_name:
 
732
 * @chooser: a #GtkFileChooser
 
733
 * @name: the filename to use, as a UTF-8 string
 
734
 * 
 
735
 * Sets the current name in the file selector, as if entered
 
736
 * by the user. Note that the name passed in here is a UTF-8
 
737
 * string rather than a filename. This function is meant for
 
738
 * such uses as a suggested name in a "Save As..." dialog.
 
739
 *
 
740
 * If you want to preselect a particular existing file, you should use
 
741
 * gtk_file_chooser_set_filename() or gtk_file_chooser_set_uri() instead.
 
742
 * Please see the documentation for those functions for an example of using
 
743
 * gtk_file_chooser_set_current_name() as well.
 
744
 *
 
745
 * Since: 2.4
 
746
 **/
 
747
void
 
748
gtk_file_chooser_set_current_name  (GtkFileChooser *chooser,
 
749
                                    const gchar    *name)
 
750
{
 
751
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
752
  g_return_if_fail (name != NULL);
 
753
  
 
754
  GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_name (chooser, name);
 
755
}
 
756
 
 
757
/**
 
758
 * gtk_file_chooser_get_uri:
 
759
 * @chooser: a #GtkFileChooser
 
760
 * 
 
761
 * Gets the URI for the currently selected file in
 
762
 * the file selector. If multiple files are selected,
 
763
 * one of the filenames will be returned at random.
 
764
 * 
 
765
 * If the file chooser is in folder mode, this function returns the selected
 
766
 * folder.
 
767
 * 
 
768
 * Return value: The currently selected URI, or %NULL
 
769
 *  if no file is selected. Free with g_free()
 
770
 *
 
771
 * Since: 2.4
 
772
 **/
 
773
gchar *
 
774
gtk_file_chooser_get_uri (GtkFileChooser *chooser)
 
775
{
 
776
  GtkFileSystem *file_system;
 
777
  GtkFilePath *path;
 
778
  gchar *result = NULL;
 
779
  
 
780
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
781
 
 
782
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
783
  path = gtk_file_chooser_get_path (chooser);
 
784
  if (path)
 
785
    {
 
786
      result = gtk_file_system_path_to_uri (file_system, path);
 
787
      gtk_file_path_free (path);
 
788
    }
 
789
 
 
790
  return result;
 
791
}
 
792
 
 
793
/**
 
794
 * gtk_file_chooser_set_uri:
 
795
 * @chooser: a #GtkFileChooser
 
796
 * @uri: the URI to set as current
 
797
 * 
 
798
 * Sets the file referred to by @uri as the current file for the file chooser,
 
799
 * by changing to the URI's parent folder and actually selecting the URI in the
 
800
 * list.  If the @chooser is #GTK_FILE_CHOOSER_ACTION_SAVE mode, the URI's base
 
801
 * name will also appear in the dialog's file name entry.
 
802
 *
 
803
 * If the URI isn't in the current folder of @chooser, then the current folder
 
804
 * of @chooser will be changed to the folder containing @uri. This is equivalent
 
805
 * to a sequence of gtk_file_chooser_unselect_all() followed by
 
806
 * gtk_file_chooser_select_uri().
 
807
 *
 
808
 * Note that the URI must exist, or nothing will be done except
 
809
 * for the directory change.
 
810
 * If you are implementing a <guimenuitem>File/Save As...</guimenuitem> dialog, you
 
811
 * should use this function if you already have a file name to which the user may save; for example,
 
812
 * when the user opens an existing file and then does <guimenuitem>File/Save As...</guimenuitem>
 
813
 * on it.  If you don't have a file name already &mdash; for example, if the user just created
 
814
 * a new file and is saving it for the first time, do not call this function.  Instead, use
 
815
 * something similar to this:
 
816
 *
 
817
 * <programlisting>
 
818
 * if (document_is_new)
 
819
 *   {
 
820
 *     /<!-- -->* the user just created a new document *<!-- -->/
 
821
 *     gtk_file_chooser_set_current_folder_uri (chooser, default_folder_for_saving);
 
822
 *     gtk_file_chooser_set_current_name (chooser, "Untitled document");
 
823
 *   }
 
824
 * else
 
825
 *   {
 
826
 *     /<!-- -->* the user edited an existing document *<!-- -->/ 
 
827
 *     gtk_file_chooser_set_uri (chooser, existing_uri);
 
828
 *   }
 
829
 * </programlisting>
 
830
 *
 
831
 * Return value: %TRUE if both the folder could be changed and the URI was
 
832
 * selected successfully, %FALSE otherwise.
 
833
 *
 
834
 * Since: 2.4
 
835
 **/
 
836
gboolean
 
837
gtk_file_chooser_set_uri (GtkFileChooser *chooser,
 
838
                          const char     *uri)
 
839
{
 
840
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
841
 
 
842
  gtk_file_chooser_unselect_all (chooser);
 
843
  return gtk_file_chooser_select_uri (chooser, uri);
 
844
}
 
845
 
 
846
/**
 
847
 * gtk_file_chooser_select_uri:
 
848
 * @chooser: a #GtkFileChooser
 
849
 * @uri: the URI to select
 
850
 * 
 
851
 * Selects the file to by @uri. If the URI doesn't refer to a
 
852
 * file in the current folder of @chooser, then the current folder of
 
853
 * @chooser will be changed to the folder containing @filename.
 
854
 *
 
855
 * Return value: %TRUE if both the folder could be changed and the URI was
 
856
 * selected successfully, %FALSE otherwise.
 
857
 *
 
858
 * Since: 2.4
 
859
 **/
 
860
gboolean
 
861
gtk_file_chooser_select_uri (GtkFileChooser *chooser,
 
862
                             const char     *uri)
 
863
{
 
864
  GtkFileSystem *file_system;
 
865
  GtkFilePath *path;
 
866
  gboolean result;
 
867
  
 
868
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
869
  g_return_val_if_fail (uri != NULL, FALSE);
 
870
 
 
871
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
872
 
 
873
  path = gtk_file_system_uri_to_path (file_system, uri);
 
874
  if (path)
 
875
    {
 
876
      result = _gtk_file_chooser_select_path (chooser, path, NULL);
 
877
      gtk_file_path_free (path);
 
878
    }
 
879
  else
 
880
    result = FALSE;
 
881
 
 
882
  return result;
 
883
}
 
884
 
 
885
/**
 
886
 * gtk_file_chooser_unselect_uri:
 
887
 * @chooser: a #GtkFileChooser
 
888
 * @uri: the URI to unselect
 
889
 * 
 
890
 * Unselects the file referred to by @uri. If the file
 
891
 * is not in the current directory, does not exist, or
 
892
 * is otherwise not currently selected, does nothing.
 
893
 *
 
894
 * Since: 2.4
 
895
 **/
 
896
void
 
897
gtk_file_chooser_unselect_uri (GtkFileChooser *chooser,
 
898
                               const char     *uri)
 
899
{
 
900
  GtkFileSystem *file_system;
 
901
  GtkFilePath *path;
 
902
  
 
903
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
904
  g_return_if_fail (uri != NULL);
 
905
 
 
906
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
907
 
 
908
  path = gtk_file_system_uri_to_path (file_system, uri);
 
909
  if (path)
 
910
    {
 
911
      _gtk_file_chooser_unselect_path (chooser, path);
 
912
      gtk_file_path_free (path);
 
913
    }
 
914
}
 
915
 
 
916
/**
 
917
 * gtk_file_chooser_select_all:
 
918
 * @chooser: a #GtkFileChooser
 
919
 * 
 
920
 * Selects all the files in the current folder of a file chooser.
 
921
 *
 
922
 * Since: 2.4
 
923
 **/
 
924
void
 
925
gtk_file_chooser_select_all (GtkFileChooser *chooser)
 
926
{
 
927
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
928
  
 
929
  GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_all (chooser);
 
930
}
 
931
 
 
932
/**
 
933
 * gtk_file_chooser_unselect_all:
 
934
 * @chooser: a #GtkFileChooser
 
935
 * 
 
936
 * Unselects all the files in the current folder of a file chooser.
 
937
 *
 
938
 * Since: 2.4
 
939
 **/
 
940
void
 
941
gtk_file_chooser_unselect_all (GtkFileChooser *chooser)
 
942
{
 
943
 
 
944
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
945
  
 
946
  GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_all (chooser);
 
947
}
 
948
 
 
949
/**
 
950
 * gtk_file_chooser_get_uris:
 
951
 * @chooser: a #GtkFileChooser
 
952
 * 
 
953
 * Lists all the selected files and subfolders in the current folder of
 
954
 * @chooser. The returned names are full absolute URIs.
 
955
 * 
 
956
 * Return value: a #GSList containing the URIs of all selected
 
957
 *   files and subfolders in the current folder. Free the returned list
 
958
 *   with g_slist_free(), and the filenames with g_free().
 
959
 *
 
960
 * Since: 2.4
 
961
 **/
 
962
GSList *
 
963
gtk_file_chooser_get_uris (GtkFileChooser *chooser)
 
964
{
 
965
  GtkFileSystem *file_system;
 
966
  GSList *paths;
 
967
  GSList *result;
 
968
  
 
969
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
970
 
 
971
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
972
  paths = _gtk_file_chooser_get_paths (chooser);
 
973
 
 
974
  result = file_paths_to_strings (file_system, paths, gtk_file_system_path_to_uri);
 
975
  gtk_file_paths_free (paths);
 
976
  return result;
 
977
}
 
978
 
 
979
/**
 
980
 * gtk_file_chooser_set_current_folder_uri:
 
981
 * @chooser: a #GtkFileChooser
 
982
 * @uri: the URI for the new current folder
 
983
 * 
 
984
 * Sets the current folder for @chooser from an URI.
 
985
 * The user will be shown the full contents of the current folder,
 
986
 * plus user interface elements for navigating to other folders.
 
987
 *
 
988
 * Return value: %TRUE if the folder could be changed successfully, %FALSE
 
989
 * otherwise.
 
990
 *
 
991
 * Since: 2.4
 
992
 **/
 
993
gboolean
 
994
gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser,
 
995
                                         const gchar    *uri)
 
996
{
 
997
  GtkFileSystem *file_system;
 
998
  GtkFilePath *path;
 
999
  gboolean result;
 
1000
  
 
1001
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1002
  g_return_val_if_fail (uri != NULL, FALSE);
 
1003
 
 
1004
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
1005
 
 
1006
  path = gtk_file_system_uri_to_path (file_system, uri);
 
1007
  if (path)
 
1008
    {
 
1009
      result = _gtk_file_chooser_set_current_folder_path (chooser, path, NULL);
 
1010
      gtk_file_path_free (path);
 
1011
    }
 
1012
  else
 
1013
    result = FALSE;
 
1014
 
 
1015
  return result;
 
1016
}
 
1017
 
 
1018
/**
 
1019
 * gtk_file_chooser_get_current_folder_uri:
 
1020
 * @chooser: a #GtkFileChooser
 
1021
 * 
 
1022
 * Gets the current folder of @chooser as an URI.
 
1023
 * See gtk_file_chooser_set_current_folder_uri().
 
1024
 *
 
1025
 * Note that this is the folder that the file chooser is currently displaying
 
1026
 * (e.g. "file:///home/username/Documents"), which is <emphasis>not the same</emphasis>
 
1027
 * as the currently-selected folder if the chooser is in
 
1028
 * #GTK_FILE_CHOOSER_SELECT_FOLDER mode
 
1029
 * (e.g. "file:///home/username/Documents/selected-folder/".  To get the
 
1030
 * currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
 
1031
 * usual way to get the selection.
 
1032
 * 
 
1033
 * Return value: the URI for the current folder.  Free with g_free().  This
 
1034
 * function will also return %NULL if the file chooser was unable to load the
 
1035
 * last folder that was requested from it; for example, as would be for calling
 
1036
 * gtk_file_chooser_set_current_folder_uri() on a nonexistent folder.
 
1037
 *
 
1038
 * Since: 2.4
 
1039
 */
 
1040
gchar *
 
1041
gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser)
 
1042
{
 
1043
  GtkFileSystem *file_system;
 
1044
  GtkFilePath *path;
 
1045
  gchar *uri;
 
1046
  
 
1047
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1048
 
 
1049
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
1050
 
 
1051
  path = _gtk_file_chooser_get_current_folder_path (chooser);
 
1052
  uri = gtk_file_system_path_to_uri (file_system, path);
 
1053
  gtk_file_path_free (path);
 
1054
 
 
1055
  return uri;
 
1056
}
 
1057
 
 
1058
/**
 
1059
 * _gtk_file_chooser_set_current_folder_path:
 
1060
 * @chooser: a #GtkFileChooser
 
1061
 * @path: the #GtkFilePath for the new folder
 
1062
 * @error: location to store error, or %NULL.
 
1063
 * 
 
1064
 * Sets the current folder for @chooser from a #GtkFilePath.
 
1065
 * Internal function, see gtk_file_chooser_set_current_folder_uri().
 
1066
 *
 
1067
 * Return value: %TRUE if the folder could be changed successfully, %FALSE
 
1068
 * otherwise.
 
1069
 *
 
1070
 * Since: 2.4
 
1071
 **/
 
1072
gboolean
 
1073
_gtk_file_chooser_set_current_folder_path (GtkFileChooser    *chooser,
 
1074
                                           const GtkFilePath *path,
 
1075
                                           GError           **error)
 
1076
{
 
1077
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1078
  g_return_val_if_fail (path != NULL, FALSE);
 
1079
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
1080
 
 
1081
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, path, error);
 
1082
}
 
1083
 
 
1084
/**
 
1085
 * _gtk_file_chooser_get_current_folder_path:
 
1086
 * @chooser: a #GtkFileChooser
 
1087
 * 
 
1088
 * Gets the current folder of @chooser as #GtkFilePath.
 
1089
 * See gtk_file_chooser_get_current_folder_uri().
 
1090
 * 
 
1091
 * Return value: the #GtkFilePath for the current folder.
 
1092
 * Free with gtk_file_path_free().
 
1093
 *
 
1094
 * Since: 2.4
 
1095
 */
 
1096
GtkFilePath *
 
1097
_gtk_file_chooser_get_current_folder_path (GtkFileChooser *chooser)
 
1098
{
 
1099
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1100
 
 
1101
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_current_folder (chooser);  
 
1102
}
 
1103
 
 
1104
/**
 
1105
 * _gtk_file_chooser_select_path:
 
1106
 * @chooser: a #GtkFileChooser
 
1107
 * @path: the path to select
 
1108
 * @error: location to store error, or %NULL
 
1109
 * 
 
1110
 * Selects the file referred to by @path. An internal function. See
 
1111
 * _gtk_file_chooser_select_uri().
 
1112
 *
 
1113
 * Return value: %TRUE if both the folder could be changed and the path was
 
1114
 * selected successfully, %FALSE otherwise.
 
1115
 *
 
1116
 * Since: 2.4
 
1117
 **/
 
1118
gboolean
 
1119
_gtk_file_chooser_select_path (GtkFileChooser    *chooser,
 
1120
                               const GtkFilePath *path,
 
1121
                               GError           **error)
 
1122
{
 
1123
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1124
  g_return_val_if_fail (path != NULL, FALSE);
 
1125
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
1126
 
 
1127
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_path (chooser, path, error);
 
1128
}
 
1129
 
 
1130
/**
 
1131
 * _gtk_file_chooser_unselect_path:
 
1132
 * @chooser: a #GtkFileChooser
 
1133
 * @path: the filename to path
 
1134
 * 
 
1135
 * Unselects the file referred to by @path. An internal
 
1136
 * function. See _gtk_file_chooser_unselect_uri().
 
1137
 *
 
1138
 * Since: 2.4
 
1139
 **/
 
1140
void
 
1141
_gtk_file_chooser_unselect_path (GtkFileChooser    *chooser,
 
1142
                                 const GtkFilePath *path)
 
1143
{
 
1144
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1145
 
 
1146
  GTK_FILE_CHOOSER_GET_IFACE (chooser)->unselect_path (chooser, path);
 
1147
}
 
1148
 
 
1149
/**
 
1150
 * _gtk_file_chooser_get_paths:
 
1151
 * @chooser: a #GtkFileChooser
 
1152
 * 
 
1153
 * Lists all the selected files and subfolders in the current folder of @chooser
 
1154
 * as #GtkFilePath. An internal function, see gtk_file_chooser_get_uris().
 
1155
 * 
 
1156
 * Return value: a #GSList containing a #GtkFilePath for each selected
 
1157
 *   file and subfolder in the current folder.  Free the returned list
 
1158
 *   with g_slist_free(), and the paths with gtk_file_path_free().
 
1159
 *
 
1160
 * Since: 2.4
 
1161
 **/
 
1162
GSList *
 
1163
_gtk_file_chooser_get_paths (GtkFileChooser *chooser)
 
1164
{
 
1165
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1166
 
 
1167
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_paths (chooser);
 
1168
}
 
1169
 
 
1170
static GtkFilePath *
 
1171
gtk_file_chooser_get_path (GtkFileChooser *chooser)
 
1172
{
 
1173
  GSList *list;
 
1174
  GtkFilePath *result = NULL;
 
1175
  
 
1176
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1177
 
 
1178
  list = _gtk_file_chooser_get_paths (chooser);
 
1179
  if (list)
 
1180
    {
 
1181
      result = list->data;
 
1182
      list = g_slist_delete_link (list, list);
 
1183
      gtk_file_paths_free (list);
 
1184
    }
 
1185
 
 
1186
  return result;
 
1187
}
 
1188
 
 
1189
/**
 
1190
 * _gtk_file_chooser_get_file_system:
 
1191
 * @chooser: a #GtkFileChooser
 
1192
 * 
 
1193
 * Gets the #GtkFileSystem of @chooser; this is an internal
 
1194
 * implementation detail, used for conversion between paths
 
1195
 * and filenames and URIs.
 
1196
 * 
 
1197
 * Return value: the file system for @chooser.
 
1198
 *
 
1199
 * Since: 2.4
 
1200
 **/
 
1201
GtkFileSystem *
 
1202
_gtk_file_chooser_get_file_system (GtkFileChooser *chooser)
 
1203
{
 
1204
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1205
 
 
1206
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_file_system (chooser);
 
1207
}
 
1208
 
 
1209
/* Preview widget
 
1210
 */
 
1211
/**
 
1212
 * gtk_file_chooser_set_preview_widget:
 
1213
 * @chooser: a #GtkFileChooser
 
1214
 * @preview_widget: widget for displaying preview.
 
1215
 *
 
1216
 * Sets an application-supplied widget to use to display a custom preview
 
1217
 * of the currently selected file. To implement a preview, after setting the
 
1218
 * preview widget, you connect to the ::update-preview
 
1219
 * signal, and call gtk_file_chooser_get_preview_filename() or
 
1220
 * gtk_file_chooser_get_preview_uri() on each change. If you can
 
1221
 * display a preview of the new file, update your widget and
 
1222
 * set the preview active using gtk_file_chooser_set_preview_widget_active().
 
1223
 * Otherwise, set the preview inactive.
 
1224
 *
 
1225
 * When there is no application-supplied preview widget, or the
 
1226
 * application-supplied preview widget is not active, the file chooser
 
1227
 * may display an internally generated preview of the current file or
 
1228
 * it may display no preview at all.
 
1229
 *
 
1230
 * Since: 2.4
 
1231
 **/
 
1232
void
 
1233
gtk_file_chooser_set_preview_widget (GtkFileChooser *chooser,
 
1234
                                     GtkWidget      *preview_widget)
 
1235
{
 
1236
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1237
 
 
1238
  g_object_set (chooser, "preview-widget", preview_widget, NULL);
 
1239
}
 
1240
 
 
1241
/**
 
1242
 * gtk_file_chooser_get_preview_widget:
 
1243
 * @chooser: a #GtkFileChooser
 
1244
 * 
 
1245
 * Gets the current preview widget; see
 
1246
 * gtk_file_chooser_set_preview_widget().
 
1247
 * 
 
1248
 * Return value: the current preview widget, or %NULL
 
1249
 *
 
1250
 * Since: 2.4
 
1251
 **/
 
1252
GtkWidget *
 
1253
gtk_file_chooser_get_preview_widget (GtkFileChooser *chooser)
 
1254
{
 
1255
  GtkWidget *preview_widget;
 
1256
  
 
1257
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1258
 
 
1259
  g_object_get (chooser, "preview-widget", &preview_widget, NULL);
 
1260
  
 
1261
  /* Horrid hack; g_object_get() refs returned objects but
 
1262
   * that contradicts the memory management conventions
 
1263
   * for accessors.
 
1264
   */
 
1265
  if (preview_widget)
 
1266
    g_object_unref (preview_widget);
 
1267
 
 
1268
  return preview_widget;
 
1269
}
 
1270
 
 
1271
/**
 
1272
 * gtk_file_chooser_set_preview_widget_active:
 
1273
 * @chooser: a #GtkFileChooser
 
1274
 * @active: whether to display the user-specified preview widget
 
1275
 * 
 
1276
 * Sets whether the preview widget set by
 
1277
 * gtk_file_chooser_set_preview_widget() should be shown for the
 
1278
 * current filename. When @active is set to false, the file chooser
 
1279
 * may display an internally generated preview of the current file
 
1280
 * or it may display no preview at all. See
 
1281
 * gtk_file_chooser_set_preview_widget() for more details.
 
1282
 *
 
1283
 * Since: 2.4
 
1284
 **/
 
1285
void
 
1286
gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser,
 
1287
                                            gboolean        active)
 
1288
{
 
1289
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1290
  
 
1291
  g_object_set (chooser, "preview-widget-active", active, NULL);
 
1292
}
 
1293
 
 
1294
/**
 
1295
 * gtk_file_chooser_get_preview_widget_active:
 
1296
 * @chooser: a #GtkFileChooser
 
1297
 * 
 
1298
 * Gets whether the preview widget set by gtk_file_chooser_set_preview_widget()
 
1299
 * should be shown for the current filename. See
 
1300
 * gtk_file_chooser_set_preview_widget_active().
 
1301
 * 
 
1302
 * Return value: %TRUE if the preview widget is active for the current filename.
 
1303
 *
 
1304
 * Since: 2.4
 
1305
 **/
 
1306
gboolean
 
1307
gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser)
 
1308
{
 
1309
  gboolean active;
 
1310
  
 
1311
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1312
 
 
1313
  g_object_get (chooser, "preview-widget-active", &active, NULL);
 
1314
 
 
1315
  return active;
 
1316
}
 
1317
 
 
1318
/**
 
1319
 * gtk_file_chooser_set_use_preview_label:
 
1320
 * @chooser: a #GtkFileChooser
 
1321
 * @use_label: whether to display a stock label with the name of the previewed file
 
1322
 * 
 
1323
 * Sets whether the file chooser should display a stock label with the name of
 
1324
 * the file that is being previewed; the default is %TRUE.  Applications that
 
1325
 * want to draw the whole preview area themselves should set this to %FALSE and
 
1326
 * display the name themselves in their preview widget.
 
1327
 *
 
1328
 * See also: gtk_file_chooser_set_preview_widget()
 
1329
 *
 
1330
 * Since: 2.4
 
1331
 **/
 
1332
void
 
1333
gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser,
 
1334
                                        gboolean        use_label)
 
1335
{
 
1336
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1337
 
 
1338
  g_object_set (chooser, "use-preview-label", use_label, NULL);
 
1339
}
 
1340
 
 
1341
/**
 
1342
 * gtk_file_chooser_get_use_preview_label:
 
1343
 * @chooser: a #GtkFileChooser
 
1344
 * 
 
1345
 * Gets whether a stock label should be drawn with the name of the previewed
 
1346
 * file.  See gtk_file_chooser_set_use_preview_label().
 
1347
 * 
 
1348
 * Return value: %TRUE if the file chooser is set to display a label with the
 
1349
 * name of the previewed file, %FALSE otherwise.
 
1350
 **/
 
1351
gboolean
 
1352
gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser)
 
1353
{
 
1354
  gboolean use_label;
 
1355
  
 
1356
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1357
 
 
1358
  g_object_get (chooser, "use-preview-label", &use_label, NULL);
 
1359
 
 
1360
  return use_label;
 
1361
}
 
1362
 
 
1363
/**
 
1364
 * gtk_file_chooser_get_preview_filename:
 
1365
 * @chooser: a #GtkFileChooser
 
1366
 * 
 
1367
 * Gets the filename that should be previewed in a custom preview
 
1368
 * Internal function, see gtk_file_chooser_get_preview_uri().
 
1369
 * 
 
1370
 * Return value: the #GtkFilePath for the file to preview, or %NULL if no file
 
1371
 *  is selected. Free with gtk_file_path_free().
 
1372
 *
 
1373
 * Since: 2.4
 
1374
 **/
 
1375
GtkFilePath *
 
1376
_gtk_file_chooser_get_preview_path (GtkFileChooser *chooser)
 
1377
{
 
1378
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1379
 
 
1380
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_preview_path (chooser);
 
1381
}
 
1382
 
 
1383
/**
 
1384
 * _gtk_file_chooser_add_shortcut_folder:
 
1385
 * @chooser: a #GtkFileChooser
 
1386
 * @path: path of the folder to add
 
1387
 * @error: location to store error, or %NULL
 
1388
 * 
 
1389
 * Adds a folder to be displayed with the shortcut folders in a file chooser.
 
1390
 * Internal function, see gtk_file_chooser_add_shortcut_folder().
 
1391
 * 
 
1392
 * Return value: %TRUE if the folder could be added successfully, %FALSE
 
1393
 * otherwise.
 
1394
 *
 
1395
 * Since: 2.4
 
1396
 **/
 
1397
gboolean
 
1398
_gtk_file_chooser_add_shortcut_folder (GtkFileChooser    *chooser,
 
1399
                                       const GtkFilePath *path,
 
1400
                                       GError           **error)
 
1401
{
 
1402
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1403
  g_return_val_if_fail (path != NULL, FALSE);
 
1404
 
 
1405
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_shortcut_folder (chooser, path, error);
 
1406
}
 
1407
 
 
1408
/**
 
1409
 * _gtk_file_chooser_remove_shortcut_folder:
 
1410
 * @chooser: a #GtkFileChooser
 
1411
 * @path: path of the folder to remove
 
1412
 * @error: location to store error, or %NULL
 
1413
 * 
 
1414
 * Removes a folder from the shortcut folders in a file chooser.  Internal
 
1415
 * function, see gtk_file_chooser_remove_shortcut_folder().
 
1416
 * 
 
1417
 * Return value: %TRUE if the folder could be removed successfully, %FALSE
 
1418
 * otherwise.
 
1419
 *
 
1420
 * Since: 2.4
 
1421
 **/
 
1422
gboolean
 
1423
_gtk_file_chooser_remove_shortcut_folder (GtkFileChooser    *chooser,
 
1424
                                          const GtkFilePath *path,
 
1425
                                          GError           **error)
 
1426
{
 
1427
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1428
  g_return_val_if_fail (path != NULL, FALSE);
 
1429
 
 
1430
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, path, error);
 
1431
}
 
1432
 
 
1433
/**
 
1434
 * gtk_file_chooser_get_preview_filename:
 
1435
 * @chooser: a #GtkFileChooser
 
1436
 * 
 
1437
 * Gets the filename that should be previewed in a custom preview
 
1438
 * widget. See gtk_file_chooser_set_preview_widget().
 
1439
 * 
 
1440
 * Return value: the filename to preview, or %NULL if no file
 
1441
 *  is selected, or if the selected file cannot be represented
 
1442
 *  as a local filename. Free with g_free()
 
1443
 *
 
1444
 * Since: 2.4
 
1445
 **/
 
1446
char *
 
1447
gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser)
 
1448
{
 
1449
  GtkFileSystem *file_system;
 
1450
  GtkFilePath *path;
 
1451
  gchar *result = NULL;
 
1452
  
 
1453
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1454
 
 
1455
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
1456
  path = _gtk_file_chooser_get_preview_path (chooser);
 
1457
  if (path)
 
1458
    {
 
1459
      result = gtk_file_system_path_to_filename (file_system, path);
 
1460
      gtk_file_path_free (path);
 
1461
    }
 
1462
 
 
1463
  return result;
 
1464
}
 
1465
 
 
1466
/**
 
1467
 * gtk_file_chooser_get_preview_uri:
 
1468
 * @chooser: a #GtkFileChooser
 
1469
 * 
 
1470
 * Gets the URI that should be previewed in a custom preview
 
1471
 * widget. See gtk_file_chooser_set_preview_widget().
 
1472
 * 
 
1473
 * Return value: the URI for the file to preview, or %NULL if no file is
 
1474
 * selected. Free with g_free().
 
1475
 *
 
1476
 * Since: 2.4
 
1477
 **/
 
1478
char *
 
1479
gtk_file_chooser_get_preview_uri (GtkFileChooser *chooser)
 
1480
{
 
1481
  GtkFileSystem *file_system;
 
1482
  GtkFilePath *path;
 
1483
  gchar *result = NULL;
 
1484
  
 
1485
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1486
 
 
1487
  file_system = _gtk_file_chooser_get_file_system (chooser);
 
1488
  path = _gtk_file_chooser_get_preview_path (chooser);
 
1489
  if (path)
 
1490
    {
 
1491
      result = gtk_file_system_path_to_uri (file_system, path);
 
1492
      gtk_file_path_free (path);
 
1493
    }
 
1494
 
 
1495
  return result;
 
1496
}
 
1497
 
 
1498
/**
 
1499
 * gtk_file_chooser_set_extra_widget:
 
1500
 * @chooser: a #GtkFileChooser
 
1501
 * @extra_widget: widget for extra options
 
1502
 * 
 
1503
 * Sets an application-supplied widget to provide extra options to the user.
 
1504
 *
 
1505
 * Since: 2.4
 
1506
 **/
 
1507
void
 
1508
gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser,
 
1509
                                   GtkWidget      *extra_widget)
 
1510
{
 
1511
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1512
 
 
1513
  g_object_set (chooser, "extra-widget", extra_widget, NULL);
 
1514
}
 
1515
 
 
1516
/**
 
1517
 * gtk_file_chooser_get_extra_widget:
 
1518
 * @chooser: a #GtkFileChooser
 
1519
 * 
 
1520
 * Gets the current preview widget; see
 
1521
 * gtk_file_chooser_set_extra_widget().
 
1522
 * 
 
1523
 * Return value: the current extra widget, or %NULL
 
1524
 *
 
1525
 * Since: 2.4
 
1526
 **/
 
1527
GtkWidget *
 
1528
gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser)
 
1529
{
 
1530
  GtkWidget *extra_widget;
 
1531
  
 
1532
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1533
 
 
1534
  g_object_get (chooser, "extra-widget", &extra_widget, NULL);
 
1535
  
 
1536
  /* Horrid hack; g_object_get() refs returned objects but
 
1537
   * that contradicts the memory management conventions
 
1538
   * for accessors.
 
1539
   */
 
1540
  if (extra_widget)
 
1541
    g_object_unref (extra_widget);
 
1542
 
 
1543
  return extra_widget;
 
1544
}
 
1545
 
 
1546
/**
 
1547
 * gtk_file_chooser_add_filter:
 
1548
 * @chooser: a #GtkFileChooser
 
1549
 * @filter: a #GtkFileFilter
 
1550
 * 
 
1551
 * Adds @filter to the list of filters that the user can select between.
 
1552
 * When a filter is selected, only files that are passed by that
 
1553
 * filter are displayed. 
 
1554
 * 
 
1555
 * Note that the @chooser takes ownership of the filter, so you have to 
 
1556
 * ref and sink it if you want to keep a reference.
 
1557
 *
 
1558
 * Since: 2.4
 
1559
 **/
 
1560
void
 
1561
gtk_file_chooser_add_filter (GtkFileChooser *chooser,
 
1562
                             GtkFileFilter  *filter)
 
1563
{
 
1564
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1565
 
 
1566
  GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_filter (chooser, filter);
 
1567
}
 
1568
 
 
1569
/**
 
1570
 * gtk_file_chooser_remove_filter:
 
1571
 * @chooser: a #GtkFileChooser
 
1572
 * @filter: a #GtkFileFilter
 
1573
 * 
 
1574
 * Removes @filter from the list of filters that the user can select between.
 
1575
 *
 
1576
 * Since: 2.4
 
1577
 **/
 
1578
void
 
1579
gtk_file_chooser_remove_filter (GtkFileChooser *chooser,
 
1580
                                GtkFileFilter  *filter)
 
1581
{
 
1582
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1583
 
 
1584
  GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_filter (chooser, filter);
 
1585
}
 
1586
 
 
1587
/**
 
1588
 * gtk_file_chooser_list_filters:
 
1589
 * @chooser: a #GtkFileChooser
 
1590
 * 
 
1591
 * Lists the current set of user-selectable filters; see
 
1592
 * gtk_file_chooser_add_filter(), gtk_file_chooser_remove_filter().
 
1593
 * 
 
1594
 * Return value: a #GSList containing the current set of
 
1595
 *  user selectable filters. The contents of the list are
 
1596
 *  owned by GTK+, but you must free the list itself with
 
1597
 *  g_slist_free() when you are done with it.
 
1598
 *
 
1599
 * Since: 2.4
 
1600
 **/
 
1601
GSList *
 
1602
gtk_file_chooser_list_filters  (GtkFileChooser *chooser)
 
1603
{
 
1604
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1605
 
 
1606
  return GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_filters (chooser);
 
1607
}
 
1608
 
 
1609
/**
 
1610
 * gtk_file_chooser_set_filter:
 
1611
 * @chooser: a #GtkFileChooser
 
1612
 * @filter: a #GtkFileFilter
 
1613
 * 
 
1614
 * Sets the current filter; only the files that pass the
 
1615
 * filter will be displayed. If the user-selectable list of filters
 
1616
 * is non-empty, then the filter should be one of the filters
 
1617
 * in that list. Setting the current filter when the list of
 
1618
 * filters is empty is useful if you want to restrict the displayed
 
1619
 * set of files without letting the user change it.
 
1620
 *
 
1621
 * Since: 2.4
 
1622
 **/
 
1623
void
 
1624
gtk_file_chooser_set_filter (GtkFileChooser *chooser,
 
1625
                             GtkFileFilter  *filter)
 
1626
{
 
1627
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1628
  g_return_if_fail (GTK_IS_FILE_FILTER (filter));
 
1629
 
 
1630
  g_object_set (chooser, "filter", filter, NULL);
 
1631
}
 
1632
 
 
1633
/**
 
1634
 * gtk_file_chooser_get_filter:
 
1635
 * @chooser: a #GtkFileChooser
 
1636
 * 
 
1637
 * Gets the current filter; see gtk_file_chooser_set_filter().
 
1638
 * 
 
1639
 * Return value: the current filter, or %NULL
 
1640
 *
 
1641
 * Since: 2.4
 
1642
 **/
 
1643
GtkFileFilter *
 
1644
gtk_file_chooser_get_filter (GtkFileChooser *chooser)
 
1645
{
 
1646
  GtkFileFilter *filter;
 
1647
  
 
1648
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1649
 
 
1650
  g_object_get (chooser, "filter", &filter, NULL);
 
1651
  /* Horrid hack; g_object_get() refs returned objects but
 
1652
   * that contradicts the memory management conventions
 
1653
   * for accessors.
 
1654
   */
 
1655
  if (filter)
 
1656
    g_object_unref (filter);
 
1657
 
 
1658
  return filter;
 
1659
}
 
1660
 
 
1661
/**
 
1662
 * gtk_file_chooser_add_shortcut_folder:
 
1663
 * @chooser: a #GtkFileChooser
 
1664
 * @folder: filename of the folder to add
 
1665
 * @error: location to store error, or %NULL
 
1666
 * 
 
1667
 * Adds a folder to be displayed with the shortcut folders in a file chooser.
 
1668
 * Note that shortcut folders do not get saved, as they are provided by the
 
1669
 * application.  For example, you can use this to add a
 
1670
 * "/usr/share/mydrawprogram/Clipart" folder to the volume list.
 
1671
 * 
 
1672
 * Return value: %TRUE if the folder could be added successfully, %FALSE
 
1673
 * otherwise.  In the latter case, the @error will be set as appropriate.
 
1674
 *
 
1675
 * Since: 2.4
 
1676
 **/
 
1677
gboolean
 
1678
gtk_file_chooser_add_shortcut_folder (GtkFileChooser    *chooser,
 
1679
                                      const char        *folder,
 
1680
                                      GError           **error)
 
1681
{
 
1682
  GtkFilePath *path;
 
1683
  gboolean result;
 
1684
 
 
1685
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1686
  g_return_val_if_fail (folder != NULL, FALSE);
 
1687
 
 
1688
  path = gtk_file_system_filename_to_path (_gtk_file_chooser_get_file_system (chooser), folder);
 
1689
  if (!path)
 
1690
    {
 
1691
      g_set_error (error,
 
1692
                   GTK_FILE_CHOOSER_ERROR,
 
1693
                   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
 
1694
                   _("Invalid filename: %s"),
 
1695
                   folder);
 
1696
      return FALSE;
 
1697
    }
 
1698
 
 
1699
  result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_shortcut_folder (chooser, path, error);
 
1700
 
 
1701
  gtk_file_path_free (path);
 
1702
 
 
1703
  return result;
 
1704
}
 
1705
 
 
1706
/**
 
1707
 * gtk_file_chooser_remove_shortcut_folder:
 
1708
 * @chooser: a #GtkFileChooser
 
1709
 * @folder: filename of the folder to remove
 
1710
 * @error: location to store error, or %NULL
 
1711
 * 
 
1712
 * Removes a folder from a file chooser's list of shortcut folders.
 
1713
 * 
 
1714
 * Return value: %TRUE if the operation succeeds, %FALSE otherwise.  
 
1715
 * In the latter case, the @error will be set as appropriate.
 
1716
 *
 
1717
 * See also: gtk_file_chooser_add_shortcut_folder()
 
1718
 *
 
1719
 * Since: 2.4
 
1720
 **/
 
1721
gboolean
 
1722
gtk_file_chooser_remove_shortcut_folder (GtkFileChooser    *chooser,
 
1723
                                         const char        *folder,
 
1724
                                         GError           **error)
 
1725
{
 
1726
  GtkFilePath *path;
 
1727
  gboolean result;
 
1728
 
 
1729
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1730
  g_return_val_if_fail (folder != NULL, FALSE);
 
1731
 
 
1732
  path = gtk_file_system_filename_to_path (_gtk_file_chooser_get_file_system (chooser), folder);
 
1733
  if (!path)
 
1734
    {
 
1735
      g_set_error (error,
 
1736
                   GTK_FILE_CHOOSER_ERROR,
 
1737
                   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
 
1738
                   _("Invalid filename: %s"),
 
1739
                   folder);
 
1740
      return FALSE;
 
1741
    }
 
1742
 
 
1743
  result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, path, error);
 
1744
 
 
1745
  gtk_file_path_free (path);
 
1746
 
 
1747
  return result;
 
1748
}
 
1749
 
 
1750
/**
 
1751
 * gtk_file_chooser_list_shortcut_folders:
 
1752
 * @chooser: a #GtkFileChooser
 
1753
 * 
 
1754
 * Queries the list of shortcut folders in the file chooser, as set by
 
1755
 * gtk_file_chooser_add_shortcut_folder().
 
1756
 * 
 
1757
 * Return value: A list of folder filenames, or %NULL if there are no shortcut
 
1758
 * folders.  Free the returned list with g_slist_free(), and the filenames with
 
1759
 * g_free().
 
1760
 *
 
1761
 * Since: 2.4
 
1762
 **/
 
1763
GSList *
 
1764
gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser)
 
1765
{
 
1766
  GSList *folders;
 
1767
  GSList *result;
 
1768
 
 
1769
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1770
 
 
1771
  folders = GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_shortcut_folders (chooser);
 
1772
 
 
1773
  result = file_paths_to_strings (_gtk_file_chooser_get_file_system (chooser),
 
1774
                                  folders,
 
1775
                                  gtk_file_system_path_to_filename);
 
1776
  gtk_file_paths_free (folders);
 
1777
  return result;
 
1778
}
 
1779
 
 
1780
/**
 
1781
 * gtk_file_chooser_add_shortcut_folder_uri:
 
1782
 * @chooser: a #GtkFileChooser
 
1783
 * @uri: URI of the folder to add
 
1784
 * @error: location to store error, or %NULL
 
1785
 * 
 
1786
 * Adds a folder URI to be displayed with the shortcut folders in a file
 
1787
 * chooser.  Note that shortcut folders do not get saved, as they are provided
 
1788
 * by the application.  For example, you can use this to add a
 
1789
 * "file:///usr/share/mydrawprogram/Clipart" folder to the volume list.
 
1790
 * 
 
1791
 * Return value: %TRUE if the folder could be added successfully, %FALSE
 
1792
 * otherwise.  In the latter case, the @error will be set as appropriate.
 
1793
 *
 
1794
 * Since: 2.4
 
1795
 **/
 
1796
gboolean
 
1797
gtk_file_chooser_add_shortcut_folder_uri (GtkFileChooser    *chooser,
 
1798
                                          const char        *uri,
 
1799
                                          GError           **error)
 
1800
{
 
1801
  GtkFilePath *path;
 
1802
  gboolean result;
 
1803
 
 
1804
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1805
  g_return_val_if_fail (uri != NULL, FALSE);
 
1806
 
 
1807
  path = gtk_file_system_uri_to_path (_gtk_file_chooser_get_file_system (chooser), uri);
 
1808
  if (!path)
 
1809
    {
 
1810
      g_set_error (error,
 
1811
                   GTK_FILE_CHOOSER_ERROR,
 
1812
                   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
 
1813
                   _("Invalid filename: %s"),
 
1814
                   uri);
 
1815
      return FALSE;
 
1816
    }
 
1817
 
 
1818
  result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->add_shortcut_folder (chooser, path, error);
 
1819
 
 
1820
  gtk_file_path_free (path);
 
1821
 
 
1822
  return result;
 
1823
}
 
1824
 
 
1825
/**
 
1826
 * gtk_file_chooser_remove_shortcut_folder_uri:
 
1827
 * @chooser: a #GtkFileChooser
 
1828
 * @uri: URI of the folder to remove
 
1829
 * @error: location to store error, or %NULL
 
1830
 * 
 
1831
 * Removes a folder URI from a file chooser's list of shortcut folders.
 
1832
 * 
 
1833
 * Return value: %TRUE if the operation succeeds, %FALSE otherwise.  
 
1834
 * In the latter case, the @error will be set as appropriate.
 
1835
 *
 
1836
 * See also: gtk_file_chooser_add_shortcut_folder_uri()
 
1837
 *
 
1838
 * Since: 2.4
 
1839
 **/
 
1840
gboolean
 
1841
gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser    *chooser,
 
1842
                                             const char        *uri,
 
1843
                                             GError           **error)
 
1844
{
 
1845
  GtkFilePath *path;
 
1846
  gboolean result;
 
1847
 
 
1848
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1849
  g_return_val_if_fail (uri != NULL, FALSE);
 
1850
 
 
1851
  path = gtk_file_system_uri_to_path (_gtk_file_chooser_get_file_system (chooser), uri);
 
1852
  if (!path)
 
1853
    {
 
1854
      g_set_error (error,
 
1855
                   GTK_FILE_CHOOSER_ERROR,
 
1856
                   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
 
1857
                   _("Invalid filename: %s"),
 
1858
                   uri);
 
1859
      return FALSE;
 
1860
    }
 
1861
 
 
1862
  result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, path, error);
 
1863
 
 
1864
  gtk_file_path_free (path);
 
1865
 
 
1866
  return result;
 
1867
}
 
1868
 
 
1869
/**
 
1870
 * gtk_file_chooser_list_shortcut_folder_uris:
 
1871
 * @chooser: a #GtkFileChooser
 
1872
 * 
 
1873
 * Queries the list of shortcut folders in the file chooser, as set by
 
1874
 * gtk_file_chooser_add_shortcut_folder_uri().
 
1875
 * 
 
1876
 * Return value: A list of folder URIs, or %NULL if there are no shortcut
 
1877
 * folders.  Free the returned list with g_slist_free(), and the URIs with
 
1878
 * g_free().
 
1879
 *
 
1880
 * Since: 2.4
 
1881
 **/
 
1882
GSList *
 
1883
gtk_file_chooser_list_shortcut_folder_uris (GtkFileChooser *chooser)
 
1884
{
 
1885
  GSList *folders;
 
1886
  GSList *result;
 
1887
 
 
1888
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL);
 
1889
 
 
1890
  folders = GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_shortcut_folders (chooser);
 
1891
 
 
1892
  result = file_paths_to_strings (_gtk_file_chooser_get_file_system (chooser),
 
1893
                                  folders,
 
1894
                                  gtk_file_system_path_to_uri);
 
1895
  gtk_file_paths_free (folders);
 
1896
  return result;
 
1897
}
 
1898
 
 
1899
 
 
1900
/**
 
1901
 * gtk_file_chooser_set_show_hidden:
 
1902
 * @chooser: a #GtkFileChooser
 
1903
 * @show_hidden: %TRUE if hidden files and folders should be displayed.
 
1904
 * 
 
1905
 * Sets whether hidden files and folders are displayed in the file selector.  
 
1906
 *
 
1907
 * Since: 2.6
 
1908
 **/
 
1909
void
 
1910
gtk_file_chooser_set_show_hidden (GtkFileChooser *chooser,
 
1911
                                  gboolean        show_hidden)
 
1912
{
 
1913
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1914
 
 
1915
  g_object_set (chooser, "show-hidden", show_hidden, NULL);
 
1916
}
 
1917
 
 
1918
/**
 
1919
 * gtk_file_chooser_get_show_hidden:
 
1920
 * @chooser: a #GtkFileChooser
 
1921
 * 
 
1922
 * Gets whether hidden files and folders are displayed in the file selector.   
 
1923
 * See gtk_file_chooser_set_show_hidden().
 
1924
 * 
 
1925
 * Return value: %TRUE if hidden files and folders are displayed.
 
1926
 *
 
1927
 * Since: 2.6
 
1928
 **/
 
1929
gboolean
 
1930
gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser)
 
1931
{
 
1932
  gboolean show_hidden;
 
1933
  
 
1934
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1935
 
 
1936
  g_object_get (chooser, "show-hidden", &show_hidden, NULL);
 
1937
 
 
1938
  return show_hidden;
 
1939
}
 
1940
 
 
1941
/**
 
1942
 * gtk_file_chooser_set_do_overwrite_confirmation:
 
1943
 * @chooser: a #GtkFileChooser
 
1944
 * @do_overwrite_confirmation: whether to confirm overwriting in save mode
 
1945
 * 
 
1946
 * Sets whether a file chooser in GTK_FILE_CHOOSER_ACTION_SAVE mode will present
 
1947
 * a confirmation dialog if the user types a file name that already exists.  This
 
1948
 * is %FALSE by default.
 
1949
 *
 
1950
 * Regardless of this setting, the @chooser will emit the "confirm-overwrite"
 
1951
 * signal when appropriate.
 
1952
 *
 
1953
 * If all you need is the stock confirmation dialog, set this property to %TRUE.
 
1954
 * You can override the way confirmation is done by actually handling the
 
1955
 * "confirm-overwrite" signal; please refer to its documentation for the
 
1956
 * details.
 
1957
 *
 
1958
 * Since: 2.8
 
1959
 **/
 
1960
void
 
1961
gtk_file_chooser_set_do_overwrite_confirmation (GtkFileChooser *chooser,
 
1962
                                                gboolean        do_overwrite_confirmation)
 
1963
{
 
1964
  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
 
1965
 
 
1966
  g_object_set (chooser, "do-overwrite-confirmation", do_overwrite_confirmation, NULL);
 
1967
}
 
1968
 
 
1969
/**
 
1970
 * gtk_file_chooser_get_do_overwrite_confirmation:
 
1971
 * @chooser: a #GtkFileChooser
 
1972
 * 
 
1973
 * Queries whether a file chooser is set to confirm for overwriting when the user
 
1974
 * types a file name that already exists.
 
1975
 * 
 
1976
 * Return value: %TRUE if the file chooser will present a confirmation dialog;
 
1977
 * %FALSE otherwise.
 
1978
 *
 
1979
 * Since: 2.8
 
1980
 **/
 
1981
gboolean
 
1982
gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser)
 
1983
{
 
1984
  gboolean do_overwrite_confirmation;
 
1985
 
 
1986
  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
 
1987
 
 
1988
  g_object_get (chooser, "do-overwrite-confirmation", &do_overwrite_confirmation, NULL);
 
1989
 
 
1990
  return do_overwrite_confirmation;
 
1991
}
 
1992
 
 
1993
#ifdef G_OS_WIN32
 
1994
 
 
1995
/* DLL ABI stability backward compatibility versions */
 
1996
 
 
1997
#undef gtk_file_chooser_get_filename
 
1998
 
 
1999
gchar *
 
2000
gtk_file_chooser_get_filename (GtkFileChooser *chooser)
 
2001
{
 
2002
  gchar *utf8_filename = gtk_file_chooser_get_filename_utf8 (chooser);
 
2003
  gchar *retval = g_locale_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
 
2004
 
 
2005
  g_free (utf8_filename);
 
2006
 
 
2007
  return retval;
 
2008
}
 
2009
 
 
2010
#undef gtk_file_chooser_set_filename
 
2011
 
 
2012
gboolean
 
2013
gtk_file_chooser_set_filename (GtkFileChooser *chooser,
 
2014
                               const gchar    *filename)
 
2015
{
 
2016
  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
 
2017
  gboolean retval = gtk_file_chooser_set_filename_utf8 (chooser, utf8_filename);
 
2018
 
 
2019
  g_free (utf8_filename);
 
2020
 
 
2021
  return retval;
 
2022
}
 
2023
 
 
2024
#undef gtk_file_chooser_select_filename
 
2025
 
 
2026
gboolean
 
2027
gtk_file_chooser_select_filename (GtkFileChooser *chooser,
 
2028
                                  const gchar    *filename)
 
2029
{
 
2030
  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
 
2031
  gboolean retval = gtk_file_chooser_select_filename_utf8 (chooser, utf8_filename);
 
2032
 
 
2033
  g_free (utf8_filename);
 
2034
 
 
2035
  return retval;
 
2036
}
 
2037
 
 
2038
#undef gtk_file_chooser_unselect_filename
 
2039
 
 
2040
void
 
2041
gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
 
2042
                                    const char     *filename)
 
2043
{
 
2044
  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
 
2045
 
 
2046
  gtk_file_chooser_unselect_filename_utf8 (chooser, utf8_filename);
 
2047
  g_free (utf8_filename);
 
2048
}
 
2049
 
 
2050
#undef gtk_file_chooser_get_filenames
 
2051
 
 
2052
GSList *
 
2053
gtk_file_chooser_get_filenames (GtkFileChooser *chooser)
 
2054
{
 
2055
  GSList *list = gtk_file_chooser_get_filenames_utf8 (chooser);
 
2056
  GSList *rover = list;
 
2057
  
 
2058
  while (rover)
 
2059
    {
 
2060
      gchar *tem = (gchar *) rover->data;
 
2061
      rover->data = g_locale_from_utf8 ((gchar *) rover->data, -1, NULL, NULL, NULL);
 
2062
      g_free (tem);
 
2063
      rover = rover->next;
 
2064
    }
 
2065
 
 
2066
  return list;
 
2067
}
 
2068
 
 
2069
#undef gtk_file_chooser_set_current_folder
 
2070
 
 
2071
gboolean
 
2072
gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
 
2073
                                     const gchar    *filename)
 
2074
{
 
2075
  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
 
2076
  gboolean retval = gtk_file_chooser_set_current_folder_utf8 (chooser, utf8_filename);
 
2077
 
 
2078
  g_free (utf8_filename);
 
2079
 
 
2080
  return retval;
 
2081
}
 
2082
 
 
2083
#undef gtk_file_chooser_get_current_folder
 
2084
 
 
2085
gchar *
 
2086
gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
 
2087
{
 
2088
  gchar *utf8_folder = gtk_file_chooser_get_current_folder_utf8 (chooser);
 
2089
  gchar *retval = g_locale_from_utf8 (utf8_folder, -1, NULL, NULL, NULL);
 
2090
 
 
2091
  g_free (utf8_folder);
 
2092
 
 
2093
  return retval;
 
2094
}
 
2095
 
 
2096
#undef gtk_file_chooser_get_preview_filename
 
2097
 
 
2098
char *
 
2099
gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser)
 
2100
{
 
2101
  char *utf8_filename = gtk_file_chooser_get_preview_filename_utf8 (chooser);
 
2102
  char *retval = g_locale_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
 
2103
 
 
2104
  g_free (utf8_filename);
 
2105
 
 
2106
  return retval;
 
2107
}
 
2108
 
 
2109
#undef gtk_file_chooser_add_shortcut_folder
 
2110
 
 
2111
gboolean
 
2112
gtk_file_chooser_add_shortcut_folder (GtkFileChooser    *chooser,
 
2113
                                      const char        *folder,
 
2114
                                      GError           **error)
 
2115
{
 
2116
  char *utf8_folder = g_locale_to_utf8 (folder, -1, NULL, NULL, NULL);
 
2117
  gboolean retval =
 
2118
    gtk_file_chooser_add_shortcut_folder_utf8 (chooser, utf8_folder, error);
 
2119
 
 
2120
  g_free (utf8_folder);
 
2121
 
 
2122
  return retval;
 
2123
}
 
2124
 
 
2125
#undef gtk_file_chooser_remove_shortcut_folder
 
2126
 
 
2127
gboolean
 
2128
gtk_file_chooser_remove_shortcut_folder (GtkFileChooser    *chooser,
 
2129
                                         const char        *folder,
 
2130
                                         GError           **error)
 
2131
{
 
2132
  char *utf8_folder = g_locale_to_utf8 (folder, -1, NULL, NULL, NULL);
 
2133
  gboolean retval =
 
2134
    gtk_file_chooser_remove_shortcut_folder_utf8 (chooser, utf8_folder, error);
 
2135
 
 
2136
  g_free (utf8_folder);
 
2137
 
 
2138
  return retval;
 
2139
}
 
2140
 
 
2141
#undef gtk_file_chooser_list_shortcut_folders
 
2142
 
 
2143
GSList *
 
2144
gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser)
 
2145
{
 
2146
  GSList *list = gtk_file_chooser_list_shortcut_folders_utf8 (chooser);
 
2147
  GSList *rover = list;
 
2148
  
 
2149
  while (rover)
 
2150
    {
 
2151
      gchar *tem = (gchar *) rover->data;
 
2152
      rover->data = g_locale_from_utf8 ((gchar *) rover->data, -1, NULL, NULL, NULL);
 
2153
      g_free (tem);
 
2154
      rover = rover->next;
 
2155
    }
 
2156
 
 
2157
  return list;
 
2158
}
 
2159
 
 
2160
#endif
 
2161
 
 
2162
#define __GTK_FILE_CHOOSER_C__
 
2163
#include "gtkaliasdef.c"