~ubuntu-branches/ubuntu/quantal/cairo-dock-plug-ins/quantal-201208191523

« back to all changes in this revision

Viewing changes to Dbus/demos/demo_bash/demo_bash.sh

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-10 00:05:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810000557-pfxoz5w7hbyclcqh
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614625)
* Fixed a few bugs on LP:
 - LP: #483963: Dustbin applet does not display trashes on all volumes
 - LP: #485159: Some apps have problem with Systray
 - LP: #500677: ~/.xsession-errors is too much used by CD
 - LP: #500979: Shortcuts: the order gets messed up
 - LP: #521531: Mail: crashes on Maildir
 - LP: #519915: GTG: create a new applet to control GTG
 - LP: #526138: GMenu doesn't handle desktop file exec strings properly
 - LP: #531317: CMake: Added an error if the prefix of 'cairo-dock-plugins'
                 is not the same 'cairo-dock-core'
 - LP: #531319: CMake: check the version of 'cairo-dock' when building
                 'cairo-dock-plugins'
 - LP: #537115: Click at the position where icon lavel was, the icon
                 and dock still receive the event
 - LP: #537943: Terminal applet shortkey behaviour
 - LP: #538637: Trash applet doesn't create .trashinfo files on XFCE
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - cdbs is now used.
* debian/copyright:
 - Updated with the new applets
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev, libindicator-dev, libdbusmenu-glib-dev
   libido-0.1-dev, libical-dev, libdbusmenu-gtk-dev as Build-deps
 - Bump Standard-Version to 3.9.1
 - Wget is required for dnd2share applet
 - Added the exact realease for 'cairo-dock-dev' in order to prevent any
    build error if this package is not already available (thx to didrocks)
* debian/cairo-dock-plug-ins*.install:
 - All sonames are now installed into lib32 or lib64 (lib*)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# This is a part of the external demo applet for Cairo-Dock
 
4
#
 
5
# Copyright : (C) 2010 by Nochka85
 
6
#                      modified by matttbe for the new API
 
7
#                      (based on the demo.py by Fabounet)
 
8
# E-mail : nochka85@glx-dock.org
 
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
# MERCHANTABILITY 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.py for cairo-dock
 
23
### Author : Nochka85
 
24
### Contact : nochka85@glx-dock.org
 
25
### Rev : 21/01/2010
 
26
 
 
27
DBUS_NAME="org.cairodock.CairoDock"
 
28
DBUS_PATH="/org/cairodock/CairoDock"
 
29
DBUS_INTERFACE="org.cairodock.CairoDock"
 
30
COMMAND=$0
 
31
SCRIPT_NAME=`basename $COMMAND`
 
32
APP_NAME="`echo $SCRIPT_NAME | cut -f1 -d '.' `"
 
33
ACTION=$1
 
34
DROP_DATA=$2
 
35
MENU_SELECT=$2
 
36
SCROLL_UP=$2
 
37
CONF_FILE="/home/$USER/.config/cairo-dock/current_theme/plug-ins/$APP_NAME/$APP_NAME.conf"
 
38
 
 
39
#############################################################################################################
 
40
get_conf_param() {
 
41
LIGNE=`cat $CONF_FILE | grep "$1"`
 
42
PARAM="`echo $LIGNE | cut -f2 -d '=' `"
 
43
}
 
44
 
 
45
#############################################################################################################
 
46
get_ALL_conf_params() {
 
47
 
 
48
get_conf_param "demo_text"
 
49
demo_text="$PARAM"
 
50
 
 
51
get_conf_param "demo_truefalse"
 
52
demo_truefalse="$PARAM"
 
53
 
 
54
get_conf_param "demo_value"
 
55
demo_value="$PARAM"
 
56
 
 
57
}
 
58
 
 
59
#############################################################################################################
 
60
action_on_click() {
 
61
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Left clic !"
 
62
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Left clic !" int32:2
 
63
 
 
64
exit
 
65
}
 
66
 
 
67
#############################################################################################################
 
68
action_on_middle_click() {
 
69
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Middle clic !"
 
70
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Middle clic !" int32:2
 
71
 
 
72
exit
 
73
}
 
74
 
 
75
#############################################################################################################
 
76
action_on_scroll_icon() {
 
77
if [ $SCROLL_UP -eq "0" ]; then
 
78
        echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Scroll UP !"
 
79
        dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Scroll UP!" int32:1
 
80
else
 
81
        echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Scroll DOWN !"
 
82
        dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Scroll DOWN!" int32:1
 
83
fi
 
84
 
 
85
exit
 
86
}
 
87
 
 
88
#############################################################################################################
 
89
action_on_drop_data() {
 
90
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> $DROP_DATA has been dropped on applet !"
 
91
 
 
92
 
 
93
if [ "`echo $DROP_DATA |grep 'file://'`" != "" ]; then  # It's a file !
 
94
        DROP_DATA="`echo $DROP_DATA | cut -c 8-`"  # we remove 'file://' before the location
 
95
        dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"FILE : $DROP_DATA has been dropped on applet !" int32:4
 
96
else    # It's an URL !
 
97
        dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"URL : $DROP_DATA has been dropped on applet !" int32:4     # we keep the 'http://' in the name
 
98
fi
 
99
 
 
100
exit
 
101
}
 
102
 
 
103
#############################################################################################################
 
104
action_on_init() {
 
105
get_ALL_conf_params
 
106
 
 
107
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_text in config is : $demo_text"
 
108
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_truefalse in config is : $demo_truefalse"
 
109
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_value in config is : $demo_value"
 
110
 
 
111
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Our module is started"
 
112
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"I'm connected to Cairo-Dock !" int32:4
 
113
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.SetQuickInfo string:"123"
 
114
 
 
115
exit
 
116
}
 
117
 
 
118
#############################################################################################################
 
119
action_on_stop() {
 
120
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Our module is stopped"
 
121
 
 
122
exit
 
123
}
 
124
 
 
125
#############################################################################################################
 
126
action_on_reload() {
 
127
get_ALL_conf_params
 
128
 
 
129
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_text in config is : $demo_text"
 
130
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_truefalse in config is : $demo_truefalse"
 
131
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> The demo_value in config is : $demo_value"
 
132
 
 
133
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Our module is reloaded"
 
134
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Our module is reloaded" int32:2
 
135
 
 
136
exit
 
137
}
 
138
 
 
139
#############################################################################################################
 
140
action_on_build_menu() {
 
141
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Build menu !"
 
142
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.PopulateMenu array:string:"choice 0","choice 1"
 
143
 
 
144
exit
 
145
}
 
146
 
 
147
#############################################################################################################
 
148
action_on_menu_select() {
 
149
echo "$APP_NAME applet -> Script Name : $SCRIPT_NAME -> Choice $MENU_SELECT has been selected !"
 
150
dbus-send --session --dest=$DBUS_NAME $DBUS_PATH/$APP_NAME $DBUS_INTERFACE.applet.ShowDialog string:"Choice $MENU_SELECT has been selected !" int32:4
 
151
 
 
152
exit
 
153
}
 
154
 
 
155
#############################################################################################################
 
156
# START ### DO NOT CHANGE THIS SECTION
 
157
#############################################################################################################
 
158
 
 
159
if [ "`echo $ACTION |grep 'register_the_applet'`" != "" ]; then
 
160
        register_the_applet
 
161
elif [ "`echo $ACTION |grep 'action_on_click'`" != "" ]; then
 
162
        action_on_click
 
163
elif [ "`echo $ACTION |grep 'action_on_middle_click'`" != "" ]; then
 
164
        action_on_middle_click
 
165
elif [ "`echo $ACTION |grep 'action_on_scroll_icon'`" != "" ]; then
 
166
        action_on_scroll_icon
 
167
elif [ "`echo $ACTION |grep 'action_on_drop_data'`" != "" ]; then
 
168
        action_on_drop_data
 
169
elif [ "`echo $ACTION |grep 'action_on_init'`" != "" ]; then
 
170
        action_on_init
 
171
elif [ "`echo $ACTION |grep 'action_on_stop'`" != "" ]; then
 
172
        action_on_stop
 
173
elif [ "`echo $ACTION |grep 'action_on_reload'`" != "" ]; then
 
174
        action_on_reload
 
175
elif [ "`echo $ACTION |grep 'action_on_build_menu'`" != "" ]; then
 
176
        action_on_build_menu
 
177
elif [ "`echo $ACTION |grep 'action_on_menu_select'`" != "" ]; then
 
178
        action_on_menu_select
 
179
fi
 
180
 
 
181
exit
 
182