Mercurial > pidgin
annotate plugins/docklet/docklet.c @ 13943:25be562aaca8
[gaim-migrate @ 16480]
New widget GntLine to use as a separator.
A partial dialog for add-account callback. Updating the dialog
as a result of selection-change in the prpl dropdown is way ickier
than I had expected it to be. It 'works' now, but quite a bit
quirky. I will try to smooth things up later, perhaps next week.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 10 Jul 2006 23:55:24 +0000 |
parents | c97c76d9d347 |
children |
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 | 6 * Inspired by a similar plugin by: |
7 * John (J5) Palmieri <johnp@martianrock.com> | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
8 * |
3510 | 9 * This program is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU General Public License as | |
11 * published by the Free Software Foundation; either version 2 of the | |
12 * License, or (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, but | |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * General Public License for more details. | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
18 * |
3510 | 19 * You should have received a copy of the GNU General Public License |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
22 * 02111-1307, USA. | |
23 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
24 #include "internal.h" |
9791 | 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 | 32 #include "sound.h" |
9943 | 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" |
12614 | 41 #include "gtksavedstatuses.h" |
5684 | 42 #include "gtksound.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
43 #include "gtkutils.h" |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10272
diff
changeset
|
44 #include "gtkstock.h" |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
45 #include "docklet.h" |
3510 | 46 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
47 #include "gaim.h" |
9709 | 48 #include "gtkdialogs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
49 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
50 #define DOCKLET_PLUGIN_ID "gtk-docklet" |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
51 |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
52 #ifndef DOCKLET_TOOLTIP_LINE_LIMIT |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
53 #define DOCKLET_TOOLTIP_LINE_LIMIT 5 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
54 #endif |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
55 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
56 /* globals */ |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
57 GaimPlugin *handle = NULL; |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
58 static struct docklet_ui_ops *ui_ops = NULL; |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
59 static DockletStatus status = DOCKLET_STATUS_OFFLINE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
60 static gboolean enable_join_chat = FALSE; |
11989 | 61 static guint docklet_blinking_timer = 0; |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
62 static gboolean visibility_manager = FALSE; |
11709
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 /************************************************************************** |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
65 * docklet status and utility functions |
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 static gboolean |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
68 docklet_blink_icon() |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
69 { |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
70 static gboolean blinked = FALSE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
71 gboolean ret = FALSE; /* by default, don't keep blinking */ |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
72 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
73 blinked = !blinked; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
74 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
75 switch (status) { |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
76 case DOCKLET_STATUS_ONLINE_PENDING: |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
77 case DOCKLET_STATUS_AWAY_PENDING: |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
78 if (blinked) { |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
79 if (ui_ops && ui_ops->blank_icon) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
80 ui_ops->blank_icon(); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
81 } else { |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
82 if (ui_ops && ui_ops->update_icon) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
83 ui_ops->update_icon(status); |
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 ret = TRUE; /* keep blinking */ |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
86 break; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
87 default: |
11989 | 88 docklet_blinking_timer = 0; |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
89 blinked = FALSE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
90 break; |
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 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
93 return ret; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
94 } |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
95 |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
96 static GList * |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
97 get_pending_list(guint max) |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
98 { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
99 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
|
100 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
|
101 GList *l_im = NULL; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
102 GList *l_chat = NULL; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
103 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
104 if (im != NULL && strcmp(im, "always") == 0) { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
105 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
|
106 GAIM_UNSEEN_TEXT, |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
107 FALSE, max); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
108 } else if (im != NULL && strcmp(im, "hidden") == 0) { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
109 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
|
110 GAIM_UNSEEN_TEXT, |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
111 TRUE, max); |
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 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
114 if (chat != NULL && strcmp(chat, "always") == 0) { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
115 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
|
116 GAIM_UNSEEN_TEXT, |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
117 FALSE, max); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
118 } else if (chat != NULL && strcmp(chat, "nick") == 0) { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
119 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
|
120 GAIM_UNSEEN_NICK, |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
121 FALSE, max); |
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 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
124 if (l_im != NULL && l_chat != NULL) |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
125 return g_list_concat(l_im, l_chat); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
126 else if (l_im != NULL) |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
127 return l_im; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
128 else |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
129 return l_chat; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
130 } |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
131 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
132 static gboolean |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
133 docklet_update_status() |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
134 { |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
135 GList *convs; |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
136 GList *l; |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
137 int count; |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
138 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
139 gboolean pending = FALSE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
140 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
141 /* determine if any ims have unseen messages */ |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
142 convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
143 |
12471
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
144 if (convs != NULL) { |
12021
1a86417abfc8
[gaim-migrate @ 14314]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12018
diff
changeset
|
145 pending = TRUE; |
12471
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
146 |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
147 /* set tooltip if messages are pending */ |
12526 | 148 if (ui_ops->set_tooltip) { |
12471
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
149 GString *tooltip_text = g_string_new(""); |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
150 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
|
151 if (GAIM_IS_GTK_CONVERSATION(l->data)) { |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
152 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)l->data); |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
153 if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
154 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
|
155 else |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
156 g_string_append_printf(tooltip_text, |
12471
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
157 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
|
158 gtkconv->unseen_count, |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
159 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
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 |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
163 /* get rid of the last newline */ |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
164 if (tooltip_text->len > 0) |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
165 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
166 |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
167 ui_ops->set_tooltip(tooltip_text->str); |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
168 |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
169 g_string_free(tooltip_text, TRUE); |
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 |
011efeb86b8d
[gaim-migrate @ 14781]
Richard Laager <rlaager@wiktel.com>
parents:
12470
diff
changeset
|
172 g_list_free(convs); |
12475
572d6d5da418
[gaim-migrate @ 14786]
Richard Laager <rlaager@wiktel.com>
parents:
12472
diff
changeset
|
173 |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
174 } else if (ui_ops->set_tooltip) { |
12475
572d6d5da418
[gaim-migrate @ 14786]
Richard Laager <rlaager@wiktel.com>
parents:
12472
diff
changeset
|
175 ui_ops->set_tooltip(NULL); |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
176 } |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
177 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
178 /* iterate through all accounts and determine which |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
179 * 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
|
180 * ranks (highest encountered rank will be used): |
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 * 1) OFFLINE |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
183 * 2) ONLINE |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
184 * 3) ONLINE_PENDING |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
185 * 4) AWAY |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
186 * 5) AWAY_PENDING |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
187 * 6) CONNECTING |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
188 */ |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
189 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
|
190 DockletStatus tmpstatus = DOCKLET_STATUS_OFFLINE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
191 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
192 GaimAccount *account = (GaimAccount*)l->data; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
193 GaimStatus *account_status; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
194 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
195 if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
196 continue; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
197 |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
198 if (gaim_account_is_disconnected(account)) |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
199 continue; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
200 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
201 account_status = gaim_account_get_active_status(account); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
202 |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
203 if (gaim_account_is_connecting(account)) { |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
204 tmpstatus = DOCKLET_STATUS_CONNECTING; |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
205 } else if (gaim_status_is_online(account_status)) { |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
206 if (!gaim_status_is_available(account_status)) { |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
207 if (pending) |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
208 tmpstatus = DOCKLET_STATUS_AWAY_PENDING; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
209 else |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
210 tmpstatus = DOCKLET_STATUS_AWAY; |
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 else { |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
213 if (pending) |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
214 tmpstatus = DOCKLET_STATUS_ONLINE_PENDING; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
215 else |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
216 tmpstatus = DOCKLET_STATUS_ONLINE; |
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 } |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
219 |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
220 if (tmpstatus > newstatus) |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
221 newstatus = tmpstatus; |
11709
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 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
224 /* update the icon if we changed status */ |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
225 if (status != newstatus) { |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
226 status = newstatus; |
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 if (ui_ops && ui_ops->update_icon) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
229 ui_ops->update_icon(status); |
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 /* and schedule the blinker function if messages are pending */ |
11989 | 232 if ((status == DOCKLET_STATUS_ONLINE_PENDING |
233 || status == DOCKLET_STATUS_AWAY_PENDING) | |
234 && docklet_blinking_timer == 0) { | |
235 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
|
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 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
239 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
|
240 } |
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 static gboolean |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
243 online_account_supports_chat() |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
244 { |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
245 GList *c = NULL; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
246 c = gaim_connections_get_all(); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
247 |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
248 while(c != NULL) { |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
249 GaimConnection *gc = c->data; |
12525 | 250 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
251 if (prpl_info != NULL && prpl_info->chat_info != NULL) | |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
252 return TRUE; |
11713 | 253 c = c->next; |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
254 } |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
255 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
256 return FALSE; |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
257 } |
3510 | 258 |
11709
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 * callbacks and signal handlers |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
261 **************************************************************************/ |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
262 static void |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
263 gaim_quit_cb() |
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 /* TODO: confirm quit while pending */ |
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 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
268 static void |
12531 | 269 docklet_update_status_cb(void *data) |
11709
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 docklet_update_status(); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
272 } |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
273 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
274 static void |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
275 docklet_prefs_cb(const char *name, GaimPrefType type, |
12816 | 276 gconstpointer val, gpointer data) |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
277 { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
278 docklet_update_status(); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
279 } |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
280 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
281 static void |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
282 docklet_conv_updated_cb(GaimConversation *conv, GaimConvUpdateType type) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
283 { |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
284 if (type == GAIM_CONV_UPDATE_UNSEEN) |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
285 docklet_update_status(); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
286 } |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
287 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
288 static void |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
289 docklet_signed_on_cb(GaimConnection *gc) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
290 { |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
291 if (!enable_join_chat) { |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
292 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
|
293 enable_join_chat = TRUE; |
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_signed_off_cb(GaimConnection *gc) |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
300 { |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
301 if (enable_join_chat) { |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
302 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
|
303 enable_join_chat = online_account_supports_chat(); |
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 docklet_update_status(); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
306 } |
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 /************************************************************************** |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
309 * docklet pop-up menu |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
310 **************************************************************************/ |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
311 static void |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
312 docklet_toggle_mute(GtkWidget *toggle, void *data) |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
313 { |
10074 | 314 gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active); |
3510 | 315 } |
316 | |
12016
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
317 static void |
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
318 docklet_toggle_blist(GtkWidget *toggle, void *data) |
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
319 { |
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
320 gaim_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active); |
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
321 } |
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
322 |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
323 #ifdef _WIN32 |
6894
c2fb9192377b
[gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6485
diff
changeset
|
324 /* 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
|
325 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
|
326 pointer leaves the menu. */ |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
327 static gboolean |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
328 hide_docklet_menu(gpointer data) |
10910
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
329 { |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
330 if (data != NULL) { |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
331 gtk_menu_popdown(GTK_MENU(data)); |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
332 } |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
333 return FALSE; |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
334 } |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
335 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
336 static gboolean |
10910
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
337 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
338 { |
10910
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
339 static guint hide_docklet_timer = 0; |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
340 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
|
341 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
|
342 /* 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
|
343 if (hide_docklet_timer == 0) { |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
344 hide_docklet_timer = gaim_timeout_add(500, |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
345 hide_docklet_menu, menu); |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
346 } |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
347 } 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
|
348 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
|
349 if (hide_docklet_timer != 0) { |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
350 /* Cancel the hiding if we reenter */ |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
351 |
10910
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
352 gaim_timeout_remove(hide_docklet_timer); |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
353 hide_docklet_timer = 0; |
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
354 } |
3570 | 355 } |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
356 return FALSE; |
3510 | 357 } |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
358 #endif |
3510 | 359 |
12614 | 360 static void |
12690 | 361 show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data) |
12614 | 362 { |
13175 | 363 GaimSavedStatus *saved_status; |
364 saved_status = gaim_savedstatus_get_current(); | |
365 gaim_gtk_status_editor_show(FALSE, | |
366 gaim_savedstatus_is_transient(saved_status) ? saved_status : NULL); | |
12614 | 367 } |
368 | |
369 static void | |
12732 | 370 activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data) |
371 { | |
372 GaimStatusPrimitive primitive; | |
373 GaimSavedStatus *saved_status; | |
374 | |
375 primitive = GPOINTER_TO_INT(user_data); | |
376 | |
13244 | 377 /* Try to lookup an already existing transient saved status */ |
378 saved_status = gaim_savedstatus_find_transient_by_type_and_message(primitive, NULL); | |
379 | |
380 /* Create a new transient saved status if we weren't able to find one */ | |
381 if (saved_status == NULL) | |
382 saved_status = gaim_savedstatus_new(NULL, primitive); | |
12732 | 383 |
384 /* Set the status for each account */ | |
385 gaim_savedstatus_activate(saved_status); | |
386 } | |
387 | |
388 static void | |
12690 | 389 activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data) |
390 { | |
391 time_t creation_time; | |
392 GaimSavedStatus *saved_status; | |
393 | |
394 creation_time = GPOINTER_TO_INT(user_data); | |
395 saved_status = gaim_savedstatus_find_by_creation_time(creation_time); | |
396 if (saved_status != NULL) | |
397 gaim_savedstatus_activate(saved_status); | |
398 } | |
399 | |
12732 | 400 static GtkWidget * |
13112 | 401 new_menu_item_with_gaim_icon(GtkWidget *menu, const char *str, GaimStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) |
402 { | |
403 GtkWidget *menuitem; | |
404 GdkPixbuf *pixbuf; | |
405 GtkWidget *image; | |
406 | |
407 menuitem = gtk_image_menu_item_new_with_mnemonic(str); | |
408 | |
409 if (menu) | |
410 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
411 | |
412 if (sf) | |
413 g_signal_connect(G_OBJECT(menuitem), "activate", sf, data); | |
414 | |
415 pixbuf = gaim_gtk_create_gaim_icon_with_status(primitive, 0.5); | |
416 image = gtk_image_new_from_pixbuf(pixbuf); | |
417 g_object_unref(pixbuf); | |
418 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); | |
419 | |
420 gtk_widget_show_all(menuitem); | |
421 | |
422 return menuitem; | |
423 } | |
424 | |
425 static GtkWidget * | |
12732 | 426 docklet_status_submenu() |
427 { | |
428 GtkWidget *submenu, *menuitem; | |
429 GList *popular_statuses, *cur; | |
430 | |
431 submenu = gtk_menu_new(); | |
13048 | 432 menuitem = gtk_menu_item_new_with_label(_("Change Status")); |
12732 | 433 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
434 | |
13112 | 435 new_menu_item_with_gaim_icon(submenu, _("Available"), |
436 GAIM_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb), | |
12732 | 437 GINT_TO_POINTER(GAIM_STATUS_AVAILABLE), 0, 0, NULL); |
438 | |
13112 | 439 new_menu_item_with_gaim_icon(submenu, _("Away"), |
440 GAIM_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb), | |
12732 | 441 GINT_TO_POINTER(GAIM_STATUS_AWAY), 0, 0, NULL); |
442 | |
13112 | 443 new_menu_item_with_gaim_icon(submenu, _("Invisible"), |
444 GAIM_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb), | |
12732 | 445 GINT_TO_POINTER(GAIM_STATUS_INVISIBLE), 0, 0, NULL); |
446 | |
13112 | 447 new_menu_item_with_gaim_icon(submenu, _("Offline"), |
448 GAIM_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb), | |
12732 | 449 GINT_TO_POINTER(GAIM_STATUS_OFFLINE), 0, 0, NULL); |
450 | |
451 popular_statuses = gaim_savedstatuses_get_popular(6); | |
452 if (popular_statuses != NULL) | |
453 gaim_separator(submenu); | |
454 for (cur = popular_statuses; cur != NULL; cur = cur->next) | |
455 { | |
456 GaimSavedStatus *saved_status = cur->data; | |
457 time_t creation_time = gaim_savedstatus_get_creation_time(saved_status); | |
13112 | 458 new_menu_item_with_gaim_icon(submenu, |
12732 | 459 gaim_savedstatus_get_title(saved_status), |
13112 | 460 gaim_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb), |
12732 | 461 GINT_TO_POINTER(creation_time), 0, 0, NULL); |
462 } | |
463 g_list_free(popular_statuses); | |
464 | |
465 gaim_separator(submenu); | |
466 | |
13175 | 467 new_menu_item_with_gaim_icon(submenu, _("New..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL); |
468 new_menu_item_with_gaim_icon(submenu, _("Saved..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(gaim_gtk_status_window_show), NULL, 0, 0, NULL); | |
12732 | 469 |
470 return menuitem; | |
471 } | |
472 | |
12690 | 473 static void |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
474 docklet_menu() { |
3513 | 475 static GtkWidget *menu = NULL; |
10127 | 476 GtkWidget *menuitem; |
3510 | 477 |
478 if (menu) { | |
479 gtk_widget_destroy(menu); | |
480 } | |
481 | |
482 menu = gtk_menu_new(); | |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
483 |
12470
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
484 menuitem = gtk_check_menu_item_new_with_label(_("Show Buddy List")); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
485 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
|
486 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
|
487 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
488 |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
489 menuitem = gtk_menu_item_new_with_label(_("Unread Messages")); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
490 |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
491 if (status == DOCKLET_STATUS_ONLINE_PENDING || status == DOCKLET_STATUS_AWAY_PENDING) { |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
492 GtkWidget *submenu = gtk_menu_new(); |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
493 GList *l = get_pending_list(0); |
12470
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
494 if (l == NULL) { |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
495 gtk_widget_set_sensitive(menuitem, FALSE); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
496 gaim_debug_warning("docklet", |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
497 "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
|
498 } else { |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
499 gaim_gtk_conversations_fill_menu(submenu, l); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
500 g_list_free(l); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
501 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
502 } |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
503 } else { |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
504 gtk_widget_set_sensitive(menuitem, FALSE); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
505 } |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
506 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
4567 | 507 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
508 gaim_separator(menu); |
3510 | 509 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
510 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
|
511 if (status == DOCKLET_STATUS_OFFLINE) |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
512 gtk_widget_set_sensitive(menuitem, FALSE); |
3510 | 513 |
12732 | 514 menuitem = docklet_status_submenu(); |
515 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
12688 | 516 |
517 gaim_separator(menu); | |
518 | |
12136
370f9d7868f9
[gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
519 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
|
520 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
|
521 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
|
522 |
370f9d7868f9
[gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
523 gaim_separator(menu); |
370f9d7868f9
[gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents:
12116
diff
changeset
|
524 |
12470
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
525 menuitem = gtk_check_menu_item_new_with_label(_("Mute Sounds")); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
526 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), gaim_prefs_get_bool("/gaim/gtk/sound/mute")); |
10074 | 527 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
|
528 gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE); |
13f351a0096e
[gaim-migrate @ 14780]
Richard Laager <rlaager@wiktel.com>
parents:
12468
diff
changeset
|
529 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
|
530 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
4567 | 531 |
532 gaim_separator(menu); | |
533 | |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
534 /* 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
|
535 * to the status in the buddy list gtkstatusbox |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
536 */ |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
537 |
9994 | 538 gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(gaim_core_quit), NULL, 0, 0, NULL); |
3510 | 539 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
540 #ifdef _WIN32 |
10910
d8b0b9c5ffd7
[gaim-migrate @ 12663]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10738
diff
changeset
|
541 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
|
542 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
|
543 #endif |
3510 | 544 gtk_widget_show_all(menu); |
10268
d082b2a71ee7
[gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents:
10127
diff
changeset
|
545 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
d082b2a71ee7
[gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents:
10127
diff
changeset
|
546 ui_ops->position_menu, |
d082b2a71ee7
[gaim-migrate @ 11414]
Christian Hammond <chipx86@chipx86.com>
parents:
10127
diff
changeset
|
547 NULL, 0, gtk_get_current_event_time()); |
4261
e252238f99df
[gaim-migrate @ 4512]
Christian Hammond <chipx86@chipx86.com>
parents:
4250
diff
changeset
|
548 } |
3510 | 549 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
550 /************************************************************************** |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
551 * public api for ui_ops |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
552 **************************************************************************/ |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
553 void |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
554 docklet_clicked(int button_type) |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
555 { |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
556 switch (button_type) { |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
557 case 1: |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
558 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
|
559 GList *l = get_pending_list(1); |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
560 if (l != NULL) { |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
561 gaim_gtkconv_present_conversation((GaimConversation *)l->data); |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
562 g_list_free(l); |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
563 } |
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
564 } else { |
12016
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
565 gaim_gtk_blist_toggle_visibility(); |
12468
6faefbebcd24
[gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents:
12280
diff
changeset
|
566 } |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
567 break; |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
568 case 3: |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
569 docklet_menu(); |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
570 break; |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
571 } |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
572 } |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
573 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
574 void |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
575 docklet_embedded() |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
576 { |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
577 if (!visibility_manager) { |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
578 gaim_gtk_blist_visibility_manager_add(); |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
579 visibility_manager = TRUE; |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
580 } |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
581 docklet_update_status(); |
6894
c2fb9192377b
[gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6485
diff
changeset
|
582 if (ui_ops && ui_ops->update_icon) |
6211
9fd7716068d9
[gaim-migrate @ 6697]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6208
diff
changeset
|
583 ui_ops->update_icon(status); |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
584 } |
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
585 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
586 void |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
587 docklet_remove() |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
588 { |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
589 if (visibility_manager) { |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
590 gaim_gtk_blist_visibility_manager_remove(); |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
591 visibility_manager = FALSE; |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
592 } |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
593 } |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
594 |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
595 void |
10504 | 596 docklet_unload() |
597 { | |
598 gaim_plugin_unload(handle); | |
599 } | |
600 | |
601 void | |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
602 docklet_set_ui_ops(struct docklet_ui_ops *ops) |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
603 { |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
604 ui_ops = ops; |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
605 } |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
606 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
607 /************************************************************************** |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
608 * plugin glue |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
609 **************************************************************************/ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
610 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
611 plugin_load(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
612 { |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
613 void *conn_handle = gaim_connections_get_handle(); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
614 void *conv_handle = gaim_conversations_get_handle(); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
615 void *accounts_handle = gaim_accounts_get_handle(); |
9893 | 616 void *core_handle = gaim_get_core(); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
617 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
618 gaim_debug(GAIM_DEBUG_INFO, "docklet", "plugin loaded\n"); |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
619 |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
620 handle = plugin; |
6077
b2c8e08508af
[gaim-migrate @ 6536]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6063
diff
changeset
|
621 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
622 docklet_ui_init(); |
6894
c2fb9192377b
[gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6485
diff
changeset
|
623 if (ui_ops && ui_ops->create) |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
624 ui_ops->create(); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
625 gaim_signal_connect(conn_handle, "signed-on", |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
626 plugin, GAIM_CALLBACK(docklet_signed_on_cb), NULL); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
627 gaim_signal_connect(conn_handle, "signed-off", |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
628 plugin, GAIM_CALLBACK(docklet_signed_off_cb), NULL); |
11714 | 629 gaim_signal_connect(accounts_handle, "account-status-changed", |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
630 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
631 gaim_signal_connect(conv_handle, "received-im-msg", |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
632 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
633 gaim_signal_connect(conv_handle, "conversation-created", |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
634 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL); |
12018
014c22dd9d06
[gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12016
diff
changeset
|
635 gaim_signal_connect(conv_handle, "deleting-conversation", |
014c22dd9d06
[gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12016
diff
changeset
|
636 plugin, GAIM_CALLBACK(docklet_update_status_cb), NULL); |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
637 gaim_signal_connect(conv_handle, "conversation-updated", |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
638 plugin, GAIM_CALLBACK(docklet_conv_updated_cb), NULL); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
639 |
9893 | 640 gaim_signal_connect(core_handle, "quitting", |
641 plugin, GAIM_CALLBACK(gaim_quit_cb), NULL); | |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
642 |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
643 gaim_prefs_connect_callback(plugin, "/plugins/gtk/docklet/blink_im", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
644 docklet_prefs_cb, NULL); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
645 gaim_prefs_connect_callback(plugin, "/plugins/gtk/docklet/blink_chat", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
646 docklet_prefs_cb, NULL); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
647 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
648 enable_join_chat = online_account_supports_chat(); |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
649 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
650 return TRUE; |
3510 | 651 } |
652 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
653 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
654 plugin_unload(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
655 { |
6894
c2fb9192377b
[gaim-migrate @ 7441]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6485
diff
changeset
|
656 if (ui_ops && ui_ops->destroy) |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
657 ui_ops->destroy(); |
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
658 |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
659 /* remove callbacks */ |
12016
24c7fb94d3a3
[gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11989
diff
changeset
|
660 gaim_signals_disconnect_by_handle(handle); |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
661 gaim_prefs_disconnect_by_handle(handle); |
11709
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
662 |
cae2fb7e8594
[gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
663 gaim_debug(GAIM_DEBUG_INFO, "docklet", "plugin unloaded\n"); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
664 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
665 return TRUE; |
3554 | 666 } |
667 | |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
668 static GtkWidget * |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
669 plugin_config_frame(GaimPlugin *plugin) |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
670 { |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
671 GtkWidget *frame; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
672 GtkWidget *vbox; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
673 GtkSizeGroup *sg; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
674 GtkWidget *dd; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
675 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
676 frame = gtk_vbox_new(FALSE, 18); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
677 gtk_container_set_border_width(GTK_CONTAINER(frame), 12); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
678 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
679 vbox = gaim_gtk_make_frame(frame, _("Blink tray icon for unread...")); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
680 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
681 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
682 dd = gaim_gtk_prefs_dropdown(vbox, _("_Instant Messages:"), |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
683 GAIM_PREF_STRING, "/plugins/gtk/docklet/blink_im", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
684 _("Never"), "never", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
685 _("In hidden conversations"), "hidden", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
686 _("Always"), "always", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
687 NULL); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
688 gtk_size_group_add_widget(sg, dd); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
689 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
690 dd = gaim_gtk_prefs_dropdown(vbox, _("C_hat Messages:"), |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
691 GAIM_PREF_STRING, "/plugins/gtk/docklet/blink_chat", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
692 _("Never"), "never", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
693 _("When my nick is said"), "nick", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
694 _("Always"), "always", |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
695 NULL); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
696 gtk_size_group_add_widget(sg, dd); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
697 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
698 gtk_widget_show_all(frame); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
699 return frame; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
700 } |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
701 |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
702 static GaimGtkPluginUiInfo ui_info = |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
703 { |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12531
diff
changeset
|
704 plugin_config_frame, |
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12531
diff
changeset
|
705 0 /* page_num (Reserved) */ |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
706 }; |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
707 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
708 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
709 { |
9943 | 710 GAIM_PLUGIN_MAGIC, |
711 GAIM_MAJOR_VERSION, | |
712 GAIM_MINOR_VERSION, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
713 GAIM_PLUGIN_STANDARD, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
714 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
715 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
716 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
717 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
718 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
719 DOCKLET_PLUGIN_ID, /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
720 N_("System Tray Icon"), /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
721 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
722 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
723 N_("Displays an icon for Gaim in the system tray."), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
724 /** description */ |
12498
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
725 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
|
726 "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
|
727 "used functions, and to toggle display of the buddy list. " |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
728 "Also provides options to blink for unread messages."), |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
729 /** author */ |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
730 "Robert McQueen <robot101@debian.org>" |
a2de852981c1
[gaim-migrate @ 14810]
Richard Laager <rlaager@wiktel.com>
parents:
12475
diff
changeset
|
731 "\n\t\t\tCasey Harkins <charkins@users.sf.net>", |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6310
diff
changeset
|
732 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
733 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
734 plugin_load, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
735 plugin_unload, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
736 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
737 |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
738 &ui_info, /**< ui_info */ |
8993 | 739 NULL, /**< extra_info */ |
740 NULL, | |
741 NULL | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
742 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
743 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
744 static void |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
745 plugin_init(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5024
diff
changeset
|
746 { |
12472
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
747 gaim_prefs_add_none("/plugins/gtk/docklet"); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
748 gaim_prefs_add_string("/plugins/gtk/docklet/blink_im", "hidden"); |
065005e5f536
[gaim-migrate @ 14782]
Richard Laager <rlaager@wiktel.com>
parents:
12471
diff
changeset
|
749 gaim_prefs_add_string("/plugins/gtk/docklet/blink_chat", "never"); |
3551 | 750 } |
3510 | 751 |
6208
3e3ee3cba192
[gaim-migrate @ 6694]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6179
diff
changeset
|
752 GAIM_INIT_PLUGIN(docklet, plugin_init, info) |