aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-roster-window.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-18 18:17:33 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-18 18:58:32 +0800
commitaac60300edfcb929acca9e4fc59cdb5803eecc30 (patch)
treeac1bacf4a1a9d69bcf6daefa061d5d51e63f52b5 /src/empathy-roster-window.c
parent5a535ee7a9d488a608e7934839fa989b804f9577 (diff)
downloadgsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.tar
gsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.tar.gz
gsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.tar.bz2
gsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.tar.lz
gsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.tar.xz
gsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.tar.zst
gsoc2013-empathy-aac60300edfcb929acca9e4fc59cdb5803eecc30.zip
roster-window: display individual tooltips
I re-used the same code as in EmpathyIndividualView. https://bugzilla.gnome.org/show_bug.cgi?id=678294
Diffstat (limited to 'src/empathy-roster-window.c')
-rw-r--r--src/empathy-roster-window.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index 6a791f45c..a1363fcee 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -124,6 +124,7 @@ struct _EmpathyRosterWindowPriv {
GtkWidget *no_entry_label;
GtkWidget *button_account_settings;
GtkWidget *spinner_loading;
+ GtkWidget *tooltip_widget;
GMenu *menumodel;
GMenu *rooms_section;
@@ -999,6 +1000,8 @@ empathy_roster_window_finalize (GObject *window)
g_object_unref (self->priv->menumodel);
g_object_unref (self->priv->rooms_section);
+ g_clear_object (&self->priv->tooltip_widget);
+
G_OBJECT_CLASS (empathy_roster_window_parent_class)->finalize (window);
}
@@ -1911,6 +1914,50 @@ view_empty_cb (EmpathyRosterView *view,
}
static void
+tooltip_destroy_cb (GtkWidget *widget,
+ EmpathyRosterWindow *self)
+{
+ g_clear_object (&self->priv->tooltip_widget);
+}
+
+static gboolean
+individual_tooltip_cb (EmpathyRosterView *view,
+ FolksIndividual *individual,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip,
+ gpointer user_data)
+{
+ EmpathyRosterWindow *self = user_data;
+
+ if (self->priv->tooltip_widget == NULL)
+ {
+ self->priv->tooltip_widget = empathy_individual_widget_new (individual,
+ EMPATHY_INDIVIDUAL_WIDGET_FOR_TOOLTIP |
+ EMPATHY_INDIVIDUAL_WIDGET_SHOW_LOCATION |
+ EMPATHY_INDIVIDUAL_WIDGET_SHOW_CLIENT_TYPES);
+
+ gtk_container_set_border_width (
+ GTK_CONTAINER (self->priv->tooltip_widget), 8);
+
+ g_object_ref (self->priv->tooltip_widget);
+
+ tp_g_signal_connect_object (self->priv->tooltip_widget, "destroy",
+ G_CALLBACK (tooltip_destroy_cb), self, 0);
+
+ gtk_widget_show (self->priv->tooltip_widget);
+ }
+ else
+ {
+ empathy_individual_widget_set_individual (
+ EMPATHY_INDIVIDUAL_WIDGET (self->priv->tooltip_widget), individual);
+ }
+
+ gtk_tooltip_set_custom (tooltip, self->priv->tooltip_widget);
+
+ return TRUE;
+}
+
+static void
empathy_roster_window_init (EmpathyRosterWindow *self)
{
GtkBuilder *gui;
@@ -2043,6 +2090,9 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
g_signal_connect (self->priv->view, "notify::empty",
G_CALLBACK (view_empty_cb), self);
+ empathy_roster_view_set_individual_tooltip_cb (self->priv->view,
+ individual_tooltip_cb, self);
+
/* Set up search bar */
self->priv->search_bar = empathy_live_search_new (
GTK_WIDGET (self->priv->view));