annotate plugins/ticker/ticker.c @ 19819:bf8fb36097ee

[gaim-migrate @ 17004] fix the windows bug of psm committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Wed, 23 Aug 2006 16:25:54 +0000
parents d4698cf18986
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6122
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
1 /*
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
2 * Gaim Ticker Plugin
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
3 * The line below doesn't apply at all, does it? It should be Syd, Sean, and
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
4 * maybe Nathan, I believe.
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * This library is free software; you can redistribute it and/or
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Library General Public
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * version 2 of the License, or (at your option) any later version.
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This library is distributed in the hope that it will be useful,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * Library General Public License for more details.
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Library General Public
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * License along with this library; if not, write to the
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * Boston, MA 02111-1307, USA.
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 /*
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 * ticker.c -- Syd Logan, Summer 2000
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 * pluginized- Sean Egan, Summer 2002
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5607
diff changeset
27 #include "internal.h"
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9620
diff changeset
28 #include "gtkgaim.h"
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5186
diff changeset
42 #define TICKER_PLUGIN_ID "gtk-ticker"
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3700
diff changeset
43
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 static GtkWidget *tickerwindow = NULL;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 static GtkWidget *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 typedef struct {
13150
d4698cf18986 [gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents: 11935
diff changeset
48 GaimContact *contact;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 GtkWidget *ebox;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 GtkWidget *label;
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
51 GtkWidget *icon;
6122
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
52 guint timeout;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 } TickerData;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
55 GList *tickerbuds = NULL;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
59 static gboolean buddy_ticker_destroy_window(GtkWidget *window,
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
60 GdkEventAny *event, gpointer data) {
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
61 if(window)
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
62 gtk_widget_hide(window);
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
63
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
64 return TRUE; /* don't actually destroy the window */
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
67 static void buddy_ticker_create_window() {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
68 if(tickerwindow) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
69 gtk_widget_show(tickerwindow);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
70 return;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
71 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
73 tickerwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5286
f82c251c8300 [gaim-migrate @ 5658]
Luke Schierer <lschiere@pidgin.im>
parents: 5234
diff changeset
74 gtk_window_set_default_size(GTK_WINDOW(tickerwindow), 500, -1);
5172
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
75 g_signal_connect(G_OBJECT(tickerwindow), "delete_event",
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
76 G_CALLBACK (buddy_ticker_destroy_window), NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
77 gtk_window_set_title (GTK_WINDOW(tickerwindow), _("Buddy Ticker"));
4850
b5508e864987 [gaim-migrate @ 5175]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
78 gtk_window_set_role (GTK_WINDOW(tickerwindow), "ticker");
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79
4850
b5508e864987 [gaim-migrate @ 5175]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
80 ticker = gtk_ticker_new();
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
81 gtk_ticker_set_spacing(GTK_TICKER(ticker), 20);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
82 gtk_container_add(GTK_CONTAINER(tickerwindow), ticker);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
83 gtk_ticker_set_interval(GTK_TICKER(ticker), 500);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
84 gtk_ticker_set_scootch(GTK_TICKER(ticker), 10);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
85 gtk_ticker_start_scroll(GTK_TICKER(ticker));
5286
f82c251c8300 [gaim-migrate @ 5658]
Luke Schierer <lschiere@pidgin.im>
parents: 5234
diff changeset
86 gtk_widget_set_size_request(ticker, 1, -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
88 gtk_widget_show_all(tickerwindow);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
b5508e864987 [gaim-migrate @ 5175]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
94
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11318
diff changeset
95 gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 return TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
100 GList *tb;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
101 for(tb = tickerbuds; tb; tb = tb->next) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
104 return td;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
105 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
106 return NULL;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
107 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
111 GdkPixbuf *pixbuf;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
113 if(!td)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 return;
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
115
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
116 if(!td->icon)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
117 td->icon = gtk_image_new();
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5205
diff changeset
120 GAIM_STATUS_ICON_SMALL);
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
121 gtk_image_set_from_pixbuf(GTK_IMAGE(td->icon), pixbuf);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
122 g_object_unref(G_OBJECT(pixbuf));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
123 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
124
6122
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
125 static gboolean buddy_ticker_set_pixmap_cb(gpointer data) {
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
126 TickerData *td = data;
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
127
13150
d4698cf18986 [gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents: 11935
diff changeset
128 buddy_ticker_update_contact(td->contact);
6122
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
129 td->timeout = 0;
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
130
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
131 return FALSE;
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
132 }
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
133
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
134 static void buddy_ticker_add_buddy(GaimBuddy *b) {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
135 GtkWidget *hbox;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
140
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
141 buddy_ticker_create_window();
5172
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
142
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 if (!ticker)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 return;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 return;
13150
d4698cf18986 [gaim-migrate @ 15513]
Richard Laager <rlaager@wiktel.com>
parents: 11935
diff changeset
150 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
154 tickerbuds = g_list_append(tickerbuds, td);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
156 td->ebox = gtk_event_box_new();
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
157 gtk_ticker_add(GTK_TICKER(ticker), td->ebox);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
158 hbox = gtk_hbox_new(FALSE, 0);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
168
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
169 gtk_widget_show_all(td->ebox);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
170 gtk_widget_show(tickerwindow);
6122
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
171
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
172 /*
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
173 * Update the icon in a few seconds (after the open door icon has
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
174 * changed). This is somewhat ugly.
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
175 */
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
176 td->timeout = g_timeout_add(11000, buddy_ticker_set_pixmap_cb, td);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
190 if (!td)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
191 return;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
5172
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
193 /* pop up the ticker window again */
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
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
2d84fe476406 [gaim-migrate @ 5536]
Nathan Walp <nwalp@pidgin.im>
parents: 5170
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
217 static void buddy_ticker_show()
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 {
7100
abdc55ffadba [gaim-migrate @ 7665]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
219 GaimBuddyList *list = gaim_get_blist();
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
220 GaimBlistNode *gnode, *cnode, *bnode;
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
221 GaimBuddy *b;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
223 if(!list)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
224 return;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
226 for(gnode = list->root; gnode; gnode = gnode->next) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
227 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
228 continue;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
229 for(cnode = gnode->child; cnode; cnode = cnode->next) {
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
230 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
231 continue;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
232 for(bnode = cnode->child; bnode; bnode = bnode->next) {
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
233 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
234 continue;
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
235 b = (GaimBuddy *)bnode;
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
236 if(GAIM_BUDDY_IS_ONLINE(b))
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
237 buddy_ticker_add_buddy(b);
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
238 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
243 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
250 else
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
251 buddy_ticker_add_buddy(b);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
254 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
255 buddy_signoff_cb(GaimBuddy *b)
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
256 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
257 buddy_ticker_remove_buddy(b);
5185
dec87634bcb1 [gaim-migrate @ 5549]
Nathan Walp <nwalp@pidgin.im>
parents: 5181
diff changeset
258 if(!tickerbuds)
dec87634bcb1 [gaim-migrate @ 5549]
Nathan Walp <nwalp@pidgin.im>
parents: 5181
diff changeset
259 gtk_widget_hide(tickerwindow);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
268 else
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
269 buddy_ticker_add_buddy(b);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271
8213
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
272 static void
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
273 signoff_cb(GaimConnection *gc)
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
274 {
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
275 TickerData *td;
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
276 if (!gaim_connections_get_all()) {
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
277 while (tickerbuds) {
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
278 td = tickerbuds->data;
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
279 tickerbuds = g_list_delete_link(tickerbuds, tickerbuds);
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
280 if (td->timeout != 0)
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
281 g_source_remove(td->timeout);
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
282 g_free(td);
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
283 }
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
284 gtk_widget_destroy(tickerwindow);
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
285 tickerwindow = NULL;
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
286 ticker = NULL;
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
287 } else {
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
288 GList *t = tickerbuds;
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
289 while (t) {
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
290 td = t->data;
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
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
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
293 }
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
294 }
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
295 }
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
296
8d41a4250bb7 [gaim-migrate @ 8936]
Nathan Walp <nwalp@pidgin.im>
parents: 7100
diff changeset
297
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
298 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
299 * EXPORTED FUNCTIONS
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
300 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315
5607
eeba9205dd0f [gaim-migrate @ 6011]
Nathan Walp <nwalp@pidgin.im>
parents: 5587
diff changeset
316 if (gaim_connections_get_all())
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
325 TickerData *td;
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
326
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
327 while (tickerbuds) {
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
328 td = tickerbuds->data;
5186
a107115a13ae [gaim-migrate @ 5550]
Nathan Walp <nwalp@pidgin.im>
parents: 5185
diff changeset
329 tickerbuds = g_list_delete_link(tickerbuds, tickerbuds);
6122
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
330 if (td->timeout != 0)
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
331 g_source_remove(td->timeout);
914f2d5da21c [gaim-migrate @ 6596]
Mark Doliner <mark@kingant.net>
parents: 6063
diff changeset
332 g_free(td);
5185
dec87634bcb1 [gaim-migrate @ 5549]
Nathan Walp <nwalp@pidgin.im>
parents: 5181
diff changeset
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
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
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
345 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
346 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
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
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9943
diff changeset
368 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
369 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
370 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
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
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3475
diff changeset
377 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5186
diff changeset
378
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5984
diff changeset
379 GAIM_INIT_PLUGIN(ticker, init_plugin, info)