Mercurial > pidgin.yaz
annotate plugins/docklet/docklet.c @ 5143:e5661daa66ea
[gaim-migrate @ 5507]
german translation updates from Bjoern Voigt
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 16 Apr 2003 23:11:42 +0000 |
parents | 8e55a4d362a3 |
children | fefad67de2c7 |
rev | line source |
---|---|
4093 | 1 /* System tray icon (aka docklet) plugin for Gaim |
3510 | 2 * Copyright (C) 2002 Robert McQueen <robot101@debian.org> |
3 * Inspired by a similar plugin by: | |
4 * John (J5) Palmieri <johnp@martianrock.com> | |
5 * | |
6 * This program is free software; you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation; either version 2 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * 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 | |
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 * 02111-1307, USA. | |
20 */ | |
21 | |
22 /* todo (in order of importance): | |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
23 - unify the queue so we can have a global away without the dialog |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
24 - handle and update tooltips to show your current accounts/queued messages? |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
25 - show a count of queued messages in the unified queue |
3510 | 26 - dernyi's account status menu in the right click |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
27 - optional pop up notices when GNOME2's system-tray-applet supports it */ |
3510 | 28 |
29 /* includes */ | |
30 #include <gtk/gtk.h> | |
31 #include "gaim.h" | |
4561 | 32 #include "sound.h" |
3510 | 33 #include "eggtrayicon.h" |
4729 | 34 #include "gtklist.h" |
3510 | 35 |
3867 | 36 #ifndef GAIM_PLUGINS |
37 #define GAIM_PLUGINS | |
38 #endif | |
39 | |
3510 | 40 /* types */ |
41 enum docklet_status { | |
4157 | 42 offline, |
43 offline_connecting, | |
3510 | 44 online, |
4157 | 45 online_connecting, |
46 online_pending, | |
3510 | 47 away, |
4157 | 48 away_pending |
3510 | 49 }; |
50 | |
51 /* functions */ | |
4093 | 52 static gboolean docklet_create(); |
4157 | 53 static gboolean docklet_update_status(); |
4093 | 54 void gaim_plugin_remove(); |
3510 | 55 |
56 /* globals */ | |
3513 | 57 static EggTrayIcon *docklet = NULL; |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
58 static GtkWidget *image = NULL; |
3510 | 59 static enum docklet_status status; |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
60 static enum docklet_status icon; |
3510 | 61 |
3554 | 62 static void docklet_toggle_mute(GtkWidget *toggle, void *data) { |
4561 | 63 gaim_sound_set_mute(GTK_CHECK_MENU_ITEM(toggle)->active); |
3510 | 64 } |
65 | |
3554 | 66 static void docklet_toggle_queue(GtkWidget *widget, void *data) { |
67 away_options ^= OPT_AWAY_QUEUE_UNREAD; | |
68 save_prefs(); | |
3510 | 69 } |
3570 | 70 |
71 /* static void docklet_toggle_blist_show(GtkWidget *widget, void *data) { | |
72 blist_options ^= OPT_BLIST_APP_BUDDY_SHOW; | |
73 save_prefs(); | |
74 } */ | |
75 | |
3554 | 76 static void docklet_flush_queue() { |
3570 | 77 if (unread_message_queue) { |
4274 | 78 purge_away_queue(&unread_message_queue); |
3570 | 79 } |
3510 | 80 } |
81 | |
82 static void docklet_menu(GdkEventButton *event) { | |
3513 | 83 static GtkWidget *menu = NULL; |
3512 | 84 GtkWidget *entry; |
3510 | 85 |
86 if (menu) { | |
87 gtk_widget_destroy(menu); | |
88 } | |
89 | |
90 menu = gtk_menu_new(); | |
91 | |
4157 | 92 switch (status) { |
93 case offline: | |
94 case offline_connecting: | |
5024 | 95 gaim_new_item_from_stock(menu, _("Auto-login"), GAIM_STOCK_SIGN_ON, G_CALLBACK(auto_login), NULL, 0, 0, NULL); |
4567 | 96 break; |
97 default: | |
5024 | 98 gaim_new_item_from_stock(menu, _("New Message.."), GAIM_STOCK_IM, G_CALLBACK(show_im_dialog), NULL, 0, 0, NULL); |
99 gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(join_chat), NULL, 0, 0, NULL); | |
4567 | 100 break; |
101 } | |
102 | |
103 switch (status) { | |
104 case offline: | |
105 case offline_connecting: | |
4157 | 106 break; |
107 case online: | |
108 case online_connecting: | |
109 case online_pending: { | |
3510 | 110 GtkWidget *docklet_awaymenu; |
111 GSList *awy = NULL; | |
112 struct away_message *a = NULL; | |
113 | |
114 docklet_awaymenu = gtk_menu_new(); | |
115 awy = away_messages; | |
116 | |
117 while (awy) { | |
118 a = (struct away_message *)awy->data; | |
119 | |
120 entry = gtk_menu_item_new_with_label(a->name); | |
3554 | 121 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_away_message), a); |
4635 | 122 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); |
3510 | 123 |
124 awy = g_slist_next(awy); | |
125 } | |
126 | |
4157 | 127 if (away_messages) |
128 gaim_separator(docklet_awaymenu); | |
3510 | 129 |
130 entry = gtk_menu_item_new_with_label(_("New...")); | |
3554 | 131 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(create_away_mess), NULL); |
4635 | 132 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); |
3510 | 133 |
134 entry = gtk_menu_item_new_with_label(_("Away")); | |
3512 | 135 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu); |
4635 | 136 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry); |
4157 | 137 } break; |
138 case away: | |
139 case away_pending: | |
3510 | 140 entry = gtk_menu_item_new_with_label(_("Back")); |
3554 | 141 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_im_back), NULL); |
4635 | 142 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry); |
4157 | 143 break; |
3510 | 144 } |
145 | |
4567 | 146 gaim_separator(menu); |
147 | |
148 entry = gtk_check_menu_item_new_with_label(_("Mute Sounds")); | |
149 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry), gaim_sound_get_mute()); | |
150 g_signal_connect(G_OBJECT(entry), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); | |
4635 | 151 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry); |
4567 | 152 |
5024 | 153 gaim_new_item_from_stock(menu, _("File Transfers..."), GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(gaim_show_xfer_dialog), NULL, 0, 0, NULL); |
154 gaim_new_item_from_stock(menu, _("Accounts..."), GAIM_STOCK_ACCOUNTS, G_CALLBACK(account_editor), NULL, 0, 0, NULL); | |
4567 | 155 gaim_new_item_from_stock(menu, _("Preferences..."), GTK_STOCK_PREFERENCES, G_CALLBACK(show_prefs), NULL, 0, 0, NULL); |
156 | |
157 gaim_separator(menu); | |
158 | |
4157 | 159 switch (status) { |
160 case offline: | |
161 case offline_connecting: | |
162 break; | |
163 default: | |
5024 | 164 gaim_new_item_from_stock(menu, _("Signoff"), GTK_STOCK_CLOSE, G_CALLBACK(signoff_all), NULL, 0, 0, 0); |
4157 | 165 break; |
166 } | |
167 | |
168 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(do_quit), NULL, 0, 0, 0); | |
3510 | 169 |
170 gtk_widget_show_all(menu); | |
171 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); | |
172 } | |
173 | |
174 static void docklet_clicked(GtkWidget *button, GdkEventButton *event, void *data) { | |
3939 | 175 if (event->type != GDK_BUTTON_PRESS) |
176 return; | |
177 | |
3510 | 178 switch (event->button) { |
179 case 1: | |
3517 | 180 if (unread_message_queue) { |
3570 | 181 docklet_flush_queue(); |
3517 | 182 docklet_update_status(); |
3570 | 183 } else { |
4698 | 184 gaim_gtk_blist_docklet_toggle(); |
3554 | 185 } |
3510 | 186 break; |
187 case 2: | |
188 break; | |
189 case 3: | |
190 docklet_menu(event); | |
191 break; | |
192 } | |
193 } | |
194 | |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
195 static void docklet_update_icon() { |
4250
3b884e35e6b5
[gaim-migrate @ 4500]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
196 const gchar *icon_name = NULL; |
3510 | 197 |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
198 switch (icon) { |
4157 | 199 case offline: |
5024 | 200 icon_name = GAIM_STOCK_ICON_OFFLINE; |
4157 | 201 break; |
202 case offline_connecting: | |
203 case online_connecting: | |
5024 | 204 icon_name = GAIM_STOCK_ICON_CONNECT; |
4157 | 205 break; |
3510 | 206 case online: |
5024 | 207 icon_name = GAIM_STOCK_ICON_ONLINE; |
3510 | 208 break; |
4157 | 209 case online_pending: |
5024 | 210 icon_name = GAIM_STOCK_ICON_ONLINE_MSG; |
4157 | 211 break; |
3510 | 212 case away: |
5024 | 213 icon_name = GAIM_STOCK_ICON_AWAY; |
3510 | 214 break; |
215 case away_pending: | |
5024 | 216 icon_name = GAIM_STOCK_ICON_AWAY_MSG; |
3510 | 217 break; |
218 } | |
219 | |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
220 gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR); |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
221 } |
3510 | 222 |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
223 static gboolean docklet_blink_icon() { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
224 if (status == online_pending) { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
225 if (status == icon) { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
226 /* last icon was the right one... let's change it */ |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
227 icon = online; |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
228 } else { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
229 /* last icon was the wrong one, change it back */ |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
230 icon = online_pending; |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
231 } |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
232 } else if (status == away_pending) { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
233 if (status == icon) { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
234 /* last icon was the right one... let's change it */ |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
235 icon = away; |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
236 } else { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
237 /* last icon was the wrong one, change it back */ |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
238 icon = away_pending; |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
239 } |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
240 } else { |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
241 /* no messages, stop blinking */ |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
242 return FALSE; |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
243 } |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
244 |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
245 docklet_update_icon(); |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
246 |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
247 return TRUE; /* keep blinking */ |
3510 | 248 } |
249 | |
4157 | 250 static gboolean docklet_update_status() { |
3510 | 251 enum docklet_status oldstatus; |
252 | |
253 oldstatus = status; | |
254 | |
255 if (connections) { | |
3517 | 256 if (unread_message_queue) { |
4157 | 257 status = online_pending; |
3517 | 258 } else if (awaymessage) { |
3510 | 259 if (message_queue) { |
260 status = away_pending; | |
261 } else { | |
262 status = away; | |
263 } | |
3554 | 264 } else if (connecting_count) { |
4157 | 265 status = online_connecting; |
3510 | 266 } else { |
267 status = online; | |
268 } | |
269 } else { | |
3517 | 270 if (connecting_count) { |
4157 | 271 status = offline_connecting; |
3517 | 272 } else { |
273 status = offline; | |
274 } | |
3510 | 275 } |
276 | |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
277 /* update the icon if we changed status */ |
3510 | 278 if (status != oldstatus) { |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
279 icon = status; |
3510 | 280 docklet_update_icon(); |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
281 |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
282 /* and schedule the blinker function if messages are pending */ |
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
283 if (status == online_pending || status == away_pending) { |
4274 | 284 g_timeout_add(500, docklet_blink_icon, &docklet); |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
285 } |
3510 | 286 } |
4157 | 287 |
288 return FALSE; /* for when we're called by the glib idle handler */ | |
3510 | 289 } |
290 | |
3554 | 291 static void docklet_embedded(GtkWidget *widget, void *data) { |
4840 | 292 debug_printf("Tray Icon: embedded\n"); |
4698 | 293 gaim_gtk_blist_docklet_add(); |
3554 | 294 } |
295 | |
4274 | 296 static void docklet_remove_callbacks() { |
297 debug_printf("Tray Icon: removing callbacks"); | |
298 | |
299 while (g_source_remove_by_user_data(&docklet)) { | |
300 debug_printf("."); | |
301 } | |
302 | |
303 debug_printf("\n"); | |
304 } | |
305 | |
3554 | 306 static void docklet_destroyed(GtkWidget *widget, void *data) { |
4093 | 307 debug_printf("Tray Icon: destroyed\n"); |
308 | |
4698 | 309 gaim_gtk_blist_docklet_remove(); |
4093 | 310 |
3570 | 311 docklet_flush_queue(); |
4093 | 312 |
4274 | 313 docklet_remove_callbacks(); |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
314 |
4093 | 315 g_object_unref(G_OBJECT(docklet)); |
316 docklet = NULL; | |
317 | |
4274 | 318 g_idle_add(docklet_create, &docklet); |
3554 | 319 } |
320 | |
4274 | 321 static gboolean docklet_create() { |
3510 | 322 GtkWidget *box; |
323 | |
3570 | 324 if (docklet) { |
4093 | 325 /* if this is being called when a tray icon exists, it's because |
326 something messed up. try destroying it before we proceed, | |
327 although docklet_refcount may be all hosed. hopefully won't happen. */ | |
328 debug_printf("Tray Icon: trying to create icon but it already exists?\n"); | |
329 gaim_plugin_remove(); | |
3510 | 330 } |
331 | |
332 docklet = egg_tray_icon_new("Gaim"); | |
333 box = gtk_event_box_new(); | |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
334 image = gtk_image_new(); |
3510 | 335 |
3554 | 336 g_signal_connect(G_OBJECT(docklet), "embedded", G_CALLBACK(docklet_embedded), NULL); |
337 g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_destroyed), NULL); | |
338 g_signal_connect(G_OBJECT(box), "button-press-event", G_CALLBACK(docklet_clicked), NULL); | |
3510 | 339 |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
340 gtk_container_add(GTK_CONTAINER(box), image); |
3510 | 341 gtk_container_add(GTK_CONTAINER(docklet), box); |
342 gtk_widget_show_all(GTK_WIDGET(docklet)); | |
343 | |
3554 | 344 /* ref the docklet before we bandy it about the place */ |
345 g_object_ref(G_OBJECT(docklet)); | |
3510 | 346 docklet_update_status(); |
347 docklet_update_icon(); | |
348 | |
4093 | 349 debug_printf("Tray Icon: created\n"); |
350 | |
351 return FALSE; /* for when we're called by the glib idle handler */ | |
3510 | 352 } |
353 | |
354 static void gaim_signon(struct gaim_connection *gc, void *data) { | |
355 docklet_update_status(); | |
356 } | |
357 | |
358 static void gaim_signoff(struct gaim_connection *gc, void *data) { | |
4157 | 359 /* do this when idle so that if the prpl was connecting |
360 and was cancelled, we register that connecting_count | |
361 has returned to 0 */ | |
4274 | 362 g_idle_add(docklet_update_status, &docklet); |
3510 | 363 } |
364 | |
4491 | 365 static void gaim_connecting(struct gaim_account *account, void *data) { |
3510 | 366 docklet_update_status(); |
367 } | |
368 | |
369 static void gaim_away(struct gaim_connection *gc, char *state, char *message, void *data) { | |
370 /* we only support global away. this is the way it is, ok? */ | |
371 docklet_update_status(); | |
372 } | |
373 | |
4274 | 374 static void gaim_im_recv(struct gaim_connection *gc, char **who, char **what, void *data) { |
3510 | 375 /* if message queuing while away is enabled, this event could be the first |
4274 | 376 message so we need to see if the status (and hence icon) needs changing. |
377 do this when idle so that all message processing is completed, queuing | |
378 etc, before we run. */ | |
379 g_idle_add(docklet_update_status, &docklet); | |
3510 | 380 } |
381 | |
3570 | 382 /* static void gaim_buddy_signon(struct gaim_connection *gc, char *who, void *data) { |
3510 | 383 } |
384 | |
385 static void gaim_buddy_signoff(struct gaim_connection *gc, char *who, void *data) { | |
386 } | |
387 | |
388 static void gaim_buddy_away(struct gaim_connection *gc, char *who, void *data) { | |
389 } | |
390 | |
391 static void gaim_buddy_back(struct gaim_connection *gc, char *who, void *data) { | |
392 } | |
393 | |
394 static void gaim_new_conversation(char *who, void *data) { | |
3570 | 395 } */ |
3510 | 396 |
397 char *gaim_plugin_init(GModule *handle) { | |
4093 | 398 docklet_create(NULL); |
3510 | 399 |
400 gaim_signal_connect(handle, event_signon, gaim_signon, NULL); | |
401 gaim_signal_connect(handle, event_signoff, gaim_signoff, NULL); | |
402 gaim_signal_connect(handle, event_connecting, gaim_connecting, NULL); | |
403 gaim_signal_connect(handle, event_away, gaim_away, NULL); | |
4274 | 404 gaim_signal_connect(handle, event_im_recv, gaim_im_recv, NULL); |
3570 | 405 /* gaim_signal_connect(handle, event_buddy_signon, gaim_buddy_signon, NULL); |
3510 | 406 gaim_signal_connect(handle, event_buddy_signoff, gaim_buddy_signoff, NULL); |
407 gaim_signal_connect(handle, event_buddy_away, gaim_buddy_away, NULL); | |
408 gaim_signal_connect(handle, event_buddy_back, gaim_buddy_back, NULL); | |
3570 | 409 gaim_signal_connect(handle, event_new_conversation, gaim_new_conversation, NULL); */ |
3510 | 410 |
411 return NULL; | |
412 } | |
413 | |
3554 | 414 void gaim_plugin_remove() { |
3570 | 415 if (GTK_WIDGET_VISIBLE(docklet)) { |
4698 | 416 gaim_gtk_blist_docklet_remove(); |
3570 | 417 } |
3554 | 418 |
3570 | 419 docklet_flush_queue(); |
3554 | 420 |
4274 | 421 docklet_remove_callbacks(); |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
422 |
3570 | 423 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_destroyed), NULL); |
424 gtk_widget_destroy(GTK_WIDGET(docklet)); | |
3554 | 425 |
4093 | 426 g_object_unref(G_OBJECT(docklet)); |
427 docklet = NULL; | |
428 | |
4567 | 429 /* do this while gaim has no other way to toggle the global mute */ |
430 gaim_sound_set_mute(FALSE); | |
431 | |
4093 | 432 debug_printf("Tray Icon: removed\n"); |
3554 | 433 } |
434 | |
3570 | 435 GtkWidget *gaim_plugin_config_gtk() { |
436 GtkWidget *frame; | |
437 GtkWidget *vbox, *hbox; | |
438 GtkWidget *toggle; | |
3517 | 439 |
3570 | 440 frame = gtk_vbox_new(FALSE, 18); |
441 gtk_container_set_border_width(GTK_CONTAINER(frame), 12); | |
442 | |
4093 | 443 vbox = make_frame(frame, _("Tray Icon Configuration")); |
3570 | 444 hbox = gtk_hbox_new(FALSE, 18); |
445 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3517 | 446 |
3570 | 447 /* toggle = gtk_check_button_new_with_mnemonic(_("_Automatically show buddy list on sign on")); |
448 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), blist_options & OPT_BLIST_APP_BUDDY_SHOW); | |
449 g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_toggle_blist_show), NULL); | |
450 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); */ | |
3517 | 451 |
4093 | 452 toggle = gtk_check_button_new_with_mnemonic(_("_Hide new messages until tray icon is clicked")); |
3570 | 453 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), away_options & OPT_AWAY_QUEUE_UNREAD); |
454 g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_toggle_queue), NULL); | |
455 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
456 | |
457 gtk_widget_show_all(frame); | |
458 return frame; | |
3517 | 459 } |
3570 | 460 |
3551 | 461 struct gaim_plugin_description desc; |
462 struct gaim_plugin_description *gaim_plugin_desc() { | |
463 desc.api_version = PLUGIN_API_VERSION; | |
4585 | 464 desc.name = g_strdup(_("System Tray Icon")); |
3551 | 465 desc.version = g_strdup(VERSION); |
4567 | 466 desc.description = g_strdup(_("Interacts with a Notification Area applet (in GNOME or KDE, for example) to display the current status of Gaim, allow fast access to commonly used functions, and to toggle display of the buddy list or login window. Also allows messages to be queued until the icon is clicked, similar to ICQ.")); |
4606 | 467 desc.authors = g_strdup("Robert McQueen <robot101@debian.org>"); |
3551 | 468 desc.url = g_strdup(WEBSITE); |
469 return &desc; | |
470 } | |
3510 | 471 |
3570 | 472 char *name() { |
4093 | 473 return _("System Tray Icon"); |
3510 | 474 } |
475 | |
3570 | 476 char *description() { |
4567 | 477 return _("Interacts with a Notification Area applet (in GNOME or KDE, for example) to display the current status of Gaim, allow fast access to commonly used functions, and to toggle display of the buddy list or login window. Also allows messages to be queued until the icon is clicked, similar to ICQ."); |
3510 | 478 } |