annotate plugins/docklet/docklet.c @ 12519:e63a80be5227

[gaim-migrate @ 14831] better (?) tooltips committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 17 Dec 2005 05:13:45 +0000
parents a2de852981c1
children dd2b171a624c
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
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
51 #ifndef DOCKLET_TOOLTIP_LINE_LIMIT
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
52 #define DOCKLET_TOOLTIP_LINE_LIMIT 5
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
53 #endif
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
54
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
55 /* globals */
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;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
58 static DockletStatus status = DOCKLET_STATUS_OFFLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
59 static gboolean enable_join_chat = FALSE;
11989
c7a36461b00c [gaim-migrate @ 14282]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11714
diff changeset
60 static guint docklet_blinking_timer = 0;
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
61 static gboolean visibility_manager = FALSE;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
62
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 * docklet status and utility functions
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
65 **************************************************************************/
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
66 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
67 docklet_blink_icon()
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 static gboolean blinked = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
70 gboolean ret = FALSE; /* by default, don't keep blinking */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
71
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
72 blinked = !blinked;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
73
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
74 switch (status) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
75 case DOCKLET_STATUS_ONLINE_PENDING:
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
76 case DOCKLET_STATUS_AWAY_PENDING:
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
77 if (blinked) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
78 if (ui_ops && ui_ops->blank_icon)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
79 ui_ops->blank_icon();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
80 } else {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
81 if (ui_ops && ui_ops->update_icon)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
82 ui_ops->update_icon(status);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
83 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
84 ret = TRUE; /* keep blinking */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
85 break;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
86 default:
11989
c7a36461b00c [gaim-migrate @ 14282]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11714
diff changeset
87 docklet_blinking_timer = 0;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
88 blinked = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
89 break;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
90 }
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 return ret;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
93 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
94
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
95 static GList *
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
96 get_pending_list(guint max)
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
97 {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
98 const char *im = gaim_prefs_get_string("/plugins/gtk/docklet/blink_im");
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
99 const char *chat = gaim_prefs_get_string("/plugins/gtk/docklet/blink_chat");
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
100 GList *l_im = NULL;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
101 GList *l_chat = NULL;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
102
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
103 if (im != NULL && strcmp(im, "always") == 0) {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
104 l_im = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
105 GAIM_UNSEEN_TEXT,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
106 FALSE, max);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
107 } else if (im != NULL && strcmp(im, "hidden") == 0) {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
108 l_im = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
109 GAIM_UNSEEN_TEXT,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
110 TRUE, max);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
111 }
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
112
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
113 if (chat != NULL && strcmp(chat, "always") == 0) {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
114 l_chat = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_CHAT,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
115 GAIM_UNSEEN_TEXT,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
116 FALSE, max);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
117 } else if (chat != NULL && strcmp(chat, "nick") == 0) {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
118 l_chat = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_CHAT,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
119 GAIM_UNSEEN_NICK,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
120 FALSE, max);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
121 }
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
122
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
123 if (l_im != NULL && l_chat != NULL)
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
124 return g_list_concat(l_im, l_chat);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
125 else if (l_im != NULL)
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
126 return l_im;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
127 else
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
128 return l_chat;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
129 }
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
130
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
131 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
132 docklet_update_status()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
133 {
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
134 GList *convs;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
135 GList *l;
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
136 int count;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
137 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
138 gboolean pending = FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
139
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
140 /* determine if any ims have unseen messages */
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
141 convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
142
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
143 if (convs != NULL) {
12021
1a86417abfc8 [gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12018
diff changeset
144 pending = TRUE;
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
145
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
146 /* set tooltip if messages are pending */
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
147 if (ui_ops->set_tooltip) {
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
148 GString *tooltip_text = g_string_new("");
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
149 for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) {
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
150 if (GAIM_IS_GTK_CONVERSATION(l->data)) {
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
151 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)l->data);
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
152 if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1)
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
153 g_string_append(tooltip_text, _("Right-click for more unread messages...\n"));
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
154 else
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
155 g_string_append_printf(tooltip_text,
12471
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
156 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
157 gtkconv->unseen_count,
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
158 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
159 }
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
160 }
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
161
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
162 /* get rid of the last newline */
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
163 if (tooltip_text->len > 0)
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
164 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
165
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
166 ui_ops->set_tooltip(tooltip_text->str);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
167
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
168 g_string_free(tooltip_text, TRUE);
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
169 }
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
170
011efeb86b8d [gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents: 12470
diff changeset
171 g_list_free(convs);
12475
572d6d5da418 [gaim-migrate @ 14786]
Richard Laager <rlaager@wiktel.com>
parents: 12472
diff changeset
172
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
173 } else if (ui_ops->set_tooltip) {
12475
572d6d5da418 [gaim-migrate @ 14786]
Richard Laager <rlaager@wiktel.com>
parents: 12472
diff changeset
174 ui_ops->set_tooltip(NULL);
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
175 }
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
176
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
177 /* iterate through all accounts and determine which
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
178 * 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
179 * ranks (highest encountered rank will be used):
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
180 *
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
181 * 1) OFFLINE
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
182 * 2) ONLINE
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
183 * 3) ONLINE_PENDING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
184 * 4) AWAY
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
185 * 5) AWAY_PENDING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
186 * 6) CONNECTING
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
187 */
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
188 for(l = gaim_accounts_get_all(); l != NULL; l = l->next) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
189 DockletStatus tmpstatus = DOCKLET_STATUS_OFFLINE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
190
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
191 GaimAccount *account = (GaimAccount*)l->data;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
192 GaimStatus *account_status;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
193
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
194 if (!gaim_account_get_enabled(account, GAIM_GTK_UI))
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
195 continue;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
196
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
197 if (gaim_account_is_disconnected(account))
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
198 continue;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
199
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
200 account_status = gaim_account_get_active_status(account);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
201
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
202 if (gaim_account_is_connecting(account)) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
203 tmpstatus = DOCKLET_STATUS_CONNECTING;
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
204 } else if (gaim_status_is_online(account_status)) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
205 if (!gaim_status_is_available(account_status)) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
206 if (pending)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
207 tmpstatus = DOCKLET_STATUS_AWAY_PENDING;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
208 else
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
209 tmpstatus = DOCKLET_STATUS_AWAY;
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 else {
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
212 if (pending)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
213 tmpstatus = DOCKLET_STATUS_ONLINE_PENDING;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
214 else
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
215 tmpstatus = DOCKLET_STATUS_ONLINE;
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 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
218
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
219 if (tmpstatus > newstatus)
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
220 newstatus = tmpstatus;
11709
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
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
223 /* update the icon if we changed status */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
224 if (status != newstatus) {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
225 status = newstatus;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
226
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
227 if (ui_ops && ui_ops->update_icon)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
228 ui_ops->update_icon(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 /* and schedule the blinker function if messages are pending */
11989
c7a36461b00c [gaim-migrate @ 14282]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11714
diff changeset
231 if ((status == DOCKLET_STATUS_ONLINE_PENDING
c7a36461b00c [gaim-migrate @ 14282]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11714
diff changeset
232 || status == DOCKLET_STATUS_AWAY_PENDING)
c7a36461b00c [gaim-migrate @ 14282]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11714
diff changeset
233 && docklet_blinking_timer == 0) {
c7a36461b00c [gaim-migrate @ 14282]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11714
diff changeset
234 docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, &handle);
11709
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 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
237
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
238 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
239 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
240
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
241 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
242 online_account_supports_chat()
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 GList *c = NULL;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
245 c = gaim_connections_get_all();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
246
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
247 while(c != NULL) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
248 GaimConnection *gc = c->data;
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
249 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
250 return TRUE;
11713
2aa3211ef3e2 [gaim-migrate @ 14004]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11709
diff changeset
251 c = c->next;
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
252 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
253
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
254 return FALSE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
255 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
257 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
258 * callbacks and signal handlers
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
259 **************************************************************************/
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
260 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
261 gaim_quit_cb()
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
262 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
263 /* TODO: confirm quit while pending */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
264 }
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 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
267 docklet_update_status_cb(void *data, ...)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
268 {
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
269 /* 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
270 * 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
271 * 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
272 * of multiple functions with different signatures that do the same
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
273 * thing.
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 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
276 }
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 static void
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
279 docklet_prefs_cb(const char *name, GaimPrefType type,
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
280 gpointer val, gpointer data)
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
281 {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
282 docklet_update_status();
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
283 }
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
284
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
285 static void
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
286 docklet_conv_updated_cb(GaimConversation *conv, GaimConvUpdateType type)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
287 {
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
288 if (type == GAIM_CONV_UPDATE_UNSEEN)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
289 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
290 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
291
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
292 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
293 docklet_signed_on_cb(GaimConnection *gc)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
294 {
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
295 if (!enable_join_chat) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
296 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
297 enable_join_chat = TRUE;
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
298 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
299 docklet_update_status();
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
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
302 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
303 docklet_signed_off_cb(GaimConnection *gc)
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
304 {
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
305 if (enable_join_chat) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
306 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
307 enable_join_chat = online_account_supports_chat();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
308 }
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
309 docklet_update_status();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
310 }
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 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
313 * docklet pop-up menu
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
314 **************************************************************************/
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
315 static void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
316 docklet_toggle_mute(GtkWidget *toggle, void *data)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
317 {
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10004
diff changeset
318 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
319 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
321 static void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
322 docklet_toggle_blist(GtkWidget *toggle, void *data)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
323 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
324 gaim_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
325 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
326
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
327 #ifdef _WIN32
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
328 /* 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
329 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
330 pointer leaves the menu. */
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
331 static gboolean
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
332 hide_docklet_menu(gpointer data)
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
333 {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
334 if (data != NULL) {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
335 gtk_menu_popdown(GTK_MENU(data));
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
336 }
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
337 return FALSE;
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
338 }
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
339
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
340 static gboolean
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
341 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
342 {
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
343 static guint hide_docklet_timer = 0;
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
344 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
345 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
346 /* 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
347 if (hide_docklet_timer == 0) {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
348 hide_docklet_timer = gaim_timeout_add(500,
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
349 hide_docklet_menu, menu);
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
350 }
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
351 } 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
352 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
353 if (hide_docklet_timer != 0) {
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
354 /* Cancel the hiding if we reenter */
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
355
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
356 gaim_timeout_remove(hide_docklet_timer);
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
357 hide_docklet_timer = 0;
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
358 }
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
359 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
360 return FALSE;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
362 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
364 static void
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
365 docklet_menu() {
3513
ab939e746bdd [gaim-migrate @ 3585]
Luke Schierer <lschiere@pidgin.im>
parents: 3512
diff changeset
366 static GtkWidget *menu = NULL;
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
367 GtkWidget *menuitem;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 if (menu) {
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 gtk_widget_destroy(menu);
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 menu = gtk_menu_new();
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
374
12470
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
375 menuitem = gtk_check_menu_item_new_with_label(_("Show Buddy List"));
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
376 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
377 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
378 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
379
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
380 menuitem = gtk_menu_item_new_with_label(_("Unread Messages"));
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
381
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
382 if (status == DOCKLET_STATUS_ONLINE_PENDING || status == DOCKLET_STATUS_AWAY_PENDING) {
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
383 GtkWidget *submenu = gtk_menu_new();
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
384 GList *l = get_pending_list(0);
12470
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
385 if (l == NULL) {
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
386 gtk_widget_set_sensitive(menuitem, FALSE);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
387 gaim_debug_warning("docklet",
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
388 "status indicates messages pending, but no conversations with unseen messages were found.");
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
389 } else {
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
390 gaim_gtk_conversations_fill_menu(submenu, l);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
391 g_list_free(l);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
392 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
393 }
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
394 } else {
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
395 gtk_widget_set_sensitive(menuitem, FALSE);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
396 }
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
397 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
398
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
399 gaim_separator(menu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
401 menuitem = gaim_new_item_from_stock(menu, _("New Message..."), GAIM_STOCK_IM, G_CALLBACK(gaim_gtkdialogs_im), NULL, 0, 0, NULL);
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
402 if (status == DOCKLET_STATUS_OFFLINE)
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
403 gtk_widget_set_sensitive(menuitem, FALSE);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
405 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
406 gtk_widget_set_sensitive(menuitem, enable_join_chat);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
408 gaim_separator(menu);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
410 gaim_new_item_from_stock(menu, _("Accounts"), GAIM_STOCK_ACCOUNTS, G_CALLBACK(gaim_gtk_accounts_window_show), NULL, 0, 0, NULL);
12163
f6f08fd1841a [gaim-migrate @ 14464]
Richard Laager <rlaager@wiktel.com>
parents: 12136
diff changeset
411 gaim_new_item_from_stock(menu, _("Plugins"), GAIM_STOCK_PLUGIN, G_CALLBACK(gaim_gtk_plugin_dialog_show), NULL, 0, 0, NULL);
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
412 gaim_new_item_from_stock(menu, _("Preferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(gaim_gtk_prefs_show), NULL, 0, 0, NULL);
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
413
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
414 gaim_separator(menu);
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
415
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
416 gaim_new_item_from_stock(menu, _("File Transfers"), GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(gaim_show_xfer_dialog), NULL, 0, 0, NULL);
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12116
diff changeset
417
12470
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
418 menuitem = gtk_check_menu_item_new_with_label(_("Mute Sounds"));
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
419 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10004
diff changeset
420 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"))
12470
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
421 gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
422 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL);
13f351a0096e [gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents: 12468
diff changeset
423 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
4567
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
424
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
425 gaim_separator(menu);
493f050dc11a [gaim-migrate @ 4848]
Sean Egan <seanegan@gmail.com>
parents: 4561
diff changeset
426
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
427 /* 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
428 * to the status in the buddy list gtkstatusbox
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
429 */
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
430
9994
e651dbb88773 [gaim-migrate @ 10907]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
431 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
432
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
433 #ifdef _WIN32
10910
d8b0b9c5ffd7 [gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10738
diff changeset
434 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
435 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
436 #endif
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 gtk_widget_show_all(menu);
10268
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 10127
diff changeset
438 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 10127
diff changeset
439 ui_ops->position_menu,
d082b2a71ee7 [gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents: 10127
diff changeset
440 NULL, 0, gtk_get_current_event_time());
4261
e252238f99df [gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents: 4250
diff changeset
441 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
443 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
444 * public api for ui_ops
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
445 **************************************************************************/
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
446 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
447 docklet_clicked(int button_type)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
448 {
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
449 switch (button_type) {
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
450 case 1:
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
451 if (status == DOCKLET_STATUS_ONLINE_PENDING || status == DOCKLET_STATUS_AWAY_PENDING) {
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
452 GList *l = get_pending_list(1);
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
453 if (l != NULL) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
454 gaim_gtkconv_present_conversation((GaimConversation *)l->data);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
455 g_list_free(l);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
456 }
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
457 } else {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
458 gaim_gtk_blist_toggle_visibility();
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12280
diff changeset
459 }
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
460 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
461 case 3:
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
462 docklet_menu();
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
463 break;
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
464 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
465 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
466
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
467 void
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
468 docklet_embedded()
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
469 {
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
470 if (!visibility_manager) {
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
471 gaim_gtk_blist_visibility_manager_add();
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
472 visibility_manager = TRUE;
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
473 }
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
474 docklet_update_status();
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
475 if (ui_ops && ui_ops->update_icon)
6211
9fd7716068d9 [gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6208
diff changeset
476 ui_ops->update_icon(status);
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
477 }
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
478
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
479 void
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
480 docklet_remove()
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
481 {
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
482 if (visibility_manager) {
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
483 gaim_gtk_blist_visibility_manager_remove();
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
484 visibility_manager = FALSE;
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
485 }
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
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
488 void
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
489 docklet_unload()
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
490 {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
491 gaim_plugin_unload(handle);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
492 }
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
493
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10297
diff changeset
494 void
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
495 docklet_set_ui_ops(struct docklet_ui_ops *ops)
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
496 {
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
497 ui_ops = ops;
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
498 }
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
499
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
500 /**************************************************************************
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
501 * plugin glue
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
502 **************************************************************************/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
503 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
504 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
505 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
506 void *conn_handle = gaim_connections_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
507 void *conv_handle = gaim_conversations_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
508 void *accounts_handle = gaim_accounts_get_handle();
9893
8053a00136ea [gaim-migrate @ 10781]
Luke Schierer <lschiere@pidgin.im>
parents: 9813
diff changeset
509 void *core_handle = gaim_get_core();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
510
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
511 gaim_debug(GAIM_DEBUG_INFO, "docklet", "plugin loaded\n");
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
512
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
513 handle = plugin;
6077
b2c8e08508af [gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
514
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
515 docklet_ui_init();
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
516 if (ui_ops && ui_ops->create)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
517 ui_ops->create();
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
519 gaim_signal_connect(conn_handle, "signed-on",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
520 plugin, GAIM_CALLBACK(docklet_signed_on_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
521 gaim_signal_connect(conn_handle, "signed-off",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
522 plugin, GAIM_CALLBACK(docklet_signed_off_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
523 gaim_signal_connect(accounts_handle, "account-connecting",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
524 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
11714
c828b5d08c91 [gaim-migrate @ 14005]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11713
diff changeset
525 gaim_signal_connect(accounts_handle, "account-status-changed",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
526 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
527 gaim_signal_connect(conv_handle, "received-im-msg",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
528 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
529 gaim_signal_connect(conv_handle, "conversation-created",
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
530 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
12018
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12016
diff changeset
531 gaim_signal_connect(conv_handle, "deleting-conversation",
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12016
diff changeset
532 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL);
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
533 gaim_signal_connect(conv_handle, "conversation-updated",
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
534 plugin, GAIM_CALLBACK(docklet_conv_updated_cb), NULL);
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
535
9893
8053a00136ea [gaim-migrate @ 10781]
Luke Schierer <lschiere@pidgin.im>
parents: 9813
diff changeset
536 gaim_signal_connect(core_handle, "quitting",
8053a00136ea [gaim-migrate @ 10781]
Luke Schierer <lschiere@pidgin.im>
parents: 9813
diff changeset
537 plugin, GAIM_CALLBACK(gaim_quit_cb), NULL);
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
538
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
539 gaim_prefs_connect_callback(plugin, "/plugins/gtk/docklet/blink_im",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
540 docklet_prefs_cb, NULL);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
541 gaim_prefs_connect_callback(plugin, "/plugins/gtk/docklet/blink_chat",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
542 docklet_prefs_cb, NULL);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
543
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
544 enable_join_chat = online_account_supports_chat();
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
545
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
546 return TRUE;
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 }
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
549 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
550 plugin_unload(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
551 {
6894
c2fb9192377b [gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6485
diff changeset
552 if (ui_ops && ui_ops->destroy)
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
553 ui_ops->destroy();
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
554
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
555 /* remove callbacks */
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11989
diff changeset
556 gaim_signals_disconnect_by_handle(handle);
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
557 gaim_prefs_disconnect_by_handle(handle);
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
558
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
559 gaim_debug(GAIM_DEBUG_INFO, "docklet", "plugin unloaded\n");
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
560
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
561 return TRUE;
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
562 }
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
563
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
564 static GtkWidget *
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
565 plugin_config_frame(GaimPlugin *plugin)
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
566 {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
567 GtkWidget *frame;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
568 GtkWidget *vbox;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
569 GtkSizeGroup *sg;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
570 GtkWidget *dd;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
571
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
572 frame = gtk_vbox_new(FALSE, 18);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
573 gtk_container_set_border_width(GTK_CONTAINER(frame), 12);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
574
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
575 vbox = gaim_gtk_make_frame(frame, _("Blink tray icon for unread..."));
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
576 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
577
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
578 dd = gaim_gtk_prefs_dropdown(vbox, _("_Instant Messages:"),
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
579 GAIM_PREF_STRING, "/plugins/gtk/docklet/blink_im",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
580 _("Never"), "never",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
581 _("In hidden conversations"), "hidden",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
582 _("Always"), "always",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
583 NULL);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
584 gtk_size_group_add_widget(sg, dd);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
585
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
586 dd = gaim_gtk_prefs_dropdown(vbox, _("C_hat Messages:"),
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
587 GAIM_PREF_STRING, "/plugins/gtk/docklet/blink_chat",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
588 _("Never"), "never",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
589 _("When my nick is said"), "nick",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
590 _("Always"), "always",
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
591 NULL);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
592 gtk_size_group_add_widget(sg, dd);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
593
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
594 gtk_widget_show_all(frame);
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
595 return frame;
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
596 }
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
597
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
598 static GaimGtkPluginUiInfo ui_info =
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
599 {
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
600 plugin_config_frame
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
601 };
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
602
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
603 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
604 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
605 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
606 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9893
diff changeset
607 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
608 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
609 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
610 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
611 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
612 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
613
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
614 DOCKLET_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
615 N_("System Tray Icon"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
616 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
617 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
618 N_("Displays an icon for Gaim in the system tray."),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
619 /** description */
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
620 N_("Displays a system tray icon (in GNOME, KDE, or Windows for example) "
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
621 "to show the current status of Gaim, allow fast access to commonly "
12498
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
622 "used functions, and to toggle display of the buddy list. "
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
623 "Also provides options to blink for unread messages."),
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
624 /** author */
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
625 "Robert McQueen <robot101@debian.org>"
a2de852981c1 [gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents: 12475
diff changeset
626 "\n\t\t\tCasey Harkins <charkins@users.sf.net>",
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6310
diff changeset
627 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
628
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
629 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
630 plugin_unload, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
631 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
632
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
633 &ui_info, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8940
diff changeset
634 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8940
diff changeset
635 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8940
diff changeset
636 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
637 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
638
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
639 static void
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
640 plugin_init(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
641 {
12472
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
642 gaim_prefs_add_none("/plugins/gtk/docklet");
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
643 gaim_prefs_add_string("/plugins/gtk/docklet/blink_im", "hidden");
065005e5f536 [gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents: 12471
diff changeset
644 gaim_prefs_add_string("/plugins/gtk/docklet/blink_chat", "never");
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3550
diff changeset
645 }
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646
6208
3e3ee3cba192 [gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6179
diff changeset
647 GAIM_INIT_PLUGIN(docklet, plugin_init, info)