add a clear button in choose avatar dialog. Fixes #2423
This commit is contained in:
		
							parent
							
								
									dcbe3e5682
								
							
						
					
					
						commit
						28b2ba04ff
					
				
					 2 changed files with 18 additions and 1 deletions
				
			
		| 
						 | 
					@ -2295,6 +2295,18 @@ class ImageChooserDialog(FileChooserDialog):
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		widget.get_preview_widget().set_from_pixbuf(pixbuf)
 | 
							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:
 | 
					class AddSpecialNotificationDialog:
 | 
				
			||||||
	def __init__(self, jid):
 | 
						def __init__(self, jid):
 | 
				
			||||||
		'''jid is the jid for which we want to add special notification
 | 
							'''jid is the jid for which we want to add special notification
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,7 +148,12 @@ class ProfileWindow:
 | 
				
			||||||
			# returns None if unknown type
 | 
								# returns None if unknown type
 | 
				
			||||||
			self.avatar_mime_type = mimetypes.guess_type(path_to_file)[0]
 | 
								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):
 | 
						def on_PHOTO_button_press_event(self, widget, event):
 | 
				
			||||||
		'''If right-clicked, show popup'''
 | 
							'''If right-clicked, show popup'''
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue