diff plugins/docklet/docklet-win32.c @ 12016:24c7fb94d3a3

[gaim-migrate @ 14309] Patch from charkins to fix potential problems with the buddy list becoming invisible with no way to restore visiblity. This (re)introduces the concept of a "visibility manager" that, if present, will be in charge of controlling the visibility of the buddy list. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 09 Nov 2005 02:25:26 +0000
parents cae2fb7e8594
children 011efeb86b8d
line wrap: on
line diff
--- a/plugins/docklet/docklet-win32.c	Wed Nov 09 01:36:28 2005 +0000
+++ b/plugins/docklet/docklet-win32.c	Wed Nov 09 02:25:26 2005 +0000
@@ -190,6 +190,15 @@
 	systray_change_icon(sysicon_blank, NULL);
 }
 
+void wgaim_tray_minimize(GaimGtkBuddyList *gtkblist) {
+	MinimizeWndToTray(GDK_WINDOW_HWND(gtkblist->window->window));
+}
+
+void wgaim_tray_maximize(GaimGtkBuddyList *gtkblist) {
+	RestoreWndFromTray(GDK_WINDOW_HWND(gtkblist->window->window));
+}
+
+
 static void wgaim_tray_create() {
 	OSVERSIONINFO osinfo;
 	/* dummy window to process systray messages */
@@ -220,31 +229,28 @@
 
 	/* Create icon in systray */
 	systray_init_icon(systray_hwnd, sysicon_disconn);
+
+	gaim_signal_connect(gaim_gtk_blist_get_handle(), "gtkblist-hiding", 
+			&handle, GAIM_CALLBACK(wgaim_tray_minimize), NULL);
+	gaim_signal_connect(gaim_gtk_blist_get_handle(), "gtkblist-unhiding", 
+			&handle, GAIM_CALLBACK(wgaim_tray_maximize), NULL);
+
 	gaim_debug(GAIM_DEBUG_INFO, "tray icon", "created\n");
 }
 
 static void wgaim_tray_destroy() {
+	gaim_signals_disconnect_by_handle(&handle);
 	systray_remove_nid();
 	DestroyWindow(systray_hwnd);
 	docklet_remove(TRUE);
 }
 
-void wgaim_tray_minimize(GtkWidget *window) {
-	MinimizeWndToTray(GDK_WINDOW_HWND(window->window));
-}
-
-void wgaim_tray_maximize(GtkWidget *window) {
-	RestoreWndFromTray(GDK_WINDOW_HWND(window->window));
-}
-
 static struct docklet_ui_ops wgaim_tray_ops =
 {
 	wgaim_tray_create,
 	wgaim_tray_destroy,
 	wgaim_tray_update_icon,
 	wgaim_tray_blank_icon,
-	wgaim_tray_minimize,
-	wgaim_tray_maximize,
 	NULL
 };