1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
225
  
226
  
227
  
228
  
229
  
230
  
231
  
232
  
233
  
234
  
235
  
236
  
237
  
238
  
239
  
240
  
241
  
242
  
243
  
244
  
245
  
246
  
247
  
248
  
249
  
250
  
251
  
252
  
253
  
254
  
255
  
256
  
257
  
258
  
259
  
260
  
261
  
262
  
263
  
264
  
265
  
266
  
267
  
268
  
269
  
270
  
271
  
272
  
273
  
274
  
275
  
276
  
277
  
278
  
279
  
280
  
281
  
282
  
283
  
284
  
285
  
286
  
287
  
288
  
289
  
290
  
291
  
292
  
293
  
294
  
295
  
296
  
297
  
298
  
299
  
300
  
301
  
302
  
303
  
304
  
305
  
306
  
307
  
308
  
309
  
310
  
311
  
312
  
313
  
314
  
315
  
316
  
317
  
318
  
319
  
320
  
321
  
322
  
323
  
324
  
325
  
326
  
327
  
328
  
329
  
330
  
331
  
332
  
333
  
334
  
335
  
336
  
337
  
338
  
339
  
340
  
341
  
342
  
343
  
344
  
345
  
346
  
347
  
348
  
349
  
350
  
351
  
352
  
353
  
354
  
355
  
356
  
357
  
358
  
359
  
360
  
361
  
/* -*- C -*- */ 
require gtk24; 
 
class GTK2.FileChooser; 
mixin_for G.Object; 
 
//! Properties: 
//! int action 
//! GTK2.Widget extra-widget 
//! string file-system-backend 
//! GTK2.FileFilter filter 
//! int local-only 
//! GTk.Widget preview-widget 
//! int preview-widget-active 
//! int select-multiple 
//! int show-hidden 
//! int use-preview-label 
 
signal current_folder_changed; 
signal file_activated; 
signal selection_changed; 
signal update_preview; 
 
void set_action(int action); 
//! Sets type of action, from opening or saving a file, or  
//! opening or saving a folder. 
//! Options are: 
//!  CONST(GTK_FILE_CHOOSER_ACTION_OPEN) 
//!  CONST(GTK_FILE_CHOOSER_ACTION_SAVE) 
//!  CONST(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) 
//!  CONST(GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) 
 
int get_action(); 
//! Get the type of action the file chooser is performing. 
 
void set_local_only(int local_only); 
//! Sets whether on local files can be selected. 
 
int get_local_only(); 
//! Gets whether only local files can be selected in the file selector. 
 
void set_select_multiple(int select_multiple); 
//! Sets whether multiple files can be selected in the file selector. 
//! This is only relevant if the action is set to be 
//! CONST(GTK_FILE_CHOOSER_ACTION_OPEN) or 
//! CONST(GTK_FILE_CHOOSER_ACTION_SAVE) 
 
int get_select_multiple(); 
//! Gets whether multiple files can be selected. 
 
require gtk26; 
void set_show_hidden(int setting); 
//! Sets whether hidden files and folders are displayed. 
 
int get_show_hidden(); 
//! Gets whether hidden files and folders are displayed. 
endrequire; 
 
require gtk28; 
void set_do_overwrite_confirmation(int setting); 
//! Sets whether a file chooser in GTK2.FILE_CHOOSER_ACTION_SAVE mode will 
//! present a confirmation dialog if the users types a file name that already 
//! exists.  This is FALSE by default. 
//! <p> 
//! Regardless of this setting, the chooser will emit the "confirm-overwrite" 
//! signal when appropriate. 
//! <p> 
//! If all you need is the stock confirmation dialog, set this property to TRUE. 
//! You can override the way confirmation is done by actually handling the 
//! "confirm-overwrite" signal. 
 
int get_do_overwrite_confirmation(); 
//! Queries whether a file chooser is set to confirm for overwriting when the 
//! user types a file name that already exists. 
endrequire; 
 
void set_current_name(string filename); 
//! Sets current name. 
 
string get_filename(); 
//! Gets the filename for the currently select file. 
 
int set_filename(string filename); 
//! Sets filename as the current filename. 
//! Same as unselect_all() followed by select_filename(); 
 
int select_filename(string filename); 
//! Selects a filename. 
 
void unselect_filename(string filename); 
//! Unselects a currently selected filename. 
 
void select_all(); 
//! Select all files. 
 
void unselect_all(); 
//! Unselect all files. 
 
array(string) get_filenames() 
//! Get a list of all selected file and subfolders. 
//! The returned names are full absolute paths. 
//! If files in the current folder cannot be represented as local 
//! filenames, they will be ignored.  If you want those files, 
//! You may want to use get_uris() instead. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GSList *gs1=gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(THIS->obj)); 
    GSList *gs2=gs1; 
    int i=0; 
    while (gs2) { 
      i++; 
      PGTK_PUSH_GCHAR(gs2->data); 
      g_free(gs2->data); 
      gs2=g_slist_next(gs2); 
    } 
    f_aggregate(i); 
    g_slist_free(gs1); 
  } 
} 
 
int set_current_folder(string folder); 
//! Sets the current folder from a local filename.  The user 
//! will be shown the full contents of the current folder, plus 
//! user interface elements for navigating to other folders. 
 
string get_current_folder(); 
//! Gets the current folder as a local filename. 
 
string get_uri(); 
//! Gets the URI for the currently selected file. 
 
int set_uri(string uri); 
//! Sets the uri as the current file. 
 
int select_uri(string uri); 
//! Selects the file by uri. 
 
void unselect_uri(string uri); 
//! Unselect the uri. 
 
array(string) get_uris() 
//! List all the selected files and subfolders in the current folder. 
//! The returned names are full absolute URIs. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GSList *gs1=gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(THIS->obj)); 
    GSList *gs2=gs1; 
    int i=0; 
    while (gs2) { 
      i++; 
      PGTK_PUSH_GCHAR(gs2->data); 
      g_free(gs2->data); 
      gs2=g_slist_next(gs2); 
    } 
    f_aggregate(i); 
    g_slist_free(gs1); 
  } 
} 
 
int set_current_folder_uri(string uri); 
//! Sets the current folder from a URI. 
 
string get_current_folder_uri(); 
//! Gets the current folder as a URI. 
 
void set_extra_widget(GTK.Widget extra); 
//! Sets an application-supplied widget to provide extra 
//! options to the user. 
 
void set_preview_widget(GTK2.Widget widget); 
//! Sets an application-supplied widget to use to display a custom preview of 
//! the currently selected file.  To implement a preview, after setting the 
//! preview widget, you connect to the "update-preview" signal, and call 
//! get_preview_filename() or get_preview_uri() on each change.  If you can 
//! display a preview of the new file, update your widget and set the preview 
//! active using set_preview_widget_active().  Otherwise, set the preview 
//! inactive. 
//! <p> 
//! When there is no application-supplied preview widget, or the application- 
//! supplied preview widget is not active, the file chooser may display an 
//! internally generated preview of the current file or it may display no 
//! preview at all. 
 
+GTK2.Widget get_preview_widget(); 
//! Gets the current preview widget. 
 
void set_preview_widget_active(int setting); 
//! Sets whether the preview widget set by set_preview_widget() should be shown 
//! for the current filename.  When setting is set to false, the file chooser 
//! may display an internally generated preview of the current file or it may 
//! display no preview at all. 
 
int get_preview_widget_active(); 
//! Gets whether the preview widget set by set_preview_widget_active() should 
//! be shown for the current filename. 
 
void set_use_preview_label(int setting); 
//! Sets whether the file chooser should display a stock label with the name 
//! of the file that is being previewed; the default is true.  Applications 
//! that want to draw the whole preview area themselves should set this to 
//! false and display the name themselves in their preview widget. 
 
int get_use_preview_label(); 
//! Gets whether a stock label should be drawn with the name of the previewed 
//! file. 
 
string get_preview_filename(); 
//! Gets the filename that should be previewed in a custom preview widget. 
 
string get_preview_uri(); 
//! Gets the URI that should be previewed in a custom preview widget. 
 
void set_extra_widget(GTK2.Widget widget); 
//! Sets an application-supplied widget to provide extra options to the user. 
 
+GTK2.Widget get_extra_widget(); 
//! Gets the extra widget. 
 
/* TODO: *shortcut_folder* *filter* */ 
void add_filter(GTK2.FileFilter filter); 
//! Adds filter to the list of filters that the user can select between.  When 
//! a filter is selected, only files that are passed by that filter are 
//! displayed. 
 
void remove_filter(GTK2.FileFilter filter); 
//! Removes filter from the list of filters that the user can select between. 
 
array(GTK2.FileFilter) list_filters() 
//! Lists the current set of user-selectable filters. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GSList *gsl,*gs2; 
    int i=0; 
    gsl=gs2=gtk_file_chooser_list_filters(GTK_FILE_CHOOSER(THIS->obj)); 
    while (gs2) { 
      push_gobject(gs2->data); 
      i++; 
      gs2=g_slist_next(gs2); 
    } 
    f_aggregate(i); 
    g_slist_free(gsl); 
  } 
} 
 
void set_filter(GTK2.FileFilter filter); 
//! Sets the current filter; only the files that pass the filter will be 
//! displayed.  If the user-selectable list of filters is non-empty, then the 
//! filter should be one of the filters in that list.  Setting the current 
//! filter when the list of filters is empty is useful if you want to restrict 
//! the displayed set of files without letting the user change it. 
 
+GTK2.FileFilter get_filter(); 
//! Gets the current filter. 
 
int add_shortcut_folder(string folder) 
//! Adds a folder to be displayed with the shortcut folders in a file chooser. 
//! Note that shortcut folders do not get saved, as they are provided by the 
//! application.  For example, you can use this to add a  
//! "/usr/share/mydrawprogram/Clipart" folder to the volume list. 
{ 
  pgtk2_verify_inited(); 
  { 
    const char *folder; 
    int res; 
    get_all_args(NULL,args,"%s",&folder); 
    res=gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(THIS->obj), 
                        folder,NULL); 
    pgtk2_pop_n_elems(args); 
    push_int(res); 
  } 
} 
 
void remove_shortcut_folder(string folder) 
//! Removes a folder from the list of shortcut folders. 
{ 
  pgtk2_verify_inited(); 
  { 
    const char *folder; 
    get_all_args(NULL,args,"%s",&folder); 
    gtk_file_chooser_remove_shortcut_folder(GTK_FILE_CHOOSER(THIS->obj), 
                        folder,NULL); 
  } 
  RETURN_THIS(); 
} 
 
array(string) list_shortcut_folders() 
//! Queries the list of shortcut folders. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GSList *gsl,*gs2; 
    int i=0; 
    gsl=gs2=gtk_file_chooser_list_shortcut_folders(GTK_FILE_CHOOSER(THIS->obj)); 
    while (gs2) { 
      PGTK_PUSH_GCHAR(gs2->data); 
      i++; 
      g_free(gs2->data); 
      gs2=g_slist_next(gs2); 
    } 
    f_aggregate(i); 
    g_slist_free(gsl); 
  } 
} 
 
int add_shortcut_folder_uri(string uri) 
//! Adds a folder URI to be displayed with the shortcut folders. 
{ 
  pgtk2_verify_inited(); 
  { 
    const char *uri; 
    int res; 
    get_all_args(NULL,args,"%s",&uri); 
    res=gtk_file_chooser_add_shortcut_folder_uri(GTK_FILE_CHOOSER(THIS->obj), 
                        uri,NULL); 
    pgtk2_pop_n_elems(args); 
    push_int(res); 
  } 
} 
 
void remove_shortcut_folder_uri(string uri) 
//! Removes a folder URI. 
{ 
  pgtk2_verify_inited(); 
  { 
    const char *uri; 
    get_all_args(NULL,args,"%s",&uri); 
    gtk_file_chooser_remove_shortcut_folder_uri(GTK_FILE_CHOOSER(THIS->obj), 
                        uri,NULL); 
  } 
  RETURN_THIS(); 
} 
 
array(string) list_shortcut_folder_uris() 
//! Queries the list of shortcut folders. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GSList *gsl,*gs2; 
    int i=0; 
    gsl=gs2=gtk_file_chooser_list_shortcut_folder_uris(GTK_FILE_CHOOSER(THIS->obj)); 
    while (gs2) { 
      PGTK_PUSH_GCHAR(gs2->data); 
      i++; 
      g_free(gs2->data); 
      gs2=g_slist_next(gs2); 
    } 
    f_aggregate(i); 
    g_slist_free(gsl); 
  } 
} 
 
endrequire;