comparison gtk/plugins/iconaway.c @ 14191:009db0b357b5

This is a hand-crafted commit to migrate across subversion revisions 16854:16861, due to some vagaries of the way the original renames were done. Witness that monotone can do in one revision what svn had to spread across several.
author Ethan Blanton <elb@pidgin.im>
date Sat, 16 Dec 2006 04:59:55 +0000
parents
children
comparison
equal deleted inserted replaced
14190:366be2ce35a7 14191:009db0b357b5
1 /* gaim
2 *
3 * Gaim is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 #include "internal.h"
22 #include "gtkgaim.h"
23
24 #include "conversation.h"
25 #include "signals.h"
26 #include "version.h"
27
28 #include "gtkconv.h"
29 #include "gtkplugin.h"
30
31 #define ICONAWAY_PLUGIN_ID "gtk-iconaway"
32
33 static void
34 iconify_windows(GaimAccount *account, GaimStatus *old, GaimStatus *newstatus)
35 {
36 GaimPresence *presence;
37 GaimGtkWindow *win;
38 GList *windows;
39
40 presence = gaim_status_get_presence(newstatus);
41
42 if (gaim_presence_is_available(presence))
43 return;
44
45 gaim_blist_set_visible(FALSE);
46
47 for (windows = gaim_gtk_conv_windows_get_list();
48 windows != NULL;
49 windows = windows->next) {
50
51 win = (GaimGtkWindow *)windows->data;
52
53 gtk_window_iconify(GTK_WINDOW(win->window));
54 }
55 }
56
57 /*
58 * EXPORTED FUNCTIONS
59 */
60
61 static gboolean
62 plugin_load(GaimPlugin *plugin)
63 {
64 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
65 plugin, GAIM_CALLBACK(iconify_windows), NULL);
66
67 return TRUE;
68 }
69
70 static GaimPluginInfo info =
71 {
72 GAIM_PLUGIN_MAGIC,
73 GAIM_MAJOR_VERSION,
74 GAIM_MINOR_VERSION,
75 GAIM_PLUGIN_STANDARD, /**< type */
76 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
77 0, /**< flags */
78 NULL, /**< dependencies */
79 GAIM_PRIORITY_DEFAULT, /**< priority */
80
81 ICONAWAY_PLUGIN_ID, /**< id */
82 N_("Iconify on Away"), /**< name */
83 VERSION, /**< version */
84 /** summary */
85 N_("Iconifies the buddy list and your conversations when you go away."),
86 /** description */
87 N_("Iconifies the buddy list and your conversations when you go away."),
88 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */
89 GAIM_WEBSITE, /**< homepage */
90
91 plugin_load, /**< load */
92 NULL, /**< unload */
93 NULL, /**< destroy */
94
95 NULL, /**< ui_info */
96 NULL, /**< extra_info */
97 NULL,
98 NULL
99 };
100
101 static void
102 init_plugin(GaimPlugin *plugin)
103 {
104 }
105
106 GAIM_INIT_PLUGIN(iconaway, init_plugin, info)