Add a public method to change the contact showed.
authorXavier Claessens <xclaesse@src.gnome.org>
Wed, 23 Jan 2008 19:35:29 +0000 (19:35 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Wed, 23 Jan 2008 19:35:29 +0000 (19:35 +0000)
svn path=/trunk/; revision=598

libempathy-gtk/empathy-contact-widget.c
libempathy-gtk/empathy-contact-widget.h

index 51d17bfb71da589205bd33ae4b90a9f29611414c..a03571d9a1562a9d7186163f8f15a958d82bb4f8 100644 (file)
@@ -223,6 +223,23 @@ empathy_contact_widget_get_contact (GtkWidget *widget)
        return information->contact;
 }
 
+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,
@@ -289,6 +306,12 @@ static void
 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);
index 21dd1bf0c0a01828a6b730a857c92326535dd1bc..643867ef54567a6ca5967329a624dd65ec86773f 100644 (file)
@@ -41,6 +41,8 @@ typedef enum {
 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);