Merge pull request #884 from mattrose/ask_before_close_gui
Ask before close gui
This commit is contained in:
commit
9a3b8997db
|
@ -1,7 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkListStore" id="AskBeforeCloseListStore">
|
||||
<columns>
|
||||
<!-- column-name askwhenclose -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Never</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Multiple Terminals</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Always</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="BackspaceKeyListStore">
|
||||
<columns>
|
||||
<!-- column-name Result -->
|
||||
|
@ -473,7 +490,7 @@
|
|||
<property name="spacing">36</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=8 -->
|
||||
<!-- n-columns=2 n-rows=9 -->
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
|
@ -524,7 +541,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -541,7 +558,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -558,7 +575,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -575,7 +592,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="top-attach">5</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -592,7 +609,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
<property name="top-attach">6</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -609,7 +626,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">6</property>
|
||||
<property name="top-attach">7</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -626,10 +643,40 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">7</property>
|
||||
<property name="top-attach">8</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="askbeforeclose">
|
||||
<property name="visible">True</property>
|
||||
<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>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Ask Before Closing:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
|
@ -308,6 +308,18 @@ class PrefsEditor:
|
|||
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'])
|
||||
|
@ -1497,7 +1509,20 @@ class PrefsEditor:
|
|||
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"""
|
||||
|
|
Loading…
Reference in New Issue