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 2535 by niro, Wed Sep 16 08:19:33 2015 UTC revision 2564 by niro, Thu Sep 17 09:40:02 2015 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3    push_config fluxbox_menuitem
4    
5  help_fluxbox_menuitem()  help_fluxbox_menuitem()
6  {  {
7   local serial="${CLASS_ARGV[0]}"   local serial="${CLASS_ARGV[0]}"
# Line 15  set_fluxbox_menuitem() Line 17  set_fluxbox_menuitem()
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   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) enabled=0 ;;
25   id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';")   *)
26   if [[ -n ${id} ]]   eecho "Unknown action '${action}'"
27   then   return 1
  mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}' where id=${id};"  
  else  
  mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon) values('${serial}','${name}','${exec}','${workdir}','${icon}');"  
  fi  
   
  del)  
  if [[ -n ${name} ]]  
  then  
  mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';"  
  else  
  mysqldo "delete from cfg_fluxbox_menuitem where serial='${serial}';"  
  fi  
28   ;;   ;;
29   esac   esac
30    
31     id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';")
32     if [[ -n ${id} ]]
33     then
34     mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}', enabled='${enabled}' where id=${id};"
35     else
36     mysqldo "insert into cfg_fluxbox_menuitem(serial,name,exec,workdir,icon,enabled) values('${serial}','${name}','${exec}','${workdir}','${icon}','${enabled}');"
37     fi
38  }  }
39    
40  control_fluxbox_menuitem()  control_fluxbox_menuitem()
41  {  {
42   local serial="${CLASS_ARGV[0]}"   local serial="${CLASS_ARGV[0]}"
43     push_config_fluxbox_menuitem "${serial}"
44    }
45    
46    push_config_fluxbox_menuitem()
47    {
48     local serial="$1"
49   local values   local values
50   local id   local id
51    
# Line 53  control_fluxbox_menuitem() Line 58  control_fluxbox_menuitem()
58   eecho "Name must not be empty id->'${id}'"   eecho "Name must not be empty id->'${id}'"
59   continue   continue
60   fi   fi
61   if [[ -z ${cfg_fluxbox_menuitem_exec} ]]   if [[ -z ${cfg_fluxbox_menuitem_enabled} ]]
62   then   then
63   eecho "Exec must not be empty id->'${id}'"   eecho "Enabled must not be empty id->'${id}'"
64   continue   continue
65   fi   fi
66   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 ]]
67     then
68     control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}"
69     elif [[ ${cfg_fluxbox_menuitem_enabled} = 0 ]]
70     then
71     control_client "${serial}" set fluxbox.menuitem del "${cfg_fluxbox_menuitem_name}"
72     # remove from database too
73     mysqldo "delete from cfg_fluxbox_menuitem where id='${id}';"
74     else
75     eecho "unknown enabled value id->'${id}', cfg_fluxbox_menuitem_enabled -> '${cfg_fluxbox_menuitem_enabled}'"
76     return 1
77     fi
78   done   done
79  }  }
80    
# Line 79  set_fluxbox_theme() Line 95  set_fluxbox_theme()
95  control_fluxbox_theme()  control_fluxbox_theme()
96  {  {
97   local serial="${CLASS_ARGV[0]}"   local serial="${CLASS_ARGV[0]}"
98     push_config_fluxbox_theme "${serial}"
99    }
100    
101    push_config_fluxbox_theme()
102    {
103     local serial="$1"
104   local value   local value
105    
106   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.2535  
changed lines
  Added in v.2564