annotate pidgin/pidgintooltip.c @ 21877:6bf73aea6450

Some utility functions for showing tooltips. This is used by the buddylist, the roomlist and the infopane in the conversation window. The userlist in chats can also use this, I think. It works OK, but it may be possible to make the code a bit nicer. Any suggestions?
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 06 Dec 2007 07:33:53 +0000
parents
children b93c099dcfe4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21877
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
1 /**
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
2 * @file pidgintooltip.c Pidgin Tooltip API
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
3 * @ingroup pidgin
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
4 */
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
5
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
6 /* pidgin
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
7 *
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 * source distribution.
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 *
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
16 *
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
21 *
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
25 */
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
26
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
27 #include "internal.h"
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
28 #include "prefs.h"
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
29 #include "pidgin.h"
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
30 #include "pidgintooltip.h"
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
31
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
32 struct
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
33 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
34 GtkWidget *widget;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
35 int timeout;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
36 GdkRectangle tip_rect;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
37 GtkWidget *tipwindow;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
38 PidginTooltipPaint paint_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39 } pidgin_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
40
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
41 typedef struct
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
42 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
43 GtkWidget *widget;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
44 gpointer userdata;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
45 PidginTooltipCreateForTree create_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
46 PidginTooltipPaint paint_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
47 GtkTreePath *path;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
48 } PidginTooltipData;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
49
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
50 static void
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
51 destroy_tooltip_data(PidginTooltipData *data)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
52 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
53 gtk_tree_path_free(data->path);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
54 g_free(data);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
55 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
56
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
57 void pidgin_tooltip_destroy()
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
58 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
59 if (pidgin_tooltip.timeout > 0) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
60 g_source_remove(pidgin_tooltip.timeout);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
61 pidgin_tooltip.timeout = 0;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
62 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
63 if (pidgin_tooltip.tipwindow) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
64 gtk_widget_destroy(pidgin_tooltip.tipwindow);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
65 pidgin_tooltip.tipwindow = NULL;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
66 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
67 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
68
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
69 static void
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
70 pidgin_tooltip_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
72 if (pidgin_tooltip.paint_tooltip)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
73 pidgin_tooltip.paint_tooltip(widget, event, data);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
74 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
75
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
76 static void
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
77 setup_tooltip_window(gpointer data, int w, int h)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
78 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
79 const char *name;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
80 int sig;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
81 int scr_w, scr_h, x, y;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
82 #if GTK_CHECK_VERSION(2,2,0)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
83 int mon_num;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
84 GdkScreen *screen = NULL;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
85 #endif
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
86 GdkRectangle mon_size;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
87 GtkWidget *tipwindow = pidgin_tooltip.tipwindow;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
88
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
89 name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget));
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
90 gtk_widget_set_app_paintable(tipwindow, TRUE);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
91 gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip"));
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
92 gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
93 gtk_widget_set_name(tipwindow, "gtk-tooltips");
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
94 g_signal_connect(G_OBJECT(tipwindow), "expose_event",
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
95 G_CALLBACK(pidgin_tooltip_expose_event), data);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
96
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
97 #if GTK_CHECK_VERSION(2,2,0)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
99 mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
100 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
101
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
102 scr_w = mon_size.width + mon_size.x;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
103 scr_h = mon_size.height + mon_size.y;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
104 #else
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 scr_w = gdk_screen_width();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
106 scr_h = gdk_screen_height();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
107 gdk_window_get_pointer(NULL, &x, &y, NULL);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
108 mon_size.x = 0;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
109 mon_size.y = 0;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
110 #endif
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
111
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
112 #if GTK_CHECK_VERSION(2,2,0)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
113 if (w > mon_size.width)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
114 w = mon_size.width - 10;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
115
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
116 if (h > mon_size.height)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
117 h = mon_size.height - 10;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
118 #endif
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
119 x -= ((w >> 1) + 4);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
120
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
121 if ((y + h + 4) > scr_h)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
122 y = y - h - 5;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
123 else
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
124 y = y + 6;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
125
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
126 if (y < mon_size.y)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
127 y = mon_size.y;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
128
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
129 if (y != mon_size.y) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
130 if ((x + w) > scr_w)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
131 x -= (x + w + 5) - scr_w;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
132 else if (x < mon_size.x)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
133 x = mon_size.x;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
134 } else {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
135 x -= (w / 2 + 10);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
136 if (x < mon_size.x)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
137 x = mon_size.x;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
138 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
139
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
140 gtk_widget_set_size_request(tipwindow, w, h);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
141 gtk_window_move(GTK_WINDOW(tipwindow), x, y);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
142 gtk_widget_show(tipwindow);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
143
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
144 /* Hide the tooltip when the widget is destroyed */
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
145 sig = g_signal_connect(G_OBJECT(pidgin_tooltip.widget), "destroy", G_CALLBACK(pidgin_tooltip_destroy), NULL);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
146 g_signal_connect_swapped(G_OBJECT(tipwindow), "destroy", G_CALLBACK(g_source_remove), GINT_TO_POINTER(sig));
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
147 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
148
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
149 void pidgin_tooltip_show(GtkWidget *widget, gpointer userdata,
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
150 PidginTooltipCreate create_tooltip, PidginTooltipPaint paint_tooltip)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
151 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
152 GtkWidget *tipwindow;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
153 int w, h;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
154
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
155 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
156 pidgin_tooltip.tipwindow = tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
157 pidgin_tooltip.widget = gtk_widget_get_toplevel(widget);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
158 pidgin_tooltip.paint_tooltip = paint_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
159 gtk_widget_ensure_style(tipwindow);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
160
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
161 if (!create_tooltip(tipwindow, userdata, &w, &h)) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
162 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
163 return;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
164 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
165 setup_tooltip_window(userdata, w, h);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
166 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
167
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
168 static void
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
169 pidgin_tooltip_draw(PidginTooltipData *data)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
170 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
171 GtkWidget *tipwindow;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
172 GtkTreePath *path = NULL;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
173 int w, h;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
174
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
175 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(data->widget),
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
176 pidgin_tooltip.tip_rect.x,
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
177 pidgin_tooltip.tip_rect.y + (pidgin_tooltip.tip_rect.height/2),
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
178 &path, NULL, NULL, NULL)) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
179 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
180 return;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
181 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
182
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
183 if (data->path) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
184 if (gtk_tree_path_compare(data->path, path) == 0)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
185 return;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
186 gtk_tree_path_free(data->path);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
187 data->path = NULL;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
188 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
189
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
190 pidgin_tooltip.tipwindow = tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
191 pidgin_tooltip.widget = gtk_widget_get_toplevel(data->widget);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
192 pidgin_tooltip.paint_tooltip = data->paint_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
193 gtk_widget_ensure_style(tipwindow);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
194
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
195 if (!data->create_tooltip(tipwindow, path, data->userdata, &w, &h)) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
196 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
197 gtk_tree_path_free(path);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
198 return;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
199 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
200
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
201 data->path = path;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
202 setup_tooltip_window(data->userdata, w, h);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
203 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
204
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
205 static gboolean
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
206 pidgin_tooltip_timeout(gpointer data)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
207 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
208 pidgin_tooltip.timeout = 0;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
209 pidgin_tooltip_draw(data);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
210 return FALSE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
211 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
212
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
213 static gboolean
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
214 row_motion_cb(GtkWidget *tv, GdkEventMotion *event, gpointer userdata)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
215 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
216 GtkTreePath *path;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
217 int delay;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
218
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
219 /* XXX: probably use something more generic? */
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
220 delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
221 if (delay == 0)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
222 return FALSE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
223
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
224 if (pidgin_tooltip.timeout) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
225 if ((event->y >= pidgin_tooltip.tip_rect.y) && ((event->y - pidgin_tooltip.tip_rect.height) <= pidgin_tooltip.tip_rect.y))
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
226 return FALSE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
227 /* We've left the cell. Remove the timeout and create a new one below */
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
228 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
229 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
230
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
231 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
232
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
233 if (path == NULL) {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
234 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
235 return FALSE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
236 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
237
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
238 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &pidgin_tooltip.tip_rect);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
239
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
240 if (path)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
241 gtk_tree_path_free(path);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
242 pidgin_tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_tooltip_timeout, userdata);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
243
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
244 return FALSE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
245 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
246
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
247 static gboolean
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
248 row_leave_cb(GtkWidget *tv, GdkEvent *event, gpointer userdata)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
249 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
250 pidgin_tooltip_destroy();
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
251 return FALSE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
252 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
253
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
254 gboolean pidgin_tooltip_setup_for_treeview(GtkWidget *tree, gpointer userdata,
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
255 PidginTooltipCreateForTree create_tooltip, PidginTooltipPaint paint_tooltip)
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
256 {
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
257 PidginTooltipData *tdata = g_new0(PidginTooltipData, 1);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
258 tdata->widget = tree;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
259 tdata->userdata = userdata;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
260 tdata->create_tooltip = create_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
261 tdata->paint_tooltip = paint_tooltip;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
262
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
263 g_signal_connect(G_OBJECT(tree), "motion-notify-event", G_CALLBACK(row_motion_cb), tdata);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
264 g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(row_leave_cb), NULL);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
265 g_signal_connect_swapped(G_OBJECT(tree), "destroy", G_CALLBACK(destroy_tooltip_data), tdata);
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
266 return TRUE;
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
267 }
6bf73aea6450 Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
268