[polari] Fix confirm action of join/message dialogs
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] Fix confirm action of join/message dialogs
- Date: Wed, 17 Sep 2014 02:49:50 +0000 (UTC)
commit 50effa361aca07488a7f6945a63f7bc5b993c678
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Sep 17 00:42:32 2014 +0200
Fix confirm action of join/message dialogs
Since commit 2271d5b02d23, clicking the confirm button will result
in GtkDialog::response being emitted (and the dialog thus destroyed)
before our GtkButton::clicked handler runs; to fix, switch to the
::response signal instead.
data/resources/message-user-dialog.ui | 2 +-
src/joinDialog.js | 9 +++++----
src/messageDialog.js | 9 ++++++---
3 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/data/resources/message-user-dialog.ui b/data/resources/message-user-dialog.ui
index 02cb565..fa473e7 100644
--- a/data/resources/message-user-dialog.ui
+++ b/data/resources/message-user-dialog.ui
@@ -179,7 +179,7 @@
</child>
<action-widgets>
<action-widget response="cancel">cancel_button</action-widget>
- <action-widget response="confirm">message_button</action-widget>
+ <action-widget response="ok">message_button</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/src/joinDialog.js b/src/joinDialog.js
index f2eacdb..3864425 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -45,6 +45,11 @@ const JoinDialog = new Lang.Class({
this._updateConnectionCombo();
}));
+ this.widget.connect('response', Lang.bind(this,
+ function(w, response) {
+ if (response == Gtk.ResponseType.OK)
+ this._onConfirmClicked();
+ }));
this.widget.connect('destroy', Lang.bind(this,
function() {
this._accountsMonitor.disconnect(this._accountAddedId);
@@ -87,9 +92,6 @@ const JoinDialog = new Lang.Class({
this._connectionCombo.sensitive = false;
this._confirmButton = builder.get_object('confirm_button');
- this._confirmButton.connect('clicked',
- Lang.bind(this, this._onConfirmClicked));
-
this._cancelButton = builder.get_object('cancel_button');
this._nameCompletion = builder.get_object('name_completion');
@@ -133,7 +135,6 @@ const JoinDialog = new Lang.Class({
_onConfirmClicked: function() {
if (this._page == DialogPage.MAIN) {
this._joinRoom();
- this.widget.response(Gtk.ResponseType.OK);
} else {
this._details.save();
this._setPage(DialogPage.MAIN);
diff --git a/src/messageDialog.js b/src/messageDialog.js
index f3a14a3..208d115 100644
--- a/src/messageDialog.js
+++ b/src/messageDialog.js
@@ -45,6 +45,12 @@ const MessageDialog = new Lang.Class({
this._updateRecentList([]);
this._nameEntry.grab_focus();
+
+ this.widget.connect('response', Lang.bind(this,
+ function(w, response) {
+ if (response == Gtk.ResponseType.OK)
+ this._onMessageClicked();
+ }));
},
_createWidget: function() {
@@ -66,8 +72,6 @@ const MessageDialog = new Lang.Class({
this._nameCompletion = builder.get_object('name_completion');
this._messageButton = builder.get_object('message_button');
- this._messageButton.connect('clicked',
- Lang.bind(this, this._onMessageClicked));
this._messageButton.sensitive = false;
this._nameEntry = builder.get_object('name_entry');
@@ -174,7 +178,6 @@ const MessageDialog = new Lang.Class({
[ account.get_object_path(),
user,
TP_CURRENT_TIME ]));
- this.widget.response(Gtk.ResponseType.OK);
},
_updateCanConfirm: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]