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