/
FileChooserT.d
1531 lines (1430 loc) · 55.7 KB
/
FileChooserT.d
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
/*
* Conversion parameters:
* inFile = GtkFileChooser.html
* outPack = gtk
* outFile = FileChooserT
* strct = GtkFileChooser
* realStrct=
* ctorStrct=
* clss = FileChooserT
* interf = FileChooserIF
* class Code: No
* interface Code: No
* template for:
* - TStruct
* extend =
* implements:
* prefixes:
* - gtk_file_chooser_
* - gtk_
* omit structs:
* omit prefixes:
* omit code:
* omit signals:
* imports:
* - glib.Str
* - glib.ErrorG
* - glib.GException
* - gio.File
* - gtk.Window
* - glib.ListSG
* - gtk.Widget
* - gtk.FileFilter
* structWrap:
* - GFile* -> File
* - GSList* -> ListSG
* - GtkFileFilter* -> FileFilter
* - GtkWidget* -> Widget
* - GtkWindow* -> Window
* module aliases:
* local aliases:
* - getAction -> getFileChooserAction
* - setAction -> setFileChooserAction
* overrides:
*/
module gtk.FileChooserT;
public import gtkc.gtktypes;
public import gtkc.gtk;
public import glib.ConstructionException;
public import gobject.Signals;
public import gtkc.gdktypes;
public import glib.Str;
public import glib.ErrorG;
public import glib.GException;
public import gio.File;
public import gtk.Window;
public import glib.ListSG;
public import gtk.Widget;
public import gtk.FileFilter;
/**
* Description
* GtkFileChooser is an interface that can be implemented by file
* selection widgets. In GTK+, the main objects that implement this
* interface are GtkFileChooserWidget, GtkFileChooserDialog, and
* GtkFileChooserButton. You do not need to write an object that
* implements the GtkFileChooser interface unless you are trying to
* adapt an existing file selector to expose a standard programming
* interface.
* GtkFileChooser allows for shortcuts to various places in the filesystem.
* In the default implementation these are displayed in the left pane. It
* may be a bit confusing at first taht these shortcuts come from various
* sources and in various flavours, so lets explain the terminology here:
* Bookmarks
* are created by the user, by dragging folders from the
* right pane to the left pane, or by using the "Add". Bookmarks
* can be renamed and deleted by the user.
* Shortcuts
* can be provided by the application or by the underlying filesystem
* abstraction (e.g. both the gnome-vfs and the Windows filesystems
* provide "Desktop" shortcuts). Shortcuts cannot be modified by the
* user.
* Volumes
* are provided by the underlying filesystem abstraction. They are
* the "roots" of the filesystem.
* File Names and Encodings
* When the user is finished selecting files in a
* GtkFileChooser, your program can get the selected names
* either as filenames or as URIs. For URIs, the normal escaping
* rules are applied if the URI contains non-ASCII characters.
* However, filenames are always returned in
* the character set specified by the
* G_FILENAME_ENCODING environment variable.
* Please see the Glib documentation for more details about this
* variable.
* Note
* This means that while you can pass the result of
* gtk_file_chooser_get_filename() to
* open(2) or
* fopen(3), you may not be able to
* directly set it as the text of a GtkLabel widget unless you
* convert it first to UTF-8, which all GTK+ widgets expect.
* You should use g_filename_to_utf8() to convert filenames
* into strings that can be passed to GTK+ widgets.
* <hr>
* Adding a Preview Widget
* You can add a custom preview widget to a file chooser and then
* get notification about when the preview needs to be updated.
* To install a preview widget, use
* gtk_file_chooser_set_preview_widget(). Then, connect to the
* "update-preview" signal to get notified when
* you need to update the contents of the preview.
* Your callback should use
* gtk_file_chooser_get_preview_filename() to see what needs
* previewing. Once you have generated the preview for the
* corresponding file, you must call
* gtk_file_chooser_set_preview_widget_active() with a boolean
* flag that indicates whether your callback could successfully
* generate a preview.
* $(DDOC_COMMENT example)
* <hr>
* Adding Extra Widgets
* You can add extra widgets to a file chooser to provide options
* that are not present in the default design. For example, you
* can add a toggle button to give the user the option to open a
* file in read-only mode. You can use
* gtk_file_chooser_set_extra_widget() to insert additional
* widgets in a file chooser.
* $(DDOC_COMMENT example)
* Note
* If you want to set more than one extra widget in the file
* chooser, you can a container such as a GtkVBox or a GtkTable
* and include your widgets in it. Then, set the container as
* the whole extra widget.
* <hr>
* Key Bindings
* Internally, GTK+ implements a file chooser's graphical user
* interface with the private
* GtkFileChooserDefaultClass. This
* widget has several key
* bindings and their associated signals. This section
* describes the available key binding signals.
* $(DDOC_COMMENT example)
* You can change these defaults to something else. For
* example, to add a Shift modifier to a few
* of the default bindings, you can include the following
* fragment in your .gtkrc-2.0 file:
* binding "my-own-gtkfilechooser-bindings" {
* bind "<Alt><Shift>Up" {
* "up-folder" ()
* }
* bind "<Alt><Shift>Down" {
* "down-folder" ()
* }
* bind "<Alt><Shift>Home" {
* "home-folder" ()
* }
* }
* class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings"
* The "GtkFileChooserDefault::location-popup" signal
* void user_function (GtkFileChooserDefault *chooser,
* const char *path,
* gpointer user_data);
* This is used to make the file chooser show a "Location"
* dialog which the user can use to manually type the name of
* the file he wishes to select. The
* path argument is a string that gets
* put in the text entry for the file name. By default this is bound to
* Control+L
* with a path string of "" (the empty
* string). It is also bound to / with a
* path string of "/"
* (a slash): this lets you type / and
* immediately type a path name. On Unix systems, this is bound to
* ~ (tilde) with a path string
* of "~" itself for access to home directories.
* chooser :
* the object which received the signal.
* path :
* default contents for the text entry for the file name
* user_data :
* user data set when the signal handler was connected.
* Note
* You can create your own bindings for the
* GtkFileChooserDefault::location-popup signal with custom
* path strings, and have a crude form
* of easily-to-type bookmarks. For example, say you access
* the path /home/username/misc very
* frequently. You could then create an Alt+M
* shortcut by including the following in your
* .gtkrc-2.0:
* binding "misc-shortcut" {
* bind "<Alt>M" {
* "location-popup" ("/home/username/misc")
* }
* }
* class "GtkFileChooserDefault" binding "misc-shortcut"
* The "GtkFileChooserDefault::up-folder" signal
* void user_function (GtkFileChooserDefault *chooser,
* gpointer user_data);
* This is used to make the file chooser go to the parent of
* the current folder in the file hierarchy. By default this
* is bound to Backspace and
* Alt+Up
* (the Up key in the numeric keypad also works).
* chooser :
* the object which received the signal.
* user_data :
* user data set when the signal handler was connected.
* The "GtkFileChooserDefault::down-folder" signal
* void user_function (GtkFileChooserDefault *chooser,
* gpointer user_data);
* This is used to make the file chooser go to a child of the
* current folder in the file hierarchy. The subfolder that
* will be used is displayed in the path bar widget of the file
* chooser. For example, if the path bar is showing
* "/foo/bar/baz", then this will cause
* the file chooser to switch to the "baz" subfolder. By
* default this is bound to
* Alt+Down
* (the Down key in the numeric keypad also works).
* chooser :
* the object which received the signal.
* user_data :
* user data set when the signal handler was connected.
* The "GtkFileChooserDefault::home-folder" signal
* void user_function (GtkFileChooserDefault *chooser,
* gpointer user_data);
* This is used to make the file chooser show the user's home
* folder in the file list. By default this is bound to
* Alt+Home
* (the Home key in the numeric keypad also works).
* chooser :
* the object which received the signal.
* user_data :
* user data set when the signal handler was connected.
* The "GtkFileChooserDefault::desktop-folder" signal
* void user_function (GtkFileChooserDefault *chooser,
* gpointer user_data);
* This is used to make the file chooser show the user's Desktop
* folder in the file list. By default this is bound to
* Alt+D.
* chooser :
* the object which received the signal.
* user_data :
* user data set when the signal handler was connected.
* The "GtkFileChooserDefault::quick-bookmark" signal
* void user_function (GtkFileChooserDefault *chooser,
* gint bookmark_index,
* gpointer user_data);
* This is used to make the file chooser switch to the bookmark
* specified in the bookmark_index parameter.
* For example, if you have three bookmarks, you can pass 0, 1, 2 to
* this signal to switch to each of them, respectively. By default this is bound to
* Alt+1,
* Alt+2,
* etc. until
* Alt+0. Note
* that in the default binding,
* that Alt+1 is
* actually defined to switch to the bookmark at index 0, and so on
* successively;
* Alt+0 is
* defined to switch to the bookmark at index 10.
* chooser :
* the object which received the signal.
* bookmark_indes :
* index of the bookmark to switch to; the indices start at 0.
* user_data :
* user data set when the signal handler was connected.
*/
public template FileChooserT(TStruct)
{
/** the main Gtk struct */
protected GtkFileChooser* gtkFileChooser;
public GtkFileChooser* getFileChooserTStruct()
{
return cast(GtkFileChooser*)getStruct();
}
/**
*/
int[string] connectedSignals;
GtkFileChooserConfirmation delegate(FileChooserIF)[] _onConfirmOverwriteListeners;
GtkFileChooserConfirmation delegate(FileChooserIF)[] onConfirmOverwriteListeners()
{
return _onConfirmOverwriteListeners;
}
/**
* This signal gets emitted whenever it is appropriate to present a
* confirmation dialog when the user has selected a file name that
* already exists. The signal only gets emitted when the file
* chooser is in GTK_FILE_CHOOSER_ACTION_SAVE mode.
* Most applications just need to turn on the
* "do-overwrite-confirmation" property (or call the
* gtk_file_chooser_set_do_overwrite_confirmation() function), and
* they will automatically get a stock confirmation dialog.
* Applications which need to customize this behavior should do
* that, and also connect to the "confirm-overwrite"
* signal.
* A signal handler for this signal must return a
* GtkFileChooserConfirmation value, which indicates the action to
* take. If the handler determines that the user wants to select a
* different filename, it should return
* GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN. If it determines
* that the user is satisfied with his choice of file name, it
* should return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME.
* On the other hand, if it determines that the stock confirmation
* dialog should be used, it should return
* GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example
* illustrates this.
* $(DDOC_COMMENT example)
*
* Since 2.8
*/
void addOnConfirmOverwrite(GtkFileChooserConfirmation delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("confirm-overwrite" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"confirm-overwrite",
cast(GCallback)&callBackConfirmOverwrite,
cast(void*)cast(FileChooserIF)this,
null,
connectFlags);
connectedSignals["confirm-overwrite"] = 1;
}
_onConfirmOverwriteListeners ~= dlg;
}
extern(C) static void callBackConfirmOverwrite(GtkFileChooser* chooserStruct, FileChooserIF fileChooserIF)
{
foreach ( GtkFileChooserConfirmation delegate(FileChooserIF) dlg ; fileChooserIF.onConfirmOverwriteListeners )
{
dlg(fileChooserIF);
}
}
void delegate(FileChooserIF)[] _onCurrentFolderChangedListeners;
void delegate(FileChooserIF)[] onCurrentFolderChangedListeners()
{
return _onCurrentFolderChangedListeners;
}
/**
* This signal is emitted when the current folder in a GtkFileChooser
* changes. This can happen due to the user performing some action that
* changes folders, such as selecting a bookmark or visiting a folder on the
* file list. It can also happen as a result of calling a function to
* explicitly change the current folder in a file chooser.
* Normally you do not need to connect to this signal, unless you need to keep
* track of which folder a file chooser is showing.
* See also: gtk_file_chooser_set_current_folder(),
* gtk_file_chooser_get_current_folder(),
* gtk_file_chooser_set_current_folder_uri(),
* gtk_file_chooser_get_current_folder_uri().
*/
void addOnCurrentFolderChanged(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("current-folder-changed" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"current-folder-changed",
cast(GCallback)&callBackCurrentFolderChanged,
cast(void*)cast(FileChooserIF)this,
null,
connectFlags);
connectedSignals["current-folder-changed"] = 1;
}
_onCurrentFolderChangedListeners ~= dlg;
}
extern(C) static void callBackCurrentFolderChanged(GtkFileChooser* chooserStruct, FileChooserIF fileChooserIF)
{
foreach ( void delegate(FileChooserIF) dlg ; fileChooserIF.onCurrentFolderChangedListeners )
{
dlg(fileChooserIF);
}
}
void delegate(FileChooserIF)[] _onFileActivatedListeners;
void delegate(FileChooserIF)[] onFileActivatedListeners()
{
return _onFileActivatedListeners;
}
/**
* This signal is emitted when the user "activates" a file in the file
* chooser. This can happen by double-clicking on a file in the file list, or
* by pressing Enter.
* Normally you do not need to connect to this signal. It is used internally
* by GtkFileChooserDialog to know when to activate the default button in the
* dialog.
* See also: gtk_file_chooser_get_filename(),
* gtk_file_chooser_get_filenames(), gtk_file_chooser_get_uri(),
* gtk_file_chooser_get_uris().
*/
void addOnFileActivated(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("file-activated" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"file-activated",
cast(GCallback)&callBackFileActivated,
cast(void*)cast(FileChooserIF)this,
null,
connectFlags);
connectedSignals["file-activated"] = 1;
}
_onFileActivatedListeners ~= dlg;
}
extern(C) static void callBackFileActivated(GtkFileChooser* chooserStruct, FileChooserIF fileChooserIF)
{
foreach ( void delegate(FileChooserIF) dlg ; fileChooserIF.onFileActivatedListeners )
{
dlg(fileChooserIF);
}
}
void delegate(FileChooserIF)[] _onSelectionChangedListeners;
void delegate(FileChooserIF)[] onSelectionChangedListeners()
{
return _onSelectionChangedListeners;
}
/**
* This signal is emitted when there is a change in the set of selected files
* in a GtkFileChooser. This can happen when the user modifies the selection
* with the mouse or the keyboard, or when explicitly calling functions to
* change the selection.
* Normally you do not need to connect to this signal, as it is easier to wait
* for the file chooser to finish running, and then to get the list of
* selected files using the functions mentioned below.
* See also: gtk_file_chooser_select_filename(),
* gtk_file_chooser_unselect_filename(), gtk_file_chooser_get_filename(),
* gtk_file_chooser_get_filenames(), gtk_file_chooser_select_uri(),
* gtk_file_chooser_unselect_uri(), gtk_file_chooser_get_uri(),
* gtk_file_chooser_get_uris().
*/
void addOnSelectionChanged(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("selection-changed" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"selection-changed",
cast(GCallback)&callBackSelectionChanged,
cast(void*)cast(FileChooserIF)this,
null,
connectFlags);
connectedSignals["selection-changed"] = 1;
}
_onSelectionChangedListeners ~= dlg;
}
extern(C) static void callBackSelectionChanged(GtkFileChooser* chooserStruct, FileChooserIF fileChooserIF)
{
foreach ( void delegate(FileChooserIF) dlg ; fileChooserIF.onSelectionChangedListeners )
{
dlg(fileChooserIF);
}
}
void delegate(FileChooserIF)[] _onUpdatePreviewListeners;
void delegate(FileChooserIF)[] onUpdatePreviewListeners()
{
return _onUpdatePreviewListeners;
}
/**
* This signal is emitted when the preview in a file chooser should be
* regenerated. For example, this can happen when the currently selected file
* changes. You should use this signal if you want your file chooser to have
* a preview widget.
* Once you have installed a preview widget with
* gtk_file_chooser_set_preview_widget(), you should update it when this
* signal is emitted. You can use the functions
* gtk_file_chooser_get_preview_filename() or
* gtk_file_chooser_get_preview_uri() to get the name of the file to preview.
* Your widget may not be able to preview all kinds of files; your callback
* must call gtk_file_chooser_set_preview_widget_active() to inform the file
* chooser about whether the preview was generated successfully or not.
* Please see the example code in the section called “Adding a Preview Widget”.
* See also: gtk_file_chooser_set_preview_widget(),
* gtk_file_chooser_set_preview_widget_active(),
* gtk_file_chooser_set_use_preview_label(),
* gtk_file_chooser_get_preview_filename(),
* gtk_file_chooser_get_preview_uri().
* See Also
* GtkFileChooserDialog, GtkFileChooserWidget, GtkFileChooserButton
*/
void addOnUpdatePreview(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("update-preview" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"update-preview",
cast(GCallback)&callBackUpdatePreview,
cast(void*)cast(FileChooserIF)this,
null,
connectFlags);
connectedSignals["update-preview"] = 1;
}
_onUpdatePreviewListeners ~= dlg;
}
extern(C) static void callBackUpdatePreview(GtkFileChooser* chooserStruct, FileChooserIF fileChooserIF)
{
foreach ( void delegate(FileChooserIF) dlg ; fileChooserIF.onUpdatePreviewListeners )
{
dlg(fileChooserIF);
}
}
/**
* Sets the type of operation that the chooser is performing; the
* user interface is adapted to suit the selected action. For example,
* an option to create a new folder might be shown if the action is
* GTK_FILE_CHOOSER_ACTION_SAVE but not if the action is
* GTK_FILE_CHOOSER_ACTION_OPEN.
* Since 2.4
* Params:
* action = the action that the file selector is performing
*/
public void setFileChooserAction(GtkFileChooserAction action)
{
// void gtk_file_chooser_set_action (GtkFileChooser *chooser, GtkFileChooserAction action);
gtk_file_chooser_set_action(getFileChooserTStruct(), action);
}
/**
* Gets the type of operation that the file chooser is performing; see
* gtk_file_chooser_set_action().
* Since 2.4
* Returns: the action that the file selector is performing
*/
public GtkFileChooserAction getFileChooserAction()
{
// GtkFileChooserAction gtk_file_chooser_get_action (GtkFileChooser *chooser);
return gtk_file_chooser_get_action(getFileChooserTStruct());
}
/**
* Sets whether only local files can be selected in the
* file selector. If local_only is TRUE (the default),
* then the selected file are files are guaranteed to be
* accessible through the operating systems native file
* file system and therefore the application only
* needs to worry about the filename functions in
* GtkFileChooser, like gtk_file_chooser_get_filename(),
* rather than the URI functions like
* gtk_file_chooser_get_uri(),
* Since 2.4
* Params:
* localOnly = TRUE if only local files can be selected
*/
public void setLocalOnly(int localOnly)
{
// void gtk_file_chooser_set_local_only (GtkFileChooser *chooser, gboolean local_only);
gtk_file_chooser_set_local_only(getFileChooserTStruct(), localOnly);
}
/**
* Gets whether only local files can be selected in the
* file selector. See gtk_file_chooser_set_local_only()
* Since 2.4
* Returns: TRUE if only local files can be selected.
*/
public int getLocalOnly()
{
// gboolean gtk_file_chooser_get_local_only (GtkFileChooser *chooser);
return gtk_file_chooser_get_local_only(getFileChooserTStruct());
}
/**
* Sets whether multiple files can be selected in the file selector. This is
* only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN or
* GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
* Since 2.4
* Params:
* selectMultiple = TRUE if multiple files can be selected.
*/
public void setSelectMultiple(int selectMultiple)
{
// void gtk_file_chooser_set_select_multiple (GtkFileChooser *chooser, gboolean select_multiple);
gtk_file_chooser_set_select_multiple(getFileChooserTStruct(), selectMultiple);
}
/**
* Gets whether multiple files can be selected in the file
* selector. See gtk_file_chooser_set_select_multiple().
* Since 2.4
* Returns: TRUE if multiple files can be selected.
*/
public int getSelectMultiple()
{
// gboolean gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser);
return gtk_file_chooser_get_select_multiple(getFileChooserTStruct());
}
/**
* Sets whether hidden files and folders are displayed in the file selector.
* Since 2.6
* Params:
* showHidden = TRUE if hidden files and folders should be displayed.
*/
public void setShowHidden(int showHidden)
{
// void gtk_file_chooser_set_show_hidden (GtkFileChooser *chooser, gboolean show_hidden);
gtk_file_chooser_set_show_hidden(getFileChooserTStruct(), showHidden);
}
/**
* Gets whether hidden files and folders are displayed in the file selector.
* See gtk_file_chooser_set_show_hidden().
* Since 2.6
* Returns: TRUE if hidden files and folders are displayed.
*/
public int getShowHidden()
{
// gboolean gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser);
return gtk_file_chooser_get_show_hidden(getFileChooserTStruct());
}
/**
* Sets whether a file chooser in GTK_FILE_CHOOSER_ACTION_SAVE mode will present
* a confirmation dialog if the user types a file name that already exists. This
* is FALSE by default.
* Regardless of this setting, the chooser will emit the
* "confirm-overwrite" signal when appropriate.
* 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; please refer to its documentation
* for the details.
* Since 2.8
* Params:
* doOverwriteConfirmation = whether to confirm overwriting in save mode
*/
public void setDoOverwriteConfirmation(int doOverwriteConfirmation)
{
// void gtk_file_chooser_set_do_overwrite_confirmation (GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
gtk_file_chooser_set_do_overwrite_confirmation(getFileChooserTStruct(), doOverwriteConfirmation);
}
/**
* Queries whether a file chooser is set to confirm for overwriting when the user
* types a file name that already exists.
* Since 2.8
* Returns: TRUE if the file chooser will present a confirmation dialog; FALSE otherwise.
*/
public int getDoOverwriteConfirmation()
{
// gboolean gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser);
return gtk_file_chooser_get_do_overwrite_confirmation(getFileChooserTStruct());
}
/**
* Sets whether file choser will offer to create new folders.
* This is only relevant if the action is not set to be
* GTK_FILE_CHOOSER_ACTION_OPEN.
* Since 2.18
* Params:
* createFolders = TRUE if the New Folder button should be displayed
*/
public void setCreateFolders(int createFolders)
{
// void gtk_file_chooser_set_create_folders (GtkFileChooser *chooser, gboolean create_folders);
gtk_file_chooser_set_create_folders(getFileChooserTStruct(), createFolders);
}
/**
* Gets whether file choser will offer to create new folders.
* See gtk_file_chooser_set_create_folders().
* Since 2.18
* Returns: TRUE if the New Folder button should be displayed.
*/
public int getCreateFolders()
{
// gboolean gtk_file_chooser_get_create_folders (GtkFileChooser *chooser);
return gtk_file_chooser_get_create_folders(getFileChooserTStruct());
}
/**
* Sets the current name in the file selector, as if entered
* by the user. Note that the name passed in here is a UTF-8
* string rather than a filename. This function is meant for
* such uses as a suggested name in a "Save As..." dialog.
* If you want to preselect a particular existing file, you should use
* gtk_file_chooser_set_filename() or gtk_file_chooser_set_uri() instead.
* Please see the documentation for those functions for an example of using
* gtk_file_chooser_set_current_name() as well.
* Since 2.4
* Params:
* name = the filename to use, as a UTF-8 string
*/
public void setCurrentName(string name)
{
// void gtk_file_chooser_set_current_name (GtkFileChooser *chooser, const gchar *name);
gtk_file_chooser_set_current_name(getFileChooserTStruct(), Str.toStringz(name));
}
/**
* Gets the filename for the currently selected file in
* the file selector. If multiple files are selected,
* one of the filenames will be returned at random.
* If the file chooser is in folder mode, this function returns the selected
* folder.
* Since 2.4
* Returns: The currently selected filename, or NULL if no file is selected, or the selected file can't be represented with a local filename. Free with g_free().
*/
public string getFilename()
{
// gchar * gtk_file_chooser_get_filename (GtkFileChooser *chooser);
return Str.toString(gtk_file_chooser_get_filename(getFileChooserTStruct()));
}
/**
* Sets filename as the current filename for the file chooser, by changing
* to the file's parent folder and actually selecting the file in list. If
* the chooser is in GTK_FILE_CHOOSER_ACTION_SAVE mode, the file's base name
* will also appear in the dialog's file name entry.
* If the file name isn't in the current folder of chooser, then the current
* folder of chooser will be changed to the folder containing filename. This
* is equivalent to a sequence of gtk_file_chooser_unselect_all() followed by
* gtk_file_chooser_select_filename().
* Note that the file must exist, or nothing will be done except
* for the directory change.
* If you are implementing a File/Save As... dialog,
* you should use this function if you already have a file name to which the
* user may save; for example, when the user opens an existing file and then
* does File/Save As... on it. If you don't have
* a file name already — for example, if the user just created a new
* file and is saving it for the first time, do not call this function.
* Since 2.4
* Params:
* filename = the filename to set as current
* Returns: TRUE if both the folder could be changed and the file was selected successfully, FALSE otherwise.
*/
public int setFilename(string filename)
{
// gboolean gtk_file_chooser_set_filename (GtkFileChooser *chooser, const char *filename);
return gtk_file_chooser_set_filename(getFileChooserTStruct(), Str.toStringz(filename));
}
/**
* Selects a filename. If the file name isn't in the current
* folder of chooser, then the current folder of chooser will
* be changed to the folder containing filename.
* Since 2.4
* Params:
* filename = the filename to select
* Returns: TRUE if both the folder could be changed and the file was selected successfully, FALSE otherwise.
*/
public int selectFilename(string filename)
{
// gboolean gtk_file_chooser_select_filename (GtkFileChooser *chooser, const char *filename);
return gtk_file_chooser_select_filename(getFileChooserTStruct(), Str.toStringz(filename));
}
/**
* Unselects a currently selected filename. If the filename
* is not in the current directory, does not exist, or
* is otherwise not currently selected, does nothing.
* Since 2.4
* Params:
* filename = the filename to unselect
*/
public void unselectFilename(string filename)
{
// void gtk_file_chooser_unselect_filename (GtkFileChooser *chooser, const char *filename);
gtk_file_chooser_unselect_filename(getFileChooserTStruct(), Str.toStringz(filename));
}
/**
* Selects all the files in the current folder of a file chooser.
* Since 2.4
*/
public void selectAll()
{
// void gtk_file_chooser_select_all (GtkFileChooser *chooser);
gtk_file_chooser_select_all(getFileChooserTStruct());
}
/**
* Unselects all the files in the current folder of a file chooser.
* Since 2.4
*/
public void unselectAll()
{
// void gtk_file_chooser_unselect_all (GtkFileChooser *chooser);
gtk_file_chooser_unselect_all(getFileChooserTStruct());
}
/**
* Lists all the selected files and subfolders in the current folder of
* chooser. The returned names are full absolute paths. If files in the current
* folder cannot be represented as local filenames they will be ignored. (See
* gtk_file_chooser_get_uris())
* Since 2.4
* Returns: a GSList containing the filenames of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free(). [element-type utf8][transfer full utf8]
*/
public ListSG getFilenames()
{
// GSList * gtk_file_chooser_get_filenames (GtkFileChooser *chooser);
auto p = gtk_file_chooser_get_filenames(getFileChooserTStruct());
if(p is null)
{
return null;
}
return new ListSG(cast(GSList*) p);
}
/**
* Sets the current folder for chooser 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.
* Since 2.4
* Params:
* filename = the full path of the new current folder
* Returns: TRUE if the folder could be changed successfully, FALSE otherwise.
*/
public int setCurrentFolder(string filename)
{
// gboolean gtk_file_chooser_set_current_folder (GtkFileChooser *chooser, const gchar *filename);
return gtk_file_chooser_set_current_folder(getFileChooserTStruct(), Str.toStringz(filename));
}
/**
* Gets the current folder of chooser as a local filename.
* See gtk_file_chooser_set_current_folder().
* Note that this is the folder that the file chooser is currently displaying
* (e.g. "/home/username/Documents"), which is not the same
* as the currently-selected folder if the chooser is in
* GTK_FILE_CHOOSER_SELECT_FOLDER mode
* (e.g. "/home/username/Documents/selected-folder/". To get the
* currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
* usual way to get the selection.
* Since 2.4
* Returns: the full path of the current folder, or NULL if the current path cannot be represented as a local filename. Free with g_free(). This function will also return NULL if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling gtk_file_chooser_set_current_folder() on a nonexistent folder.
*/
public string getCurrentFolder()
{
// gchar * gtk_file_chooser_get_current_folder (GtkFileChooser *chooser);
return Str.toString(gtk_file_chooser_get_current_folder(getFileChooserTStruct()));
}
/**
* Gets the URI for the currently selected file in
* the file selector. If multiple files are selected,
* one of the filenames will be returned at random.
* If the file chooser is in folder mode, this function returns the selected
* folder.
* Since 2.4
* Returns: The currently selected URI, or NULL if no file is selected. Free with g_free()
*/
public string getUri()
{
// gchar * gtk_file_chooser_get_uri (GtkFileChooser *chooser);
return Str.toString(gtk_file_chooser_get_uri(getFileChooserTStruct()));
}
/**
* Sets the file referred to by uri as the current file for the file chooser,
* by changing to the URI's parent folder and actually selecting the URI in the
* list. If the chooser is GTK_FILE_CHOOSER_ACTION_SAVE mode, the URI's base
* name will also appear in the dialog's file name entry.
* If the URI isn't in the current folder of chooser, then the current folder
* of chooser will be changed to the folder containing uri. This is equivalent
* to a sequence of gtk_file_chooser_unselect_all() followed by
* gtk_file_chooser_select_uri().
* Note that the URI must exist, or nothing will be done except for the
* directory change.
* If you are implementing a File/Save As... dialog,
* you should use this function if you already have a file name to which the
* user may save; for example, when the user opens an existing file and then
* does File/Save As... on it. If you don't have
* a file name already — for example, if the user just created a new
* file and is saving it for the first time, do not call this function.
* Since 2.4
* Params:
* uri = the URI to set as current
* Returns: TRUE if both the folder could be changed and the URI was selected successfully, FALSE otherwise.
*/
public int setUri(string uri)
{
// gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser, const char *uri);
return gtk_file_chooser_set_uri(getFileChooserTStruct(), Str.toStringz(uri));
}
/**
* Selects the file to by uri. If the URI doesn't refer to a
* file in the current folder of chooser, then the current folder of
* chooser will be changed to the folder containing filename.
* Since 2.4
* Params:
* uri = the URI to select
* Returns: TRUE if both the folder could be changed and the URI was selected successfully, FALSE otherwise.
*/
public int selectUri(string uri)
{
// gboolean gtk_file_chooser_select_uri (GtkFileChooser *chooser, const char *uri);
return gtk_file_chooser_select_uri(getFileChooserTStruct(), Str.toStringz(uri));
}
/**
* Unselects the file referred to by uri. If the file
* is not in the current directory, does not exist, or
* is otherwise not currently selected, does nothing.
* Since 2.4
* Params:
* uri = the URI to unselect
*/
public void unselectUri(string uri)
{
// void gtk_file_chooser_unselect_uri (GtkFileChooser *chooser, const char *uri);
gtk_file_chooser_unselect_uri(getFileChooserTStruct(), Str.toStringz(uri));
}
/**
* Lists all the selected files and subfolders in the current folder of
* chooser. The returned names are full absolute URIs.
* Since 2.4
* Returns: a GSList containing the URIs of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free(). [element-type utf8][transfer full utf8]
*/
public ListSG getUris()
{
// GSList * gtk_file_chooser_get_uris (GtkFileChooser *chooser);
auto p = gtk_file_chooser_get_uris(getFileChooserTStruct());
if(p is null)
{
return null;
}
return new ListSG(cast(GSList*) p);
}
/**
* Sets the current folder for chooser from an URI.
* The user will be shown the full contents of the current folder,
* plus user interface elements for navigating to other folders.
* Since 2.4
* Params:
* uri = the URI for the new current folder
* Returns: TRUE if the folder could be changed successfully, FALSE otherwise.
*/
public int setCurrentFolderUri(string uri)
{
// gboolean gtk_file_chooser_set_current_folder_uri (GtkFileChooser *chooser, const gchar *uri);
return gtk_file_chooser_set_current_folder_uri(getFileChooserTStruct(), Str.toStringz(uri));
}
/**
* Gets the current folder of chooser as an URI.
* See gtk_file_chooser_set_current_folder_uri().
* Note that this is the folder that the file chooser is currently displaying
* (e.g. "file:///home/username/Documents"), which is not the same
* as the currently-selected folder if the chooser is in
* GTK_FILE_CHOOSER_SELECT_FOLDER mode
* (e.g. "file:///home/username/Documents/selected-folder/". To get the
* currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
* usual way to get the selection.
* Since 2.4
* Returns: the URI for the current folder. Free with g_free(). This function will also return NULL if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling gtk_file_chooser_set_current_folder_uri() on a nonexistent folder.
*/
public string getCurrentFolderUri()
{
// gchar * gtk_file_chooser_get_current_folder_uri (GtkFileChooser *chooser);
return Str.toString(gtk_file_chooser_get_current_folder_uri(getFileChooserTStruct()));
}