@@ -288,7 +288,7 @@ def __create_plugin_item(self, plugin_config):
288288
289289 def __show_plugins_properties_dialog (self , plugin_config ):
290290 """Show the PluginProperties dialog."""
291- dialog = PluginSettingsDialog (self .application , plugin_config )
291+ dialog = PluginSettingsDialog (self .window , plugin_config )
292292 dialog .show ()
293293
294294 def __disable_errored_plugin (self , button , plugin_config ):
@@ -301,7 +301,7 @@ def __show_break_properties_dialog(
301301 ):
302302 """Show the BreakProperties dialog."""
303303 dialog = BreakSettingsDialog (
304- self .application ,
304+ self .window ,
305305 break_config ,
306306 is_short ,
307307 parent ,
@@ -355,7 +355,7 @@ def on_info_bar_long_break_close(self, infobar, *user_data):
355355 def add_break (self , button ) -> None :
356356 """Event handler for add break button."""
357357 dialog = NewBreakDialog (
358- self .application ,
358+ self .window ,
359359 self .config ,
360360 lambda is_short , break_config : self .__create_break_item (
361361 break_config , is_short
@@ -406,13 +406,13 @@ def on_window_delete(self, *args):
406406class PluginSettingsDialog :
407407 """Builds a settings dialog based on the configuration of a plugin."""
408408
409- def __init__ (self , application , config ):
409+ def __init__ (self , parent , config ):
410410 self .config = config
411411 self .property_controls = []
412412
413413 builder = utility .create_gtk_builder (SETTINGS_DIALOG_PLUGIN_GLADE )
414414 self .window = builder .get_object ("dialog_settings_plugin" )
415- self .window .set_application ( application )
415+ self .window .set_transient_for ( parent )
416416 box_settings = builder .get_object ("box_settings" )
417417 self .window .set_title (_ ("Plugin Settings" ))
418418 for setting in config .get ("settings" ):
@@ -421,21 +421,21 @@ def __init__(self, application, config):
421421 self .__load_int_item (
422422 setting ["label" ],
423423 setting ["id" ],
424- setting [ "safeeyes_config " ],
424+ config [ "active_plugin_config " ],
425425 setting .get ("min" , 0 ),
426426 setting .get ("max" , 120 ),
427427 )
428428 )
429429 elif setting ["type" ].upper () == "TEXT" :
430430 box_settings .append (
431431 self .__load_text_item (
432- setting ["label" ], setting ["id" ], setting [ "safeeyes_config " ]
432+ setting ["label" ], setting ["id" ], config [ "active_plugin_config " ]
433433 )
434434 )
435435 elif setting ["type" ].upper () == "BOOL" :
436436 box_settings .append (
437437 self .__load_bool_item (
438- setting ["label" ], setting ["id" ], setting [ "safeeyes_config " ]
438+ setting ["label" ], setting ["id" ], config [ "active_plugin_config " ]
439439 )
440440 )
441441
@@ -450,9 +450,7 @@ def __load_int_item(self, name, key, settings, min_value, max_value):
450450 spin_value .set_value (settings [key ])
451451 box = builder .get_object ("box" )
452452 box .set_visible (True )
453- self .property_controls .append (
454- {"key" : key , "settings" : settings , "value" : spin_value .get_value }
455- )
453+ self .property_controls .append ({"key" : key , "value" : spin_value .get_value })
456454 return box
457455
458456 def __load_text_item (self , name , key , settings ):
@@ -463,9 +461,7 @@ def __load_text_item(self, name, key, settings):
463461 txt_value .set_text (settings [key ])
464462 box = builder .get_object ("box" )
465463 box .set_visible (True )
466- self .property_controls .append (
467- {"key" : key , "settings" : settings , "value" : txt_value .get_text }
468- )
464+ self .property_controls .append ({"key" : key , "value" : txt_value .get_text })
469465 return box
470466
471467 def __load_bool_item (self , name , key , settings ):
@@ -476,17 +472,15 @@ def __load_bool_item(self, name, key, settings):
476472 switch_value .set_active (settings [key ])
477473 box = builder .get_object ("box" )
478474 box .set_visible (True )
479- self .property_controls .append (
480- {"key" : key , "settings" : settings , "value" : switch_value .get_active }
481- )
475+ self .property_controls .append ({"key" : key , "value" : switch_value .get_active })
482476 return box
483477
484478 def on_window_delete (self , * args ):
485479 """Event handler for Properties dialog close action."""
486480 for property_control in self .property_controls :
487- property_control [ "settings " ][property_control ["key" ]] = property_control [
488- "value"
489- ]( )
481+ self . config [ "active_plugin_config " ][property_control ["key" ]] = (
482+ property_control [ "value" ]()
483+ )
490484 self .window .destroy ()
491485
492486 def show (self ):
@@ -499,7 +493,7 @@ class BreakSettingsDialog:
499493
500494 def __init__ (
501495 self ,
502- application ,
496+ parent ,
503497 break_config ,
504498 is_short ,
505499 parent_config ,
@@ -518,7 +512,7 @@ def __init__(
518512
519513 builder = utility .create_gtk_builder (SETTINGS_DIALOG_BREAK_GLADE )
520514 self .window = builder .get_object ("dialog_settings_break" )
521- self .window .set_application ( application )
515+ self .window .set_transient_for ( parent )
522516 self .txt_break = builder .get_object ("txt_break" )
523517 self .switch_override_interval = builder .get_object ("switch_override_interval" )
524518 self .switch_override_duration = builder .get_object ("switch_override_duration" )
@@ -698,13 +692,13 @@ def show(self):
698692class NewBreakDialog :
699693 """Builds a new break dialog."""
700694
701- def __init__ (self , application , parent_config , on_add ):
695+ def __init__ (self , parent , parent_config , on_add ):
702696 self .parent_config = parent_config
703697 self .on_add = on_add
704698
705699 builder = utility .create_gtk_builder (SETTINGS_DIALOG_NEW_BREAK_GLADE )
706700 self .window = builder .get_object ("dialog_new_break" )
707- self .window .set_application ( application )
701+ self .window .set_transient_for ( parent )
708702 self .txt_break = builder .get_object ("txt_break" )
709703 self .cmb_type = builder .get_object ("cmb_type" )
710704 list_types = builder .get_object ("lst_break_types" )
0 commit comments