| 28 #include "gtkconv.h" |
28 #include "gtkconv.h" |
| 29 #include "gtkplugin.h" |
29 #include "gtkplugin.h" |
| 30 |
30 |
| 31 #define ICONAWAY_PLUGIN_ID "gtk-iconaway" |
31 #define ICONAWAY_PLUGIN_ID "gtk-iconaway" |
| 32 |
32 |
| 33 #ifdef _WIN32 |
33 static void |
| 34 __declspec(dllimport) GtkWidget *imaway; |
34 iconify_windows(GaimAccount *account, GaimStatus *old, GaimStatus *newstatus) |
| 35 #else |
35 { |
| 36 G_MODULE_IMPORT GtkWidget *imaway; |
36 GaimPresence *presence; |
| 37 #endif |
37 GaimGtkWindow *win; |
| |
38 GList *windows; |
| 38 |
39 |
| 39 #ifdef USE_APPLET |
40 presence = gaim_status_get_presence(newstatus); |
| 40 extern void applet_destroy_buddy(); |
|
| 41 #endif |
|
| 42 |
41 |
| 43 static void |
42 if (gaim_presence_is_available(presence)) |
| 44 iconify_windows(GaimAccount *account, char *state, char *message, void *data) |
|
| 45 { |
|
| 46 #if 0 /* XXX TODO STATUS */ |
|
| 47 GaimConvWindow *win; |
|
| 48 GList *windows; |
|
| 49 GaimConnection *gc; |
|
| 50 |
|
| 51 gc = gaim_account_get_connection(account); |
|
| 52 |
|
| 53 if (!imaway || !gc->away) |
|
| 54 return; |
43 return; |
| 55 |
44 |
| 56 gtk_window_iconify(GTK_WINDOW(imaway)); |
|
| 57 gaim_blist_set_visible(FALSE); |
45 gaim_blist_set_visible(FALSE); |
| 58 |
46 |
| 59 for (windows = gaim_get_windows(); |
47 for (windows = gaim_gtk_conv_windows_get_list(); |
| 60 windows != NULL; |
48 windows != NULL; |
| 61 windows = windows->next) { |
49 windows = windows->next) { |
| 62 |
50 |
| 63 win = (GaimConvWindow *)windows->data; |
51 win = (GaimGtkWindow *)windows->data; |
| 64 |
52 |
| 65 if (GAIM_IS_GTK_WINDOW(win)) { |
53 gtk_window_iconify(GTK_WINDOW(win->window)); |
| 66 GaimGtkWindow *gtkwin; |
|
| 67 |
|
| 68 gtkwin = GAIM_GTK_WINDOW(win); |
|
| 69 |
|
| 70 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); |
|
| 71 } |
|
| 72 } |
54 } |
| 73 #endif /* XXX TODO STATUS */ |
|
| 74 } |
55 } |
| 75 |
56 |
| 76 /* |
57 /* |
| 77 * EXPORTED FUNCTIONS |
58 * EXPORTED FUNCTIONS |
| 78 */ |
59 */ |
| 79 |
60 |
| 80 static gboolean |
61 static gboolean |
| 81 plugin_load(GaimPlugin *plugin) |
62 plugin_load(GaimPlugin *plugin) |
| 82 { |
63 { |
| 83 gaim_signal_connect(gaim_accounts_get_handle(), "account-away", |
64 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", |
| 84 plugin, GAIM_CALLBACK(iconify_windows), NULL); |
65 plugin, GAIM_CALLBACK(iconify_windows), NULL); |
| 85 |
66 |
| 86 return TRUE; |
67 return TRUE; |
| 87 } |
68 } |
| 88 |
69 |