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) |
add) enabled=1 ;; |
24 |
id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';") |
del) enabled=0 ;; |
25 |
if [[ -n ${id} ]] |
*) |
26 |
then |
eecho "Unknown action '${action}'" |
27 |
mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}' where id=${id};" |
return 1 |
|
else |
|
|
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 |
|
if [[ -z ${name} ]] |
32 |
|
then |
33 |
|
eecho "No name given" |
34 |
|
return 1 |
35 |
|
fi |
36 |
|
|
37 |
|
id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';") |
38 |
|
if [[ -n ${id} ]] |
39 |
|
then |
40 |
|
mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}', enabled='${enabled}' where id=${id};" |
41 |
|
else |
42 |
|
mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon,enabled) values('${serial}','${name}','${exec}','${workdir}','${icon}','${enabled}');" |
43 |
|
fi |
44 |
} |
} |
45 |
|
|
46 |
control_fluxbox_menuitem() |
control_fluxbox_menuitem() |
47 |
{ |
{ |
48 |
local serial="${CLASS_ARGV[0]}" |
local serial="${CLASS_ARGV[0]}" |
49 |
|
push_config_fluxbox_menuitem "${serial}" |
50 |
|
} |
51 |
|
|
52 |
|
push_config_fluxbox_menuitem() |
53 |
|
{ |
54 |
|
local serial="$1" |
55 |
local values |
local values |
56 |
local id |
local id |
57 |
|
|
64 |
eecho "Name must not be empty id->'${id}'" |
eecho "Name must not be empty id->'${id}'" |
65 |
continue |
continue |
66 |
fi |
fi |
67 |
if [[ -z ${cfg_fluxbox_menuitem_exec} ]] |
if [[ -z ${cfg_fluxbox_menuitem_enabled} ]] |
68 |
then |
then |
69 |
eecho "Exec must not be empty id->'${id}'" |
eecho "Enabled must not be empty id->'${id}'" |
70 |
continue |
continue |
71 |
fi |
fi |
72 |
control_client "${serial}" set 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 ]] |
73 |
|
then |
74 |
|
control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}" |
75 |
|
elif [[ ${cfg_fluxbox_menuitem_enabled} = 0 ]] |
76 |
|
then |
77 |
|
control_client "${serial}" set fluxbox.menuitem del "${cfg_fluxbox_menuitem_name}" |
78 |
|
# remove from database too |
79 |
|
mysqldo "delete from cfg_fluxbox_menuitem where id='${id}';" |
80 |
|
else |
81 |
|
eecho "unknown enabled value id->'${id}', cfg_fluxbox_menuitem_enabled -> '${cfg_fluxbox_menuitem_enabled}'" |
82 |
|
return 1 |
83 |
|
fi |
84 |
done |
done |
85 |
} |
} |
86 |
|
|
101 |
control_fluxbox_theme() |
control_fluxbox_theme() |
102 |
{ |
{ |
103 |
local serial="${CLASS_ARGV[0]}" |
local serial="${CLASS_ARGV[0]}" |
104 |
|
push_config_fluxbox_theme "${serial}" |
105 |
|
} |
106 |
|
|
107 |
|
push_config_fluxbox_theme() |
108 |
|
{ |
109 |
|
local serial="$1" |
110 |
local value |
local value |
111 |
|
|
112 |
value=$(mysqldo "select theme from cfg_fluxbox.menuitem where serial='${serial}'") |
value=$(mysqldo "select theme from cfg_fluxbox.menuitem where serial='${serial}'") |