Sun, 17 Aug 2008 23:48:14 +0000
merge of '42b776027452a88655415a229c29753b035065ac'
and '9f4b03e07b54cbe90971f1ec5f5886b498ef1182'
| 11553 | 1 | /* |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
2 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 11553 | 3 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 4 | * source distribution. | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15931
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11553 | 19 | */ |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
20 | #include "debug.h" |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
21 | |
| 11553 | 22 | #include "gtkmenutray.h" |
| 23 | ||
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
24 | #include <gtk/gtkeventbox.h> |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
25 | #include <gtk/gtkiconfactory.h> |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
26 | #include <gtk/gtkversion.h> |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
27 | |
| 11553 | 28 | /****************************************************************************** |
| 29 | * Enums | |
| 30 | *****************************************************************************/ | |
| 31 | enum { | |
| 32 | PROP_ZERO = 0, | |
| 33 | PROP_BOX | |
| 34 | }; | |
| 35 | ||
| 36 | /****************************************************************************** | |
| 37 | * Globals | |
| 38 | *****************************************************************************/ | |
| 39 | static GObjectClass *parent_class = NULL; | |
| 40 | ||
| 41 | /****************************************************************************** | |
| 42 | * Internal Stuff | |
| 43 | *****************************************************************************/ | |
| 44 | ||
| 45 | /****************************************************************************** | |
| 46 | * Item Stuff | |
| 47 | *****************************************************************************/ | |
| 48 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
49 | pidgin_menu_tray_select(GtkItem *item) { |
| 11553 | 50 | /* this may look like nothing, but it's really overriding the |
| 51 | * GtkMenuItem's select function so that it doesn't get highlighted like | |
| 52 | * a normal menu item would. | |
| 53 | */ | |
| 54 | } | |
| 55 | ||
| 56 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
57 | pidgin_menu_tray_deselect(GtkItem *item) { |
| 11553 | 58 | /* Probably not necessary, but I'd rather be safe than sorry. We're |
| 59 | * overridding the select, so it makes sense to override deselect as well. | |
| 60 | */ | |
| 61 | } | |
| 62 | ||
| 63 | /****************************************************************************** | |
| 64 | * Widget Stuff | |
| 65 | *****************************************************************************/ | |
| 66 | ||
| 67 | /****************************************************************************** | |
| 68 | * Object Stuff | |
| 69 | *****************************************************************************/ | |
| 70 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
71 | pidgin_menu_tray_get_property(GObject *obj, guint param_id, GValue *value, |
| 11553 | 72 | GParamSpec *pspec) |
| 73 | { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
74 | PidginMenuTray *menu_tray = PIDGIN_MENU_TRAY(obj); |
| 11553 | 75 | |
| 76 | switch(param_id) { | |
| 77 | case PROP_BOX: | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
78 | g_value_set_object(value, pidgin_menu_tray_get_box(menu_tray)); |
| 11553 | 79 | break; |
| 80 | default: | |
| 81 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); | |
| 82 | break; | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | static void | |
|
23187
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
87 | pidgin_menu_tray_finalize(GObject *obj) |
|
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
88 | { |
|
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
89 | PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj); |
|
11599
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
90 | #if 0 |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
91 | /* This _might_ be leaking, but I have a sneaking suspicion that the widget is |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
92 | * getting destroyed in GtkContainer's finalize function. But if were are |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
93 | * leaking here, be sure to figure out why this causes a crash. |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
94 | * -- Gary |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
95 | */ |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
96 | |
| 11558 | 97 | if(GTK_IS_WIDGET(tray->tray)) |
| 98 | gtk_widget_destroy(GTK_WIDGET(tray->tray)); | |
|
11599
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
99 | #endif |
| 11553 | 100 | |
|
23188
eab7aad90c95
*** Plucked rev 1dc65a60 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23187
diff
changeset
|
101 | if (tray->tooltips) { |
|
eab7aad90c95
*** Plucked rev 1dc65a60 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23187
diff
changeset
|
102 | gtk_object_sink(GTK_OBJECT(tray->tooltips)); |
|
eab7aad90c95
*** Plucked rev 1dc65a60 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23187
diff
changeset
|
103 | } |
|
23187
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
104 | |
| 11553 | 105 | G_OBJECT_CLASS(parent_class)->finalize(obj); |
| 106 | } | |
| 107 | ||
| 108 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
109 | pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { |
| 11553 | 110 | GObjectClass *object_class = G_OBJECT_CLASS(klass); |
| 111 | GtkItemClass *item_class = GTK_ITEM_CLASS(klass); | |
| 112 | GParamSpec *pspec; | |
| 113 | ||
| 114 | parent_class = g_type_class_peek_parent(klass); | |
| 115 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
116 | object_class->finalize = pidgin_menu_tray_finalize; |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
117 | object_class->get_property = pidgin_menu_tray_get_property; |
| 11553 | 118 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
119 | item_class->select = pidgin_menu_tray_select; |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
120 | item_class->deselect = pidgin_menu_tray_deselect; |
| 11553 | 121 | |
| 122 | pspec = g_param_spec_object("box", "The box", | |
| 123 | "The box", | |
| 124 | GTK_TYPE_BOX, | |
| 125 | G_PARAM_READABLE); | |
| 126 | g_object_class_install_property(object_class, PROP_BOX, pspec); | |
| 127 | } | |
| 128 | ||
| 129 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
130 | pidgin_menu_tray_init(PidginMenuTray *menu_tray) { |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
131 | GtkWidget *widget = GTK_WIDGET(menu_tray); |
|
11888
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
132 | #if GTK_CHECK_VERSION(2,2,0) |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
133 | GtkSettings *settings; |
|
11888
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
134 | #endif |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
135 | gint height = -1; |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
136 | |
| 11553 | 137 | gtk_menu_item_set_right_justified(GTK_MENU_ITEM(menu_tray), TRUE); |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
138 | |
| 11558 | 139 | if(!GTK_IS_WIDGET(menu_tray->tray)) |
| 140 | menu_tray->tray = gtk_hbox_new(FALSE, 0); | |
| 11553 | 141 | |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
142 | #if GTK_CHECK_VERSION(2,2,0) |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
143 | settings = |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
144 | gtk_settings_get_for_screen(gtk_widget_get_screen(widget)); |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
145 | |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
146 | if(gtk_icon_size_lookup_for_settings(settings, GTK_ICON_SIZE_MENU, |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
147 | NULL, &height)) |
|
11888
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
148 | #else |
|
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
149 | if(gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, NULL, &height)) |
|
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
150 | #endif |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
151 | { |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
152 | gtk_widget_set_size_request(widget, -1, height); |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
153 | } |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
154 | |
| 11558 | 155 | gtk_container_add(GTK_CONTAINER(menu_tray), menu_tray->tray); |
| 11553 | 156 | |
| 11558 | 157 | gtk_widget_show(menu_tray->tray); |
| 11553 | 158 | } |
| 159 | ||
| 160 | /****************************************************************************** | |
| 161 | * API | |
| 162 | *****************************************************************************/ | |
| 163 | GType | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
164 | pidgin_menu_tray_get_gtype(void) { |
| 11553 | 165 | static GType type = 0; |
| 166 | ||
| 167 | if(type == 0) { | |
| 168 | static const GTypeInfo info = { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
169 | sizeof(PidginMenuTrayClass), |
| 11553 | 170 | NULL, |
| 171 | NULL, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
172 | (GClassInitFunc)pidgin_menu_tray_class_init, |
| 11553 | 173 | NULL, |
| 174 | NULL, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
175 | sizeof(PidginMenuTray), |
| 11553 | 176 | 0, |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
177 | (GInstanceInitFunc)pidgin_menu_tray_init, |
| 11553 | 178 | NULL |
| 179 | }; | |
| 180 | ||
| 181 | type = g_type_register_static(GTK_TYPE_MENU_ITEM, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
182 | "PidginMenuTray", |
| 11553 | 183 | &info, 0); |
| 184 | } | |
| 185 | ||
| 186 | return type; | |
| 187 | } | |
| 188 | ||
| 189 | GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
190 | pidgin_menu_tray_new() { |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
191 | return g_object_new(PIDGIN_TYPE_MENU_TRAY, NULL); |
| 11553 | 192 | } |
| 193 | ||
| 194 | GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
195 | pidgin_menu_tray_get_box(PidginMenuTray *menu_tray) { |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
196 | g_return_val_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray), NULL); |
| 11558 | 197 | return menu_tray->tray; |
| 11553 | 198 | } |
| 199 | ||
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
200 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
201 | pidgin_menu_tray_add(PidginMenuTray *menu_tray, GtkWidget *widget, |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
202 | const char *tooltip, gboolean prepend) |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
203 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
204 | g_return_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray)); |
| 11553 | 205 | g_return_if_fail(GTK_IS_WIDGET(widget)); |
| 206 | ||
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
207 | if (GTK_WIDGET_NO_WINDOW(widget)) |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
208 | { |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
209 | GtkWidget *event; |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
210 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
211 | event = gtk_event_box_new(); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
212 | gtk_container_add(GTK_CONTAINER(event), widget); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
213 | gtk_widget_show(event); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
214 | widget = event; |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
215 | } |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
216 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
217 | pidgin_menu_tray_set_tooltip(menu_tray, widget, tooltip); |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
218 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
219 | if (prepend) |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
220 | gtk_box_pack_start(GTK_BOX(menu_tray->tray), widget, FALSE, FALSE, 0); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
221 | else |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
222 | gtk_box_pack_end(GTK_BOX(menu_tray->tray), widget, FALSE, FALSE, 0); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
223 | } |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
224 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
225 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
226 | pidgin_menu_tray_append(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip) |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
227 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
228 | pidgin_menu_tray_add(menu_tray, widget, tooltip, FALSE); |
| 11553 | 229 | } |
| 230 | ||
| 231 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
232 | pidgin_menu_tray_prepend(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip) |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
233 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
234 | pidgin_menu_tray_add(menu_tray, widget, tooltip, TRUE); |
| 11553 | 235 | } |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
236 | |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
237 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
238 | pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip) |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
239 | { |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
240 | if (!menu_tray->tooltips) |
| 22851 | 241 | menu_tray->tooltips = gtk_tooltips_new(); |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
242 | |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
243 | /* Should we check whether widget is a child of menu_tray? */ |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
244 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
245 | /* |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
246 | * If the widget does not have it's own window, then it |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
247 | * must have automatically been added to an event box |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
248 | * when it was added to the menu tray. If this is the |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
249 | * case, we want to set the tooltip on the widget's parent, |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
250 | * not on the widget itself. |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
251 | */ |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
252 | if (GTK_WIDGET_NO_WINDOW(widget)) |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
253 | widget = widget->parent; |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
254 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
255 | gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL); |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
256 | } |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
257 |