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 2622 by niro, Thu Sep 17 10:45:21 2015 UTC revision 2623 by niro, Fri Sep 25 13:06:52 2015 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  push_config 80_fluxbox_menuitem  push_config 80_fluxbox_menuitem
4    push_config 80_fluxbox_autostart
5    
6  help_fluxbox_menuitem()  help_fluxbox_menuitem()
7  {  {
# Line 82  push_config_80_fluxbox_menuitem() Line 83  push_config_80_fluxbox_menuitem()
83   return 1   return 1
84   fi   fi
85   done   done
86    }
87    
88    help_fluxbox_autostart()
89    {
90     local serial="${CLASS_ARGV[0]}"
91     control_client "${serial}" help fluxbox.autostart
92    }
93    
94    set_fluxbox_autostart()
95    {
96     local serial="${CLASS_ARGV[0]}"
97     local action="${CLASS_ARGV[1]}"
98     local name="${CLASS_ARGV[2]}"
99     local exec="${CLASS_ARGV[3]}"
100     local comment="${CLASS_ARGV[4]}"
101     local id
102     local enabled
103    
104     case "${action}" in
105     add) enabled=1 ;;
106     del) enabled=0 ;;
107     *)
108     eecho "Unknown action '${action}'"
109     return 1
110     ;;
111     esac
112    
113     if [[ -z ${name} ]]
114     then
115     eecho "No name given"
116     return 1
117     fi
118    
119     id=$(mysqldo "select id from cfg_autostart where serial='${serial}' and name='${name}';")
120     if [[ -n ${id} ]]
121     then
122     mysqldo "update cfg_autostart set name='${name}', exec='${exec}', comment='${comment}', enabled='${enabled}' where id=${id};"
123     else
124     mysqldo "insert into cfg_autostart(serial,name,exec,comment,enabled) values('${serial}','${name}','${exec}','${comment}','${enabled}');"
125     fi
126    }
127    
128    control_fluxbox_autostart()
129    {
130     local serial="${CLASS_ARGV[0]}"
131     push_config_80_fluxbox_autostart "${serial}"
132    }
133    
134    push_config_80_fluxbox_autostart()
135    {
136     local serial="$1"
137     local values
138     local id
139    
140     values=$(mysqldo "select id from cfg_autostart where serial='${serial}';")
141     for id in ${values}
142     do
143     evaluate_table_xml cfg_autostart "where serial='${serial}'"
144     if [[ -z ${cfg_autostart_name} ]]
145     then
146     eecho "Name must not be empty id->'${id}'"
147     continue
148     fi
149     if [[ -z ${cfg_autostart_enabled} ]]
150     then
151     eecho "Enabled must not be empty id->'${id}'"
152     continue
153     fi
154     if [[ ${cfg_autostart_enabled} = 1 ]]
155     then
156     control_client "${serial}" set fluxbox.autostart add "${cfg_autostart_name}" "${cfg_autostart_exec}" "${cfg_autostart_comment}"
157     elif [[ ${cfg_autostart_enabled} = 0 ]]
158     then
159     control_client "${serial}" set fluxbox.autostart del "${cfg_autostart_name}"
160     # remove from database too
161     mysqldo "delete from cfg_autostart where id='${id}';"
162     else
163     eecho "unknown enabled value id->'${id}', cfg_autostart_enabled -> '${cfg_autostart_enabled}'"
164     return 1
165     fi
166     done
167  }  }
168    
169  help_fluxbox_theme()  help_fluxbox_theme()

Legend:
Removed from v.2622  
changed lines
  Added in v.2623