Annotation of /mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox.control.class.in
Parent Directory | Revision Log
Revision 2546 -
(hide annotations)
(download)
Wed Sep 16 11:16:27 2015 UTC (8 years, 7 months ago) by niro
File size: 2733 byte(s)
Wed Sep 16 11:16:27 2015 UTC (8 years, 7 months ago) by niro
File size: 2733 byte(s)
-fixed missing fi
1 | niro | 2532 | # $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 | niro | 2535 | local id |
18 | niro | 2545 | local enabled |
19 | niro | 2532 | |
20 | case "${action}" in | ||
21 | niro | 2545 | add) enabled=1 ;; |
22 | del) enabled=0 ;; | ||
23 | *) | ||
24 | eecho "Unknown action '${action}'" | ||
25 | return 1 | ||
26 | niro | 2536 | ;; |
27 | niro | 2532 | esac |
28 | niro | 2545 | |
29 | id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';") | ||
30 | if [[ -n ${id} ]] | ||
31 | then | ||
32 | mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}', enabled='${enabled}' where id=${id};" | ||
33 | else | ||
34 | mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon,enabled) values('${serial}','${name}','${exec}','${workdir}','${icon}','${enabled}');" | ||
35 | fi | ||
36 | niro | 2532 | } |
37 | |||
38 | control_fluxbox_menuitem() | ||
39 | { | ||
40 | local serial="${CLASS_ARGV[0]}" | ||
41 | local values | ||
42 | local id | ||
43 | |||
44 | values=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}';") | ||
45 | for id in ${values} | ||
46 | do | ||
47 | evaluate_table_xml cfg_fluxbox_menuitem "where serial='${serial}'" | ||
48 | if [[ -z ${cfg_fluxbox_menuitem_name} ]] | ||
49 | then | ||
50 | eecho "Name must not be empty id->'${id}'" | ||
51 | continue | ||
52 | fi | ||
53 | if [[ -z ${cfg_fluxbox_menuitem_exec} ]] | ||
54 | then | ||
55 | eecho "Exec must not be empty id->'${id}'" | ||
56 | continue | ||
57 | fi | ||
58 | niro | 2545 | if [[ -z ${cfg_fluxbox_menuitem_enabled} ]] |
59 | then | ||
60 | eecho "Enabled must not be empty id->'${id}'" | ||
61 | continue | ||
62 | fi | ||
63 | if [[ ${cfg_fluxbox_menuitem_enabled} = 1 ]] | ||
64 | then | ||
65 | control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}" | ||
66 | elif [[ ${cfg_fluxbox_menuitem_enabled} = 0 ]] | ||
67 | control_client "${serial}" set fluxbox.menuitem del "${cfg_fluxbox_menuitem_name}" | ||
68 | # remove from database too | ||
69 | mysqldo "delete from cfg_fluxbox_menuitem where id='${id}';" | ||
70 | else | ||
71 | eecho "unknown enabled value id->'${id}', cfg_fluxbox_menuitem_enabled -> '${cfg_fluxbox_menuitem_enabled}'" | ||
72 | return 1 | ||
73 | niro | 2546 | fi |
74 | niro | 2532 | done |
75 | } | ||
76 | |||
77 | help_fluxbox_theme() | ||
78 | { | ||
79 | local serial="${CLASS_ARGV[0]}" | ||
80 | control_client "${serial}" help fluxbox.menuitem | ||
81 | } | ||
82 | |||
83 | set_fluxbox_theme() | ||
84 | { | ||
85 | local serial="${CLASS_ARGV[0]}" | ||
86 | local theme="${CLASS_ARGV[1]}" | ||
87 | |||
88 | import_resource cfg_fluxbox_theme "${serial}" theme "${theme}" | ||
89 | } | ||
90 | |||
91 | control_fluxbox_theme() | ||
92 | { | ||
93 | local serial="${CLASS_ARGV[0]}" | ||
94 | local value | ||
95 | |||
96 | value=$(mysqldo "select theme from cfg_fluxbox.menuitem where serial='${serial}'") | ||
97 | if [[ -z ${value} ]] || [[ ${value} = NULL ]] | ||
98 | then | ||
99 | decho "No theme retrieved" | ||
100 | else | ||
101 | control_client "${serial}" set fluxbox.theme "${value}" | ||
102 | fi | ||
103 | } |