dialogs: Use get_widget_for_response() to access buttons

The get_action_area() API is deprecated and under some circumstances
the wrong button gets accessed.
This commit is contained in:
Marc Schink 2017-12-18 23:05:33 +01:00
parent 0ffd7b6907
commit 65bc965918
1 changed files with 4 additions and 4 deletions

View File

@ -1722,7 +1722,7 @@ class ConfirmationDialogCheck(ConfirmationDialog):
self.set_default_response(Gtk.ResponseType.OK) self.set_default_response(Gtk.ResponseType.OK)
ok_button = self.get_action_area().get_children()[0] # right to left ok_button = self.get_widget_for_response(Gtk.ResponseType.OK)
ok_button.grab_focus() ok_button.grab_focus()
self.checkbutton = Gtk.CheckButton.new_with_mnemonic(checktext) self.checkbutton = Gtk.CheckButton.new_with_mnemonic(checktext)
@ -1777,7 +1777,7 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog):
self.set_default_response(Gtk.ResponseType.OK) self.set_default_response(Gtk.ResponseType.OK)
ok_button = self.get_action_area().get_children()[0] # right to left ok_button = self.get_widget_for_response(Gtk.ResponseType.OK)
ok_button.grab_focus() ok_button.grab_focus()
vbox = self.get_content_area() vbox = self.get_content_area()
@ -1847,7 +1847,7 @@ class PlainConnectionDialog(ConfirmationDialogDoubleCheck):
ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext, ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext,
checktext1, checktext2, tooltip1=tooltip1, on_response_ok=on_ok, checktext1, checktext2, tooltip1=tooltip1, on_response_ok=on_ok,
on_response_cancel=on_cancel, is_modal=False) on_response_cancel=on_cancel, is_modal=False)
self.ok_button = self.get_action_area().get_children()[0] # right to left self.ok_button = self.get_widget_for_response(Gtk.ResponseType.OK)
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
self.checkbutton1.connect('clicked', self.on_checkbutton_clicked) self.checkbutton1.connect('clicked', self.on_checkbutton_clicked)
self.set_title(_('Insecure connection')) self.set_title(_('Insecure connection'))
@ -1875,7 +1875,7 @@ class ConfirmationDialogDoubleRadio(ConfirmationDialog):
self.set_default_response(Gtk.ResponseType.OK) self.set_default_response(Gtk.ResponseType.OK)
ok_button = self.get_action_area().get_children()[0] # right to left ok_button = self.get_widget_for_response(Gtk.ResponseType.OK)
ok_button.grab_focus() ok_button.grab_focus()
vbox = self.get_content_area() vbox = self.get_content_area()