[Sugar-devel] [PATCH 1/4] passphrase dialog, remove destroy, fix duplicate error, catch escape key

James Cameron quozl at laptop.org
Wed Apr 21 21:10:53 EDT 2010


Removed the destroy callback, since it is always called.  The error
callback was called after an OK response, resulting in DBusException
CanceledError, which was ignored by NetworkManager.  When Cancel was
pressed, there were two DBusExceptions.  This was benign.

Added handling of gtk.RESPONSE_DELETE_EVENT.  This event occurs if
either the window manager close button or the escape key is used.
When escape key was used, previous code did not send CanceledError.
This was benign.

These changes were made to support a fix for #1805 to prevent an AP
from being marked as a favourite after a failed connection attempt.
---
 src/jarabe/desktop/keydialog.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/jarabe/desktop/keydialog.py b/src/jarabe/desktop/keydialog.py
index 5478980..3b524da 100644
--- a/src/jarabe/desktop/keydialog.py
+++ b/src/jarabe/desktop/keydialog.py
@@ -291,19 +291,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.0


-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list