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 2541 by niro, Wed Sep 16 10:28:47 2015 UTC revision 2548 by niro, Wed Sep 16 11:21:09 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 52  control_fluxbox_menuitem() Line 50  control_fluxbox_menuitem()
50   eecho "Name must not be empty id->'${id}'"   eecho "Name must not be empty id->'${id}'"
51   continue   continue
52   fi   fi
53   if [[ -z ${cfg_fluxbox_menuitem_exec} ]]   if [[ -z ${cfg_fluxbox_menuitem_enabled} ]]
54   then   then
55   eecho "Exec must not be empty id->'${id}'"   eecho "Enabled 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 [[ ${cfg_fluxbox_menuitem_enabled} = 1 ]]
59     then
60     control_client "${serial}" set fluxbox.menuitem add "${cfg_fluxbox_menuitem_name}" "${cfg_fluxbox_menuitem_exec}" "${cfg_fluxbox_menuitem_workdir}" "${cfg_fluxbox_menuitem_icon}"
61     elif [[ ${cfg_fluxbox_menuitem_enabled} = 0 ]]
62     then
63     control_client "${serial}" set fluxbox.menuitem del "${cfg_fluxbox_menuitem_name}"
64     # remove from database too
65     mysqldo "delete from cfg_fluxbox_menuitem where id='${id}';"
66     else
67     eecho "unknown enabled value id->'${id}', cfg_fluxbox_menuitem_enabled -> '${cfg_fluxbox_menuitem_enabled}'"
68     return 1
69     fi
70   done   done
71  }  }
72    

Legend:
Removed from v.2541  
changed lines
  Added in v.2548