empathy r598 - trunk/libempathy-gtk



Author: xclaesse
Date: Wed Jan 23 19:35:29 2008
New Revision: 598
URL: http://svn.gnome.org/viewvc/empathy?rev=598&view=rev

Log:
Add a public method to change the contact showed.


Modified:
   trunk/libempathy-gtk/empathy-contact-widget.c
   trunk/libempathy-gtk/empathy-contact-widget.h

Modified: trunk/libempathy-gtk/empathy-contact-widget.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-widget.c	(original)
+++ trunk/libempathy-gtk/empathy-contact-widget.c	Wed Jan 23 19:35:29 2008
@@ -224,6 +224,23 @@
 }
 
 void
+empathy_contact_widget_set_contact (GtkWidget      *widget,
+				    EmpathyContact *contact)
+{
+	EmpathyContactWidget *information;
+
+	g_return_if_fail (GTK_IS_WIDGET (widget));
+	g_return_if_fail (EMPATHY_IS_CONTACT (contact));
+
+	information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
+	if (!information) {
+		return;
+	}
+
+	contact_widget_set_contact (information, contact);
+}
+
+void
 empathy_contact_widget_set_account_filter (GtkWidget                       *widget,
 					   EmpathyAccountChooserFilterFunc  filter,
 					   gpointer                         user_data)
@@ -289,6 +306,12 @@
 contact_widget_set_contact (EmpathyContactWidget *information,
 			    EmpathyContact        *contact)
 {
+	if (contact == information->contact ||
+	    (contact && information->contact &&
+	     empathy_contact_equal (contact, information->contact))) {
+		return;
+	}
+
 	contact_widget_remove_contact (information);
 	if (contact) {
 		information->contact = g_object_ref (contact);

Modified: trunk/libempathy-gtk/empathy-contact-widget.h
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-widget.h	(original)
+++ trunk/libempathy-gtk/empathy-contact-widget.h	Wed Jan 23 19:35:29 2008
@@ -41,6 +41,8 @@
 GtkWidget *     empathy_contact_widget_new                (EmpathyContact                  *contact,
 							   EmpathyContactWidgetFlags        flags);
 EmpathyContact *empathy_contact_widget_get_contact        (GtkWidget                       *widget);
+void            empathy_contact_widget_set_contact        (GtkWidget                       *widget,
+							   EmpathyContact                  *contact);
 void            empathy_contact_widget_set_account_filter (GtkWidget                       *widget,
 							   EmpathyAccountChooserFilterFunc  filter,
 							   gpointer                         user_data);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]