Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > 13f5dcef5358e9d5a2a5a1ae6baf28fc > files > 231

gtkdialog-0.8.3-1.mga5.x86_64.rpm

#!/bin/sh

GTKDIALOG=gtkdialog

TMPDIR=/tmp/gtkdialog/examples/"`basename $0`"
mkdir -p "$TMPDIR"

funcbtnCreate() {
	echo '<button image-position="'$3'">
			<label>"'"$2"'"</label>
			<input file stock="'$4'"></input>
			<action>echo "'"$5"' '$1'"</action>
			<action function="'"$6"'">'$1'</action>
		</button>'
}

funcscaType0Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'" range-value="4">
			<variable>'$1'</variable>
			<action>echo "'$1' changed to $'$1'"</action>
		</'$2'scale>
		<'$2'separator></'$2'separator>'
}

funcscaType1Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'"
			range-min="0" range-max="1" range-step="0.1"
			value-pos="3" digits="2" inverted="true">
			<default>0.20</default>
			<variable>'$1'</variable>
			<action>echo "'$1' changed to $'$1'"</action>
			<item>"0.25 | '$5'"</item>
			<item>"0.5  | '$6'"</item>
			<item>"0.75 | '$7'"</item>
		</'$2'scale>
		<'$2'separator></'$2'separator>'
}

funcscaType2Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'"
			range-min="0" range-max="255" range-step="8" value-pos="1"
			block-function-signals="true">
			<variable>'$1'</variable>
			<input>echo 18</input>
			<action>echo "'$1' changed to $'$1'"</action>
			<item>"64 |'$5'|<span fgcolor='"'white'"' bgcolor='"'darkred'"'> 64 </span>"</item>
			<item>"128|'$6'|<span fgcolor='"'white'"' bgcolor='"'darkgreen'"'> 128 </span>"</item>
			<item>"192|'$7'|<span fgcolor='"'white'"' bgcolor='"'darkblue'"'> 192 </span>"</item>
			<output file>'"$TMPDIR"'/outputfile</output>
		</'$2'scale>
		<'$2'box homogeneous="true">
			'"`funcbtnCreate $1 Disable $8 gtk-no Disabling disable`"'
			'"`funcbtnCreate $1 Enable $8 gtk-yes Enabling enable`"'
			'"`funcbtnCreate $1 Refresh $8 gtk-refresh Reloading refresh`"'
			'"`funcbtnCreate $1 Save $8 gtk-save Saving save`"'
		</'$2'box>
		<'$2'separator></'$2'separator>'
}

funcscaType3Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'"
			range-min="0" range-max="123" range-step="1"
			draw-value="false" show-fill-level="true" fill-level="56"
			restrict-to-fill-level="true" update-policy="1">
			<variable>'$1'</variable>
			<input file>'"$TMPDIR"'/inputfile</input>
			<action signal="value_changed">echo "'$1' changed to $'$1'"</action>
			<output file>'"$TMPDIR"'/outputfile</output>
		</'$2'scale>
		<'$2'box homogeneous="true">
			'"`funcbtnCreate $1 Disable $5 gtk-no Disabling disable`"'
			'"`funcbtnCreate $1 Enable $5 gtk-yes Enabling enable`"'
			'"`funcbtnCreate $1 Refresh $5 gtk-refresh Reloading refresh`"'
			'"`funcbtnCreate $1 Save $5 gtk-save Saving save`"'
		</'$2'box>'
}

if [ ! -f "$TMPDIR"/inputfile ]; then
	echo "44" > "$TMPDIR"/inputfile
fi

MAIN_DIALOG='
<window title="VScale Advanced" resizable="false">
	<vbox>
		<hbox>
			<frame vscale widget>
				<hbox>
					'"`funcscaType0Create vscVScale0 v 50 410`"'
					'"`funcscaType1Create vscVScale1 v 50 410 1 1 1`"'
					'"`funcscaType2Create vscVScale2 v -1 410 0 1 0 2`"'
					'"`funcscaType3Create vscVScale3 v 50 410 2`"'
				</hbox>
			</frame>
		</hbox>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac