From 3a0dc8812d6c720499e34882b499f1cd9447c57c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 22 Jun 2012 09:40:15 +0200 Subject: roster-view: export empathy_roster_view_get_individual_at_y() https://bugzilla.gnome.org/show_bug.cgi?id=678524 --- libempathy-gtk/empathy-roster-view.c | 31 ++++++++++++++++++++++++------- libempathy-gtk/empathy-roster-view.h | 5 +++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index 111b643b6..8dc739fde 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -1262,6 +1262,27 @@ empathy_roster_view_key_press_event (GtkWidget *widget, return chain_up (widget, event); } +/** + * @out_child: (out) (allow-none) + */ +FolksIndividual * +empathy_roster_view_get_individual_at_y (EmpathyRosterView *self, + gint y, + GtkWidget **out_child) +{ + GtkWidget *child; + + child = egg_list_box_get_child_at_y (EGG_LIST_BOX (self), y); + + if (out_child != NULL) + *out_child = child; + + if (!EMPATHY_IS_ROSTER_CONTACT (child)) + return NULL; + + return empathy_roster_contact_get_individual (EMPATHY_ROSTER_CONTACT (child)); +} + static gboolean empathy_roster_view_query_tooltip (GtkWidget *widget, gint x, @@ -1270,18 +1291,14 @@ empathy_roster_view_query_tooltip (GtkWidget *widget, GtkTooltip *tooltip) { EmpathyRosterView *self = EMPATHY_ROSTER_VIEW (widget); - GtkWidget *child; - EmpathyRosterContact *contact; FolksIndividual *individual; gboolean result; + GtkWidget *child; - child = egg_list_box_get_child_at_y (EGG_LIST_BOX (self), y); - if (!EMPATHY_IS_ROSTER_CONTACT (child)) + individual = empathy_roster_view_get_individual_at_y (self, y, &child); + if (individual == NULL) return FALSE; - contact = EMPATHY_ROSTER_CONTACT (child); - individual = empathy_roster_contact_get_individual (contact); - g_signal_emit (self, signals[SIG_INDIVIDUAL_TOOLTIP], 0, individual, keyboard_mode, tooltip, &result); diff --git a/libempathy-gtk/empathy-roster-view.h b/libempathy-gtk/empathy-roster-view.h index a0ed77515..ff9ba6c57 100644 --- a/libempathy-gtk/empathy-roster-view.h +++ b/libempathy-gtk/empathy-roster-view.h @@ -76,6 +76,11 @@ guint empathy_roster_view_add_event (EmpathyRosterView *self, void empathy_roster_view_remove_event (EmpathyRosterView *self, guint event_id); +FolksIndividual * empathy_roster_view_get_individual_at_y ( + EmpathyRosterView *self, + gint y, + GtkWidget **out_child); + G_END_DECLS #endif /* #ifndef __EMPATHY_ROSTER_VIEW_H__*/ -- cgit v1.2.3