annotate plugins/docklet/docklet.c @ 7082:25a616f16b6c

[gaim-migrate @ 7647] Added more core wrappers for the glib mainloops, and replaced the last GTK+ code in OSCAR with them. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 30 Sep 2003 22:55:22 +0000
parents bdd046deec7e
children bf630f7dfdcd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
1 /*
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
2 * System tray icon (aka docklet) plugin for Gaim
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
3 *
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
4 * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org>
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
5 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * Inspired by a similar plugin by:
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * John (J5) Palmieri <johnp@martianrock.com>
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
8 *
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation; either version 2 of the
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 *
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
18 *
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * 02111-1307, USA.
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 /* todo (in order of importance):
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
26 - 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
27 - handle and update tooltips to show your current accounts/queued messages?
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
28 - show a count of queued messages in the unified queue
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 - dernyi's account status menu in the right click
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
30 - optional pop up notices when GNOME2's system-tray-applet supports it */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
32 #include "internal.h"
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6310
diff changeset
33 #include "gtkinternal.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
34
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6138
diff changeset
35 #include "core.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
36 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
37 #include "prefs.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
38 #include "signals.h"
4561
9df99116840a [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
39 #include "sound.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
40
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
41 #include "gtkaccount.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
42 #include "gtkblist.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
43 #include "gtkft.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
44 #include "gtkplugin.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
45 #include "gtkprefs.h"
5684
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5669
diff changeset
46 #include "gtksound.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
47 #include "gtkutils.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
48 #include "stock.h"
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
49 #include "docklet.h"
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
51 #include "gaim.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
52 #include "ui.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
53
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
54 /* globals */
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3773
diff changeset
55
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
56 GaimPlugin *handle = NULL;
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
57 static struct docklet_ui_ops *ui_ops = NULL;
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
58 static enum docklet_status status = offline;
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
59 #ifdef _WIN32
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
60 __declspec(dllimport) GSList *unread_message_queue;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
61 __declspec(dllimport) GSList *away_messages;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
62 __declspec(dllimport) struct away_message *awaymessage;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
63 __declspec(dllimport) GSList *message_queue;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
64 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
66 /* private functions */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
68 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
69 docklet_toggle_mute(GtkWidget *toggle, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
70 {
5684
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5669
diff changeset
71 gaim_gtk_sound_set_mute(GTK_CHECK_MENU_ITEM(toggle)->active);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
74 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
75 docklet_set_bool(GtkWidget *widget, const char *key)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
76 {
5554
7b36d02031a2 [gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
77 gaim_prefs_set_bool(key, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 }
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
79
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
80 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
81 docklet_auto_login()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
82 {
5905
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
83 gaim_accounts_auto_login(GAIM_GTK_UI);
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
84 }
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
85
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
86 #ifdef _WIN32
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
87 /* This is a workaround for a bug in windows GTK+. Clicking outside of the
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
88 menu does not get rid of it, so instead we get rid of it as soon as the
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
89 pointer leaves the menu. */
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
90 static gboolean
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
91 docklet_menu_leave(GtkWidget *menu, GdkEventCrossing *event, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
92 {
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
93 if(event->detail == GDK_NOTIFY_ANCESTOR) {
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
94 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "menu leave-notify-event\n");
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
95 gtk_menu_popdown(GTK_MENU(menu));
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
96 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
97 return FALSE;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
99 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
101 static void docklet_menu() {
3513
ab939e746bdd [gaim-migrate @ 3585]
Luke Schierer <lschiere@pidgin.im>
parents: 3512
diff changeset
102 static GtkWidget *menu = NULL;
3512
1ea341091de8 [gaim-migrate @ 3584]
Luke Schierer <lschiere@pidgin.im>
parents: 3510
diff changeset
103 GtkWidget *entry;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 if (menu) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 gtk_widget_destroy(menu);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 menu = gtk_menu_new();
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
110
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
111 switch (status) {
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
112 case offline:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
113 case offline_connecting:
5905
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
114 gaim_new_item_from_stock(menu, _("Auto-login"), GAIM_STOCK_SIGN_ON, G_CALLBACK(docklet_auto_login), NULL, 0, 0, NULL);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
115 break;
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
116 default:
6979
bdd046deec7e [gaim-migrate @ 7535]
Mark Doliner <mark@kingant.net>
parents: 6910
diff changeset
117 gaim_new_item_from_stock(menu, _("New Message..."), GAIM_STOCK_IM, G_CALLBACK(show_im_dialog), NULL, 0, 0, NULL);
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4840
diff changeset
118 gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(join_chat), NULL, 0, 0, NULL);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
119 break;
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
120 }
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
121
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
122 switch (status) {
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
123 case offline:
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
124 case offline_connecting:
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
125 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
126 case online:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
127 case online_connecting:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
128 case online_pending: {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 GtkWidget *docklet_awaymenu;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 GSList *awy = NULL;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 struct away_message *a = NULL;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 docklet_awaymenu = gtk_menu_new();
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 awy = away_messages;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 while (awy) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 a = (struct away_message *)awy->data;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 entry = gtk_menu_item_new_with_label(a->name);
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
140 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_away_message), a);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
141 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 awy = g_slist_next(awy);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
146 if (away_messages)
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
147 gaim_separator(docklet_awaymenu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 entry = gtk_menu_item_new_with_label(_("New..."));
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
150 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(create_away_mess), NULL);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
151 gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 entry = gtk_menu_item_new_with_label(_("Away"));
3512
1ea341091de8 [gaim-migrate @ 3584]
Luke Schierer <lschiere@pidgin.im>
parents: 3510
diff changeset
154 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry), docklet_awaymenu);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
155 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
156 } break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
157 case away:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
158 case away_pending:
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 entry = gtk_menu_item_new_with_label(_("Back"));
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
160 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_im_back), NULL);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
161 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
162 break;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
165 gaim_separator(menu);
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
166
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
167 entry = gtk_check_menu_item_new_with_label(_("Mute Sounds"));
5684
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5669
diff changeset
168 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry), gaim_gtk_sound_get_mute());
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
169 g_signal_connect(G_OBJECT(entry), "toggled", G_CALLBACK(docklet_toggle_mute), NULL);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
170 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
171
5669
9e7f8ffb0404 [gaim-migrate @ 6086]
Sean Egan <seanegan@gmail.com>
parents: 5609
diff changeset
172 gaim_new_item_from_stock(menu, _("File Transfers"), GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(gaim_show_xfer_dialog), NULL, 0, 0, NULL);
6138
1894de5f7fbd [gaim-migrate @ 6612]
Nathan Walp <nwalp@pidgin.im>
parents: 6077
diff changeset
173 gaim_new_item_from_stock(menu, _("Accounts"), GAIM_STOCK_ACCOUNTS, G_CALLBACK(gaim_gtk_accounts_window_show), NULL, 0, 0, NULL);
5669
9e7f8ffb0404 [gaim-migrate @ 6086]
Sean Egan <seanegan@gmail.com>
parents: 5609
diff changeset
174 gaim_new_item_from_stock(menu, _("Preferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(gaim_gtk_prefs_show), NULL, 0, 0, NULL);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
175
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
176 gaim_separator(menu);
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
177
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
178 switch (status) {
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
179 case offline:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
180 case offline_connecting:
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
181 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
182 default:
5607
eeba9205dd0f [gaim-migrate @ 6011]
Nathan Walp <nwalp@pidgin.im>
parents: 5584
diff changeset
183 gaim_new_item_from_stock(menu, _("Signoff"), GTK_STOCK_CLOSE, G_CALLBACK(gaim_connections_disconnect_all), NULL, 0, 0, 0);
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
184 break;
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
185 }
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
186
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6138
diff changeset
187 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(gaim_core_quit), NULL, 0, 0, 0);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
189 #ifdef _WIN32
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
190 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave), NULL);
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
191 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 gtk_widget_show_all(menu);
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
193 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
194 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
196 static gboolean
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
197 docklet_blink_icon()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
198 {
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
199 static gboolean blinked = FALSE;
6910
37d1699df8e2 [gaim-migrate @ 7457]
Mark Doliner <mark@kingant.net>
parents: 6906
diff changeset
200 gboolean ret = FALSE; /* by default, don't keep blinking */
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
201
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
202 blinked = !blinked;
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
203
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
204 switch (status) {
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
205 case online_pending:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
206 case away_pending:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
207 if (blinked) {
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
208 if (ui_ops && ui_ops->blank_icon)
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
209 ui_ops->blank_icon();
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
210 } else {
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
211 if (ui_ops && ui_ops->update_icon)
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
212 ui_ops->update_icon(status);
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
213 }
6910
37d1699df8e2 [gaim-migrate @ 7457]
Mark Doliner <mark@kingant.net>
parents: 6906
diff changeset
214 ret = TRUE; /* keep blinking */
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
215 break;
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
216 case offline:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
217 case offline_connecting:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
218 case online:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
219 case online_connecting:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
220 case away:
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
221 blinked = FALSE;
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
222 break;
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
223 }
6906
567991b90cee [gaim-migrate @ 7453]
Mark Doliner <mark@kingant.net>
parents: 6894
diff changeset
224
6910
37d1699df8e2 [gaim-migrate @ 7457]
Mark Doliner <mark@kingant.net>
parents: 6906
diff changeset
225 return ret;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
228 static gboolean
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
229 docklet_update_status()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
230 {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 enum docklet_status oldstatus;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 oldstatus = status;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234
5584
cade2082f760 [gaim-migrate @ 5988]
Luke Schierer <lschiere@pidgin.im>
parents: 5554
diff changeset
235 if (gaim_connections_get_all()) {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
236 if (unread_message_queue) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
237 status = online_pending;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
238 } else if (awaymessage) {
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 if (message_queue) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 status = away_pending;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 } else {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 status = away;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 }
5905
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
244 } else if (gaim_connections_get_connecting()) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
245 status = online_connecting;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 } else {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 status = online;
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 } else {
5905
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
250 if (gaim_connections_get_connecting()) {
4157
9c31ddae80a1 [gaim-migrate @ 4385]
Rob Flynn <gaim@robflynn.com>
parents: 4108
diff changeset
251 status = offline_connecting;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
252 } else {
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
253 status = offline;
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
254 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
257 /* update the icon if we changed status */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 if (status != oldstatus) {
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
259 if (ui_ops && ui_ops->update_icon)
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
260 ui_ops->update_icon(status);
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
262 /* and schedule the blinker function if messages are pending */
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
263 if (status == online_pending || status == away_pending) {
6310
f14718d7082e [gaim-migrate @ 6809]
Mark Doliner <mark@kingant.net>
parents: 6309
diff changeset
264 g_timeout_add(500, docklet_blink_icon, &handle);
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
265 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 }
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
267
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
268 return FALSE; /* for when we're called by the glib idle handler */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
271 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
272 docklet_flush_queue()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
273 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
274 if (unread_message_queue) {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
275 purge_away_queue(&unread_message_queue);
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
276 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
279 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
280 docklet_remove_callbacks()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
281 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
282 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "removing callbacks");
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
284 while (g_source_remove_by_user_data(&handle)) {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
285 gaim_debug(GAIM_DEBUG_INFO, NULL, ".");
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
286 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
288 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n");
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
291 /* public code */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
293 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
294 docklet_clicked(int button_type)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
295 {
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
296 switch (button_type) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
297 case 1:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
298 if (unread_message_queue) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
299 docklet_flush_queue();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
300 } else {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
301 gaim_gtk_blist_docklet_toggle();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
302 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
303 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
304 case 2:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
305 switch (status) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
306 case offline:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
307 case offline_connecting:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
308 docklet_auto_login();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
309 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
310 default:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
311 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
312 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
313 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
314 case 3:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
315 docklet_menu();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
316 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
317 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
318 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
319
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
320 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
321 docklet_embedded()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
322 {
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
323 gaim_gtk_blist_docklet_add();
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
324
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
325 docklet_update_status();
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
326 if (ui_ops && ui_ops->update_icon)
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
327 ui_ops->update_icon(status);
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
328 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
329
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
330 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
331 docklet_remove(gboolean visible)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
332 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
333 if (visible)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
334 gaim_gtk_blist_docklet_remove();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
335
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
336 docklet_flush_queue();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
337 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
338
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
339 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
340 docklet_set_ui_ops(struct docklet_ui_ops *ops)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
341 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
342 ui_ops = ops;
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
343 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
344
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
345 /* callbacks */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
346
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
347 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
348 gaim_signon(GaimConnection *gc, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
349 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
350 docklet_update_status();
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
351 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
352
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
353 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
354 gaim_signoff(GaimConnection *gc, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
355 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
356 /* do this when idle so that if the prpl was connecting
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
357 and was cancelled, we register that connecting_count
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
358 has returned to 0 */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
359 /* no longer necessary because Chip decided that us plugins
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
360 didn't need to know if an account was connecting or not
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
361 g_idle_add(docklet_update_status, &docklet); */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
362 docklet_update_status();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
363 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
364
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
365 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
366 gaim_connecting(GaimAccount *account, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
367 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
368 docklet_update_status();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
369 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
370
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
371 static void
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
372 gaim_away(GaimAccount *account, char *state, char *message, void *data)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
373 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
374 /* we only support global away. this is the way it is, ok? */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
375 docklet_update_status();
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
376 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
377
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
378 static gboolean
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
379 gaim_im_recv(GaimAccount *account, GaimConversation *conv, char **who,
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
380 char **what, int *flags, void *data)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
381 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
382 /* if message queuing while away is enabled, this event could be the first
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
383 message so we need to see if the status (and hence icon) needs changing.
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
384 do this when idle so that all message processing is completed, queuing
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
385 etc, before we run. */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
386 g_idle_add(docklet_update_status, &handle);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
387
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
388 return FALSE;
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
389 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
390
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
391 static void
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
392 gaim_new_conversation(GaimConversation *conv, void *data)
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
393 {
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
394 /* queue a callback here so if the queue is being
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
395 flushed, we stop flashing. thanks javabsp. */
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
396 g_idle_add(docklet_update_status, &handle);
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
397 }
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
398
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
399 /* static void gaim_buddy_signon(GaimConnection *gc, char *who, void *data) {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
400 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
401
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
402 static void gaim_buddy_signoff(GaimConnection *gc, char *who, void *data) {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
403 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
404
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
405 static void gaim_buddy_away(GaimConnection *gc, char *who, void *data) {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
406 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
407
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
408 static void gaim_buddy_back(GaimConnection *gc, char *who, void *data) {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
409 } */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
410
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
411 /* plugin glue */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
412
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
413 #define DOCKLET_PLUGIN_ID "gtk-docklet"
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
414
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
415 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
416 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
417 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
418 void *conn_handle = gaim_connections_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
419 void *conv_handle = gaim_conversations_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
420 void *accounts_handle = gaim_accounts_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
421
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
422 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "plugin loaded\n");
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
423
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
424 handle = plugin;
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
425
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
426 docklet_ui_init();
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
427 if (ui_ops && ui_ops->create)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
428 ui_ops->create();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
430 gaim_signal_connect(conn_handle, "signed-on",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
431 plugin, GAIM_CALLBACK(gaim_signon), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
432 gaim_signal_connect(conn_handle, "signed-off",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
433 plugin, GAIM_CALLBACK(gaim_signoff), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
434 gaim_signal_connect(accounts_handle, "account-connecting",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
435 plugin, GAIM_CALLBACK(gaim_connecting), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
436 gaim_signal_connect(accounts_handle, "account-away",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
437 plugin, GAIM_CALLBACK(gaim_away), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
438 gaim_signal_connect(conv_handle, "received-im-msg",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
439 plugin, GAIM_CALLBACK(gaim_im_recv), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
440 gaim_signal_connect(conv_handle, "conversation-created",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
441 plugin, GAIM_CALLBACK(gaim_new_conversation), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
442
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
443 /* gaim_signal_connect(plugin, event_buddy_signon, gaim_buddy_signon, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
444 gaim_signal_connect(plugin, event_buddy_signoff, gaim_buddy_signoff, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
445 gaim_signal_connect(plugin, event_buddy_away, gaim_buddy_away, NULL);
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
446 gaim_signal_connect(plugin, event_buddy_back, gaim_buddy_back, NULL); */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
448 return TRUE;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
451 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
452 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
453 {
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
454 if (ui_ops && ui_ops->destroy)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
455 ui_ops->destroy();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
456
5905
dbe2a2174be9 [gaim-migrate @ 6337]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
457 /* XXX: do this while gaim has no other way to toggle the global mute */
5684
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5669
diff changeset
458 gaim_gtk_sound_set_mute(FALSE);
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
459
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
460 docklet_remove_callbacks();
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
461
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
462 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "plugin unloaded\n");
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
463
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
464 return TRUE;
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
465 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
466
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
467 static GtkWidget *
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
468 plugin_config_frame(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
469 {
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
470 GtkWidget *frame;
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
471 GtkWidget *vbox, *hbox;
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
472 GtkWidget *toggle;
5554
7b36d02031a2 [gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
473 static const char *qmpref = "/plugins/gtk/docklet/queue_messages";
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
474
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
475 frame = gtk_vbox_new(FALSE, 18);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
476 gtk_container_set_border_width(GTK_CONTAINER(frame), 12);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
477
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
478 vbox = gaim_gtk_make_frame(frame, _("Tray Icon Configuration"));
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
479 hbox = gtk_hbox_new(FALSE, 18);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
480 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
481
4093
987624dcece4 [gaim-migrate @ 4308]
Luke Schierer <lschiere@pidgin.im>
parents: 3939
diff changeset
482 toggle = gtk_check_button_new_with_mnemonic(_("_Hide new messages until tray icon is clicked"));
5554
7b36d02031a2 [gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
483 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), gaim_prefs_get_bool(qmpref));
7b36d02031a2 [gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
484 g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_set_bool), (void *)qmpref);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
485 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
486
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
487 gtk_widget_show_all(frame);
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
488 return frame;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3514
diff changeset
489 }
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
490
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
491 static GaimGtkPluginUiInfo ui_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
492 {
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
493 plugin_config_frame
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
494 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
495
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
496 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
497 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
498 2, /**< api_version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
499 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
500 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
501 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
502 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
503 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
504
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
505 DOCKLET_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
506 N_("System Tray Icon"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
507 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
508 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
509 N_("Displays an icon for Gaim in the system tray."),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
510 /** description */
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
511 N_("Displays a system tray icon (in GNOME, KDE or Windows for example) "
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
512 "to show the current status of Gaim, allow fast access to commonly "
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
513 "used functions, and to toggle display of the buddy list or login "
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
514 "window. Also allows messages to be queued until the icon is "
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
515 "clicked, similar to ICQ."),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
516 "Robert McQueen <robot101@debian.org>", /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6310
diff changeset
517 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
518
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
519 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
520 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
521 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
522
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
523 &ui_info, /**< ui_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
524 NULL /**< extra_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
525 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
526
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
527 static void
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
528 plugin_init(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
529 {
6226
6b95da075de9 [gaim-migrate @ 6719]
Christian Hammond <chipx86@chipx86.com>
parents: 6211
diff changeset
530 gaim_prefs_add_none("/plugins/gtk/docklet");
6b95da075de9 [gaim-migrate @ 6719]
Christian Hammond <chipx86@chipx86.com>
parents: 6211
diff changeset
531 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE);
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
532 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
534 GAIM_INIT_PLUGIN(docklet, plugin_init, info)