Skip to content

Commit

Permalink
wired up preferences GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrose committed Feb 8, 2024
1 parent 305f6b2 commit aa03c23
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions terminatorlib/preferences.glade
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@
<property name="can-focus">False</property>
<property name="model">AskBeforeCloseListStore</property>
<property name="active">1</property>
<signal name="changed" handler="on_askbeforeclose_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
Expand Down
27 changes: 26 additions & 1 deletion terminatorlib/prefseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,18 @@ def set_values(self):
active = 0
widget = guiget('winstatecombo')
widget.set_active(active)
# Ask Before Closing
option = self.config['ask_before_closing']
if option == 'never':
active = 0
elif option == 'multiple_terminals':
active = 1
elif option == 'always':
active = 2
else:
active = 1
widget = guiget('askbeforeclose')
widget.set_active(active)
# Window borders
widget = guiget('winbordercheck')
widget.set_active(not self.config['borderless'])
Expand Down Expand Up @@ -1497,7 +1509,20 @@ def on_winstatecombo_changed(self, widget):
value = 'normal'
self.config['window_state'] = value
self.config.save()

def on_askbeforeclose_changed(self, widget):
"""Ask Before Close changed"""
selected = widget.get_active()
if selected == 0:
value = 'Never'
elif selected == 1:
value = 'Multiple Terminals'
elif selected == 2:
value = 'Always'
else:
value = 'Multiple Terminals'
configval = value.lower().replace(" ","_")
self.config['ask_before_closing'] = configval
self.config.save()
# helper function, not a signal
def addprofile(self, name, toclone):
"""Add a profile"""
Expand Down

0 comments on commit aa03c23

Please sign in to comment.