aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Contzen <lcontzen@gmail.com>2012-08-08 17:18:38 +0800
committerLaurent Contzen <lcontzen@gmail.com>2012-08-09 18:51:40 +0800
commit2a819c16c9ecd02c929156be39fa1c994cc907e2 (patch)
tree1d280eff6355f026e788a7bc29aa6f71d6128e91
parentf7ba567b17c1d0d0cdc5d04e0bca4d2368be75fa (diff)
downloadgsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.tar
gsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.tar.gz
gsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.tar.bz2
gsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.tar.lz
gsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.tar.xz
gsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.tar.zst
gsoc2013-empathy-2a819c16c9ecd02c929156be39fa1c994cc907e2.zip
Added new aggregator property in EmpathyRosterModelAggregator
-rw-r--r--libempathy-gtk/empathy-roster-model-aggregator.c48
-rw-r--r--libempathy-gtk/empathy-roster-model-aggregator.h6
2 files changed, 47 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-roster-model-aggregator.c b/libempathy-gtk/empathy-roster-model-aggregator.c
index 1f6a0f124..8aa20f934 100644
--- a/libempathy-gtk/empathy-roster-model-aggregator.c
+++ b/libempathy-gtk/empathy-roster-model-aggregator.c
@@ -24,6 +24,9 @@
#include "config.h"
+#include <folks/folks.h>
+#include <folks/folks-telepathy.h>
+
#include "empathy-roster-model-aggregator.h"
#include "empathy-roster-model.h"
@@ -61,7 +64,7 @@ G_DEFINE_TYPE_WITH_CODE (EmpathyRosterModelAggregator,
enum
{
- PROP_FIRST_PROP = 1,
+ PROP_AGGREGATOR = 1,
N_PROPS
};
@@ -76,7 +79,7 @@ static guint signals[LAST_SIGNAL];
struct _EmpathyRosterModelAggregatorPriv
{
- gpointer badger;
+ FolksIndividualAggregator *aggregator;
};
static void
@@ -85,10 +88,13 @@ empathy_roster_model_aggregator_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- //EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
+ EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
switch (property_id)
{
+ case PROP_AGGREGATOR:
+ g_value_set_object (value, self->priv->aggregator);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -101,10 +107,14 @@ empathy_roster_model_aggregator_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- //EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
+ EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
switch (property_id)
{
+ case PROP_AGGREGATOR:
+ g_assert (self->priv->aggregator == NULL); /* construct only */
+ self->priv->aggregator = g_value_dup_object (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -114,21 +124,28 @@ empathy_roster_model_aggregator_set_property (GObject *object,
static void
empathy_roster_model_aggregator_constructed (GObject *object)
{
- //EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
+ EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
void (*chain_up) (GObject *) =
((GObjectClass *) empathy_roster_model_aggregator_parent_class)->constructed;
if (chain_up != NULL)
chain_up (object);
+
+ if (self->priv->aggregator == NULL)
+ self->priv->aggregator = folks_individual_aggregator_new ();
+
+ g_assert (FOLKS_IS_INDIVIDUAL_AGGREGATOR (self->priv->aggregator));
}
static void
empathy_roster_model_aggregator_dispose (GObject *object)
{
- //EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
+ EmpathyRosterModelAggregator *self = EMPATHY_ROSTER_MODEL_AGGREGATOR (object);
void (*chain_up) (GObject *) =
((GObjectClass *) empathy_roster_model_aggregator_parent_class)->dispose;
+ g_clear_object (&self->priv->aggregator);
+
if (chain_up != NULL)
chain_up (object);
}
@@ -149,7 +166,7 @@ empathy_roster_model_aggregator_class_init (
EmpathyRosterModelAggregatorClass *klass)
{
GObjectClass *oclass = G_OBJECT_CLASS (klass);
- //GParamSpec *spec;
+ GParamSpec *spec;
oclass->get_property = empathy_roster_model_aggregator_get_property;
oclass->set_property = empathy_roster_model_aggregator_set_property;
@@ -157,6 +174,12 @@ empathy_roster_model_aggregator_class_init (
oclass->dispose = empathy_roster_model_aggregator_dispose;
oclass->finalize = empathy_roster_model_aggregator_finalize;
+ spec = g_param_spec_object ("aggregator", "Aggregator",
+ "FolksIndividualAggregator",
+ FOLKS_TYPE_INDIVIDUAL_AGGREGATOR,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (oclass, PROP_AGGREGATOR, spec);
+
g_type_class_add_private (klass, sizeof (EmpathyRosterModelAggregatorPriv));
}
@@ -174,6 +197,17 @@ empathy_roster_model_aggregator_new (void)
NULL);
}
+EmpathyRosterModelAggregator *
+empathy_roster_model_aggregator_new_with_aggregator (
+ FolksIndividualAggregator *aggregator)
+{
+ g_return_val_if_fail (FOLKS_IS_INDIVIDUAL_AGGREGATOR (aggregator), NULL);
+
+ return g_object_new (EMPATHY_TYPE_ROSTER_MODEL_AGGREGATOR,
+ "aggregator", aggregator,
+ NULL);
+}
+
static void
roster_model_iface_init (EmpathyRosterModelInterface *iface)
{
diff --git a/libempathy-gtk/empathy-roster-model-aggregator.h b/libempathy-gtk/empathy-roster-model-aggregator.h
index aa5603e32..74dc560a3 100644
--- a/libempathy-gtk/empathy-roster-model-aggregator.h
+++ b/libempathy-gtk/empathy-roster-model-aggregator.h
@@ -24,6 +24,8 @@
#include <glib-object.h>
+#include <folks/folks.h>
+
G_BEGIN_DECLS
typedef struct _EmpathyRosterModelAggregator EmpathyRosterModelAggregator;
@@ -71,6 +73,10 @@ GType empathy_roster_model_aggregator_get_type (void);
EmpathyRosterModelAggregator * empathy_roster_model_aggregator_new (void);
+EmpathyRosterModelAggregator *
+empathy_roster_model_aggregator_new_with_aggregator (
+ FolksIndividualAggregator *aggregator);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_ROSTER_MODEL_AGGREGATOR_H__*/