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 2542 by niro, Wed Sep 16 10:29:20 2015 UTC revision 2545 by niro, Wed Sep 16 10:54:19 2015 UTC
# Line 15  set_fluxbox_menuitem() Line 15  set_fluxbox_menuitem()
15   local workdir="${CLASS_ARGV[4]}"   local workdir="${CLASS_ARGV[4]}"
16   local icon="${CLASS_ARGV[5]}"   local icon="${CLASS_ARGV[5]}"
17   local id   local id
18     local enabled
19    
20   case "${action}" in   case "${action}" in
21   add)   add) enabled=1 ;;
22   id=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}' and name='${name}';")   del) enabled=0 ;;
23   if [[ -n ${id} ]]   *)
24   then   eecho "Unknown action '${action}'"
25   mysqldo "update cfg_fluxbox_menuitem set name='${name}', exec='${exec}', workdir='${workdir}', icon='${icon}' where id=${id};"   return 1
  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  
26   ;;   ;;
27   esac   esac
28    
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  }  }
37    
38  control_fluxbox_menuitem()  control_fluxbox_menuitem()
# Line 43  control_fluxbox_menuitem() Line 41  control_fluxbox_menuitem()
41   local values   local values
42   local id   local id
43    
  # first delete all menuitems then regen all  
  control_client "${serial}" set fluxbox.menuitem del  
44   values=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}';")   values=$(mysqldo "select id from cfg_fluxbox_menuitem where serial='${serial}';")
45   for id in ${values}   for id in ${values}
46   do   do
# Line 59  control_fluxbox_menuitem() Line 55  control_fluxbox_menuitem()
55   eecho "Exec must not be empty id->'${id}'"   eecho "Exec must not be empty id->'${id}'"
56   continue   continue
57   fi   fi
58   control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}"   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   done   done
74  }  }
75    

Legend:
Removed from v.2542  
changed lines
  Added in v.2545