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