annotate plugins/docklet/docklet.c @ 11740:7e0ad3b6882a

[gaim-migrate @ 14031] Moved Plugins to Tools > Plugins Made iChat Timestamp plugin instant apply Made Proxy options visible only when needed. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 23 Oct 2005 07:12:12 +0000
parents c828b5d08c91
children c7a36461b00c
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 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
24 #include "internal.h"
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9730
diff changeset
25 #include "gtkgaim.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
26
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6138
diff changeset
27 #include "core.h"
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
28 #include "conversation.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
29 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
30 #include "prefs.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
31 #include "signals.h"
4561
9df99116840a [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
32 #include "sound.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
33 #include "version.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
34
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
35 #include "gtkaccount.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
36 #include "gtkblist.h"
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
37 #include "gtkconv.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
38 #include "gtkft.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
39 #include "gtkplugin.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
40 #include "gtkprefs.h"
5684
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5669
diff changeset
41 #include "gtksound.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
42 #include "gtkutils.h"
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10272
diff changeset
43 #include "gtkstock.h"
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
44 #include "docklet.h"
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
46 #include "gaim.h"
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 8999
diff changeset
47 #include "gtkdialogs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
48
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
49 #define DOCKLET_PLUGIN_ID "gtk-docklet"
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
50
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
51 /* globals */
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
52 GaimPlugin *handle = NULL;
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
53 static struct docklet_ui_ops *ui_ops = NULL;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
54 static DockletStatus status = DOCKLET_STATUS_OFFLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
55 static gulong gtkblist_delete_cb_id = 0;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
56 static gboolean enable_join_chat = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
57
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
58 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
59 * docklet status and utility functions
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
60 **************************************************************************/
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
61 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
62 docklet_blink_icon()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
63 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
64 static gboolean blinked = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
65 gboolean ret = FALSE; /* by default, don't keep blinking */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
66
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
67 blinked = !blinked;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
68
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
69 switch (status) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
70 case DOCKLET_STATUS_ONLINE_PENDING:
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
71 case DOCKLET_STATUS_AWAY_PENDING:
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
72 if (blinked) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
73 if (ui_ops && ui_ops->blank_icon)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
74 ui_ops->blank_icon();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
75 } else {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
76 if (ui_ops && ui_ops->update_icon)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
77 ui_ops->update_icon(status);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
78 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
79 ret = TRUE; /* keep blinking */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
80 break;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
81 default:
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
82 blinked = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
83 break;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
84 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
85
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
86 return ret;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
87 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
88
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
89 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
90 docklet_update_status()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
91 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
92 GList *l;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
93 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
94 gboolean pending = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
95
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
96 /* determine if any ims have unseen messages */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
97 for(l = gaim_get_ims(); l!=NULL; l=l->next) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
98 GaimConversation *conv = (GaimConversation*)l->data;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
99 if(GAIM_IS_GTK_CONVERSATION(conv)) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
100 if(GAIM_GTK_CONVERSATION(conv)->unseen_state!=GAIM_UNSEEN_NONE) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
101 pending = TRUE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
102 break;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
103 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
104 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
105 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
106
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
107 /* iterate through all accounts and determine which
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
108 * status to show in the tray icon based on the following
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
109 * ranks (highest encountered rank will be used):
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
110 *
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
111 * 1) OFFLINE
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
112 * 2) ONLINE
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
113 * 3) ONLINE_PENDING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
114 * 4) AWAY
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
115 * 5) AWAY_PENDING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
116 * 6) CONNECTING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
117 */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
118 for(l = gaim_accounts_get_all(); l!=NULL; l=l->next) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
119 DockletStatus tmpstatus = DOCKLET_STATUS_OFFLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
120
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
121 GaimAccount *account = (GaimAccount*)l->data;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
122 GaimStatus *account_status;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
123
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
124 if (!gaim_account_get_enabled(account, GAIM_GTK_UI))
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
125 continue;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
126
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
127 if(gaim_account_is_disconnected(account))
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
128 continue;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
129
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
130 account_status = gaim_account_get_active_status(account);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
131
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
132 if(gaim_account_is_connecting(account)) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
133 tmpstatus = DOCKLET_STATUS_CONNECTING;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
134 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
135 else if(gaim_status_is_online(account_status)) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
136 if(!gaim_status_is_available(account_status)) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
137 if(pending)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
138 tmpstatus = DOCKLET_STATUS_AWAY_PENDING;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
139 else
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
140 tmpstatus = DOCKLET_STATUS_AWAY;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
141 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
142 else {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
143 if(pending)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
144 tmpstatus = DOCKLET_STATUS_ONLINE_PENDING;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
145 else
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
146 tmpstatus = DOCKLET_STATUS_ONLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
147 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
148 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
149
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
150 if(tmpstatus>newstatus) newstatus=tmpstatus;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
151 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
152
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
153 /* update the icon if we changed status */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
154 if (status != newstatus) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
155 status = newstatus;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
156
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
157 if (ui_ops && ui_ops->update_icon)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
158 ui_ops->update_icon(status);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
159
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
160 /* and schedule the blinker function if messages are pending */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
161 if (status == DOCKLET_STATUS_ONLINE_PENDING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
162 || status == DOCKLET_STATUS_AWAY_PENDING) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
163 g_timeout_add(500, docklet_blink_icon, &handle);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
164 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
165 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
166
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
167 return FALSE; /* for when we're called by the glib idle handler */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
168 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
169
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
170 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
171 online_account_supports_chat()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
172 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
173 GList *c = NULL;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
174 c = gaim_connections_get_all();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
175
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
176 while(c!=NULL) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
177 GaimConnection *gc = c->data;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
178 if(GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info!=NULL)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
179 return TRUE;
11713
2aa3211ef3e2 [gaim-migrate @ 14004]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11709
diff changeset
180 c = c->next;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
181 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
182
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
183 return FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
184 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
186 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
187 focus_first_unseen_conv()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
188 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
189 GList *l;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
190 GaimConversation *conv;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
191 GaimGtkConversation *gtkconv;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
192
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
193 /* find first im with unseen messages */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
194 for(l = gaim_get_ims(); l!=NULL; l=l->next) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
195 conv = (GaimConversation*)l->data;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
196 if(GAIM_IS_GTK_CONVERSATION(conv)) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
197 gtkconv=GAIM_GTK_CONVERSATION(conv);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
198 if(gtkconv->unseen_state!=GAIM_UNSEEN_NONE) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
199 gtkconv->active_conv=conv;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
200 gaim_gtk_conv_window_switch_gtkconv(gtkconv->win, gtkconv);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
201 gaim_gtk_conv_window_raise(gtkconv->win);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
202 gtk_window_present(GTK_WINDOW(gtkconv->win->window));
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
203 return TRUE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
204 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
205 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
206 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
207
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
208 return FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
209 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
210
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
211 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
212 * minimize to and unminimize from the tray icon
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
213 **************************************************************************/
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
214 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
215 minimize_to_tray()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
216 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
217 GaimGtkBuddyList *blist = gaim_gtk_blist_get_default_gtk_blist();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
218
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
219 if(!blist || !blist->window)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
220 return;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
221
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
222 if (ui_ops && ui_ops->minimize)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
223 ui_ops->minimize(blist->window);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
224
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
225 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", FALSE);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
226 gtk_widget_hide(blist->window);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
227
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
228 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
229 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
230
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
231 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
232 unminimize_from_tray()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
233 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
234 GaimGtkBuddyList *blist = gaim_gtk_blist_get_default_gtk_blist();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
235
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
236 if(!blist || !blist->window)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
237 return;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
238
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
239 if (ui_ops && ui_ops->maximize)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
240 ui_ops->maximize(blist->window);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
241
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
242 gaim_blist_set_visible(TRUE);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
243
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
244 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
245 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
246
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
247 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
248 docklet_toggle_blist()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
249 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
250 if(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"))
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
251 minimize_to_tray();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
252 else
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
253 unminimize_from_tray();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
254 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
256 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
257 * callbacks and signal handlers
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
258 **************************************************************************/
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
259 /* catch delete events on gtkblist and hide it instead */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
260 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
261 gtkblist_delete_cb(GtkWidget *widget) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
262 gaim_debug(GAIM_DEBUG_INFO, "docklet", "hiding buddy list\n");
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
263 minimize_to_tray(widget);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
264 return TRUE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
265 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
266
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
267 /* connect to delete signal when gtkblist is created */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
268 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
269 gtkblist_created_cb(GaimBuddyList *list)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
270 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
271 if(list!=NULL && GAIM_IS_GTK_BLIST(list) &&
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
272 GAIM_GTK_BLIST(list)->window!=NULL &&
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
273 gtkblist_delete_cb_id==0) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
274
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
275 gtkblist_delete_cb_id = g_signal_connect(G_OBJECT(GAIM_GTK_BLIST(list)->window),
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
276 "delete_event", G_CALLBACK(gtkblist_delete_cb), NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
277 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
278 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
279
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
280 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
281 gaim_quit_cb()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
282 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
283 /* TODO: confirm quit while pending */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
284 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
285
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
286 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
287 docklet_update_status_cb(void *data, ...)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
288 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
289 /* The odd function arguments allow this callback to be used for
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
290 * any signal which has a pointer as the first callback parameter.
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
291 * Although ugly, it allows this single callback to be used instead
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
292 * of multiple functions with different signatures that do the same
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
293 * thing.
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
294 */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
295 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
296 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
297
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
298 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
299 docklet_conv_updated_cb(GaimConversation *conv, GaimConvUpdateType type)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
300 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
301 if(type==GAIM_CONV_UPDATE_UNSEEN)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
302 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
303 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
304
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
305 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
306 docklet_signed_on_cb(GaimConnection *gc)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
307 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
308 if(!enable_join_chat) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
309 if(GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info!=NULL)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
310 enable_join_chat = TRUE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
311 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
312 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
313 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
314
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
315 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
316 docklet_signed_off_cb(GaimConnection *gc)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
317 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
318 if(enable_join_chat) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
319 if(GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info!=NULL)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
320 enable_join_chat = online_account_supports_chat();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
321 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
322 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
323 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
324
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
325 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
326 * docklet pop-up menu
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
327 **************************************************************************/
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
328 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
329 docklet_toggle_mute(GtkWidget *toggle, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
330 {
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10004
diff changeset
331 gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
334 #ifdef _WIN32
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
335 /* 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
336 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
337 pointer leaves the menu. */
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
338 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
339 hide_docklet_menu(gpointer data)
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
340 {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
341 if (data != NULL) {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
342 gtk_menu_popdown(GTK_MENU(data));
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
343 }
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
344 return FALSE;
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
345 }
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
346
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
347 static gboolean
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
348 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
349 {
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
350 static guint hide_docklet_timer = 0;
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
351 if (event->type == GDK_LEAVE_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
352 gaim_debug(GAIM_DEBUG_INFO, "docklet", "menu leave-notify-event\n");
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
353 /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
354 if (hide_docklet_timer == 0) {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
355 hide_docklet_timer = gaim_timeout_add(500,
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
356 hide_docklet_menu, menu);
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
357 }
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
358 } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
359 gaim_debug(GAIM_DEBUG_INFO, "docklet", "menu enter-notify-event\n");
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
360 if (hide_docklet_timer != 0) {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
361 /* Cancel the hiding if we reenter */
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
362
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
363 gaim_timeout_remove(hide_docklet_timer);
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
364 hide_docklet_timer = 0;
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
365 }
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
366 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
367 return FALSE;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
369 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
371 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
372 docklet_menu() {
3513
ab939e746bdd [gaim-migrate @ 3585]
Luke Schierer <lschiere@pidgin.im>
parents: 3512
diff changeset
373 static GtkWidget *menu = NULL;
3512
1ea341091de8 [gaim-migrate @ 3584]
Luke Schierer <lschiere@pidgin.im>
parents: 3510
diff changeset
374 GtkWidget *entry;
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
375 GtkWidget *menuitem;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 if (menu) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 gtk_widget_destroy(menu);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 menu = gtk_menu_new();
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
382
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
383 entry = gtk_check_menu_item_new_with_label(_("Show Buddy List"));
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
384 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry), gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
385 g_signal_connect(G_OBJECT(entry), "toggled", G_CALLBACK(docklet_toggle_blist), NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
386 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
387
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
388 gaim_separator(menu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
390 menuitem = gaim_new_item_from_stock(menu, _("New Message..."), GAIM_STOCK_IM, G_CALLBACK(gaim_gtkdialogs_im), NULL, 0, 0, NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
391 if(status == DOCKLET_STATUS_OFFLINE)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
392 gtk_widget_set_sensitive(menuitem, FALSE);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
394 menuitem = gaim_new_item_from_stock(menu, _("Join A Chat..."), GAIM_STOCK_CHAT, G_CALLBACK(gaim_gtk_blist_joinchat_show), NULL, 0, 0, NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
395 gtk_widget_set_sensitive(menuitem, enable_join_chat);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
397 gaim_separator(menu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
399 entry = gtk_check_menu_item_new_with_label(_("Mute Sounds"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10004
diff changeset
400 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry), gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10004
diff changeset
401 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"))
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10004
diff changeset
402 gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
403 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
404 gtk_menu_shell_append(GTK_MENU_SHELL(menu), entry);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
405
5669
9e7f8ffb0404 [gaim-migrate @ 6086]
Sean Egan <seanegan@gmail.com>
parents: 5609
diff changeset
406 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
407 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
408 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
409
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
410 gaim_separator(menu);
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
411
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
412 /* TODO: need a submenu to change status, this needs to "link"
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
413 * to the status in the buddy list gtkstatusbox
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
414 */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
415
9994
e651dbb88773 [gaim-migrate @ 10907]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
416 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(gaim_core_quit), NULL, 0, 0, NULL);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
418 #ifdef _WIN32
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
419 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
420 g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
421 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 gtk_widget_show_all(menu);
10268
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 10127
diff changeset
423 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 10127
diff changeset
424 ui_ops->position_menu,
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 10127
diff changeset
425 NULL, 0, gtk_get_current_event_time());
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
426 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
428 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
429 * public api for ui_ops
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
430 **************************************************************************/
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
431 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
432 docklet_clicked(int button_type)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
433 {
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
434 switch (button_type) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
435 case 1:
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
436 if(status==DOCKLET_STATUS_ONLINE_PENDING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
437 || status==DOCKLET_STATUS_AWAY_PENDING)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
438 focus_first_unseen_conv();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
439 else
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
440 docklet_toggle_blist();
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
441 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
442 case 3:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
443 docklet_menu();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
444 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
445 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
446 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
447
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
448 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
449 docklet_embedded()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
450 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
451 docklet_update_status();
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
452 if (ui_ops && ui_ops->update_icon)
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
453 ui_ops->update_icon(status);
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
454 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
455
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
456 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
457 docklet_remove(gboolean visible)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
458 {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
459 unminimize_from_tray();
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
460 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
461
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
462 void
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
463 docklet_unload()
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
464 {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
465 gaim_plugin_unload(handle);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
466 }
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
467
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
468 void
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
469 docklet_set_ui_ops(struct docklet_ui_ops *ops)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
470 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
471 ui_ops = ops;
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
472 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
473
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
474 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
475 * plugin glue
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
476 **************************************************************************/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
477 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
478 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
479 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
480 void *conn_handle = gaim_connections_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
481 void *conv_handle = gaim_conversations_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
482 void *accounts_handle = gaim_accounts_get_handle();
9893
8053a00136ea [gaim-migrate @ 10781]
Luke Schierer <lschiere@pidgin.im>
parents: 9813
diff changeset
483 void *core_handle = gaim_get_core();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
484
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
485 gaim_debug(GAIM_DEBUG_INFO, "docklet", "plugin loaded\n");
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
486
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
487 handle = plugin;
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
488
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
489 docklet_ui_init();
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
490 if (ui_ops && ui_ops->create)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
491 ui_ops->create();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
493 gaim_signal_connect(conn_handle, "signed-on",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
494 plugin, GAIM_CALLBACK(docklet_signed_on_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
495 gaim_signal_connect(conn_handle, "signed-off",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
496 plugin, GAIM_CALLBACK(docklet_signed_off_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
497 gaim_signal_connect(accounts_handle, "account-connecting",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
498 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
11714
c828b5d08c91 [gaim-migrate @ 14005]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11713
diff changeset
499 gaim_signal_connect(accounts_handle, "account-status-changed",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
500 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
501 gaim_signal_connect(conv_handle, "received-im-msg",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
502 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
503 gaim_signal_connect(conv_handle, "conversation-created",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
504 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
505 gaim_signal_connect(conv_handle, "conversation-updated",
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
506 plugin, GAIM_CALLBACK(docklet_conv_updated_cb), NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
507
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
508 gaim_signal_connect(gaim_gtk_blist_get_handle(), "gtkblist-created",
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
509 plugin, GAIM_CALLBACK(gtkblist_created_cb), NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
510 gtkblist_created_cb(gaim_get_blist());
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
511
9893
8053a00136ea [gaim-migrate @ 10781]
Luke Schierer <lschiere@pidgin.im>
parents: 9813
diff changeset
512 gaim_signal_connect(core_handle, "quitting",
8053a00136ea [gaim-migrate @ 10781]
Luke Schierer <lschiere@pidgin.im>
parents: 9813
diff changeset
513 plugin, GAIM_CALLBACK(gaim_quit_cb), NULL);
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
514
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
515 enable_join_chat = online_account_supports_chat();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
516
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
517 if(!gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"))
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
518 minimize_to_tray();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
520 return TRUE;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
523 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
524 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
525 {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
526 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
527
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
528 if (ui_ops && ui_ops->destroy)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
529 ui_ops->destroy();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
530
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
531 /* remove callbacks */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
532 gaim_signals_disconnect_by_handle(handle);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
533 if(gtkblist_delete_cb_id!=0)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
534 g_signal_handler_disconnect(G_OBJECT(gtkblist->window), gtkblist_delete_cb_id);
11714
c828b5d08c91 [gaim-migrate @ 14005]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11713
diff changeset
535 gtkblist_delete_cb_id = 0;
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
536
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
537 unminimize_from_tray();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
538
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
539 gaim_debug(GAIM_DEBUG_INFO, "docklet", "plugin unloaded\n");
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
540
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
541 return TRUE;
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
542 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
543
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
544 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
545 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
546 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
547 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
548 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
549 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
550 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
551 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
552 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
553 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
554
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
555 DOCKLET_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
556 N_("System Tray Icon"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
557 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
558 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
559 N_("Displays an icon for Gaim in the system tray."),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
560 /** description */
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
561 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
562 "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
563 "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
564 "window. Also allows messages to be queued until the icon is "
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
565 "clicked, similar to ICQ."),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
566 "Robert McQueen <robot101@debian.org>", /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6310
diff changeset
567 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
568
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
569 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
570 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
571 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
572
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
573 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8940
diff changeset
574 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8940
diff changeset
575 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8940
diff changeset
576 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
577 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
578
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
579 static void
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
580 plugin_init(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
581 {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
582 /* TODO: these will be removed once queuing is working in the ui */
6226
6b95da075de9 [gaim-migrate @ 6719]
Christian Hammond <chipx86@chipx86.com>
parents: 6211
diff changeset
583 gaim_prefs_add_none("/plugins/gtk/docklet");
6b95da075de9 [gaim-migrate @ 6719]
Christian Hammond <chipx86@chipx86.com>
parents: 6211
diff changeset
584 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE);
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
585 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
587 GAIM_INIT_PLUGIN(docklet, plugin_init, info)