| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # This is a part of the external demo applets for Cairo-Dock |
| 4 | # |
| 5 | # Copyright : (C) 2010-2011 by Nochka85 |
| 6 | # modified by matttbe for the new API |
| 7 | # modified by Fabounet for the new interface |
| 8 | # E-mail : [email protected] |
| 9 | # |
| 10 | # |
| 11 | # This program is free software; you can redistribute it and/or |
| 12 | # modify it under the terms of the GNU General Public License |
| 13 | # as published by the Free Software Foundation; either version 2 |
| 14 | # of the License, or (at your option) any later version. |
| 15 | # |
| 16 | # This program is distributed in the hope that it will be useful, |
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | # ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | # GNU General Public License for more details. |
| 20 | # http://www.gnu.org/licenses/licenses.html#GPL |
| 21 | |
| 22 | ### This is a part of the external applet demo_bash for cairo-dock |
| 23 | ### Author : Nochka85 |
| 24 | ### Contact : [email protected] |
| 25 | ### Rev : 09/02/2011 |
| 26 | |
| 27 | . /usr/share/cairo-dock/plug-ins/Dbus/CDBashApplet.shscip-shell source . . `/usr/share/cairo-dock/plug-ins/Dbus/CDBashApplet.sh`. $* |
| 28 | |
| 29 | ############################################################################################################# |
| 30 | |
| 31 | get_configscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 get_config().() |
| 32 | { |
| 33 | demo_text=`get_conf_param "demo_text"` |
| 34 | |
| 35 | demo_truefalse=`get_conf_param "demo_truefalse"` |
| 36 | |
| 37 | demo_value=`get_conf_param "demo_value"` |
| 38 | } |
| 39 | |
| 40 | ############################################################################################################# |
| 41 | |
| 42 | on_clickscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 on_click().() |
| 43 | { |
| 44 | call ShowDialog "string:\"Left clic\"" "int32:2" |
| 45 | } |
| 46 | |
| 47 | on_middle_clickscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 on_middle_click().() |
| 48 | { |
| 49 | call ShowDialog "string:\"Middle clic\"" "int32:2" |
| 50 | } |
| 51 | |
| 52 | |
| 53 | on_scroll_iconscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 on_scroll_icon().() |
| 54 | { |
| 55 | i=0 |
| 56 | if [scip-shell system . . `[`. -f store ]; then |
| 57 | i=`catscip-shell system . . cat. store` |
| 58 | fi |
| 59 | if [scip-shell system . . `[`. $1 -eq 1 ]; then |
| 60 | let "i += 1" |
| 61 | else |
| 62 | let "i -= 1" |
| 63 | fi |
| 64 | call SetQuickInfo "string:$i" |
| 65 | echoscip-shell system . . echo. "$i" > store |
| 66 | } |
| 67 | |
| 68 | on_drop_datascip-shell shell cairo-dock-plug-ins 3.5.1-1.1 on_drop_data().() |
| 69 | { |
| 70 | if [scip-shell system . . `[`. "`echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. file://`" ]; then # It's a file ! |
| 71 | file="`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -c 8-`" # we remove 'file://' before the location |
| 72 | call ShowDialog "string:\"FILE : $file has been dropped on the applet\"" "int32:5" |
| 73 | else # It's an URL ! |
| 74 | call ShowDialog "string:\"URL : $1 has been dropped on the applet\"" "int32:5" # we keep the 'http://' in the name |
| 75 | fi |
| 76 | } |
| 77 | |
| 78 | on_build_menuscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 on_build_menu().() |
| 79 | { |
| 80 | call PopulateMenu "array:string:\"choice 0\",\"choice 1\"" |
| 81 | } |
| 82 | |
| 83 | on_menu_selectscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 on_menu_select().() |
| 84 | { |
| 85 | call ShowDialog "string:\"Choice $1 has been selected\"" "int32:4" |
| 86 | } |
| 87 | |
| 88 | ############################################################################################################# |
| 89 | |
| 90 | beginscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 begin().() |
| 91 | { |
| 92 | get_configscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 get_config(). |
| 93 | |
| 94 | echoscip-shell system . . echo. "from file $CONF_FILE:" |
| 95 | echoscip-shell system . . echo. "Param 'demo_text' in config is : $demo_text" |
| 96 | echoscip-shell system . . echo. "Param 'demo_truefalse' in config is : $demo_truefalse" |
| 97 | echoscip-shell system . . echo. "Param 'demo_value' in config is : $demo_value" |
| 98 | |
| 99 | call ShowDialog "string:\"I'm connected to Cairo-Dock \!\"" "int32:4" |
| 100 | call SetQuickInfo "string:0" |
| 101 | |
| 102 | echoscip-shell system . . echo. "0" > store |
| 103 | } |
| 104 | |
| 105 | endscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 end().() |
| 106 | { |
| 107 | rmscip-shell system . . rm. -f store |
| 108 | } |
| 109 | |
| 110 | reloadscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 reload().() |
| 111 | { |
| 112 | get_configscip-shell shell cairo-dock-plug-ins 3.5.1-1.1 get_config(). |
| 113 | |
| 114 | echoscip-shell system . . echo. "Param 'demo_text' in config is now : $demo_text" |
| 115 | echoscip-shell system . . echo. "Param 'demo_truefalse' in config is now : $demo_truefalse" |
| 116 | echoscip-shell system . . echo. "Param 'demo_value' in config is now : $demo_value" |
| 117 | |
| 118 | call ShowDialog "string:\"Our module is reloaded\"" "int32:2" |
| 119 | } |
| 120 | |
| 121 | ############################################################################################################# |
| 122 | |
| 123 | run $* |
| 124 | |
| 125 | exit 0 |