Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/daemon/client/include/session.client.class

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

revision 1252 by niro, Wed Feb 2 20:20:24 2011 UTC revision 1253 by niro, Wed Feb 2 21:18:41 2011 UTC
# Line 4  Line 4 
4  provide fluxbox  provide fluxbox
5    
6  # helper  # helper
7  helper_session_rebuild_fluxbox_menu()  helper_rebuild_fluxbox_menu()
8  {  {
9   :> ${SETTINGSPATH}/fluxbox/alxmenu   local MMINCLUDE
10     local CONFIG
11    
12   for file in ${SETTINGSPATH}/fluxbox/menu/*   MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include"
13     CONFIG="${MMINCLUDE}"
14     clearconfig
15    
16     for file in ${MCORE_CONFIG_PATH}/fluxbox/menu/*
17   do   do
18   echo "[include] (${file})" >> ${SETTINGSPATH}/fluxbox/alxmenu   addconfig "[include] (${file})"
19   done   done
20    
21   # rebuild the user menu too atm   # rebuild the user menu too atm
22   cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu   CONFIG="${MCORE_UNPRIV_HOME}/.fluxbox/menu"
23     if [[ ! -d ${MCORE_UNPRIV_HOME}/.fluxbox ]]
24     then
25     install -o ${MCORE_UNPRIV_USER} -o ${MCORE_UNPRIV_GROUP} -d ${MCORE_UNPRIV_HOME}/.fluxbox
26     fi
27    
28   # now fix it with proper messages :P   # fluxbox menu header
29     clearconfig
30   local ver="$(< /etc/mageversion)"   local ver="$(< /etc/mageversion)"
31   sed -i "s:@CHANGEME@:tinyALX-${ver}  #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig "[begin] (mCore-${ver}  #${MCORE_SERIAL})"
32    
33   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
34   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig
35    
36   # our specific include   # our specific menu include
37   echo "[include] (${SETTINGSPATH}/fluxbox/alxmenu)" >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig "[include] (${MMINCLUDE})"
38    
39   # fluxbox menu footer   # fluxbox menu footer
40   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig '[nop]  (__________)'
41     addconfig '[exec] (Neustarten) {sudo reboot}'
42     addconfig '[exec] (Herunterfahren) {sudo halt}'
43     addconfig '[end]'
44    
45   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
46   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   addconfig
47  }  }
48    
49  help_session_addmenuitem()  help_fluxbox_addmenuitem()
50  {  {
51   mecho "set session.addmenuitem [name] [exec] [workdir] [icon]"   mecho "set fluxbox.addmenuitem [name] [exec] [workdir] [icon]"
52   mecho " adds a fluxbox menu entry"   mecho " adds a fluxbox menu entry"
53   mecho "  name    - menu entry name"   mecho "  name    - menu entry name"
54   mecho "  exec    - executable to start"   mecho "  exec    - executable to start"
# Line 43  help_session_addmenuitem() Line 56  help_session_addmenuitem()
56   mecho "  icon    - pixmap icon of the entry - optional"   mecho "  icon    - pixmap icon of the entry - optional"
57  }  }
58    
59  # set_session_addmenuitem $name $exec $workdir $icon  # set_fluxbox_addmenuitem $name $exec $workdir $icon
60  set_session_addmenuitem()  set_fluxbox_addmenuitem()
61  {  {
62   local name="$1"   local name="$1"
63   local exec="$2"   local exec="$2"
64   local workdir="$3"   local workdir="$3"
65   local icon="$4"   local icon="$4"
66     local CONFIG
67    
68     [[ -z ${name} ]] && help_session_addmenuitem && return 1
69     [[ -z ${exec} ]] && help_session_addmenuitem && return 1
70    
71   echo "[exec] (${name}) {${exec}}" > ${SETTINGSPATH}/fluxbox/menu/${name}   CONFIG="${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"
72     clearconfig
73     addconfig "[exec] (${name}) {${exec}}"
74    
75   # rebuild the menu now   # rebuild the menu now
76   helper_session_rebuild_fluxbox_menu   helper_rebuild_fluxbox_menu
77  }  }
78    
79  help_session_delmenuitem()  help_fluxbox_delmenuitem()
80  {  {
81   mecho "set session.delmenuitem [name]"   mecho "set session.delmenuitem [name]"
82   mecho " deletes a fluxbox menu entry"   mecho " Deletes a fluxbox menu entry."
83   mecho "  name - menu entry name"   mecho "  name - menu entry name"
84     mecho " If no [name] given, all entries are deleted."
85  }  }
86    
87  # set_session_delmenuitem [$name]  # set_fluxbox_delmenuitem [$name]
88  set_session_delmenuitem()  set_fluxbox_delmenuitem()
89  {  {
90   local name="$1"   local name="$1"
91    
92   if [[ -f ${SETTINGSPATH}/fluxbox/menu/${name} ]]   if [[ -f ${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]
93   then   then
94   rm ${SETTINGSPATH}/fluxbox/menu/${name}   rm ${MCORE_CONFIG_PATH}/fluxbox/menu/${name}
95   elif [[ -z ${name} ]]   elif [[ -z ${name} ]]
96   then   then
97   # delete all items   # delete all items
98   rm ${SETTINGSPATH}/fluxbox/menu/*   rm ${MCORE_CONFIG_PATH}/fluxbox/menu/*
99   fi   fi
100    
101   # rebuild the menu now   # rebuild the menu now
102   helper_session_rebuild_fluxbox_menu   helper_rebuild_fluxbox_menu
103  }  }

Legend:
Removed from v.1252  
changed lines
  Added in v.1253