annotate plugins/iconaway.c @ 13479:90740e70af91

[gaim-migrate @ 15855] Patch from sadrul, expanded a bit by me, which fixes a crash when an MSN account disconnects while an msn_get_info() request is in progress and then completes after the disconnection. (Patch #1446189) committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 09 Mar 2006 15:44:08 +0000
parents cdbef02c91e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
1 /* gaim
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
2 *
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
3 * Gaim is the legal property of its developers, whose names are too numerous
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
5 * source distribution.
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
6 *
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
7 * This program is free software; you can redistribute it and/or modify
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
8 * it under the terms of the GNU General Public License as published by
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
10 * (at your option) any later version.
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
11 *
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
12 * This program is distributed in the hope that it will be useful,
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
15 * GNU General Public License for more details.
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
16 *
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
17 * You should have received a copy of the GNU General Public License
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
18 * along with this program; if not, write to the Free Software
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
20 */
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
21 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
22 #include "gtkgaim.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
23
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
24 #include "conversation.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
25 #include "signals.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
26 #include "version.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
27
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
28 #include "gtkconv.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
29 #include "gtkplugin.h"
4202
59751fe608c5 [gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents: 4113
diff changeset
30
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
31 #define ICONAWAY_PLUGIN_ID "gtk-iconaway"
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
33 static void
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
34 iconify_windows(GaimAccount *account, GaimStatus *old, GaimStatus *newstatus)
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
35 {
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
36 GaimPresence *presence;
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
37 GaimGtkWindow *win;
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
38 GList *windows;
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
40 presence = gaim_status_get_presence(newstatus);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
41
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
42 if (gaim_presence_is_available(presence))
1406
cabde2947ba4 [gaim-migrate @ 1416]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1405
diff changeset
43 return;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
44
4726
0b1c01fd68f1 [gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4585
diff changeset
45 gaim_blist_set_visible(FALSE);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
46
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
47 for (windows = gaim_gtk_conv_windows_get_list();
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
48 windows != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
49 windows = windows->next) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
50
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
51 win = (GaimGtkWindow *)windows->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
52
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
53 gtk_window_iconify(GTK_WINDOW(win->window));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4202
diff changeset
54 }
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 }
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3564
diff changeset
57 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3564
diff changeset
58 * EXPORTED FUNCTIONS
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3564
diff changeset
59 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3564
diff changeset
60
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
61 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
62 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
63 {
12665
cdbef02c91e9 [gaim-migrate @ 15008]
Richard Laager <rlaager@wiktel.com>
parents: 11964
diff changeset
64 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
65 plugin, GAIM_CALLBACK(iconify_windows), NULL);
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
67 return TRUE;
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 }
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
70 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
71 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
72 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
73 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
74 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
75 GAIM_PLUGIN_STANDARD, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
76 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
77 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
78 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
79 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
80
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
81 ICONAWAY_PLUGIN_ID, /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
82 N_("Iconify on Away"), /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
83 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
84 /** summary */
5598
8b24e4d1e082 [gaim-migrate @ 6002]
Luke Schierer <lschiere@pidgin.im>
parents: 5587
diff changeset
85 N_("Iconifies the buddy list and your conversations when you go away."),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
86 /** description */
5598
8b24e4d1e082 [gaim-migrate @ 6002]
Luke Schierer <lschiere@pidgin.im>
parents: 5587
diff changeset
87 N_("Iconifies the buddy list and your conversations when you go away."),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
88 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
89 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
90
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
91 plugin_load, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
92 NULL, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
93 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
94
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10142
diff changeset
95 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
96 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
97 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
98 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
99 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
100
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
101 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5917
diff changeset
102 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4726
diff changeset
103 {
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 }
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
106 GAIM_INIT_PLUGIN(iconaway, init_plugin, info)