annotate plugins/docklet/trayicon-x11.c @ 6077:b2c8e08508af

[gaim-migrate @ 6536] Integrated Win Gaim systray to the docklet plugin committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Thu, 10 Jul 2003 23:13:07 +0000
parents
children 29ddc42ff402
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 /* System tray icon (aka docklet) plugin for Gaim
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
2 * Copyright (C) 2002 Robert McQueen <robot101@debian.org>
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
3 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
4 * Inspired by a similar plugin by:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
5 * John (J5) Palmieri <johnp@martianrock.com>
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
6 *
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
9 * published by the Free Software Foundation; either version 2 of the
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
11 *
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
15 * General Public License for more details.
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
16 *
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
20 * 02111-1307, USA.
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
21 */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 #include "internal.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
23 #include "debug.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 #include "stock.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
25
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
26 #include "gaim.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27 #include "ui.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
28
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29 #include "eggtrayicon.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 #include "docklet.h"
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
31
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
32
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
33 /* globals */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34 static EggTrayIcon *docklet = NULL;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35 static GtkWidget *image = NULL;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
36
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
37 /* protos */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
38 static void gaim_tray_remove_callbacks();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39 static void gaim_tray_create();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
41 static void gaim_tray_embedded_cb(GtkWidget *widget, void *data) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42 docklet_embedded();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 static gboolean gaim_tray_create_cb() {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
46 gaim_tray_create();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47 return FALSE; /* for when we're called by the glib idle handler */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50 static void gaim_tray_clicked_cb(GtkWidget *button, GdkEventButton *event, void *data) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
51 if (event->type != GDK_BUTTON_PRESS)
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52 return;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53 docklet_clicked(event->button);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 static void gaim_tray_destroyed_cb(GtkWidget *widget, void *data) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57 gaim_debug(GAIM_DEBUG_INFO, "docklet", "Tray Icon: destroyed\n");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59 docklet_flush_queue();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61 gaim_tray_remove_callbacks();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
63 g_object_unref(G_OBJECT(docklet));
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 docklet = NULL;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66 g_idle_add(gaim_tray_create_cb, &docklet);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
68
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 static void gaim_tray_remove_callbacks() {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70 gaim_debug(GAIM_DEBUG_INFO, "docklet", "Tray Icon: removing callbacks");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
71
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72 while (g_source_remove_by_user_data(&docklet)) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 gaim_debug(GAIM_DEBUG_INFO, NULL, ".");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
74 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
75
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
76 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
77 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
78
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
79
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80 static void gaim_tray_update_icon(enum docklet_status icon) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81 const gchar *icon_name = NULL;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 switch (icon) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84 case offline:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
85 icon_name = GAIM_STOCK_ICON_OFFLINE;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
86 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
87 case offline_connecting:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
88 case online_connecting:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
89 icon_name = GAIM_STOCK_ICON_CONNECT;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
90 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
91 case online:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
92 icon_name = GAIM_STOCK_ICON_ONLINE;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
93 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
94 case online_pending:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
95 icon_name = GAIM_STOCK_ICON_ONLINE_MSG;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
96 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97 case away:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98 icon_name = GAIM_STOCK_ICON_AWAY;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
99 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
100 case away_pending:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
101 icon_name = GAIM_STOCK_ICON_AWAY_MSG;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
102 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
103 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
104
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
105 gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
106 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
107
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
108 static void gaim_tray_create() {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
109 GtkWidget *box;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
110
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
111 if (docklet) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
112 /* if this is being called when a tray icon exists, it's because
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
113 something messed up. try destroying it before we proceed,
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
114 although docklet_refcount may be all hosed. hopefully won't happen. */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
115 gaim_debug(GAIM_DEBUG_WARNING, "docklet",
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
116 "Tray Icon: trying to create icon but it already exists?\n");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
117 /*plugin_unload(NULL);*/
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
118 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
119
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
120 docklet = egg_tray_icon_new("Gaim");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
121 box = gtk_event_box_new();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
122 image = gtk_image_new();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
123
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
124 g_signal_connect(G_OBJECT(docklet), "embedded", G_CALLBACK(gaim_tray_embedded_cb), NULL);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
125 g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(gaim_tray_destroyed_cb), NULL);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
126 g_signal_connect(G_OBJECT(box), "button-press-event", G_CALLBACK(gaim_tray_clicked_cb), NULL);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
127
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
128 gtk_container_add(GTK_CONTAINER(box), image);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
129 gtk_container_add(GTK_CONTAINER(docklet), box);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
130 gtk_widget_show_all(GTK_WIDGET(docklet));
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
131
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
132 /* ref the docklet before we bandy it about the place */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
133 g_object_ref(G_OBJECT(docklet));
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
134
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
135 gaim_debug(GAIM_DEBUG_INFO, "docklet", "Tray Icon: created\n");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
136 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
137
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
138 static void gaim_tray_destroy() {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
139 gaim_tray_remove_callbacks();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
140
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
141 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(gaim_tray_destroyed_cb), NULL);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
142 gtk_widget_destroy(GTK_WIDGET(docklet));
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
143
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
144 g_object_unref(G_OBJECT(docklet));
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
145 docklet = NULL;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
146
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
147 gaim_debug(GAIM_DEBUG_INFO, "docklet", "Tray Icon: removed\n");
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
148 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
149
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
150 static struct gaim_tray_ops tray_ops =
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
151 {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
152 gaim_tray_create,
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
153 gaim_tray_destroy,
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
154 gaim_tray_update_icon
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
155 };
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
156
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
157 /* Used by docklet's plugin load func */
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
158 void trayicon_init() {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
159 docklet_set_tray_ops(&tray_ops);
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
160 }