aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-roster-view.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-01 19:25:42 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-14 15:21:49 +0800
commit785ce2292d3b61afd25099fd87eb3b7fbf4f4270 (patch)
treec188dbc8f47fbcb997c1ec86061f66122e49c7d0 /libempathy-gtk/empathy-roster-view.c
parent525000e6fe4dee72ebc327286d37b9d3260eab7b (diff)
downloadgsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.tar
gsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.tar.gz
gsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.tar.bz2
gsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.tar.lz
gsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.tar.xz
gsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.tar.zst
gsoc2013-empathy-785ce2292d3b61afd25099fd87eb3b7fbf4f4270.zip
add a signal when a contact is activated
Diffstat (limited to 'libempathy-gtk/empathy-roster-view.c')
-rw-r--r--libempathy-gtk/empathy-roster-view.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index ecd8f40e5..dadc044c8 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -18,14 +18,13 @@ enum
N_PROPS
};
-/*
enum
{
+ SIG_INDIVIDUAL_ACTIVATED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
-*/
#define NO_GROUP "X-no-group"
#define UNGROUPPED _("Ungroupped")
@@ -767,6 +766,8 @@ empathy_roster_view_constructed (GObject *object)
self, NULL);
egg_list_box_set_filter_func (EGG_LIST_BOX (self), filter_list, self, NULL);
+
+ egg_list_box_set_activate_on_single_click (EGG_LIST_BOX (self), FALSE);
}
static void
@@ -798,10 +799,27 @@ empathy_roster_view_finalize (GObject *object)
}
static void
+empathy_roster_view_child_activated (EggListBox *box,
+ GtkWidget *child)
+{
+ EmpathyRosterContact *contact;
+ FolksIndividual *individual;
+
+ if (!EMPATHY_IS_ROSTER_CONTACT (child))
+ return;
+
+ contact = EMPATHY_ROSTER_CONTACT (child);
+ individual = empathy_roster_contact_get_individual (contact);
+
+ g_signal_emit (box, signals[SIG_INDIVIDUAL_ACTIVATED], 0, individual);
+}
+
+static void
empathy_roster_view_class_init (
EmpathyRosterViewClass *klass)
{
GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ EggListBoxClass *box_class = EGG_LIST_BOX_CLASS (klass);
GParamSpec *spec;
oclass->get_property = empathy_roster_view_get_property;
@@ -810,6 +828,8 @@ empathy_roster_view_class_init (
oclass->dispose = empathy_roster_view_dispose;
oclass->finalize = empathy_roster_view_finalize;
+ box_class->child_activated = empathy_roster_view_child_activated;
+
spec = g_param_spec_object ("manager", "Manager",
"EmpathyIndividualManager",
EMPATHY_TYPE_INDIVIDUAL_MANAGER,
@@ -828,6 +848,13 @@ empathy_roster_view_class_init (
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_SHOW_GROUPS, spec);
+ signals[SIG_INDIVIDUAL_ACTIVATED] = g_signal_new ("individual-activated",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 1, FOLKS_TYPE_INDIVIDUAL);
+
g_type_class_add_private (klass, sizeof (EmpathyRosterViewPriv));
}
@@ -934,7 +961,14 @@ static void
search_activate_cb (GtkWidget *search,
EmpathyRosterView *self)
{
- /* TODO */
+ EggListBox *box = EGG_LIST_BOX (self);
+ GtkWidget *child;
+
+ child = egg_list_box_get_selected_child (box);
+ if (child == NULL)
+ return;
+
+ empathy_roster_view_child_activated (box, child);
}
void