Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox.control.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2542 - (show annotations) (download)
Wed Sep 16 10:29:20 2015 UTC (8 years, 8 months ago) by niro
File size: 2382 byte(s)
-delete all menuitem before regen all
1 # $Id$
2
3 help_fluxbox_menuitem()
4 {
5 local serial="${CLASS_ARGV[0]}"
6 control_client "${serial}" help fluxbox.menuitem
7 }
8
9 set_fluxbox_menuitem()
10 {
11 local serial="${CLASS_ARGV[0]}"
12 local action="${CLASS_ARGV[1]}"
13 local name="${CLASS_ARGV[2]}"
14 local exec="${CLASS_ARGV[3]}"
15 local workdir="${CLASS_ARGV[4]}"
16 local icon="${CLASS_ARGV[5]}"
17 local id
18
19 case "${action}" in
20 add)
21 id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';")
22 if [[ -n ${id} ]]
23 then
24 mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}' where id=${id};"
25 else
26 mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon) values('${serial}','${name}','${exec}','${workdir}','${icon}');"
27 fi
28 ;;
29 del)
30 if [[ -n ${name} ]]
31 then
32 mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';"
33 else
34 mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}';"
35 fi
36 ;;
37 esac
38 }
39
40 control_fluxbox_menuitem()
41 {
42 local serial="${CLASS_ARGV[0]}"
43 local values
44 local id
45
46 # first delete all menuitems then regen all
47 control_client "${serial}" set fluxbox.menuitem del
48 values=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}';")
49 for id in ${values}
50 do
51 evaluate_table_xml cfg_fluxbox_menuitem "where serial='${serial}'"
52 if [[ -z ${cfg_fluxbox_menuitem_name} ]]
53 then
54 eecho "Name must not be empty id->'${id}'"
55 continue
56 fi
57 if [[ -z ${cfg_fluxbox_menuitem_exec} ]]
58 then
59 eecho "Exec must not be empty id->'${id}'"
60 continue
61 fi
62 control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}"
63 done
64 }
65
66 help_fluxbox_theme()
67 {
68 local serial="${CLASS_ARGV[0]}"
69 control_client "${serial}" help fluxbox.menuitem
70 }
71
72 set_fluxbox_theme()
73 {
74 local serial="${CLASS_ARGV[0]}"
75 local theme="${CLASS_ARGV[1]}"
76
77 import_resource cfg_fluxbox_theme "${serial}" theme "${theme}"
78 }
79
80 control_fluxbox_theme()
81 {
82 local serial="${CLASS_ARGV[0]}"
83 local value
84
85 value=$(mysqldo "select theme from cfg_fluxbox.menuitem where serial='${serial}'")
86 if [[ -z ${value} ]] || [[ ${value} = NULL ]]
87 then
88 decho "No theme retrieved"
89 else
90 control_client "${serial}" set fluxbox.theme "${value}"
91 fi
92 }