"""Open the preferences for this provider as a child of the 'parent' widget."""
dialog = gtk.Dialog(self.get_name(), parent)
- dialog.add_button(_('Clear'), gtk.RESPONSE_OK)
dialog.add_button(_('Disable'), gtk.RESPONSE_NO)
dialog.add_button(_('Enable'), gtk.RESPONSE_YES)
checkbox.set_label(_('Create birthday-only contacts'))
checkbox.set_active(self._gc.get_bool('/apps/maemo/hermes/facebook_birthday_only'))
dialog.vbox.add(checkbox)
- dialog.vbox.add(gtk.Label("\n" + _('Note: authentication via web page') + "\n\n\n"))
+ dialog.vbox.add(gtk.Label("\n" + _('Note: authentication via web page') + "\n"))
- while True:
- dialog.show_all()
- result = dialog.run()
- dialog.hide()
- if result == gtk.RESPONSE_CANCEL or result == gtk.RESPONSE_DELETE_EVENT:
- return None
- elif result == gtk.RESPONSE_OK:
- self._gc.unset('/apps/maemo/hermes/facebook_session_key')
- self._gc.unset('/apps/maemo/hermes/facebook_secret_key')
- self._gc.unset('/apps/maemo/hermes/facebook_uid')
- self._gc.unset('/apps/maemo/hermes/facebook_user')
- else:
- break
+ clear = hildon.Button(gtk.HILDON_SIZE_FINGER_HEIGHT,
+ hildon.BUTTON_ARRANGEMENT_VERTICAL,
+ title = _("Clear authorisation"))
+ clear.connect('clicked', self._clear_auth)
+ dialog.vbox.add(clear)
+
+ dialog.show_all()
+ result = dialog.run()
+ dialog.hide()
+ if result == gtk.RESPONSE_CANCEL or result == gtk.RESPONSE_DELETE_EVENT:
+ return None
self._gc.set_bool('/apps/maemo/hermes/facebook_birthday_only', checkbox.get_active())
return result == gtk.RESPONSE_YES
+
+
+ # -----------------------------------------------------------------------
+ def _clear_auth(self, event):
+ """Clear Facebook authorisation information. Triggered by pressing
+ the 'clear' button in the preferences dialogue."""
+ self._gc.unset('/apps/maemo/hermes/facebook_session_key')
+ self._gc.unset('/apps/maemo/hermes/facebook_secret_key')
+ self._gc.unset('/apps/maemo/hermes/facebook_uid')
+ self._gc.unset('/apps/maemo/hermes/facebook_user')
+
# -----------------------------------------------------------------------
def service(self, gui_callback):