changeset 12665:cdbef02c91e9

[gaim-migrate @ 15008] SF Patch #1390129 from Sadrul "I have never used this plugin. But I have been noticing a warning about this iconaway plugin in the debug-window for a long time. This patch at least gets rid of that. This patch may also make it work as was intended. But I am not sure." I don't use this plugin either. This looks correct to me. Someone that really uses it should verify. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 28 Dec 2005 09:01:41 +0000
parents 4669a779341c
children 8765dee8f517
files plugins/iconaway.c
diffstat 1 files changed, 12 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/iconaway.c	Tue Dec 27 20:42:24 2005 +0000
+++ b/plugins/iconaway.c	Wed Dec 28 09:01:41 2005 +0000
@@ -30,47 +30,28 @@
 
 #define ICONAWAY_PLUGIN_ID "gtk-iconaway"
 
-#ifdef _WIN32
-__declspec(dllimport) GtkWidget *imaway;
-#else
-G_MODULE_IMPORT GtkWidget *imaway;
-#endif
-
-#ifdef USE_APPLET
-extern void applet_destroy_buddy();
-#endif
+static void
+iconify_windows(GaimAccount *account, GaimStatus *old, GaimStatus *newstatus)
+{
+	GaimPresence *presence;
+	GaimGtkWindow *win;
+	GList *windows;
 
-static void
-iconify_windows(GaimAccount *account, char *state, char *message, void *data)
-{
-#if 0 /* XXX TODO STATUS */
-	GaimConvWindow *win;
-	GList *windows;
-	GaimConnection *gc;
+	presence = gaim_status_get_presence(newstatus);
 
-	gc = gaim_account_get_connection(account);
-
-	if (!imaway || !gc->away)
+	if (gaim_presence_is_available(presence))
 		return;
 
-	gtk_window_iconify(GTK_WINDOW(imaway));
 	gaim_blist_set_visible(FALSE);
 
-	for (windows = gaim_get_windows();
+	for (windows = gaim_gtk_conv_windows_get_list();
 		 windows != NULL;
 		 windows = windows->next) {
 
-		win = (GaimConvWindow *)windows->data;
-
-		if (GAIM_IS_GTK_WINDOW(win)) {
-			GaimGtkWindow *gtkwin;
+		win = (GaimGtkWindow *)windows->data;
 
-			gtkwin = GAIM_GTK_WINDOW(win);
-
-			gtk_window_iconify(GTK_WINDOW(gtkwin->window));
-		}
+		gtk_window_iconify(GTK_WINDOW(win->window));
 	}
-#endif /* XXX TODO STATUS */
 }
 
 /*
@@ -80,7 +61,7 @@
 static gboolean
 plugin_load(GaimPlugin *plugin)
 {
-	gaim_signal_connect(gaim_accounts_get_handle(), "account-away",
+	gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
 						plugin, GAIM_CALLBACK(iconify_windows), NULL);
 
 	return TRUE;