Commit 28b2ba04 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

add a clear button in choose avatar dialog. Fixes #2423

parent dcbe3e56
......@@ -2295,6 +2295,18 @@ class ImageChooserDialog(FileChooserDialog):
return
widget.get_preview_widget().set_from_pixbuf(pixbuf)
class AvatarChooserDialog(ImageChooserDialog):
def __init__(self, path_to_file = '', on_response_ok = None,
on_response_cancel = None, on_response_clear = None):
ImageChooserDialog.__init__(self, path_to_file, on_response_ok,
on_response_cancel)
button = gtk.Button(None, gtk.STOCK_CLEAR)
if on_response_clear:
button.connect('clicked', on_response_clear)
button.show_all()
self.action_area.pack_start(button)
self.action_area.reorder_child(button, 0)
class AddSpecialNotificationDialog:
def __init__(self, jid):
'''jid is the jid for which we want to add special notification
......
......@@ -148,7 +148,12 @@ class ProfileWindow:
# returns None if unknown type
self.avatar_mime_type = mimetypes.guess_type(path_to_file)[0]
self.dialog = dialogs.ImageChooserDialog(on_response_ok = on_ok)
def on_clear(widget):
self.dialog.destroy()
self.on_clear_button_clicked(widget)
self.dialog = dialogs.AvatarChooserDialog(on_response_ok = on_ok,
on_response_clear = on_clear)
def on_PHOTO_button_press_event(self, widget, event):
'''If right-clicked, show popup'''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment