Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2532 by niro, Wed Sep 16 07:51:43 2015 UTC revision 2576 by niro, Thu Sep 17 10:45:21 2015 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3    push_config 80_fluxbox_menuitem
4    
5  help_fluxbox_menuitem()  help_fluxbox_menuitem()
6  {  {
7   local serial="${CLASS_ARGV[0]}"   local serial="${CLASS_ARGV[0]}"
# Line 14  set_fluxbox_menuitem() Line 16  set_fluxbox_menuitem()
16   local exec="${CLASS_ARGV[3]}"   local exec="${CLASS_ARGV[3]}"
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
20     local enabled
21    
22   case "${action}" in   case "${action}" in
23   add) import_resource cfg_fluxbox_menuitem "${serial}" name "${name}" exec "${exec}" workdir "${workdir}" icon "${icon}" ;;   add) enabled=1 ;;
24   del)   del) enabled=0 ;;
25   if [[ -n ${name} ]]   *)
26   then   eecho "Unknown action '${action}'"
27   mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';"   return 1
  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_80_fluxbox_menuitem "${serial}"
50    }
51    
52    push_config_80_fluxbox_menuitem()
53    {
54     local serial="$1"
55   local values   local values
56   local id   local id
57    
# Line 43  control_fluxbox_menuitem() Line 64  control_fluxbox_menuitem()
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 fluxbox.menitem "${serial}" "${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    
# Line 69  set_fluxbox_theme() Line 101  set_fluxbox_theme()
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}'")

Legend:
Removed from v.2532  
changed lines
  Added in v.2576