[Sugar-devel] [PATCH] Wireless key dialog: handle delete_event correctly
Daniel Drake
dsd at laptop.org
Thu Sep 15 05:43:02 EDT 2011
When clicking 'OK' in the key dialog, the response callback correctly
destroys the dialog after processing the response. However, this
causes _key_dialog_destroy_cb to attempt to process a cancel response,
causing an invalid message to be sent over dbus (which dbus rejects).
Handle delete_event correctly by catching gtk.RESPONSE_DELETE_EVENT,
no need for any special event handling.
---
src/jarabe/desktop/keydialog.py | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/jarabe/desktop/keydialog.py b/src/jarabe/desktop/keydialog.py
index 6241b9b..c72f498 100644
--- a/src/jarabe/desktop/keydialog.py
+++ b/src/jarabe/desktop/keydialog.py
@@ -301,21 +301,17 @@ def create(ssid, flags, wpa_flags, rsn_flags, dev_caps, settings, response):
dev_caps, settings, response)
key_dialog.connect('response', _key_dialog_response_cb)
- key_dialog.connect('destroy', _key_dialog_destroy_cb)
key_dialog.show_all()
-def _key_dialog_destroy_cb(key_dialog, data=None):
- _key_dialog_response_cb(key_dialog, gtk.RESPONSE_CANCEL)
-
-
def _key_dialog_response_cb(key_dialog, response_id):
response = key_dialog.get_response_object()
secrets = None
if response_id == gtk.RESPONSE_OK:
secrets = key_dialog.create_security()
- if response_id in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_NONE]:
+ if response_id in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_NONE,
+ gtk.RESPONSE_DELETE_EVENT]:
# key dialog dialog was canceled; send the error back to NM
response.set_error(CanceledKeyRequestError())
elif response_id == gtk.RESPONSE_OK:
--
1.7.6
More information about the Sugar-devel
mailing list