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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.40.0 -->
|
<!-- Generated with glade 3.38.2 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.10"/>
|
<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">
|
<object class="GtkListStore" id="BackspaceKeyListStore">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name Result -->
|
<!-- column-name Result -->
|
||||||
|
@ -473,7 +490,7 @@
|
||||||
<property name="spacing">36</property>
|
<property name="spacing">36</property>
|
||||||
<property name="homogeneous">True</property>
|
<property name="homogeneous">True</property>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=2 n-rows=8 -->
|
<!-- n-columns=2 n-rows=9 -->
|
||||||
<object class="GtkGrid" id="grid1">
|
<object class="GtkGrid" id="grid1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
@ -524,7 +541,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">1</property>
|
<property name="top-attach">2</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -541,7 +558,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">2</property>
|
<property name="top-attach">3</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -558,7 +575,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">3</property>
|
<property name="top-attach">4</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -575,7 +592,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">5</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -592,7 +609,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">5</property>
|
<property name="top-attach">6</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -609,7 +626,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">6</property>
|
<property name="top-attach">7</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -626,10 +643,40 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">7</property>
|
<property name="top-attach">8</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
|
|
@ -308,6 +308,18 @@ class PrefsEditor:
|
||||||
active = 0
|
active = 0
|
||||||
widget = guiget('winstatecombo')
|
widget = guiget('winstatecombo')
|
||||||
widget.set_active(active)
|
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
|
# Window borders
|
||||||
widget = guiget('winbordercheck')
|
widget = guiget('winbordercheck')
|
||||||
widget.set_active(not self.config['borderless'])
|
widget.set_active(not self.config['borderless'])
|
||||||
|
@ -1497,7 +1509,20 @@ class PrefsEditor:
|
||||||
value = 'normal'
|
value = 'normal'
|
||||||
self.config['window_state'] = value
|
self.config['window_state'] = value
|
||||||
self.config.save()
|
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
|
# helper function, not a signal
|
||||||
def addprofile(self, name, toclone):
|
def addprofile(self, name, toclone):
|
||||||
"""Add a profile"""
|
"""Add a profile"""
|
||||||
|
|
Loading…
Reference in New Issue