Mercurial > pidgin.yaz
annotate pidgin/pidgintooltip.c @ 29080:f27ed49948b7
jabber: Oops, re-enable DIGEST-MD5 (I was testing PLAIN).
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 07 Nov 2009 06:42:48 +0000 |
parents | 5587f50886a5 |
children | 21277e69e06c |
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" |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
31 #include "debug.h" |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
33 static gboolean enable_tooltips; |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
34 static int tooltip_delay = -1; |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
35 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 struct |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 GtkWidget *widget; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 int timeout; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 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
|
41 GtkWidget *tipwindow; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 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
|
43 } pidgin_tooltip; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 typedef struct |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 GtkWidget *widget; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 gpointer userdata; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 PidginTooltipPaint paint_tooltip; |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
50 union { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
51 struct { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
52 PidginTooltipCreateForTree create_tooltip; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
53 GtkTreePath *path; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
54 } treeview; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
55 struct { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
56 PidginTooltipCreate create_tooltip; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
57 } widget; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
58 } common; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 } PidginTooltipData; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 static void |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
62 initialize_tooltip_delay() |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
63 { |
24289
d0e0de920387
Fix a compiler warning I introduce with the GtkSetting code.
Richard Laager <rlaager@wiktel.com>
parents:
24282
diff
changeset
|
64 #if GTK_CHECK_VERSION(2,14,0) |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
65 GtkSettings *settings; |
24289
d0e0de920387
Fix a compiler warning I introduce with the GtkSetting code.
Richard Laager <rlaager@wiktel.com>
parents:
24282
diff
changeset
|
66 #endif |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
67 |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
68 if (tooltip_delay != -1) |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
69 return; |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
70 |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
71 #if GTK_CHECK_VERSION(2,14,0) |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
72 settings = gtk_settings_get_default(); |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
73 |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
74 g_object_get(settings, "gtk-enable-tooltips", &enable_tooltips, NULL); |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
75 g_object_get(settings, "gtk-tooltip-timeout", &tooltip_delay, NULL); |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
76 #else |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
77 tooltip_delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay"); |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
78 enable_tooltips = (tooltip_delay != 0); |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
79 #endif |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
80 } |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
81 |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
82 static void |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 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
|
84 { |
24964
8a5c0c5c71f9
Jan Kratochvil found another race condition in the treeview tooltip code, this fixes it. Fixes #8069.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24289
diff
changeset
|
85 if (data->common.treeview.path) |
8a5c0c5c71f9
Jan Kratochvil found another race condition in the treeview tooltip code, this fixes it. Fixes #8069.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24289
diff
changeset
|
86 gtk_tree_path_free(data->common.treeview.path); |
23634
b79cfdcb704e
Jan Kratochvil noticed there was a race condition in the treeview tooltip
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22007
diff
changeset
|
87 pidgin_tooltip_destroy(); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 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
|
89 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 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
|
92 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 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
|
94 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
|
95 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
|
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 (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
|
98 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
|
99 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
|
100 } |
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 |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
103 static gboolean |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 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
|
105 { |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
106 if (pidgin_tooltip.paint_tooltip) { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
107 gtk_paint_flat_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
108 NULL, widget, "tooltip", 0, 0, -1, -1); |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
109 pidgin_tooltip.paint_tooltip(widget, data); |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
110 } |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
111 return FALSE; |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
112 } |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
113 |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
114 static GtkWidget* |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21945
diff
changeset
|
115 setup_tooltip_window(void) |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
116 { |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
117 const char *name; |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
118 GtkWidget *tipwindow; |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
119 |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
120 tipwindow = gtk_window_new(GTK_WINDOW_POPUP); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
121 name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget)); |
21905
2dafcbfc1556
GDK_WINDOW_TYPE_HINT_TOOLTIP is GTK+ >= 2.10.0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21885
diff
changeset
|
122 #if GTK_CHECK_VERSION(2,10,0) |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
123 gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP); |
21905
2dafcbfc1556
GDK_WINDOW_TYPE_HINT_TOOLTIP is GTK+ >= 2.10.0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21885
diff
changeset
|
124 #endif |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
125 gtk_widget_set_app_paintable(tipwindow, TRUE); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
126 gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip")); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
127 gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
128 gtk_widget_set_name(tipwindow, "gtk-tooltips"); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
129 gtk_widget_ensure_style(tipwindow); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
130 gtk_widget_realize(tipwindow); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
131 return tipwindow; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 static void |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
135 setup_tooltip_window_position(gpointer data, int w, int h) |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 int sig; |
25102
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
138 int scr_w, scr_h, x, y, dy; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 #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
|
140 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
|
141 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
|
142 #endif |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 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
|
144 GtkWidget *tipwindow = pidgin_tooltip.tipwindow; |
25102
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
145 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 #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
|
147 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
|
148 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
|
149 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
|
150 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 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
|
152 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
|
153 #else |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 #endif |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 |
25102
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
161 #if GTK_CHECK_VERSION(2,4,0) |
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
162 dy = gdk_display_get_default_cursor_size(gdk_display_get_default()) / 2; |
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
163 #else |
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
164 dy = 0; |
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
165 #endif |
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
166 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 #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
|
168 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
|
169 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
|
170 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 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
|
172 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
|
173 #endif |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 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
|
175 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 if ((y + h + 4) > scr_h) |
25102
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
177 y = y - h - dy - 5; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 else |
25102
2d873973b4d6
Adjust tooltips to offset their position by half the cursor size. This will
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
24964
diff
changeset
|
179 y = y + dy + 6; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 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
|
182 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
|
183 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 } else { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 } |
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 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
|
196 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
|
197 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
|
198 |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
199 g_signal_connect(G_OBJECT(tipwindow), "expose_event", |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
200 G_CALLBACK(pidgin_tooltip_expose_event), data); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
201 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 /* 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
|
203 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
|
204 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
|
205 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 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
|
208 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
|
209 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 GtkWidget *tipwindow; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 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
|
212 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 pidgin_tooltip_destroy(); |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
214 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 pidgin_tooltip.widget = gtk_widget_get_toplevel(widget); |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
216 pidgin_tooltip.tipwindow = tipwindow = setup_tooltip_window(); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 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
|
218 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 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
|
220 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
|
221 return; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 } |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
223 setup_tooltip_window_position(userdata, w, h); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 static void |
21884
b40a6bb267a1
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21881
diff
changeset
|
227 reset_data_treepath(PidginTooltipData *data) |
b40a6bb267a1
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21881
diff
changeset
|
228 { |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
229 gtk_tree_path_free(data->common.treeview.path); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
230 data->common.treeview.path = NULL; |
21884
b40a6bb267a1
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21881
diff
changeset
|
231 } |
b40a6bb267a1
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21881
diff
changeset
|
232 |
b40a6bb267a1
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21881
diff
changeset
|
233 static void |
21877
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_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
|
235 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 GtkWidget *tipwindow; |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
237 int w, h; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
238 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
239 pidgin_tooltip_destroy(); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
240 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
241 pidgin_tooltip.widget = gtk_widget_get_toplevel(data->widget); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
242 pidgin_tooltip.tipwindow = tipwindow = setup_tooltip_window(); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
243 pidgin_tooltip.paint_tooltip = data->paint_tooltip; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
244 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
245 if (!data->common.widget.create_tooltip(tipwindow, data->userdata, &w, &h)) { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
246 if (tipwindow == pidgin_tooltip.tipwindow) |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
247 pidgin_tooltip_destroy(); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
248 return; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
249 } |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
250 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
251 setup_tooltip_window_position(data->userdata, w, h); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
252 } |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
253 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
254 static void |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
255 pidgin_tooltip_draw_tree(PidginTooltipData *data) |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
256 { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
257 GtkWidget *tipwindow; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 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
|
259 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
|
260 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 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
|
262 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
|
263 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
|
264 &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
|
265 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
|
266 return; |
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 |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
269 if (data->common.treeview.path) { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
270 if (gtk_tree_path_compare(data->common.treeview.path, path) == 0) { |
21881
a69a4307c9a8
Plug a leak. And a patch from 'js' to fix tooltips in compiz fusion. References #4323.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21880
diff
changeset
|
271 gtk_tree_path_free(path); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 return; |
21881
a69a4307c9a8
Plug a leak. And a patch from 'js' to fix tooltips in compiz fusion. References #4323.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21880
diff
changeset
|
273 } |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
274 gtk_tree_path_free(data->common.treeview.path); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
275 data->common.treeview.path = NULL; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 |
21880
b93c099dcfe4
Make sure an old tooltip is destroyed before creating a new one.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21877
diff
changeset
|
278 pidgin_tooltip_destroy(); |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
279 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 pidgin_tooltip.widget = gtk_widget_get_toplevel(data->widget); |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
281 pidgin_tooltip.tipwindow = tipwindow = setup_tooltip_window(); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 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
|
283 |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
284 if (!data->common.treeview.create_tooltip(tipwindow, path, data->userdata, &w, &h)) { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
285 if (tipwindow == pidgin_tooltip.tipwindow) |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
286 pidgin_tooltip_destroy(); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 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
|
288 return; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
291 setup_tooltip_window_position(data->userdata, w, h); |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
292 |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
293 data->common.treeview.path = path; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
294 g_signal_connect_swapped(G_OBJECT(pidgin_tooltip.tipwindow), "destroy", |
21884
b40a6bb267a1
Reset tree-path when a tooltip is destroyed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21881
diff
changeset
|
295 G_CALLBACK(reset_data_treepath), data); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 static gboolean |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 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
|
300 { |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
301 PidginTooltipData *tdata = data; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 pidgin_tooltip.timeout = 0; |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
303 if (GTK_IS_TREE_VIEW(tdata->widget)) |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
304 pidgin_tooltip_draw_tree(data); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
305 else |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
306 pidgin_tooltip_draw(data); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 return FALSE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 static gboolean |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 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
|
312 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 GtkTreePath *path; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
315 if (event->window != gtk_tree_view_get_bin_window(GTK_TREE_VIEW(tv))) |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
316 return FALSE; /* The cursor is probably on the TreeView's header. */ |
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
317 |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
318 initialize_tooltip_delay(); |
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
319 if (!enable_tooltips) |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 return FALSE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 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
|
323 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
|
324 return FALSE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 /* 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
|
326 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
|
327 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
329 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
|
330 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 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
|
332 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
|
333 return FALSE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &pidgin_tooltip.tip_rect); |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21884
diff
changeset
|
337 gtk_tree_path_free(path); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
339 pidgin_tooltip.timeout = g_timeout_add(tooltip_delay, (GSourceFunc)pidgin_tooltip_timeout, userdata); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 return FALSE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 static gboolean |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
345 widget_leave_cb(GtkWidget *tv, GdkEvent *event, gpointer userdata) |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 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
|
348 return FALSE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 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
|
352 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
|
353 { |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 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
|
355 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
|
356 tdata->userdata = userdata; |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
357 tdata->common.treeview.create_tooltip = create_tooltip; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 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
|
359 |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 g_signal_connect(G_OBJECT(tree), "motion-notify-event", G_CALLBACK(row_motion_cb), tdata); |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
361 g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(widget_leave_cb), NULL); |
25104
5587f50886a5
Prevent tooltips from lingering while scrolling in the buddy list window.
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25102
diff
changeset
|
362 g_signal_connect(G_OBJECT(tree), "scroll-event", G_CALLBACK(widget_leave_cb), NULL); |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 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
|
364 return TRUE; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 } |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
367 static gboolean |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
368 widget_motion_cb(GtkWidget *widget, GdkEvent *event, gpointer data) |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
369 { |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
370 initialize_tooltip_delay(); |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
371 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
372 pidgin_tooltip_destroy(); |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
373 if (!enable_tooltips) |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
374 return FALSE; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
375 |
24282
d38d854cd0bf
Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@wiktel.com>
parents:
23634
diff
changeset
|
376 pidgin_tooltip.timeout = g_timeout_add(tooltip_delay, (GSourceFunc)pidgin_tooltip_timeout, data); |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
377 return FALSE; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
378 } |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
379 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
380 gboolean pidgin_tooltip_setup_for_widget(GtkWidget *widget, gpointer userdata, |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
381 PidginTooltipCreate create_tooltip, PidginTooltipPaint paint_tooltip) |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
382 { |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
383 PidginTooltipData *wdata = g_new0(PidginTooltipData, 1); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
384 wdata->widget = widget; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
385 wdata->userdata = userdata; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
386 wdata->common.widget.create_tooltip = create_tooltip; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
387 wdata->paint_tooltip = paint_tooltip; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
388 |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
389 g_signal_connect(G_OBJECT(widget), "motion-notify-event", G_CALLBACK(widget_motion_cb), wdata); |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
390 g_signal_connect(G_OBJECT(widget), "leave-notify-event", G_CALLBACK(widget_leave_cb), NULL); |
25104
5587f50886a5
Prevent tooltips from lingering while scrolling in the buddy list window.
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
25102
diff
changeset
|
391 g_signal_connect(G_OBJECT(widget), "scroll-event", G_CALLBACK(widget_leave_cb), NULL); |
24964
8a5c0c5c71f9
Jan Kratochvil found another race condition in the treeview tooltip code, this fixes it. Fixes #8069.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24289
diff
changeset
|
392 g_signal_connect_swapped(G_OBJECT(widget), "destroy", G_CALLBACK(destroy_tooltip_data), wdata); |
21945
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
393 return TRUE; |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
394 } |
3fc5862b834a
Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21905
diff
changeset
|
395 |