31 |
# for debugging purpose |
# for debugging purpose |
32 |
use Data::Dumper; |
use Data::Dumper; |
33 |
|
|
34 |
|
# make sure the config directory exists |
35 |
|
-e '/etc/capisuite/answering_machine.conf' or system('mkdir -p /etc/capisuite/'); |
36 |
|
|
37 |
# we ask glueconf to give us the structure representing the answering_machine config file |
# we ask glueconf to give us the structure representing the answering_machine config file |
38 |
my $struct = new Libconf::Glueconf::Answering_Machine('/etc/capisuite/answering_machine.conf'); |
my $struct = new Libconf::Glueconf::Answering_Machine('/etc/capisuite/answering_machine.conf'); |
39 |
|
|
57 |
|
|
58 |
#global section |
#global section |
59 |
1, gtkadd(new Gtk2::Frame(N('General parameters')), |
1, gtkadd(new Gtk2::Frame(N('General parameters')), |
60 |
gtkset_border_width(mycreate_packtable({}, |
gtkset_border_width(construct_table($struct, |
61 |
[ N('Audio snippets directory'), getBestWidget($struct, '{GLOBAL}{audio_dir}') ], |
[ N('Audio snippets directory'), '{GLOBAL}{audio_dir}'], |
62 |
[ N('User-specific data directory'), getBestWidget($struct, '{GLOBAL}{voice_user_dir}') ], |
[ N('User-specific data directory'), '{GLOBAL}{voice_user_dir}' ], |
63 |
[ N('Search for audio files'), getBestWidget($struct, '{GLOBAL}{user_audio_files}') ], |
[ N('Search for audio files'), '{GLOBAL}{user_audio_files}' ], |
64 |
[ N('Voice delay (in sec.)'), getBestWidget($struct, '{GLOBAL}{voice_delay}') ], |
[ N('Voice delay (in sec.)'), '{GLOBAL}{voice_delay}' ], |
65 |
[ N('Announcement'), getBestWidget($struct, '{GLOBAL}{announcement}') ], |
[ N('Announcement'), '{GLOBAL}{announcement}' ], |
66 |
[ N('Record length (in sec.)'), getBestWidget($struct, '{GLOBAL}{record_length}') ], |
[ N('Record length (in sec.)'), '{GLOBAL}{record_length}' ], |
67 |
[ N('Record silence timeout (in sec.)'), getBestWidget($struct, '{GLOBAL}{record_silence_timeout}') ], |
[ N('Record silence timeout (in sec.)'), '{GLOBAL}{record_silence_timeout}' ], |
68 |
), 5), |
), 5), |
69 |
), |
), |
70 |
|
|
71 |
#users section |
#users section |
110 |
|
|
111 |
##### subfonctions ##### |
##### subfonctions ##### |
112 |
|
|
113 |
|
sub construct_table { |
114 |
|
my ($local_struct) = shift; |
115 |
|
mycreate_packtable({}, |
116 |
|
map { |
117 |
|
my ($label, $path) = @$_; |
118 |
|
[ $label, |
119 |
|
getBestWidget($local_struct, $path), |
120 |
|
gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), |
121 |
|
clicked => sub { |
122 |
|
create_dialog(N('Help'), |
123 |
|
new Gtk2::Label(getDescription($local_struct, $path)), |
124 |
|
{ |
125 |
|
stock => 'gtk-dialog-info', |
126 |
|
cancel => 0, |
127 |
|
} |
128 |
|
) |
129 |
|
} |
130 |
|
), |
131 |
|
] |
132 |
|
} @_ |
133 |
|
) |
134 |
|
} |
135 |
|
|
136 |
# this fonction builds the users list |
# this fonction builds the users list |
137 |
sub build_user_list { |
sub build_user_list { |
138 |
#we clear the list in case it wasn't empty |
#we clear the list in case it wasn't empty |
200 |
# we create the dialog so that it's possible to edit the settings |
# we create the dialog so that it's possible to edit the settings |
201 |
if (create_dialog($user, |
if (create_dialog($user, |
202 |
gtkadd(new Gtk2::Frame(N('User parameters')), |
gtkadd(new Gtk2::Frame(N('User parameters')), |
203 |
gtkset_border_width(mycreate_packtable({}, |
gtkset_border_width(construct_table($user_struct, |
204 |
[ N('Voice delay (in sec.)'), getBestWidget($user_struct, "{$user}{voice_delay}") ], |
[ N('Voice delay (in sec.)'), "{$user}{voice_delay}" ], |
205 |
[ N('Announcement'), getBestWidget($user_struct, "{$user}{announcement}") ], |
[ N('Announcement'), "{$user}{announcement}" ], |
206 |
[ N('Record length (in sec.)'), getBestWidget($user_struct, "{$user}{record_length}") ], |
[ N('Record length (in sec.)'), "{$user}{record_length}" ], |
207 |
[ N('Record silence timeout (in sec.)'), getBestWidget($user_struct, "{$user}{record_silence_timeout}") ], |
[ N('Record silence timeout (in sec.)'), "{$user}{record_silence_timeout}" ], |
208 |
[ N('Voice numbers'), getBestWidget($user_struct, "{$user}{voice_numbers}") ], |
[ N('Voice numbers'), "{$user}{voice_numbers}" ], |
209 |
[ N('Pin'), getBestWidget($user_struct, "{$user}{pin}") ], |
[ N('Pin'), "{$user}{pin}" ], |
210 |
[ N('Voice action'), getBestWidget($user_struct, "{$user}{voice_action}") ], |
[ N('Voice action'), "{$user}{voice_action}" ], |
211 |
), 5), |
), 5), |
212 |
), |
), |
213 |
{ |
{ |