Migrate certificates, icons, logs to XDG dirs
[pidgin-git.git] / pidgin / plugins / iconaway.c
blob58436d6b7b84fdd29222f6b0802c6d7093236f51
1 /* purple
3 * Pidgin 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.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 #include "internal.h"
22 #include "pidgin.h"
24 #include "conversation.h"
25 #include "signals.h"
26 #include "version.h"
28 #include "gtkconv.h"
29 #include "gtkplugin.h"
31 #define ICONAWAY_PLUGIN_ID "gtk-iconaway"
33 static void
34 iconify_windows(PurpleAccount *account, PurpleStatus *old, PurpleStatus *newstatus)
36 PurplePresence *presence;
37 PidginConvWindow *win;
38 GList *windows;
40 presence = purple_status_get_presence(newstatus);
42 if (purple_presence_is_available(presence))
43 return;
45 purple_blist_set_visible(FALSE);
47 for (windows = pidgin_conv_windows_get_list();
48 windows != NULL;
49 windows = windows->next) {
51 win = (PidginConvWindow *)windows->data;
53 gtk_window_iconify(GTK_WINDOW(win->window));
58 * EXPORTED FUNCTIONS
61 static PidginPluginInfo *
62 plugin_query(GError **error)
64 const gchar * const authors[] = {
65 "Eric Warmenhoven <eric@warmenhoven.org>",
66 NULL
69 return pidgin_plugin_info_new(
70 "id", ICONAWAY_PLUGIN_ID,
71 "name", N_("Iconify on Away"),
72 "version", DISPLAY_VERSION,
73 "category", N_("User interface"),
74 "summary", N_("Iconifies the buddy list and your conversations "
75 "when you go away."),
76 "description", N_("Iconifies the buddy list and your conversations "
77 "when you go away."),
78 "authors", authors,
79 "website", PURPLE_WEBSITE,
80 "abi-version", PURPLE_ABI_VERSION,
81 NULL
85 static gboolean
86 plugin_load(PurplePlugin *plugin, GError **error)
88 purple_signal_connect(purple_accounts_get_handle(), "account-status-changed",
89 plugin, PURPLE_CALLBACK(iconify_windows), NULL);
91 return TRUE;
94 static gboolean
95 plugin_unload(PurplePlugin *plugin, GError **error)
97 return TRUE;
100 PURPLE_PLUGIN_INIT(iconaway, plugin_query, plugin_load, plugin_unload);