1 |
# $Id$ |
# $Id$ |
2 |
|
|
3 |
|
push_config fluxbox_menuitem |
4 |
|
|
5 |
help_fluxbox_menuitem() |
help_fluxbox_menuitem() |
6 |
{ |
{ |
7 |
local serial="${CLASS_ARGV[0]}" |
local serial="${CLASS_ARGV[0]}" |
17 |
local workdir="${CLASS_ARGV[4]}" |
local workdir="${CLASS_ARGV[4]}" |
18 |
local icon="${CLASS_ARGV[5]}" |
local icon="${CLASS_ARGV[5]}" |
19 |
local id |
local id |
20 |
|
local enabled |
21 |
|
|
22 |
case "${action}" in |
case "${action}" in |
23 |
add) id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';") |
add) enabled=1 ;; |
24 |
if [[ -n ${id} ]] |
del) enabled=0 ;; |
25 |
then |
*) |
26 |
mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}' where id=${id};" |
eecho "Unknown action '${action}'" |
27 |
else |
return 1 |
|
mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon) values('${serial}','${name}','${exec}','${workdir}','${icon}');" |
|
|
fi |
|
|
;; |
|
|
del) |
|
|
if [[ -n ${name} ]] |
|
|
then |
|
|
mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';" |
|
|
else |
|
|
mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}';" |
|
|
fi |
|
28 |
;; |
;; |
29 |
esac |
esac |
30 |
|
|
31 |
|
id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';") |
32 |
|
if [[ -n ${id} ]] |
33 |
|
then |
34 |
|
mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}', enabled='${enabled}' where id=${id};" |
35 |
|
else |
36 |
|
mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon,enabled) values('${serial}','${name}','${exec}','${workdir}','${icon}','${enabled}');" |
37 |
|
fi |
38 |
} |
} |
39 |
|
|
40 |
control_fluxbox_menuitem() |
control_fluxbox_menuitem() |
41 |
{ |
{ |
42 |
local serial="${CLASS_ARGV[0]}" |
local serial="${CLASS_ARGV[0]}" |
43 |
|
push_config_fluxbox_menuitem "${serial}" |
44 |
|
} |
45 |
|
|
46 |
|
push_config_fluxbox_menuitem() |
47 |
|
{ |
48 |
|
local serial="$1" |
49 |
local values |
local values |
50 |
local id |
local id |
51 |
|
|
58 |
eecho "Name must not be empty id->'${id}'" |
eecho "Name must not be empty id->'${id}'" |
59 |
continue |
continue |
60 |
fi |
fi |
61 |
if [[ -z ${cfg_fluxbox_menuitem_exec} ]] |
if [[ -z ${cfg_fluxbox_menuitem_enabled} ]] |
62 |
then |
then |
63 |
eecho "Exec must not be empty id->'${id}'" |
eecho "Enabled must not be empty id->'${id}'" |
64 |
continue |
continue |
65 |
fi |
fi |
66 |
control_client "${serial}" fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}" |
if [[ ${cfg_fluxbox_menuitem_enabled} = 1 ]] |
67 |
|
then |
68 |
|
control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}" |
69 |
|
elif [[ ${cfg_fluxbox_menuitem_enabled} = 0 ]] |
70 |
|
then |
71 |
|
control_client "${serial}" set fluxbox.menuitem del "${cfg_fluxbox_menuitem_name}" |
72 |
|
# remove from database too |
73 |
|
mysqldo "delete from cfg_fluxbox_menuitem where id='${id}';" |
74 |
|
else |
75 |
|
eecho "unknown enabled value id->'${id}', cfg_fluxbox_menuitem_enabled -> '${cfg_fluxbox_menuitem_enabled}'" |
76 |
|
return 1 |
77 |
|
fi |
78 |
done |
done |
79 |
} |
} |
80 |
|
|
95 |
control_fluxbox_theme() |
control_fluxbox_theme() |
96 |
{ |
{ |
97 |
local serial="${CLASS_ARGV[0]}" |
local serial="${CLASS_ARGV[0]}" |
98 |
|
push_config_fluxbox_theme "${serial}" |
99 |
|
} |
100 |
|
|
101 |
|
push_config_fluxbox_theme() |
102 |
|
{ |
103 |
|
local serial="$1" |
104 |
local value |
local value |
105 |
|
|
106 |
value=$(mysqldo "select theme from cfg_fluxbox.menuitem where serial='${serial}'") |
value=$(mysqldo "select theme from cfg_fluxbox.menuitem where serial='${serial}'") |