Wed, 05 Nov 2008 23:24:01 +0000
Remove that hack involving GtkIMHtmlSmileys
Thanks to Sadrul for hinting about the solution
| 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 | |
|
24327
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
87 | pidgin_menu_tray_map(GtkWidget *widget) |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
88 | { |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
89 | GTK_WIDGET_CLASS(parent_class)->map(widget); |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
90 | gtk_container_add(GTK_CONTAINER(widget), |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
91 | PIDGIN_MENU_TRAY(widget)->tray); |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
92 | } |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
93 | |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
94 | static void |
|
23187
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
95 | pidgin_menu_tray_finalize(GObject *obj) |
|
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
96 | { |
|
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
97 | PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj); |
|
11599
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
98 | #if 0 |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
99 | /* 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
|
100 | * getting destroyed in GtkContainer's finalize function. But if were are |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
101 | * 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
|
102 | * -- Gary |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
103 | */ |
|
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
104 | |
| 11558 | 105 | if(GTK_IS_WIDGET(tray->tray)) |
| 106 | gtk_widget_destroy(GTK_WIDGET(tray->tray)); | |
|
11599
431352c132c8
[gaim-migrate @ 13869]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
107 | #endif |
| 11553 | 108 | |
|
23188
eab7aad90c95
*** Plucked rev 1dc65a60 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23187
diff
changeset
|
109 | if (tray->tooltips) { |
|
eab7aad90c95
*** Plucked rev 1dc65a60 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23187
diff
changeset
|
110 | gtk_object_sink(GTK_OBJECT(tray->tooltips)); |
|
eab7aad90c95
*** Plucked rev 1dc65a60 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23187
diff
changeset
|
111 | } |
|
23187
671e00775afb
*** Plucked rev 69b22e32f7ada182101e0746f02891389ceb0c52 (sadrul@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22851
diff
changeset
|
112 | |
| 11553 | 113 | G_OBJECT_CLASS(parent_class)->finalize(obj); |
| 114 | } | |
| 115 | ||
| 116 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
117 | pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { |
| 11553 | 118 | GObjectClass *object_class = G_OBJECT_CLASS(klass); |
| 119 | GtkItemClass *item_class = GTK_ITEM_CLASS(klass); | |
|
24327
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
120 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
| 11553 | 121 | GParamSpec *pspec; |
| 122 | ||
| 123 | parent_class = g_type_class_peek_parent(klass); | |
| 124 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
125 | object_class->finalize = pidgin_menu_tray_finalize; |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
126 | object_class->get_property = pidgin_menu_tray_get_property; |
| 11553 | 127 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
128 | item_class->select = pidgin_menu_tray_select; |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
129 | item_class->deselect = pidgin_menu_tray_deselect; |
| 11553 | 130 | |
|
24327
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
131 | widget_class->map = pidgin_menu_tray_map; |
|
2c0e33b2dc94
Change some menutray internals. This makes the tray-icons behave better.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23188
diff
changeset
|
132 | |
| 11553 | 133 | pspec = g_param_spec_object("box", "The box", |
| 134 | "The box", | |
| 135 | GTK_TYPE_BOX, | |
| 136 | G_PARAM_READABLE); | |
| 137 | g_object_class_install_property(object_class, PROP_BOX, pspec); | |
| 138 | } | |
| 139 | ||
| 140 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
141 | pidgin_menu_tray_init(PidginMenuTray *menu_tray) { |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
142 | GtkWidget *widget = GTK_WIDGET(menu_tray); |
|
11888
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
143 | #if GTK_CHECK_VERSION(2,2,0) |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
144 | GtkSettings *settings; |
|
11888
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
145 | #endif |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
146 | gint height = -1; |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
147 | |
| 11553 | 148 | 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
|
149 | |
| 11558 | 150 | if(!GTK_IS_WIDGET(menu_tray->tray)) |
| 151 | menu_tray->tray = gtk_hbox_new(FALSE, 0); | |
| 11553 | 152 | |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
153 | #if GTK_CHECK_VERSION(2,2,0) |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
154 | settings = |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
155 | gtk_settings_get_for_screen(gtk_widget_get_screen(widget)); |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
156 | |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
157 | 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
|
158 | NULL, &height)) |
|
11888
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
159 | #else |
|
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
160 | if(gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, NULL, &height)) |
|
525706b75438
[gaim-migrate @ 14179]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11787
diff
changeset
|
161 | #endif |
|
11787
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
162 | { |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
163 | gtk_widget_set_size_request(widget, -1, height); |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
164 | } |
|
fb0c7b22368d
[gaim-migrate @ 14078]
Gary Kramlich <grim@reaperworld.com>
parents:
11599
diff
changeset
|
165 | |
| 11558 | 166 | gtk_widget_show(menu_tray->tray); |
| 11553 | 167 | } |
| 168 | ||
| 169 | /****************************************************************************** | |
| 170 | * API | |
| 171 | *****************************************************************************/ | |
| 172 | GType | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
173 | pidgin_menu_tray_get_gtype(void) { |
| 11553 | 174 | static GType type = 0; |
| 175 | ||
| 176 | if(type == 0) { | |
| 177 | static const GTypeInfo info = { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
178 | sizeof(PidginMenuTrayClass), |
| 11553 | 179 | NULL, |
| 180 | NULL, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
181 | (GClassInitFunc)pidgin_menu_tray_class_init, |
| 11553 | 182 | NULL, |
| 183 | NULL, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
184 | sizeof(PidginMenuTray), |
| 11553 | 185 | 0, |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
186 | (GInstanceInitFunc)pidgin_menu_tray_init, |
| 11553 | 187 | NULL |
| 188 | }; | |
| 189 | ||
| 190 | 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
|
191 | "PidginMenuTray", |
| 11553 | 192 | &info, 0); |
| 193 | } | |
| 194 | ||
| 195 | return type; | |
| 196 | } | |
| 197 | ||
| 198 | GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
199 | pidgin_menu_tray_new() { |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
200 | return g_object_new(PIDGIN_TYPE_MENU_TRAY, NULL); |
| 11553 | 201 | } |
| 202 | ||
| 203 | GtkWidget * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
204 | pidgin_menu_tray_get_box(PidginMenuTray *menu_tray) { |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
205 | g_return_val_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray), NULL); |
| 11558 | 206 | return menu_tray->tray; |
| 11553 | 207 | } |
| 208 | ||
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
209 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
210 | pidgin_menu_tray_add(PidginMenuTray *menu_tray, GtkWidget *widget, |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
211 | const char *tooltip, gboolean prepend) |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
212 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
213 | g_return_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray)); |
| 11553 | 214 | g_return_if_fail(GTK_IS_WIDGET(widget)); |
| 215 | ||
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
216 | if (GTK_WIDGET_NO_WINDOW(widget)) |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
217 | { |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
218 | GtkWidget *event; |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
219 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
220 | event = gtk_event_box_new(); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
221 | gtk_container_add(GTK_CONTAINER(event), widget); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
222 | gtk_widget_show(event); |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
223 | widget = event; |
|
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 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
226 | pidgin_menu_tray_set_tooltip(menu_tray, widget, tooltip); |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
227 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
228 | if (prepend) |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
229 | 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
|
230 | else |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
231 | 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
|
232 | } |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
233 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
234 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
235 | 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
|
236 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
237 | pidgin_menu_tray_add(menu_tray, widget, tooltip, FALSE); |
| 11553 | 238 | } |
| 239 | ||
| 240 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
241 | 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
|
242 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
243 | pidgin_menu_tray_add(menu_tray, widget, tooltip, TRUE); |
| 11553 | 244 | } |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
245 | |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
246 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
247 | 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
|
248 | { |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
249 | if (!menu_tray->tooltips) |
| 22851 | 250 | menu_tray->tooltips = gtk_tooltips_new(); |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
251 | |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
252 | /* 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
|
253 | |
|
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 | * 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
|
256 | * must have automatically been added to an event box |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
257 | * 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
|
258 | * 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
|
259 | * not on the widget itself. |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
260 | */ |
|
11908
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
261 | if (GTK_WIDGET_NO_WINDOW(widget)) |
|
12008
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
262 | widget = widget->parent; |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
263 | |
|
df998b18ec60
[gaim-migrate @ 14301]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11908
diff
changeset
|
264 | 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
|
265 | } |
|
ad9c7ca74793
[gaim-migrate @ 14199]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11888
diff
changeset
|
266 |