don't allow to open several filter dialogs. Fixes #8848

This commit is contained in:
Yann Leboulanger 2018-03-29 12:26:37 +02:00
parent c2184aaf8c
commit ec78ce22e6
1 changed files with 11 additions and 2 deletions

View File

@ -3569,6 +3569,7 @@ class XMLConsoleWindow(Gtk.Window):
self.stream = True self.stream = True
self.incoming = True self.incoming = True
self.outgoing = True self.outgoing = True
self.filter_dialog = None
glade_objects = ['textview', 'input', 'scrolled_input', 'headerbar', glade_objects = ['textview', 'input', 'scrolled_input', 'headerbar',
'scrolled', 'actionbar', 'paned', 'box', 'menubutton'] 'scrolled', 'actionbar', 'paned', 'box', 'menubutton']
@ -3689,6 +3690,9 @@ class XMLConsoleWindow(Gtk.Window):
self.menubutton.hide() self.menubutton.hide()
def on_filter_options(self, *args): def on_filter_options(self, *args):
if self.filter_dialog:
self.filter_dialog.present()
return
options = [ options = [
Option(OptionKind.SWITCH, 'Presence', Option(OptionKind.SWITCH, 'Presence',
OptionType.VALUE, self.presence, OptionType.VALUE, self.presence,
@ -3712,8 +3716,13 @@ class XMLConsoleWindow(Gtk.Window):
callback=self.on_option, data='outgoing'), callback=self.on_option, data='outgoing'),
] ]
OptionsDialog(self, 'Filter', Gtk.DialogFlags.DESTROY_WITH_PARENT, self.filter_dialog = OptionsDialog(self, 'Filter',
options, self.account) Gtk.DialogFlags.DESTROY_WITH_PARENT,
options, self.account)
self.filter_dialog.connect('destroy', self.on_filter_destroyed)
def on_filter_destroyed(self, win):
self.filter_dialog = None
def on_clear(self, *args): def on_clear(self, *args):
buffer_ = self.textview.get_buffer().set_text('') buffer_ = self.textview.get_buffer().set_text('')