| 42 |
42 |
| 43 /****************************************************************************** |
43 /****************************************************************************** |
| 44 * Item Stuff |
44 * Item Stuff |
| 45 *****************************************************************************/ |
45 *****************************************************************************/ |
| 46 static void |
46 static void |
| 47 pidgin_menu_tray_select(GtkItem *item) { |
47 pidgin_menu_tray_select(GtkMenuItem *widget) { |
| 48 /* this may look like nothing, but it's really overriding the |
48 /* this may look like nothing, but it's really overriding the |
| 49 * GtkMenuItem's select function so that it doesn't get highlighted like |
49 * GtkMenuItem's select function so that it doesn't get highlighted like |
| 50 * a normal menu item would. |
50 * a normal menu item would. |
| 51 */ |
51 */ |
| 52 } |
52 } |
| 53 |
53 |
| 54 static void |
54 static void |
| 55 pidgin_menu_tray_deselect(GtkItem *item) { |
55 pidgin_menu_tray_deselect(GtkMenuItem *widget) { |
| 56 /* Probably not necessary, but I'd rather be safe than sorry. We're |
56 /* Probably not necessary, but I'd rather be safe than sorry. We're |
| 57 * overridding the select, so it makes sense to override deselect as well. |
57 * overridding the select, so it makes sense to override deselect as well. |
| 58 */ |
58 */ |
| 59 } |
59 } |
| 60 |
60 |
| 114 } |
114 } |
| 115 |
115 |
| 116 static void |
116 static void |
| 117 pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { |
117 pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { |
| 118 GObjectClass *object_class = G_OBJECT_CLASS(klass); |
118 GObjectClass *object_class = G_OBJECT_CLASS(klass); |
| 119 GtkItemClass *item_class = GTK_ITEM_CLASS(klass); |
119 GtkMenuItemClass *menu_item_class = GTK_MENU_ITEM_CLASS(klass); |
| 120 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
120 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
| 121 GParamSpec *pspec; |
121 GParamSpec *pspec; |
| 122 |
122 |
| 123 parent_class = g_type_class_peek_parent(klass); |
123 parent_class = g_type_class_peek_parent(klass); |
| 124 |
124 |
| 125 object_class->finalize = pidgin_menu_tray_finalize; |
125 object_class->finalize = pidgin_menu_tray_finalize; |
| 126 object_class->get_property = pidgin_menu_tray_get_property; |
126 object_class->get_property = pidgin_menu_tray_get_property; |
| 127 |
127 |
| 128 item_class->select = pidgin_menu_tray_select; |
128 menu_item_class->select = pidgin_menu_tray_select; |
| 129 item_class->deselect = pidgin_menu_tray_deselect; |
129 menu_item_class->deselect = pidgin_menu_tray_deselect; |
| 130 |
130 |
| 131 widget_class->map = pidgin_menu_tray_map; |
131 widget_class->map = pidgin_menu_tray_map; |
| 132 |
132 |
| 133 pspec = g_param_spec_object("box", "The box", |
133 pspec = g_param_spec_object("box", "The box", |
| 134 "The box", |
134 "The box", |
| 205 const char *tooltip, gboolean prepend) |
205 const char *tooltip, gboolean prepend) |
| 206 { |
206 { |
| 207 g_return_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray)); |
207 g_return_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray)); |
| 208 g_return_if_fail(GTK_IS_WIDGET(widget)); |
208 g_return_if_fail(GTK_IS_WIDGET(widget)); |
| 209 |
209 |
| 210 if (GTK_WIDGET_NO_WINDOW(widget)) |
210 if (!gtk_widget_get_has_window(widget)) |
| 211 { |
211 { |
| 212 GtkWidget *event; |
212 GtkWidget *event; |
| 213 |
213 |
| 214 event = gtk_event_box_new(); |
214 event = gtk_event_box_new(); |
| 215 gtk_container_add(GTK_CONTAINER(event), widget); |
215 gtk_container_add(GTK_CONTAINER(event), widget); |
| 252 * must have automatically been added to an event box |
252 * must have automatically been added to an event box |
| 253 * when it was added to the menu tray. If this is the |
253 * when it was added to the menu tray. If this is the |
| 254 * case, we want to set the tooltip on the widget's parent, |
254 * case, we want to set the tooltip on the widget's parent, |
| 255 * not on the widget itself. |
255 * not on the widget itself. |
| 256 */ |
256 */ |
| 257 if (GTK_WIDGET_NO_WINDOW(widget)) |
257 if (!gtk_widget_get_has_window(widget)) |
| 258 widget = widget->parent; |
258 widget = gtk_widget_get_parent(widget); |
| 259 |
259 |
| 260 #if GTK_CHECK_VERSION(2,12,0) |
260 #if GTK_CHECK_VERSION(2,12,0) |
| 261 gtk_widget_set_tooltip_text(widget, tooltip); |
261 gtk_widget_set_tooltip_text(widget, tooltip); |
| 262 #else |
262 #else |
| 263 gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL); |
263 gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL); |