@@ -77,7 +77,8 @@ def __init__(self, application):
77
77
self .critical_battery_entry = self .builder .get_object ("critical_battery" )
78
78
79
79
## Sound configuration page
80
- self .mute_sound_entry = self .builder .get_object ("mute_sound" )
80
+ self .label_sound_switch = self .builder .get_object ("label_sound_switch" )
81
+ self .sound_switch = self .builder .get_object ("sound_switch" )
81
82
self .sound_file_entry = self .builder .get_object ("sound_file" )
82
83
83
84
## Notification configuration page
@@ -148,6 +149,7 @@ def __load_config(self):
148
149
self .third_custom_warning = self .config ['settings' ]['third_custom_warning' ]
149
150
self .low_battery = self .config ['settings' ]['low_battery' ]
150
151
self .critical_battery = self .config ['settings' ]['critical_battery' ]
152
+ self .use_sound = int (self .config ['settings' ]['use_sound' ])
151
153
self .notification_stability = self .config ['settings' ]['notification_stability' ]
152
154
except :
153
155
print ('Config file is missing or not readable. Using default configurations.' )
@@ -158,6 +160,7 @@ def __load_config(self):
158
160
self .third_custom_warning = '40'
159
161
self .low_battery = '30'
160
162
self .critical_battery = '15'
163
+ self .use_sound = 1
161
164
self .notification_stability = '5'
162
165
163
166
self .success_shown_entry .set_text (self .success_shown )
@@ -167,6 +170,7 @@ def __load_config(self):
167
170
self .third_custom_warning_entry .set_text (self .third_custom_warning )
168
171
self .low_battery_entry .set_text (self .low_battery )
169
172
self .critical_battery_entry .set_text (self .critical_battery )
173
+ self .sound_switch .set_active (self .use_sound )
170
174
self .notify_duration_entry .set_text (self .notification_stability )
171
175
172
176
def __save_config (self , widget ):
@@ -180,6 +184,11 @@ def __save_config(self, widget):
180
184
else :
181
185
os .makedirs (self .config_dir )
182
186
187
+ if self .sound_switch .get_active ():
188
+ use_sound = 1
189
+ else :
190
+ use_sound = 0
191
+
183
192
self .config ['settings' ] = {
184
193
'success_shown' : self .success_shown_entry .get_text (),
185
194
'upper_threshold_warning' : self .upper_threshold_warning_entry .get_text (),
@@ -188,6 +197,7 @@ def __save_config(self, widget):
188
197
'third_custom_warning' : self .third_custom_warning_entry .get_text (),
189
198
'low_battery' : self .low_battery_entry .get_text (),
190
199
'critical_battery' : self .critical_battery_entry .get_text (),
200
+ 'use_sound' : use_sound ,
191
201
'notification_stability' : self .notify_duration_entry .get_text ()
192
202
}
193
203
0 commit comments