From 65bc96591842f7b2549332991ed35518aba1d1a9 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Mon, 18 Dec 2017 23:05:33 +0100 Subject: [PATCH] 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. --- gajim/dialogs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gajim/dialogs.py b/gajim/dialogs.py index 9b6a99022..a0d2a27d7 100644 --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -1722,7 +1722,7 @@ class ConfirmationDialogCheck(ConfirmationDialog): 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() self.checkbutton = Gtk.CheckButton.new_with_mnemonic(checktext) @@ -1777,7 +1777,7 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog): 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() vbox = self.get_content_area() @@ -1847,7 +1847,7 @@ class PlainConnectionDialog(ConfirmationDialogDoubleCheck): ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext, checktext1, checktext2, tooltip1=tooltip1, on_response_ok=on_ok, 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.checkbutton1.connect('clicked', self.on_checkbutton_clicked) self.set_title(_('Insecure connection')) @@ -1875,7 +1875,7 @@ class ConfirmationDialogDoubleRadio(ConfirmationDialog): 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() vbox = self.get_content_area()