Thu, 15 May 2003 23:59:20 +0000
[gaim-migrate @ 5765]
fix for disappearing systray icon when explorer crashes.
Thanks again to phroggie.. this is turning into a Phroggie-thon
| 3946 | 1 | /* |
| 2 | * systray.c | |
| 3 | * | |
| 4 | * Author: Herman Bloggs <hermanator12002@yahoo.com> | |
| 5 | * Date: November, 2002 | |
| 6 | * Description: Gaim systray functionality | |
| 7 | */ | |
| 8 | #include <windows.h> | |
| 9 | #include <gdk/gdkwin32.h> | |
| 10 | #include "resource.h" | |
| 11 | #include "gaim.h" | |
| 12 | #include "win32dep.h" | |
| 13 | #include "MinimizeToTray.h" | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
14 | #include "ui.h" |
|
5248
f4f944f4dbe0
[gaim-migrate @ 5620]
Mark Doliner <markdoliner@pidgin.im>
parents:
5084
diff
changeset
|
15 | #include "gtkblist.h" |
| 3946 | 16 | |
| 17 | /* | |
| 18 | * DEFINES, MACROS & DATA TYPES | |
| 19 | */ | |
| 20 | #define GAIM_SYSTRAY_HINT _("Gaim Instant Messenger") | |
| 21 | #define GAIM_SYSTRAY_DISCONN_HINT _("Gaim Instant Messenger - Signed off") | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
22 | #define GAIM_SYSTRAY_AWAY_HINT _("Gaim Instant Messenger - Away") |
| 3946 | 23 | #define WM_TRAYMESSAGE WM_USER /* User defined WM Message */ |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
24 | #define MAX_AWY_MESSAGES 50 |
| 3946 | 25 | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
26 | enum _SYSTRAY_STATE { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
27 | SYSTRAY_STATE_ONLINE, |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
28 | SYSTRAY_STATE_ONLINE_CONNECTING, |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
29 | SYSTRAY_STATE_OFFLINE, |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
30 | SYSTRAY_STATE_OFFLINE_CONNECTING, |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
31 | SYSTRAY_STATE_AWAY, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
32 | SYSTRAY_STATE_COUNT |
| 3946 | 33 | }; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
34 | typedef enum _SYSTRAY_STATE SYSTRAY_STATE; |
| 3946 | 35 | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
36 | enum _SYSTRAY_CMND { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
37 | SYSTRAY_CMND_MENU_EXIT, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
38 | SYSTRAY_CMND_SIGNON, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
39 | SYSTRAY_CMND_SIGNOFF, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
40 | SYSTRAY_CMND_AUTOLOGIN, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
41 | SYSTRAY_CMND_PREFS, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
42 | SYSTRAY_CMND_BACK, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
43 | SYSTRAY_CMND_SET_AWY_NEW, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
44 | SYSTRAY_CMND_SET_AWY, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
45 | SYSTRAY_CMND_SET_AWY_LAST=SYSTRAY_CMND_SET_AWY+MAX_AWY_MESSAGES |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
46 | }; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
47 | typedef enum _SYSTRAY_CMND SYSTRAY_CMND; |
| 3946 | 48 | |
| 49 | /* | |
| 50 | * LOCALS | |
| 51 | */ | |
| 52 | static HWND systray_hwnd=0; | |
| 53 | static HICON sysicon_disconn=0; | |
| 54 | static HICON sysicon_conn=0; | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
55 | static HICON sysicon_away=0; |
| 3946 | 56 | static NOTIFYICONDATA wgaim_nid; |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
57 | static SYSTRAY_STATE st_state=SYSTRAY_STATE_OFFLINE; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
58 | static HMENU systray_menu=0; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
59 | static HMENU systray_away_menu=0; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
60 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
61 | /* |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
62 | * GLOBALS |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
63 | */ |
|
3972
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
64 | extern GtkWidget *imaway; |
| 3946 | 65 | |
| 66 | /* | |
| 67 | * PRIVATE CODE | |
| 68 | */ | |
| 69 | ||
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
70 | /* |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
71 | * SYSTRAY HELPERS |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
72 | ********************/ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
73 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
74 | /* Returns 1 if menu item exists, 0 if not */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
75 | static int IsMenuItem( HMENU hMenu, UINT id ) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
76 | if(0xFFFFFFFF == GetMenuState(hMenu, id, MF_BYCOMMAND)) |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
77 | return 0; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
78 | else |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
79 | return 1; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
80 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
81 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
82 | /* |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
83 | * WGAIM SYSTRAY GUI |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
84 | ********************/ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
85 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
86 | static HMENU systray_create_awy_menu(void) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
87 | int item_count = SYSTRAY_CMND_SET_AWY; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
88 | struct away_message *a = NULL; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
89 | GSList *awy = away_messages; |
|
5377
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
90 | char* locenc=NULL; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
91 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
92 | /* Delete previous away submenu */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
93 | if(systray_away_menu) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
94 | DestroyMenu(systray_away_menu); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
95 | systray_away_menu = 0; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
96 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
97 | systray_away_menu = CreatePopupMenu(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
98 | while (awy && (item_count <= SYSTRAY_CMND_SET_AWY+MAX_AWY_MESSAGES)) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
99 | a = (struct away_message *)awy->data; |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
100 | locenc = g_locale_from_utf8(a->name, -1, NULL, NULL, NULL); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
101 | AppendMenu(systray_away_menu, MF_STRING, item_count, locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
102 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
103 | awy = g_slist_next(awy); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
104 | item_count+=1; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
105 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
106 | AppendMenu(systray_away_menu, MF_SEPARATOR, 0, 0); |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
107 | locenc = g_locale_from_utf8(_("New"), -1, NULL, NULL, NULL); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
108 | AppendMenu(systray_away_menu, MF_STRING, SYSTRAY_CMND_SET_AWY_NEW, locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
109 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
110 | return systray_away_menu; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
111 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
112 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
113 | static void systray_show_menu(int x, int y, BOOL connected) { |
|
5377
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
114 | char* locenc=NULL; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
115 | /* need to call this so that the menu disappears if clicking outside |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
116 | of the menu scope */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
117 | SetForegroundWindow(systray_hwnd); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
118 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
119 | /* Different menus depending on signed on/off state */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
120 | if(connected) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
121 | /* If signoff item dosn't exist.. create it */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
122 | if(!IsMenuItem(systray_menu, SYSTRAY_CMND_SIGNOFF)) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
123 | DeleteMenu(systray_menu, SYSTRAY_CMND_SIGNON, MF_BYCOMMAND); |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
124 | locenc = g_locale_from_utf8(_("Signoff"), -1, NULL, NULL, NULL); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
125 | InsertMenu(systray_menu, SYSTRAY_CMND_MENU_EXIT, |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
126 | MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_SIGNOFF, locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
127 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
128 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
129 | /* if away menu exists, remove and rebuild it */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
130 | if(systray_away_menu) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
131 | if(!DeleteMenu(systray_menu, (UINT)systray_away_menu, MF_BYCOMMAND)) |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
132 | debug_printf("Error using DeleteMenu\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
133 | } |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
134 | locenc = g_locale_from_utf8(_("Set Away Message"), -1, NULL, NULL, NULL); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
135 | InsertMenu(systray_menu, SYSTRAY_CMND_PREFS, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
136 | MF_BYCOMMAND | MF_POPUP | MF_STRING, (UINT)systray_create_awy_menu(), |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
137 | locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
138 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
139 | EnableMenuItem(systray_menu, SYSTRAY_CMND_AUTOLOGIN, MF_GRAYED); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
140 | /* If away, put "I'm Back" option in menu */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
141 | if(st_state == SYSTRAY_STATE_AWAY) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
142 | if(!IsMenuItem(systray_menu, SYSTRAY_CMND_BACK)) { |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
143 | locenc = g_locale_from_utf8(_("I'm Back"), -1, NULL, NULL, NULL); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
144 | InsertMenu(systray_menu, (UINT)systray_away_menu, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
145 | MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_BACK, |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
146 | locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
147 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
148 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
149 | } else { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
150 | /* Delete I'm Back item if it exists */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
151 | DeleteMenu(systray_menu, SYSTRAY_CMND_BACK, MF_BYCOMMAND); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
152 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
153 | } else { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
154 | /* If signon item dosn't exist.. create it */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
155 | if(!IsMenuItem(systray_menu, SYSTRAY_CMND_SIGNON)) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
156 | DeleteMenu(systray_menu, SYSTRAY_CMND_SIGNOFF, MF_BYCOMMAND); |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
157 | locenc = g_locale_from_utf8(_("Sign On"), -1, NULL, NULL, NULL); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
158 | InsertMenu(systray_menu, SYSTRAY_CMND_MENU_EXIT, |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
159 | MF_BYCOMMAND | MF_STRING, SYSTRAY_CMND_SIGNON, locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
160 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
161 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
162 | EnableMenuItem(systray_menu, SYSTRAY_CMND_AUTOLOGIN, MF_ENABLED); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
163 | EnableMenuItem(systray_menu, (UINT)systray_away_menu, MF_GRAYED); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
164 | /* Delete I'm Back item if it exists */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
165 | DeleteMenu(systray_menu, SYSTRAY_CMND_BACK, MF_BYCOMMAND); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
166 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
167 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
168 | TrackPopupMenu(systray_menu, // handle to shortcut menu |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
169 | TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON, |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
170 | x, // horizontal position, in screen coordinates |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
171 | y, // vertical position, in screen coordinates |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
172 | 0, // reserved, must be zero |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
173 | systray_hwnd, // handle to owner window |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
174 | NULL // ignored |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
175 | ); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
176 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
177 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
178 | /* Set nth away message from away_messages list */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
179 | static void systray_set_away(int nth) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
180 | int item_count = 0; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
181 | GSList *awy = away_messages; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
182 | struct away_message *a = NULL; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
183 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
184 | while (awy && (item_count != nth)) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
185 | awy = g_slist_next(awy); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
186 | item_count+=1; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
187 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
188 | if(awy) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
189 | a = (struct away_message *)awy->data; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
190 | do_away_message(NULL, a); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
191 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
192 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
193 | |
| 3946 | 194 | static LRESULT CALLBACK systray_mainmsg_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { |
|
5389
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
195 | static UINT taskbarRestartMsg; /* static here means value is kept across multiple calls to this func */ |
| 3946 | 196 | |
| 197 | switch(msg) { | |
| 198 | case WM_CREATE: | |
| 199 | debug_printf("WM_CREATE\n"); | |
|
5389
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
200 | taskbarRestartMsg = RegisterWindowMessage("TaskbarCreated"); |
| 3946 | 201 | break; |
| 202 | ||
| 203 | case WM_TIMER: | |
| 204 | debug_printf("WM_TIMER\n"); | |
| 205 | break; | |
| 206 | ||
| 207 | case WM_DESTROY: | |
| 208 | debug_printf("WM_DESTROY\n"); | |
| 209 | break; | |
| 210 | ||
| 211 | case WM_COMMAND: | |
| 212 | debug_printf("WM_COMMAND\n"); | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
213 | switch(LOWORD(wparam)) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
214 | case SYSTRAY_CMND_MENU_EXIT: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
215 | do_quit(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
216 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
217 | case SYSTRAY_CMND_SIGNON: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
218 | debug_printf("signon\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
219 | show_login(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
220 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
221 | case SYSTRAY_CMND_SIGNOFF: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
222 | debug_printf("signoff\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
223 | signoff_all(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
224 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
225 | case SYSTRAY_CMND_AUTOLOGIN: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
226 | debug_printf("autologin\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
227 | auto_login(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
228 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
229 | case SYSTRAY_CMND_PREFS: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
230 | debug_printf("Prefs\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
231 | show_prefs(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
232 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
233 | case SYSTRAY_CMND_BACK: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
234 | debug_printf("I'm back\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
235 | do_im_back(NULL, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
236 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
237 | case SYSTRAY_CMND_SET_AWY_NEW: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
238 | debug_printf("New away item\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
239 | create_away_mess(NULL, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
240 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
241 | default: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
242 | /* SYSTRAY_CMND_SET_AWY */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
243 | if((LOWORD(wparam) >= SYSTRAY_CMND_SET_AWY) && |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
244 | (LOWORD(wparam) <= (SYSTRAY_CMND_SET_AWY + MAX_AWY_MESSAGES))) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
245 | debug_printf("Set away message\n"); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
246 | systray_set_away(LOWORD(wparam)-SYSTRAY_CMND_SET_AWY); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
247 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
248 | } |
| 3946 | 249 | break; |
| 250 | case WM_TRAYMESSAGE: | |
| 251 | { | |
| 252 | if( lparam == WM_LBUTTONDBLCLK ) { | |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
253 | /* Double Click */ |
|
3972
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
254 | /* Either hide or show current window (login or buddy) */ |
|
4715
714d2fa57d79
[gaim-migrate @ 5026]
Herman Bloggs <herman@bluedigits.com>
parents:
4500
diff
changeset
|
255 | gaim_gtk_blist_docklet_toggle(); |
| 3946 | 256 | debug_printf("Systray got double click\n"); |
| 257 | } | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
258 | if( lparam == WM_RBUTTONUP ) { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
259 | /* Right Click */ |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
260 | POINT mpoint; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
261 | GetCursorPos(&mpoint); |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
262 | |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
263 | switch(st_state) { |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
264 | case SYSTRAY_STATE_OFFLINE: |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
265 | case SYSTRAY_STATE_OFFLINE_CONNECTING: |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
266 | systray_show_menu(mpoint.x, mpoint.y, 0); |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
267 | break; |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
268 | default: |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
269 | systray_show_menu(mpoint.x, mpoint.y, 1); |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
270 | } |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
271 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
272 | break; |
| 3946 | 273 | } |
|
5389
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
274 | default: |
|
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
275 | if (msg == taskbarRestartMsg) { |
|
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
276 | /* explorer crashed and left us hanging... |
|
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
277 | This will put the systray icon back in it's place, when it restarts */ |
|
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
278 | Shell_NotifyIcon(NIM_ADD,&wgaim_nid); |
|
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
279 | } |
|
d557e64e6d8c
[gaim-migrate @ 5765]
Herman Bloggs <herman@bluedigits.com>
parents:
5377
diff
changeset
|
280 | break; |
| 3946 | 281 | }/* end switch */ |
| 282 | ||
| 283 | return DefWindowProc(hwnd, msg, wparam, lparam); | |
| 284 | } | |
| 285 | ||
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
286 | /* Create hidden window to process systray messages */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
287 | static HWND systray_create_hiddenwin() { |
| 3946 | 288 | WNDCLASSEX wcex; |
| 289 | TCHAR wname[32]; | |
| 290 | ||
| 291 | strcpy(wname, "GaimWin"); | |
| 292 | ||
| 293 | wcex.cbSize = sizeof(WNDCLASSEX); | |
| 294 | ||
| 295 | wcex.style = 0; | |
| 296 | wcex.lpfnWndProc = (WNDPROC)systray_mainmsg_handler; | |
| 297 | wcex.cbClsExtra = 0; | |
| 298 | wcex.cbWndExtra = 0; | |
| 299 | wcex.hInstance = wgaim_hinstance(); | |
| 300 | wcex.hIcon = NULL; | |
| 301 | wcex.hCursor = NULL, | |
| 302 | wcex.hbrBackground = NULL; | |
| 303 | wcex.lpszMenuName = NULL; | |
| 304 | wcex.lpszClassName = wname; | |
| 305 | wcex.hIconSm = NULL; | |
| 306 | ||
| 307 | RegisterClassEx(&wcex); | |
| 308 | ||
| 309 | // Create the window | |
| 310 | return (CreateWindow(wname, "", 0, 0, 0, 0, 0, GetDesktopWindow(), NULL, wgaim_hinstance(), 0)); | |
| 311 | } | |
| 312 | ||
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
313 | static void systray_create_menu(void) { |
|
5377
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
314 | char* locenc=NULL; |
|
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
315 | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
316 | /* create popup menu */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
317 | if((systray_menu = CreatePopupMenu())) { |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
318 | if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_PREFS, |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
319 | (locenc=g_locale_from_utf8(_("Preferences"), -1, NULL, NULL, NULL)))) |
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
320 | debug_printf("AppendMenu error: %ld\n", GetLastError()); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
321 | g_free(locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
322 | if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_AUTOLOGIN, |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
323 | (locenc=g_locale_from_utf8(_("Auto-login"), -1, NULL, NULL, NULL)))) |
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
324 | debug_printf("AppendMenu error: %ld\n", GetLastError()); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
325 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
326 | if(!AppendMenu(systray_menu, MF_SEPARATOR, 0, 0)) |
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
327 | debug_printf("AppendMenu error: %ld\n", GetLastError()); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
328 | if(!AppendMenu(systray_menu, MF_STRING, SYSTRAY_CMND_MENU_EXIT, |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
329 | (locenc=g_locale_from_utf8(_("Exit"), -1, NULL, NULL, NULL)))) |
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
330 | debug_printf("AppendMenu error: %ld\n", GetLastError()); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
331 | g_free(locenc); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
332 | } else |
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
333 | debug_printf("CreatePopupMenu error: %ld\n", GetLastError()); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
334 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
335 | |
| 3946 | 336 | static void systray_init_icon(HWND hWnd, HICON icon) { |
|
5377
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
337 | char* locenc=NULL; |
|
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
338 | |
| 3946 | 339 | ZeroMemory(&wgaim_nid,sizeof(wgaim_nid)); |
| 340 | wgaim_nid.cbSize=sizeof(NOTIFYICONDATA); | |
| 341 | wgaim_nid.hWnd=hWnd; | |
| 342 | wgaim_nid.uID=0; | |
| 343 | wgaim_nid.uFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP; | |
| 344 | wgaim_nid.uCallbackMessage=WM_TRAYMESSAGE; | |
| 345 | wgaim_nid.hIcon=icon; | |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
346 | locenc=g_locale_from_utf8(GAIM_SYSTRAY_DISCONN_HINT, -1, NULL, NULL, NULL); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
347 | strcpy(wgaim_nid.szTip, locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
348 | g_free(locenc); |
| 3946 | 349 | Shell_NotifyIcon(NIM_ADD,&wgaim_nid); |
| 350 | } | |
| 351 | ||
| 352 | static void systray_change_icon(HICON icon, char* text) { | |
|
5377
621008da1987
[gaim-migrate @ 5753]
Herman Bloggs <herman@bluedigits.com>
parents:
5376
diff
changeset
|
353 | char *locenc=NULL; |
| 3946 | 354 | wgaim_nid.hIcon = icon; |
|
5376
742cacf926ef
[gaim-migrate @ 5752]
Herman Bloggs <herman@bluedigits.com>
parents:
5365
diff
changeset
|
355 | locenc = g_locale_from_utf8(text, -1, NULL, NULL, NULL); |
|
5365
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
356 | lstrcpy(wgaim_nid.szTip, locenc); |
|
9708d37a3b21
[gaim-migrate @ 5741]
Herman Bloggs <herman@bluedigits.com>
parents:
5248
diff
changeset
|
357 | g_free(locenc); |
| 3946 | 358 | Shell_NotifyIcon(NIM_MODIFY,&wgaim_nid); |
| 359 | } | |
| 360 | ||
| 361 | static void systray_remove_nid(void) { | |
| 362 | Shell_NotifyIcon(NIM_DELETE,&wgaim_nid); | |
| 363 | } | |
| 364 | ||
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
365 | static void systray_update_icon() { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
366 | switch(st_state) { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
367 | case SYSTRAY_STATE_ONLINE: |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
368 | systray_change_icon(sysicon_conn, GAIM_SYSTRAY_HINT); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
369 | break; |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
370 | case SYSTRAY_STATE_ONLINE_CONNECTING: |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
371 | case SYSTRAY_STATE_OFFLINE_CONNECTING: |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
372 | break; |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
373 | case SYSTRAY_STATE_OFFLINE: |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
374 | systray_change_icon(sysicon_disconn, GAIM_SYSTRAY_DISCONN_HINT); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
375 | break; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
376 | case SYSTRAY_STATE_AWAY: |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
377 | systray_change_icon(sysicon_away, GAIM_SYSTRAY_AWAY_HINT); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
378 | break; |
|
5084
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
379 | case SYSTRAY_STATE_COUNT: /* not a state, here to avoid warning */ |
|
21d2e7ec99ce
[gaim-migrate @ 5439]
Herman Bloggs <herman@bluedigits.com>
parents:
4881
diff
changeset
|
380 | default: |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
381 | } |
| 3946 | 382 | } |
| 383 | ||
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
384 | static void systray_update_status() { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
385 | SYSTRAY_STATE old_state = st_state; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
386 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
387 | if(connections) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
388 | if(awaymessage) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
389 | st_state = SYSTRAY_STATE_AWAY; |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
390 | } else if(connecting_count) { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
391 | st_state = SYSTRAY_STATE_ONLINE_CONNECTING; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
392 | } else { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
393 | st_state = SYSTRAY_STATE_ONLINE; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
394 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
395 | } else { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
396 | if(connecting_count) { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
397 | /* Don't rely on this state.. signoff in multi.c sends |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
398 | event_signoff before decrementing connecting_count |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
399 | for a reason unknown to me.. |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
400 | */ |
|
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
401 | st_state = SYSTRAY_STATE_OFFLINE_CONNECTING; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
402 | } else { |
|
4500
99f0188eb8cf
[gaim-migrate @ 4775]
Herman Bloggs <herman@bluedigits.com>
parents:
4106
diff
changeset
|
403 | st_state = SYSTRAY_STATE_OFFLINE; |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
404 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
405 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
406 | if(st_state != old_state) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
407 | systray_update_icon(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
408 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
409 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
410 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
411 | /* |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
412 | * GAIM EVENT CALLBACKS |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
413 | ***********************/ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
414 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
415 | static void st_signon(struct gaim_connection *gc, void *data) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
416 | systray_update_status(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
417 | } |
| 3946 | 418 | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
419 | static void st_signoff(struct gaim_connection *gc, void *data) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
420 | systray_update_status(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
421 | } |
| 3946 | 422 | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
423 | static void st_away(struct gaim_connection *gc, void *data) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
424 | systray_update_status(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
425 | } |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
426 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
427 | static void st_back(struct gaim_connection *gc, void *data) { |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
428 | systray_update_status(); |
| 3946 | 429 | } |
| 430 | ||
| 431 | /* | |
| 432 | * PUBLIC CODE | |
| 433 | */ | |
| 434 | ||
| 435 | /* Create a hidden window and associate it with the systray icon. | |
| 436 | We use this hidden window to proccess WM_TRAYMESSAGE msgs. */ | |
| 437 | void wgaim_systray_init(void) { | |
|
4715
714d2fa57d79
[gaim-migrate @ 5026]
Herman Bloggs <herman@bluedigits.com>
parents:
4500
diff
changeset
|
438 | gaim_gtk_blist_docklet_add(); |
|
3972
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
439 | |
| 3946 | 440 | /* dummy window to process systray messages */ |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
441 | systray_hwnd = systray_create_hiddenwin(); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
442 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
443 | systray_create_menu(); |
| 3946 | 444 | |
| 445 | /* Load icons, and init systray notify icon */ | |
|
4101
a27b5966a1ac
[gaim-migrate @ 4316]
Herman Bloggs <herman@bluedigits.com>
parents:
4087
diff
changeset
|
446 | sysicon_disconn = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON), IMAGE_ICON, 16, 16, 0); |
|
a27b5966a1ac
[gaim-migrate @ 4316]
Herman Bloggs <herman@bluedigits.com>
parents:
4087
diff
changeset
|
447 | sysicon_conn = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON), IMAGE_ICON, 16, 16, 0); |
|
a27b5966a1ac
[gaim-migrate @ 4316]
Herman Bloggs <herman@bluedigits.com>
parents:
4087
diff
changeset
|
448 | sysicon_away = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON), IMAGE_ICON, 16, 16, 0); |
| 3946 | 449 | |
| 450 | /* Create icon in systray */ | |
| 451 | systray_init_icon(systray_hwnd, sysicon_disconn); | |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
452 | |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
453 | /* Register Gaim event callbacks */ |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
454 | gaim_signal_connect(NULL, event_signon, st_signon, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
455 | gaim_signal_connect(NULL, event_signoff, st_signoff, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
456 | gaim_signal_connect(NULL, event_away, st_away, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
457 | gaim_signal_connect(NULL, event_back, st_back, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
458 | /*gaim_signal_connect(NULL, event_connecting, wgaim_st_connecting, NULL); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
459 | gaim_signal_connect(NULL, event_im_displayed_rcvd, wgaim_st_im_displayed_recv, NULL);*/ |
| 3946 | 460 | } |
| 461 | ||
| 462 | void wgaim_systray_cleanup(void) { | |
|
4728
048393024194
[gaim-migrate @ 5041]
Herman Bloggs <herman@bluedigits.com>
parents:
4715
diff
changeset
|
463 | /*gaim_gtk_blist_docklet_remove();*/ |
| 3946 | 464 | systray_remove_nid(); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
465 | DestroyMenu(systray_menu); |
|
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
466 | DestroyWindow(systray_hwnd); |
| 3946 | 467 | } |
| 468 | ||
|
3972
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
469 | void wgaim_systray_minimize( GtkWidget *window ) { |
|
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
470 | MinimizeWndToTray(GDK_WINDOW_HWND(window->window)); |
|
3959
3d86547a1d75
[gaim-migrate @ 4141]
Herman Bloggs <herman@bluedigits.com>
parents:
3946
diff
changeset
|
471 | } |
|
3972
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
472 | |
|
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
473 | void wgaim_systray_maximize( GtkWidget *window ) { |
|
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
474 | RestoreWndFromTray(GDK_WINDOW_HWND(window->window)); |
|
3ae6879c1bae
[gaim-migrate @ 4156]
Herman Bloggs <herman@bluedigits.com>
parents:
3959
diff
changeset
|
475 | } |