Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_sessions.sh

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

revision 2746 by niro, Wed Jul 6 21:34:49 2011 UTC revision 2747 by niro, Thu Aug 11 19:50:58 2011 UTC
# Line 195  generate_all_desktop_icons() Line 195  generate_all_desktop_icons()
195  {  {
196   local session_list="$1"   local session_list="$1"
197   local other_menuitem_list="$2"   local other_menuitem_list="$2"
198     local plugin_list="$3"
199   local res   local res
200   local xres   local xres
201   local yres   local yres
# Line 307  generate_all_desktop_icons() Line 308  generate_all_desktop_icons()
308    
309   y=$((${y} + 80))   y=$((${y} + 80))
310   done   done
311    
312     for i in ${plugin_list}
313     do
314     # abort if empty
315     [[ -z ${i} ]] && continue
316    
317     evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
318     if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]]
319     then
320     eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem)
321    
322     # abort if name or exec is empty
323     [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue
324     [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue
325    
326     # new line if x > xres
327     if [ ${x} -ge ${xres} ]
328     then
329     x=50
330     y=$((${y} + 80))
331     fi
332    
333     # new row if y > yres
334     if [ ${y} -ge ${yres} ]
335     then
336     x=$((${x} + 120))
337     y=50
338    
339     # re-check x
340     [ ${x} -ge ${xres} ] && x=50
341     fi
342    
343     generate_icon \
344     --name "${PLUGIN_MENUITEM_NAME}" \
345     --command "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \
346     --icon "${ALX_SESSIONS_ICONS}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).png" \
347     --dest "${dest}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME}).lnk" \
348     --xres "${x}" \
349     --yres "${y}" \
350     --default-icon "default_item.png"
351    
352     y=$((${y} + 80))
353     fi
354    
355     # unset all variables
356     unset PLUGIN_MENUITEM_NAME
357     unset PLUGIN_MENUITEM_EXEC
358     unset PLUGIN_MENUITEM_PARAM
359     unset PLUGIN_MENUITEM_WORKDIR
360     unset PLUGIN_MENUITEM_ICON
361     done
362    
363   # add shutdown, reboot icons   # add shutdown, reboot icons
364   for i in shutdown reboot   for i in shutdown reboot
# Line 387  config_sessions() Line 439  config_sessions()
439    
440   # get all session ids from database   # get all session ids from database
441   all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")   all_ses_ids=$(mysqldo "select id from cfg_sessions where serial='${ALX_SERIAL}'")
442   # get all other_menutiem ids from database   # get all other_menuitem ids from database
443   all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'")   all_other_ids=$(mysqldo "select id from cfg_other_menuitems where serial='${ALX_SERIAL}'")
444     # get all plugin ids from database
445     all_plugin_ids=$(mysqldo "select id from cfg_plugins where serial='${ALX_SERIAL}'")
446    
447   # get screensaver settings   # get screensaver settings
448   evaluate_table cfg_screensaver   evaluate_table cfg_screensaver
# Line 518  config_sessions() Line 572  config_sessions()
572   addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}"   addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}"
573   done   done
574    
575     # add plugins
576     for i in ${all_plugin_ids}
577     do
578     evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
579     if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]]
580     then
581     eval $(${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh menuitem)
582    
583     # abort if name or exec is empty
584     [[ -z ${PLUGIN_MENUITEM_NAME} ]] && continue
585     [[ -z ${PLUGIN_MENUITEM_EXEC} ]] && continue
586    
587     # now echo config line for fluxbox-menu
588     # make it "configureable" :p
589     if [[ -n ${PLUGIN_MENUITEM_WORKDIR} ]]
590     then
591     workdir="--workdir ${PLUGIN_MENUITEM_WORKDIR}"
592     fi
593     if [[ -n ${PLUGIN_MENUITEM_ICON} ]]
594     then
595     PLUGIN_MENUITEM_ICON="<${PLUGIN_MENUITEM_ICON}>"
596     fi
597    
598     # gen prog startup wrapper
599     generate_program_sh \
600     --name "${PLUGIN_MENUITEM_NAME}" \
601     --exec "${PLUGIN_MENUITEM_EXEC}" \
602     --param "${PLUGIN_MENUITEM_PARM}" \
603     --dest "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \
604     "${workdir}"
605    
606     addconfig "[exec] (${PLUGIN_MENUITEM_NAME}) {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})} ${PLUGIN_MENUITEM_ICON}"
607     fi
608    
609     # unset all variables
610     unset PLUGIN_MENUITEM_NAME
611     unset PLUGIN_MENUITEM_EXEC
612     unset PLUGIN_MENUITEM_PARAM
613     unset PLUGIN_MENUITEM_WORKDIR
614     unset PLUGIN_MENUITEM_ICON
615     done
616    
617   # fluxbox menu footer   # fluxbox menu footer
618   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
619   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
620   addconfig   addconfig
621    
622   # now it's a good time to generate *all* icons :)   # now it's a good time to generate *all* icons :)
623   generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}"   generate_all_desktop_icons "${all_ses_ids}" "${all_other_ids}" "${all_plugin_ids}"
624    
625   # fix permissions   # fix permissions
626   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}

Legend:
Removed from v.2746  
changed lines
  Added in v.2747