aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-24 03:35:29 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-24 03:35:29 +0800
commit935e4f2004e6d9966a124d1ac6289e5cc0dca3fb (patch)
treee21b4c451c2a792febf94cbddf443a22f53db532
parent61a627be9a0d353ee9fc4d8edecde948aab5d243 (diff)
downloadgsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.tar
gsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.tar.gz
gsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.tar.bz2
gsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.tar.lz
gsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.tar.xz
gsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.tar.zst
gsoc2013-empathy-935e4f2004e6d9966a124d1ac6289e5cc0dca3fb.zip
Add a public method to change the contact showed.
svn path=/trunk/; revision=598
-rw-r--r--libempathy-gtk/empathy-contact-widget.c23
-rw-r--r--libempathy-gtk/empathy-contact-widget.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 51d17bfb7..a03571d9a 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -224,6 +224,23 @@ empathy_contact_widget_get_contact (GtkWidget *widget)
}
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 @@ 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);
diff --git a/libempathy-gtk/empathy-contact-widget.h b/libempathy-gtk/empathy-contact-widget.h
index 21dd1bf0c..643867ef5 100644
--- a/libempathy-gtk/empathy-contact-widget.h
+++ b/libempathy-gtk/empathy-contact-widget.h
@@ -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);