Mercurial > pidgin
annotate plugins/ticker/ticker.c @ 13836:9af607a0108f
[gaim-migrate @ 16285]
Fix a case of a file transfer "system message" notification where we were not looking up an alias like everywhere else in this file.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 19 Jun 2006 06:23:20 +0000 |
parents | d4698cf18986 |
children |
rev | line source |
---|---|
6122 | 1 /* |
2 * Gaim Ticker Plugin | |
3 * The line below doesn't apply at all, does it? It should be Syd, Sean, and | |
4 * maybe Nathan, I believe. | |
3391 | 5 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
6 * | |
7 * This library is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU Library General Public | |
9 * License as published by the Free Software Foundation; either | |
10 * version 2 of the License, or (at your option) any later version. | |
11 * | |
12 * This library is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Library General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Library General Public | |
18 * License along with this library; if not, write to the | |
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 * Boston, MA 02111-1307, USA. | |
21 */ | |
22 | |
23 /* | |
24 * ticker.c -- Syd Logan, Summer 2000 | |
25 * pluginized- Sean Egan, Summer 2002 | |
26 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
27 #include "internal.h" |
9791 | 28 #include "gtkgaim.h" |
3391 | 29 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
30 #include "blist.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
31 #include "conversation.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
32 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
33 #include "prpl.h" |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
34 #include "signals.h" |
9943 | 35 #include "version.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
36 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
37 #include "gtkblist.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
38 #include "gtkplugin.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
39 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
40 #include "gtkticker.h" |
3391 | 41 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
42 #define TICKER_PLUGIN_ID "gtk-ticker" |
3867 | 43 |
3391 | 44 static GtkWidget *tickerwindow = NULL; |
45 static GtkWidget *ticker; | |
46 | |
47 typedef struct { | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
48 GaimContact *contact; |
3391 | 49 GtkWidget *ebox; |
50 GtkWidget *label; | |
5170 | 51 GtkWidget *icon; |
6122 | 52 guint timeout; |
3391 | 53 } TickerData; |
54 | |
5170 | 55 GList *tickerbuds = NULL; |
3391 | 56 |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
57 static void buddy_ticker_update_contact(GaimContact *contact); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
58 |
5172 | 59 static gboolean buddy_ticker_destroy_window(GtkWidget *window, |
60 GdkEventAny *event, gpointer data) { | |
61 if(window) | |
62 gtk_widget_hide(window); | |
63 | |
64 return TRUE; /* don't actually destroy the window */ | |
3391 | 65 } |
66 | |
5170 | 67 static void buddy_ticker_create_window() { |
68 if(tickerwindow) { | |
69 gtk_widget_show(tickerwindow); | |
70 return; | |
71 } | |
3391 | 72 |
5170 | 73 tickerwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
5286 | 74 gtk_window_set_default_size(GTK_WINDOW(tickerwindow), 500, -1); |
5172 | 75 g_signal_connect(G_OBJECT(tickerwindow), "delete_event", |
5170 | 76 G_CALLBACK (buddy_ticker_destroy_window), NULL); |
77 gtk_window_set_title (GTK_WINDOW(tickerwindow), _("Buddy Ticker")); | |
4850 | 78 gtk_window_set_role (GTK_WINDOW(tickerwindow), "ticker"); |
3391 | 79 |
4850 | 80 ticker = gtk_ticker_new(); |
5170 | 81 gtk_ticker_set_spacing(GTK_TICKER(ticker), 20); |
82 gtk_container_add(GTK_CONTAINER(tickerwindow), ticker); | |
83 gtk_ticker_set_interval(GTK_TICKER(ticker), 500); | |
84 gtk_ticker_set_scootch(GTK_TICKER(ticker), 10); | |
85 gtk_ticker_start_scroll(GTK_TICKER(ticker)); | |
5286 | 86 gtk_widget_set_size_request(ticker, 1, -1); |
3391 | 87 |
5170 | 88 gtk_widget_show_all(tickerwindow); |
3391 | 89 } |
90 | |
5170 | 91 static gboolean buddy_click_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
92 GaimContact *contact = user_data; |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
93 GaimBuddy *b = gaim_contact_get_priority_buddy(contact); |
4850 | 94 |
11338 | 95 gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name); |
3391 | 96 return TRUE; |
97 } | |
98 | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
99 static TickerData *buddy_ticker_find_contact(GaimContact *c) { |
5170 | 100 GList *tb; |
101 for(tb = tickerbuds; tb; tb = tb->next) { | |
102 TickerData *td = tb->data; | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
103 if(td->contact == c) |
5170 | 104 return td; |
105 } | |
106 return NULL; | |
107 } | |
108 | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
109 static void buddy_ticker_set_pixmap(GaimContact *c) { |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
110 TickerData *td = buddy_ticker_find_contact(c); |
5170 | 111 GdkPixbuf *pixbuf; |
3391 | 112 |
5170 | 113 if(!td) |
3391 | 114 return; |
5170 | 115 |
116 if(!td->icon) | |
117 td->icon = gtk_image_new(); | |
3391 | 118 |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
119 pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)c, |
5234 | 120 GAIM_STATUS_ICON_SMALL); |
5170 | 121 gtk_image_set_from_pixbuf(GTK_IMAGE(td->icon), pixbuf); |
122 g_object_unref(G_OBJECT(pixbuf)); | |
123 } | |
124 | |
6122 | 125 static gboolean buddy_ticker_set_pixmap_cb(gpointer data) { |
126 TickerData *td = data; | |
127 | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
128 buddy_ticker_update_contact(td->contact); |
6122 | 129 td->timeout = 0; |
130 | |
131 return FALSE; | |
132 } | |
133 | |
6695 | 134 static void buddy_ticker_add_buddy(GaimBuddy *b) { |
5170 | 135 GtkWidget *hbox; |
136 TickerData *td; | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
137 GaimContact *contact; |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
138 |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
139 contact = gaim_buddy_get_contact(b); |
5170 | 140 |
141 buddy_ticker_create_window(); | |
5172 | 142 |
3391 | 143 if (!ticker) |
144 return; | |
145 | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
146 if (buddy_ticker_find_contact(contact)) |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
147 { |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
148 buddy_ticker_update_contact(contact); |
3391 | 149 return; |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
150 } |
3391 | 151 |
5170 | 152 td = g_new0(TickerData, 1); |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
153 td->contact = contact; |
5170 | 154 tickerbuds = g_list_append(tickerbuds, td); |
3391 | 155 |
5170 | 156 td->ebox = gtk_event_box_new(); |
157 gtk_ticker_add(GTK_TICKER(ticker), td->ebox); | |
158 hbox = gtk_hbox_new(FALSE, 0); | |
159 gtk_container_add(GTK_CONTAINER(td->ebox), hbox); | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
160 buddy_ticker_set_pixmap(contact); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
161 gtk_box_pack_start(GTK_BOX(hbox), td->icon, FALSE, FALSE, 0); |
3391 | 162 |
5170 | 163 g_signal_connect(G_OBJECT(td->ebox), "button-press-event", |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
164 G_CALLBACK(buddy_click_cb), contact); |
3391 | 165 |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
166 td->label = gtk_label_new(gaim_contact_get_alias(contact)); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
167 gtk_box_pack_start(GTK_BOX(hbox), td->label, FALSE, FALSE, 2); |
5170 | 168 |
169 gtk_widget_show_all(td->ebox); | |
170 gtk_widget_show(tickerwindow); | |
6122 | 171 |
172 /* | |
173 * Update the icon in a few seconds (after the open door icon has | |
174 * changed). This is somewhat ugly. | |
175 */ | |
176 td->timeout = g_timeout_add(11000, buddy_ticker_set_pixmap_cb, td); | |
3391 | 177 } |
178 | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
179 static void buddy_ticker_remove(TickerData *td) { |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
180 gtk_ticker_remove(GTK_TICKER(ticker), td->ebox); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
181 tickerbuds = g_list_remove(tickerbuds, td); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
182 if (td->timeout != 0) |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
183 g_source_remove(td->timeout); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
184 g_free(td); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
185 } |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
186 |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
187 static void buddy_ticker_update_contact(GaimContact *contact) { |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
188 TickerData *td = buddy_ticker_find_contact(contact); |
3391 | 189 |
5170 | 190 if (!td) |
191 return; | |
3391 | 192 |
5172 | 193 /* pop up the ticker window again */ |
194 buddy_ticker_create_window(); | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
195 if (gaim_contact_get_priority_buddy(contact) == NULL) |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
196 buddy_ticker_remove(td); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
197 else { |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
198 buddy_ticker_set_pixmap(contact); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
199 gtk_label_set_text(GTK_LABEL(td->label), gaim_contact_get_alias(contact)); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
200 } |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
201 } |
5172 | 202 |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
203 static void buddy_ticker_remove_buddy(GaimBuddy *b) { |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
204 GaimContact *c = gaim_buddy_get_contact(b); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
205 TickerData *td = buddy_ticker_find_contact(c); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
206 |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
207 if (!td) |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
208 return; |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
209 |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
210 gaim_contact_invalidate_priority_buddy(c); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
211 |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
212 /* pop up the ticker window again */ |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
213 buddy_ticker_create_window(); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
214 buddy_ticker_update_contact(c); |
3391 | 215 } |
216 | |
5170 | 217 static void buddy_ticker_show() |
3391 | 218 { |
7100
abdc55ffadba
[gaim-migrate @ 7665]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
219 GaimBuddyList *list = gaim_get_blist(); |
6695 | 220 GaimBlistNode *gnode, *cnode, *bnode; |
221 GaimBuddy *b; | |
3391 | 222 |
5170 | 223 if(!list) |
224 return; | |
3391 | 225 |
5170 | 226 for(gnode = list->root; gnode; gnode = gnode->next) { |
227 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
228 continue; | |
6695 | 229 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
230 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
5170 | 231 continue; |
6695 | 232 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
233 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
234 continue; | |
235 b = (GaimBuddy *)bnode; | |
236 if(GAIM_BUDDY_IS_ONLINE(b)) | |
237 buddy_ticker_add_buddy(b); | |
238 } | |
3391 | 239 } |
240 } | |
241 } | |
242 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
243 static void |
6695 | 244 buddy_signon_cb(GaimBuddy *b) |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
245 { |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
246 GaimContact *c = gaim_buddy_get_contact(b); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
247 gaim_contact_invalidate_priority_buddy(c); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
248 if(buddy_ticker_find_contact(c)) |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
249 buddy_ticker_update_contact(c); |
5170 | 250 else |
251 buddy_ticker_add_buddy(b); | |
3391 | 252 } |
253 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
254 static void |
6695 | 255 buddy_signoff_cb(GaimBuddy *b) |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
256 { |
5170 | 257 buddy_ticker_remove_buddy(b); |
5185 | 258 if(!tickerbuds) |
259 gtk_widget_hide(tickerwindow); | |
3391 | 260 } |
261 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
262 static void |
11935
cb73483c9f63
[gaim-migrate @ 14226]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11338
diff
changeset
|
263 status_changed_cb(GaimBuddy *b, GaimStatus *os, GaimStatus *s) |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
264 { |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
265 GaimContact *c = gaim_buddy_get_contact(b); |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
266 if(buddy_ticker_find_contact(c)) |
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
267 buddy_ticker_set_pixmap(c); |
5170 | 268 else |
269 buddy_ticker_add_buddy(b); | |
3391 | 270 } |
271 | |
8213 | 272 static void |
273 signoff_cb(GaimConnection *gc) | |
274 { | |
275 TickerData *td; | |
276 if (!gaim_connections_get_all()) { | |
277 while (tickerbuds) { | |
278 td = tickerbuds->data; | |
279 tickerbuds = g_list_delete_link(tickerbuds, tickerbuds); | |
280 if (td->timeout != 0) | |
281 g_source_remove(td->timeout); | |
282 g_free(td); | |
283 } | |
284 gtk_widget_destroy(tickerwindow); | |
285 tickerwindow = NULL; | |
286 ticker = NULL; | |
287 } else { | |
288 GList *t = tickerbuds; | |
289 while (t) { | |
290 td = t->data; | |
291 t = t->next; | |
13150
d4698cf18986
[gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents:
11935
diff
changeset
|
292 buddy_ticker_update_contact(td->contact); |
8213 | 293 } |
294 } | |
295 } | |
296 | |
297 | |
3630 | 298 /* |
299 * EXPORTED FUNCTIONS | |
300 */ | |
301 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
302 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
303 plugin_load(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
304 { |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
305 void *blist_handle = gaim_blist_get_handle(); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
306 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
307 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
308 plugin, GAIM_CALLBACK(signoff_cb), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
309 gaim_signal_connect(blist_handle, "buddy-signed-on", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
310 plugin, GAIM_CALLBACK(buddy_signon_cb), NULL); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
311 gaim_signal_connect(blist_handle, "buddy-signed-off", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
312 plugin, GAIM_CALLBACK(buddy_signoff_cb), NULL); |
11935
cb73483c9f63
[gaim-migrate @ 14226]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11338
diff
changeset
|
313 gaim_signal_connect(blist_handle, "buddy-status-changed", |
cb73483c9f63
[gaim-migrate @ 14226]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11338
diff
changeset
|
314 plugin, GAIM_CALLBACK(status_changed_cb), NULL); |
3391 | 315 |
5607 | 316 if (gaim_connections_get_all()) |
5170 | 317 buddy_ticker_show(); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
318 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
319 return TRUE; |
3391 | 320 } |
321 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
322 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
323 plugin_unload(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
324 { |
6122 | 325 TickerData *td; |
326 | |
327 while (tickerbuds) { | |
328 td = tickerbuds->data; | |
5186 | 329 tickerbuds = g_list_delete_link(tickerbuds, tickerbuds); |
6122 | 330 if (td->timeout != 0) |
331 g_source_remove(td->timeout); | |
332 g_free(td); | |
5185 | 333 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
334 |
5984
c55b32640690
[gaim-migrate @ 6432]
Christian Hammond <chipx86@chipx86.com>
parents:
5983
diff
changeset
|
335 if (tickerwindow != NULL) { |
5983
e0be64ced3d7
[gaim-migrate @ 6431]
Christian Hammond <chipx86@chipx86.com>
parents:
5920
diff
changeset
|
336 gtk_widget_destroy(tickerwindow); |
5984
c55b32640690
[gaim-migrate @ 6432]
Christian Hammond <chipx86@chipx86.com>
parents:
5983
diff
changeset
|
337 tickerwindow = NULL; |
c55b32640690
[gaim-migrate @ 6432]
Christian Hammond <chipx86@chipx86.com>
parents:
5983
diff
changeset
|
338 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
339 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
340 return TRUE; |
3391 | 341 } |
5170 | 342 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
343 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
344 { |
9943 | 345 GAIM_PLUGIN_MAGIC, |
346 GAIM_MAJOR_VERSION, | |
347 GAIM_MINOR_VERSION, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
348 GAIM_PLUGIN_STANDARD, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
349 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
350 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
351 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
352 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
353 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
354 TICKER_PLUGIN_ID, /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
355 N_("Buddy Ticker"), /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
356 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
357 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
358 N_("A horizontal scrolling version of the buddy list."), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
359 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
360 N_("A horizontal scrolling version of the buddy list."), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
361 "Syd Logan", /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6122
diff
changeset
|
362 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
363 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
364 plugin_load, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
365 plugin_unload, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
366 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
367 |
11318 | 368 NULL, /**< ui_info */ |
8993 | 369 NULL, /**< extra_info */ |
370 NULL, | |
371 NULL | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
372 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
373 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
374 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
375 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
376 { |
3551 | 377 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5186
diff
changeset
|
378 |
6063 | 379 GAIM_INIT_PLUGIN(ticker, init_plugin, info) |