Mercurial > pidgin.yaz
comparison plugins/win32/transparency/win2ktrans.c @ 4569:7f2de19d052d
[gaim-migrate @ 4850]
Bug fix. Gaim would crash if using the IM convo window slider bars after plugin removal.
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Tue, 11 Feb 2003 00:58:28 +0000 |
parents | d629e7989a8a |
children | 864518c3767d |
comparison
equal
deleted
inserted
replaced
4568:ddc1f12b52d6 | 4569:7f2de19d052d |
---|---|
44 /* Transparency plugin configuration */ | 44 /* Transparency plugin configuration */ |
45 #define OPT_WGAIM_IMTRANS 0x00000001 | 45 #define OPT_WGAIM_IMTRANS 0x00000001 |
46 #define OPT_WGAIM_SHOW_IMTRANS 0x00000002 | 46 #define OPT_WGAIM_SHOW_IMTRANS 0x00000002 |
47 #define OPT_WGAIM_BLTRANS 0x00000004 | 47 #define OPT_WGAIM_BLTRANS 0x00000004 |
48 #define OPT_WGAIM_BUDDYWIN_ONTOP 0x00000008 | 48 #define OPT_WGAIM_BUDDYWIN_ONTOP 0x00000008 |
49 | |
50 /* | |
51 * DATA STRUCTS | |
52 */ | |
53 typedef struct { | |
54 GtkWidget *win; | |
55 GtkWidget *slider; | |
56 } slider_win; | |
57 | |
49 | 58 |
50 /* | 59 /* |
51 * GLOBALS | 60 * GLOBALS |
52 */ | 61 */ |
53 G_MODULE_IMPORT GtkWidget *blist; | 62 G_MODULE_IMPORT GtkWidget *blist; |
128 gtk_widget_show_all(hbox); | 137 gtk_widget_show_all(hbox); |
129 | 138 |
130 return frame; | 139 return frame; |
131 } | 140 } |
132 | 141 |
142 static slider_win* find_slidwin( GtkWidget *win ) { | |
143 GList *tmp = window_list; | |
144 | |
145 while(tmp) { | |
146 if( ((slider_win*)(tmp->data))->win == win) | |
147 return (slider_win*)tmp->data; | |
148 tmp = tmp->next; | |
149 } | |
150 return NULL; | |
151 } | |
152 | |
133 gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { | 153 gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { |
154 slider_win *slidwin=NULL; | |
134 /* Remove window from the window list */ | 155 /* Remove window from the window list */ |
135 debug_printf("win2ktrans.dll: Conv window destoyed.. removing from list\n"); | 156 debug_printf("win2ktrans.dll: Conv window destoyed.. removing from list\n"); |
136 window_list = g_list_remove(window_list, (gpointer)widget); | 157 |
158 if((slidwin=find_slidwin(widget))) { | |
159 window_list = g_list_remove(window_list, (gpointer)slidwin); | |
160 g_free(slidwin); | |
161 } | |
137 return FALSE; | 162 return FALSE; |
138 } | 163 } |
139 | 164 |
140 static void gaim_new_conversation(char *who) { | 165 static void gaim_new_conversation(char *who) { |
141 GList *wl, *wl1; | 166 GList *wl, *wl1; |
150 | 175 |
151 /* check prefs to see if we want trans */ | 176 /* check prefs to see if we want trans */ |
152 if ((trans_options & OPT_WGAIM_IMTRANS) && | 177 if ((trans_options & OPT_WGAIM_IMTRANS) && |
153 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) { | 178 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) { |
154 /* Look up this window to see if it already has a scroller */ | 179 /* Look up this window to see if it already has a scroller */ |
155 if(!g_list_find(window_list, (gpointer)win)) { | 180 if(!find_slidwin(win)) { |
156 GtkWidget *slider_box=NULL; | 181 GtkWidget *slider_box=NULL; |
182 slider_win *slidwin=NULL; | |
157 | 183 |
158 /* Get top vbox */ | 184 /* Get top vbox */ |
159 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win)); | 185 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win)); |
160 wl != NULL; | 186 wl != NULL; |
161 wl = wl->next ) { | 187 wl = wl->next ) { |
170 | 196 |
171 slider_box = wintrans_slider(win); | 197 slider_box = wintrans_slider(win); |
172 gtk_box_pack_start(GTK_BOX(vbox), | 198 gtk_box_pack_start(GTK_BOX(vbox), |
173 slider_box, | 199 slider_box, |
174 FALSE, FALSE, 0); | 200 FALSE, FALSE, 0); |
175 /* Add window to list, to track that it has a scroller */ | 201 /* Add window to list, to track that it has a slider */ |
176 window_list = g_list_append(window_list, (gpointer)win); | 202 slidwin = g_new0( slider_win, 1 ); |
203 slidwin->win = win; | |
204 slidwin->slider = slider_box; | |
205 window_list = g_list_append(window_list, (gpointer)slidwin); | |
177 /* Set callback to remove window from the list, if the window is destroyed */ | 206 /* Set callback to remove window from the list, if the window is destroyed */ |
178 g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL); | 207 g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL); |
179 } | 208 } |
180 else | 209 else |
181 return; | 210 return; |
325 return NULL; | 354 return NULL; |
326 } | 355 } |
327 | 356 |
328 G_MODULE_EXPORT void gaim_plugin_remove() { | 357 G_MODULE_EXPORT void gaim_plugin_remove() { |
329 debug_printf("Removing win2ktrans.dll plugin\n"); | 358 debug_printf("Removing win2ktrans.dll plugin\n"); |
359 | |
360 /* Remove slider bars */ | |
330 if(window_list) { | 361 if(window_list) { |
362 GList *tmp=window_list; | |
363 while(tmp) { | |
364 slider_win *slidwin = (slider_win*)tmp->data; | |
365 gtk_widget_destroy(slidwin->slider); | |
366 set_wintrans_off(slidwin->win); | |
367 g_free(slidwin); | |
368 tmp=tmp->next; | |
369 } | |
331 g_list_free(window_list); | 370 g_list_free(window_list); |
332 window_list = NULL; | 371 window_list = NULL; |
333 } | 372 } |
334 if(blist) { | 373 if(blist) { |
335 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); | 374 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); |