-
Notifications
You must be signed in to change notification settings - Fork 7
/
chooser
executable file
·44 lines (40 loc) · 1.54 KB
/
chooser
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
#!/bin/sh
# Thunor: This widget is very limited in comparision to the fileselect
# action function so I can't recommend using it. It doesn't support any
# mode other than the default GTK_FILE_CHOOSER_ACTION_OPEN (file open)
# and as a result there's no access to a directory creation button and
# neither is there support for file filters.
#
# This widget was never documented and so this example fully explores
# its capabilities. Interestingly it supports a unique feature not used
# anywhere else within the project whereby instead of having a hardcoded
# selection of signals that the application developer chooses to connect
# to using <action signal="type">, the signal is instead specified by
# the application developer using <action when="type">.
[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog
MAIN_DIALOG='
<window title="Chooser Widget Example" resizable="false">
<vbox border-width="10">
<chooser>
<variable>CHOOSER</variable>
<default>/usr/share/doc</default>
<width>600</width>
<height>400</height>
<action when="confirm-overwrite">echo confirm-overwrite</action>
<action when="current-folder-changed">echo current-folder-changed</action>
<action when="file-activated">echo file-activated</action>
<action when="selection-changed">echo selection-changed</action>
<action when="update-preview">echo update-preview</action>
</chooser>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
export MAIN_DIALOG
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac