aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-roster-view.c41
-rw-r--r--libempathy-gtk/empathy-roster-view.h11
2 files changed, 52 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index 28aac164c..3803c8b17 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -50,6 +50,9 @@ struct _EmpathyRosterViewPriv
gboolean show_groups;
EmpathyLiveSearch *search;
+
+ EmpathyRosterViewIndividualTooltipCb individual_tooltip_cb;
+ gpointer individual_tooltip_data;
};
static void
@@ -876,6 +879,43 @@ empathy_roster_view_key_press_event (GtkWidget *widget,
return chain_up (widget, event);
}
+static gboolean
+empathy_roster_view_query_tooltip (GtkWidget *widget,
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip)
+{
+ EmpathyRosterView *self = EMPATHY_ROSTER_VIEW (widget);
+ GtkWidget *child;
+ EmpathyRosterContact *contact;
+ FolksIndividual *individual;
+
+ if (self->priv->individual_tooltip_cb == NULL)
+ return FALSE;
+
+ child = egg_list_box_get_child_at_y (EGG_LIST_BOX (self), y);
+ if (!EMPATHY_IS_ROSTER_CONTACT (child))
+ return FALSE;
+
+ contact = EMPATHY_ROSTER_CONTACT (child);
+ individual = empathy_roster_contact_get_individual (contact);
+
+ return self->priv->individual_tooltip_cb (self, individual, keyboard_mode,
+ tooltip, self->priv->individual_tooltip_data);
+}
+
+void
+empathy_roster_view_set_individual_tooltip_cb (EmpathyRosterView *self,
+ EmpathyRosterViewIndividualTooltipCb callback,
+ gpointer user_data)
+{
+ self->priv->individual_tooltip_cb = callback;
+ self->priv->individual_tooltip_data = user_data;
+
+ gtk_widget_set_has_tooltip (GTK_WIDGET (self), callback != NULL);
+}
+
static void
empathy_roster_view_class_init (
EmpathyRosterViewClass *klass)
@@ -893,6 +933,7 @@ empathy_roster_view_class_init (
widget_class->button_press_event = empathy_roster_view_button_press_event;
widget_class->key_press_event = empathy_roster_view_key_press_event;
+ widget_class->query_tooltip = empathy_roster_view_query_tooltip;
box_class->child_activated = empathy_roster_view_child_activated;
diff --git a/libempathy-gtk/empathy-roster-view.h b/libempathy-gtk/empathy-roster-view.h
index e5c3a6f40..e5160f6a3 100644
--- a/libempathy-gtk/empathy-roster-view.h
+++ b/libempathy-gtk/empathy-roster-view.h
@@ -64,6 +64,17 @@ void empathy_roster_view_show_groups (EmpathyRosterView *self,
void empathy_roster_view_set_live_search (EmpathyRosterView *self,
EmpathyLiveSearch *search);
+typedef gboolean (* EmpathyRosterViewIndividualTooltipCb) (
+ EmpathyRosterView *self,
+ FolksIndividual *individual,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip,
+ gpointer user_data);
+
+void empathy_roster_view_set_individual_tooltip_cb (EmpathyRosterView *self,
+ EmpathyRosterViewIndividualTooltipCb callback,
+ gpointer user_data);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_ROSTER_VIEW_H__*/