diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-05-25 21:35:11 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-14 15:21:48 +0800 |
commit | dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa (patch) | |
tree | c78b34cdd767e03736f228f7b82f684270b952f0 | |
parent | ad12e6ef47f56a291e9cc46496a5f27620701242 (diff) | |
download | gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.tar gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.tar.gz gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.tar.bz2 gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.tar.lz gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.tar.xz gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.tar.zst gsoc2013-empathy-dd84cb92422f8c74e8ba2b1f66bb3ddc789a78fa.zip |
roster-contact: add group property
-rw-r--r-- | libempathy-gtk/empathy-roster-contact.c | 29 | ||||
-rw-r--r-- | libempathy-gtk/empathy-roster-contact.h | 5 | ||||
-rw-r--r-- | libempathy-gtk/empathy-roster-view.c | 2 |
3 files changed, 32 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-roster-contact.c b/libempathy-gtk/empathy-roster-contact.c index 3b30d2517..b98552590 100644 --- a/libempathy-gtk/empathy-roster-contact.c +++ b/libempathy-gtk/empathy-roster-contact.c @@ -16,6 +16,7 @@ G_DEFINE_TYPE (EmpathyRosterContact, empathy_roster_contact, GTK_TYPE_ALIGNMENT) enum { PROP_INDIVIDIUAL = 1, + PROP_GROUP, PROP_ONLINE, PROP_ALIAS, N_PROPS @@ -33,6 +34,7 @@ static guint signals[LAST_SIGNAL]; struct _EmpathyRosterContactPriv { FolksIndividual *individual; + gchar *group; GtkWidget *avatar; GtkWidget *first_line_alig; @@ -64,6 +66,9 @@ empathy_roster_contact_get_property (GObject *object, case PROP_INDIVIDIUAL: g_value_set_object (value, self->priv->individual); break; + case PROP_GROUP: + g_value_set_string (value, self->priv->group); + break; case PROP_ONLINE: g_value_set_boolean (value, self->priv->online); break; @@ -90,6 +95,10 @@ empathy_roster_contact_set_property (GObject *object, g_assert (self->priv->individual == NULL); /* construct only */ self->priv->individual = g_value_dup_object (value); break; + case PROP_GROUP: + g_assert (self->priv->group == NULL); /* construct only */ + self->priv->group = g_value_dup_string (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -317,10 +326,12 @@ empathy_roster_contact_dispose (GObject *object) static void empathy_roster_contact_finalize (GObject *object) { - //EmpathyRosterContact *self = EMPATHY_ROSTER_CONTACT (object); + EmpathyRosterContact *self = EMPATHY_ROSTER_CONTACT (object); void (*chain_up) (GObject *) = ((GObjectClass *) empathy_roster_contact_parent_class)->finalize; + g_free (self->priv->group); + if (chain_up != NULL) chain_up (object); } @@ -344,6 +355,12 @@ empathy_roster_contact_class_init ( G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (oclass, PROP_INDIVIDIUAL, spec); + spec = g_param_spec_string ("group", "Group", + "Group of this widget, or NULL", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (oclass, PROP_GROUP, spec); + spec = g_param_spec_boolean ("online", "Online", "TRUE if Individual is online", FALSE, @@ -426,12 +443,14 @@ empathy_roster_contact_init (EmpathyRosterContact *self) } GtkWidget * -empathy_roster_contact_new (FolksIndividual *individual) +empathy_roster_contact_new (FolksIndividual *individual, + const gchar *group) { g_return_val_if_fail (FOLKS_IS_INDIVIDUAL (individual), NULL); return g_object_new (EMPATHY_TYPE_ROSTER_CONTACT, "individual", individual, + "group", group, "bottom-padding", 8, "top-padding", 8, "left-padding", 8, @@ -450,3 +469,9 @@ empathy_roster_contact_is_online (EmpathyRosterContact *self) { return self->priv->online; } + +const gchar * +empathy_roster_contact_get_group (EmpathyRosterContact *self) +{ + return self->priv->group; +} diff --git a/libempathy-gtk/empathy-roster-contact.h b/libempathy-gtk/empathy-roster-contact.h index 09a791874..a7c5b0866 100644 --- a/libempathy-gtk/empathy-roster-contact.h +++ b/libempathy-gtk/empathy-roster-contact.h @@ -47,10 +47,13 @@ GType empathy_roster_contact_get_type (void); EMPATHY_TYPE_ROSTER_CONTACT, \ EmpathyRosterContactClass)) -GtkWidget * empathy_roster_contact_new (FolksIndividual *individual); +GtkWidget * empathy_roster_contact_new (FolksIndividual *individual, + const gchar *group); FolksIndividual * empathy_roster_contact_get_individual (EmpathyRosterContact *self); +const gchar * empathy_roster_contact_get_group (EmpathyRosterContact *self); + gboolean empathy_roster_contact_is_online (EmpathyRosterContact *self); G_END_DECLS diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index eff7fbdbb..5ae28b1eb 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -101,7 +101,7 @@ add_roster_contact (EmpathyRosterView *self, { GtkWidget *contact; - contact = empathy_roster_contact_new (individual); + contact = empathy_roster_contact_new (individual, NULL); /* Need to refilter if online is changed */ g_signal_connect (contact, "notify::online", |