Mercurial > pidgin.yaz
comparison plugins/win32/transparency/win2ktrans.c @ 5854:14891982dbee
[gaim-migrate @ 6285]
Update to new prefs api and new debug api. Thanks SimGuy3k
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Fri, 13 Jun 2003 16:49:00 +0000 |
parents | 6d6ae91c5de7 |
children | b3c412884a22 |
comparison
equal
deleted
inserted
replaced
5853:3ed4c7df2f41 | 5854:14891982dbee |
---|---|
23 #include <gdk/gdkwin32.h> | 23 #include <gdk/gdkwin32.h> |
24 #include <gmodule.h> | 24 #include <gmodule.h> |
25 #include "gaim.h" | 25 #include "gaim.h" |
26 #include "gtkplugin.h" | 26 #include "gtkplugin.h" |
27 #include "gtkblist.h" | 27 #include "gtkblist.h" |
28 #include "prefs.h" | |
28 #include "win32dep.h" | 29 #include "win32dep.h" |
29 | 30 |
30 /* | 31 /* |
31 * MACROS & DEFINES | 32 * MACROS & DEFINES |
32 */ | 33 */ |
33 #define WINTRANS_PLUGIN_ID "win-gaim-trans" | 34 #define WINTRANS_PLUGIN_ID "gtk-win-trans" |
34 #define WINTRANS_VERSION 1 | 35 #define WINTRANS_VERSION 1 |
35 | 36 |
36 /* These defines aren't found in mingw's winuser.h */ | 37 /* These defines aren't found in mingw's winuser.h */ |
37 #ifndef LWA_ALPHA | 38 #ifndef LWA_ALPHA |
38 #define LWA_ALPHA 0x00000002 | 39 #define LWA_ALPHA 0x00000002 |
40 | 41 |
41 #ifndef WS_EX_LAYERED | 42 #ifndef WS_EX_LAYERED |
42 #define WS_EX_LAYERED 0x00080000 | 43 #define WS_EX_LAYERED 0x00080000 |
43 #endif | 44 #endif |
44 | 45 |
45 /* Transparency plugin configuration */ | |
46 #define OPT_WGAIM_IMTRANS 0x00000001 | |
47 #define OPT_WGAIM_SHOW_IMTRANS 0x00000002 | |
48 #define OPT_WGAIM_BLTRANS 0x00000004 | |
49 #define OPT_WGAIM_BUDDYWIN_ONTOP 0x00000008 | |
50 | |
51 #define blist (gaim_get_blist()?(GAIM_GTK_BLIST(gaim_get_blist())?((GAIM_GTK_BLIST(gaim_get_blist()))->window):NULL):NULL) | 46 #define blist (gaim_get_blist()?(GAIM_GTK_BLIST(gaim_get_blist())?((GAIM_GTK_BLIST(gaim_get_blist()))->window):NULL):NULL) |
52 | 47 |
53 /* | 48 /* |
54 * DATA STRUCTS | 49 * DATA STRUCTS |
55 */ | 50 */ |
64 */ | 59 */ |
65 | 60 |
66 /* | 61 /* |
67 * LOCALS | 62 * LOCALS |
68 */ | 63 */ |
64 static const char *OPT_WINTRANS_IM_ENABLED="/plugins/gtk/win32/wintrans/im_enabled"; | |
65 static const char *OPT_WINTRANS_IM_ALPHA ="/plugins/gtk/win32/wintrans/im_alpha"; | |
66 static const char *OPT_WINTRANS_IM_SLIDER ="/plugins/gtk/win32/wintrans/im_slider"; | |
67 static const char *OPT_WINTRANS_BL_ENABLED="/plugins/gtk/win32/wintrans/bl_enabled"; | |
68 static const char *OPT_WINTRANS_BL_ALPHA ="/plugins/gtk/win32/wintrans/bl_alpha"; | |
69 static const char *OPT_WINTRANS_BL_ON_TOP ="/plugins/gtk/win32/wintrans/bl_on_top"; | |
69 static int imalpha = 255; | 70 static int imalpha = 255; |
70 static int blalpha = 255; | 71 static int blalpha = 255; |
71 guint trans_options = 0; | |
72 GList *window_list = NULL; | 72 GList *window_list = NULL; |
73 | 73 |
74 /* | 74 /* |
75 * PROTOS | 75 * PROTOS |
76 */ | 76 */ |
77 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL; | 77 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL; |
78 static void save_trans_prefs(); | |
79 | 78 |
80 /* | 79 /* |
81 * CODE | 80 * CODE |
82 */ | 81 */ |
83 static GtkWidget *wgaim_button(const char *text, guint *options, int option, GtkWidget *page) { | 82 static GtkWidget *wgaim_button(const char *text, const char *pref, GtkWidget *page) { |
84 GtkWidget *button; | 83 GtkWidget *button; |
85 button = gtk_check_button_new_with_mnemonic(text); | 84 button = gtk_check_button_new_with_mnemonic(text); |
86 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (*options & option)); | 85 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), gaim_prefs_get_bool(pref)); |
87 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); | 86 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); |
88 g_object_set_data(G_OBJECT(button), "options", options); | |
89 gtk_widget_show(button); | 87 gtk_widget_show(button); |
90 return button; | 88 return button; |
91 } | 89 } |
92 | 90 |
93 /* Set window transparency level */ | 91 /* Set window transparency level */ |
94 void set_wintrans(GtkWidget *window, int trans) { | 92 void set_wintrans(GtkWidget *window, int trans) { |
95 if(MySetLayeredWindowAttributes) { | 93 if(MySetLayeredWindowAttributes) { |
162 } | 160 } |
163 | 161 |
164 gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { | 162 gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { |
165 slider_win *slidwin=NULL; | 163 slider_win *slidwin=NULL; |
166 /* Remove window from the window list */ | 164 /* Remove window from the window list */ |
167 debug_printf("win2ktrans.dll: Conv window destoyed.. removing from list\n"); | 165 gaim_debug(GAIM_DEBUG_INFO, WINTRANS_PLUGIN_ID, "Conv window destoyed.. removing from list\n"); |
168 | 166 |
169 if((slidwin=find_slidwin(widget))) { | 167 if((slidwin=find_slidwin(widget))) { |
170 window_list = g_list_remove(window_list, (gpointer)slidwin); | 168 window_list = g_list_remove(window_list, (gpointer)slidwin); |
171 g_free(slidwin); | 169 g_free(slidwin); |
172 } | 170 } |
186 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); | 184 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c)); |
187 | 185 |
188 win = gtkwin->window; | 186 win = gtkwin->window; |
189 | 187 |
190 /* check prefs to see if we want trans */ | 188 /* check prefs to see if we want trans */ |
191 if ((trans_options & OPT_WGAIM_IMTRANS) && | 189 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { |
192 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) { | |
193 /* Look up this window to see if it already has a scroller */ | 190 /* Look up this window to see if it already has a scroller */ |
194 if(!find_slidwin(win)) { | 191 if(!find_slidwin(win)) { |
195 GtkWidget *slider_box=NULL; | 192 GtkWidget *slider_box=NULL; |
196 slider_win *slidwin=NULL; | 193 slider_win *slidwin=NULL; |
197 | 194 |
200 wl != NULL; | 197 wl != NULL; |
201 wl = wl->next ) { | 198 wl = wl->next ) { |
202 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) ) | 199 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) ) |
203 vbox = GTK_WIDGET(wl->data); | 200 vbox = GTK_WIDGET(wl->data); |
204 else { | 201 else { |
205 debug_printf("no vbox found\n"); | 202 gaim_debug(GAIM_DEBUG_ERROR, WINTRANS_PLUGIN_ID, "no vbox found\n"); |
206 return; | 203 return; |
207 } | 204 } |
208 } | 205 } |
209 g_list_free(wl1); | 206 g_list_free(wl1); |
210 | 207 |
222 } | 219 } |
223 else | 220 else |
224 return; | 221 return; |
225 } | 222 } |
226 | 223 |
227 if((trans_options & OPT_WGAIM_IMTRANS) && | 224 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) && |
228 !(trans_options & OPT_WGAIM_SHOW_IMTRANS)) { | 225 !gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { |
229 set_wintrans(win, imalpha); | 226 set_wintrans(win, imalpha); |
230 } | 227 } |
231 } | 228 } |
232 | 229 |
233 static void blist_created() { | 230 static void blist_created() { |
234 if(blist) { | 231 if(blist) { |
235 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP) | 232 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ON_TOP)) |
236 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); | 233 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); |
237 else | 234 else |
238 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); | 235 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); |
239 | 236 |
240 if(trans_options & OPT_WGAIM_BLTRANS) | 237 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
241 set_wintrans(blist, blalpha); | 238 set_wintrans(blist, blalpha); |
242 else | 239 else |
243 set_wintrans_off(blist); | 240 set_wintrans_off(blist); |
244 } | 241 } |
245 } | 242 } |
246 | 243 |
247 static void alpha_change(GtkWidget *w, gpointer data) { | 244 static void alpha_change(GtkWidget *w, gpointer data) { |
248 int *alpha = (int*)data; | 245 int *alpha = (int*)data; |
249 *alpha = gtk_range_get_value(GTK_RANGE(w)); | 246 *alpha = gtk_range_get_value(GTK_RANGE(w)); |
247 } | |
248 | |
249 static void alpha_pref_set_int(GtkWidget *w, GdkEventFocus *e, const char *pref) { | |
250 int alpha = 0; | |
251 if (pref == OPT_WINTRANS_IM_ALPHA) | |
252 alpha = imalpha; | |
253 else if (pref == OPT_WINTRANS_BL_ALPHA) | |
254 alpha = blalpha; | |
255 | |
256 gaim_prefs_set_int(pref, alpha); | |
250 } | 257 } |
251 | 258 |
252 static void bl_alpha_change(GtkWidget *w, gpointer data) { | 259 static void bl_alpha_change(GtkWidget *w, gpointer data) { |
253 alpha_change(w, data); | 260 alpha_change(w, data); |
254 if(blist) | 261 if(blist) |
255 change_alpha(w, blist); | 262 change_alpha(w, blist); |
256 } | 263 } |
257 | 264 |
258 /* Load options */ | 265 static void set_trans_option(GtkWidget *w, const char *pref) { |
259 static void load_trans_prefs() { | 266 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
260 FILE *f; | 267 if(pref == OPT_WINTRANS_BL_ON_TOP) { |
261 char buf[1024]; | |
262 int ver=0; | |
263 char tag[256]; | |
264 | |
265 if (gaim_home_dir()) | |
266 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "wintransrc", gaim_home_dir()); | |
267 else | |
268 return; | |
269 | |
270 if ((f = fopen(buf, "r"))) { | |
271 fgets(buf, sizeof(buf), f); | |
272 sscanf(buf, "# wintransrc v%d", &ver); | |
273 if ((ver > 1) || (buf[0] != '#')) | |
274 return; | |
275 | |
276 while (!feof(f)) { | |
277 fgets(buf, sizeof(buf), f); | |
278 sscanf(buf, "%s {", tag); | |
279 if (strcmp(tag, "options")==0) { | |
280 fgets(buf, sizeof(buf), f); | |
281 sscanf(buf, "\ttrans_options { %d", &trans_options); | |
282 continue; | |
283 } else if (strcmp(tag, "trans")==0) { | |
284 int num; | |
285 for(fgets(buf, sizeof(buf), f);buf[0] != '}' && !feof(f);fgets(buf, sizeof(buf), f)) { | |
286 sscanf(buf, "\t%s { %d", tag, &num); | |
287 if(strcmp(tag, "imalpha")==0) { | |
288 imalpha = num; | |
289 } | |
290 else if(strcmp(tag, "blalpha")==0) { | |
291 blalpha = num; | |
292 } | |
293 } | |
294 } | |
295 } | |
296 } | |
297 else | |
298 save_trans_prefs(); | |
299 blist_created(); | |
300 } | |
301 | |
302 /* Save options */ | |
303 | |
304 static void write_options(FILE *f) { | |
305 fprintf(f, "options {\n"); | |
306 fprintf(f, "\ttrans_options { %u }\n", trans_options); | |
307 fprintf(f, "}\n"); | |
308 } | |
309 | |
310 static void write_trans(FILE *f) { | |
311 fprintf(f, "trans {\n"); | |
312 fprintf(f, "\timalpha { %d }\n", imalpha); | |
313 fprintf(f, "\tblalpha { %d }\n", blalpha); | |
314 fprintf(f, "}\n"); | |
315 } | |
316 | |
317 static void save_trans_prefs() { | |
318 FILE *f; | |
319 char buf[1024]; | |
320 | |
321 if (gaim_home_dir()) { | |
322 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "wintransrc", gaim_home_dir()); | |
323 } | |
324 else | |
325 return; | |
326 | |
327 if ((f = fopen(buf, "w"))) { | |
328 fprintf(f, "# wintransrc v%d\n", WINTRANS_VERSION); | |
329 write_trans(f); | |
330 write_options(f); | |
331 fclose(f); | |
332 } | |
333 else | |
334 debug_printf("Error opening wintransrc\n"); | |
335 } | |
336 | |
337 static void set_trans_option(GtkWidget *w, int option) { | |
338 trans_options ^= option; | |
339 save_trans_prefs(); | |
340 | |
341 if(option == OPT_WGAIM_BUDDYWIN_ONTOP) { | |
342 if(blist) { | 268 if(blist) { |
343 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP) | 269 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) |
344 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); | 270 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); |
345 else | 271 else |
346 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); | 272 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); |
347 } | 273 } |
348 } else if(option == OPT_WGAIM_BLTRANS) { | 274 } else if(pref == OPT_WINTRANS_BL_ENABLED) { |
349 if(blist) { | 275 if(blist) { |
350 if(trans_options & OPT_WGAIM_BLTRANS) | 276 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) |
351 set_wintrans(blist, blalpha); | 277 set_wintrans(blist, blalpha); |
352 else | 278 else |
353 set_wintrans_off(blist); | 279 set_wintrans_off(blist); |
354 } | 280 } |
355 } | 281 } |
357 | 283 |
358 /* | 284 /* |
359 * EXPORTED FUNCTIONS | 285 * EXPORTED FUNCTIONS |
360 */ | 286 */ |
361 G_MODULE_EXPORT gboolean plugin_load(GaimPlugin *plugin) { | 287 G_MODULE_EXPORT gboolean plugin_load(GaimPlugin *plugin) { |
288 imalpha = gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA); | |
289 blalpha = gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA); | |
290 | |
362 gaim_signal_connect(plugin, event_new_conversation, gaim_new_conversation, NULL); | 291 gaim_signal_connect(plugin, event_new_conversation, gaim_new_conversation, NULL); |
363 gaim_signal_connect(plugin, event_signon, blist_created, NULL); | 292 gaim_signal_connect(plugin, event_signon, blist_created, NULL); |
364 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" ); | 293 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" ); |
365 load_trans_prefs(); | 294 |
295 if(blist) { | |
296 blist_created(); | |
297 } | |
366 | 298 |
367 return TRUE; | 299 return TRUE; |
368 } | 300 } |
369 | 301 |
370 G_MODULE_EXPORT gboolean plugin_unload(GaimPlugin *plugin) { | 302 G_MODULE_EXPORT gboolean plugin_unload(GaimPlugin *plugin) { |
371 debug_printf("Removing win2ktrans.dll plugin\n"); | 303 gaim_debug(GAIM_DEBUG_INFO, WINTRANS_PLUGIN_ID, "Removing win2ktrans.dll plugin\n"); |
372 | 304 |
373 /* Remove slider bars */ | 305 /* Remove slider bars */ |
374 if(window_list) { | 306 if(window_list) { |
375 GList *tmp=window_list; | 307 GList *tmp=window_list; |
376 while(tmp) { | 308 while(tmp) { |
401 ret = gtk_vbox_new(FALSE, 18); | 333 ret = gtk_vbox_new(FALSE, 18); |
402 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | 334 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
403 | 335 |
404 /* IM Convo trans options */ | 336 /* IM Convo trans options */ |
405 imtransbox = gaim_gtk_make_frame (ret, _("IM Conversation Windows")); | 337 imtransbox = gaim_gtk_make_frame (ret, _("IM Conversation Windows")); |
406 button = wgaim_button(_("_IM window transparency"), &trans_options, OPT_WGAIM_IMTRANS, imtransbox); | 338 button = wgaim_button(_("_IM window transparency"), OPT_WINTRANS_IM_ENABLED, imtransbox); |
407 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_IMTRANS); | 339 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_IM_ENABLED); |
408 | 340 |
409 trans_box = gtk_vbox_new(FALSE, 18); | 341 trans_box = gtk_vbox_new(FALSE, 18); |
410 if (!(trans_options & OPT_WGAIM_IMTRANS)) | 342 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) |
411 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); | 343 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
412 gtk_widget_show(trans_box); | 344 gtk_widget_show(trans_box); |
413 | 345 |
414 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); | 346 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); |
415 | 347 |
416 button = wgaim_button(_("_Show slider bar in IM window"), &trans_options, OPT_WGAIM_SHOW_IMTRANS, trans_box); | 348 button = wgaim_button(_("_Show slider bar in IM window"), OPT_WINTRANS_IM_SLIDER, trans_box); |
417 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_SHOW_IMTRANS); | 349 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_IM_SLIDER); |
418 | 350 |
419 gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5); | 351 gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5); |
420 | 352 |
421 /* IM transparency slider */ | 353 /* IM transparency slider */ |
422 hbox = gtk_hbox_new(FALSE, 5); | 354 hbox = gtk_hbox_new(FALSE, 5); |
427 slider = gtk_hscale_new_with_range(50,255,1); | 359 slider = gtk_hscale_new_with_range(50,255,1); |
428 gtk_range_set_value(GTK_RANGE(slider), imalpha); | 360 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
429 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); | 361 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
430 | 362 |
431 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), (void*)&imalpha); | 363 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), (void*)&imalpha); |
432 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL); | 364 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(alpha_pref_set_int), (void *)OPT_WINTRANS_IM_ALPHA); |
433 | 365 |
434 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | 366 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
435 | 367 |
436 gtk_widget_show_all(hbox); | 368 gtk_widget_show_all(hbox); |
437 | 369 |
438 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); | 370 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); |
439 | 371 |
440 /* Buddy List trans options */ | 372 /* Buddy List trans options */ |
441 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); | 373 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); |
442 button = wgaim_button(_("_Keep Buddy List window on top"), &trans_options, OPT_WGAIM_BUDDYWIN_ONTOP, bltransbox); | 374 button = wgaim_button(_("_Keep Buddy List window on top"), OPT_WINTRANS_BL_ON_TOP, bltransbox); |
443 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_BUDDYWIN_ONTOP); | 375 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ON_TOP); |
444 | 376 |
445 button = wgaim_button(_("_Buddy List window transparency"), &trans_options, OPT_WGAIM_BLTRANS, bltransbox); | 377 button = wgaim_button(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox); |
446 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_BLTRANS); | 378 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ENABLED); |
447 | 379 |
448 trans_box = gtk_vbox_new(FALSE, 18); | 380 trans_box = gtk_vbox_new(FALSE, 18); |
449 if (!(trans_options & OPT_WGAIM_BLTRANS)) | 381 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
450 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); | 382 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
451 gtk_widget_show(trans_box); | 383 gtk_widget_show(trans_box); |
452 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); | 384 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); |
453 gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5); | 385 gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5); |
454 | 386 |
461 slider = gtk_hscale_new_with_range(50,255,1); | 393 slider = gtk_hscale_new_with_range(50,255,1); |
462 gtk_range_set_value(GTK_RANGE(slider), blalpha); | 394 gtk_range_set_value(GTK_RANGE(slider), blalpha); |
463 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); | 395 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
464 | 396 |
465 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), (void*)&blalpha); | 397 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), (void*)&blalpha); |
466 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL); | 398 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(alpha_pref_set_int), (void *)OPT_WINTRANS_BL_ALPHA); |
467 | 399 |
468 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | 400 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
469 | 401 |
470 gtk_widget_show_all(hbox); | 402 gtk_widget_show_all(hbox); |
471 | 403 |
472 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); | 404 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); |
473 | 405 |
474 /* If this version of Windows dosn't support Transparency, grey out options */ | 406 /* If this version of Windows dosn't support Transparency, grey out options */ |
475 if(!has_transparency()) { | 407 if(!has_transparency()) { |
476 debug_printf("This version of windows dosn't support transparency\n"); | 408 gaim_debug(GAIM_DEBUG_WARNING, WINTRANS_PLUGIN_ID, "This version of windows dosn't support transparency\n"); |
477 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE); | 409 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE); |
478 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); | 410 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
479 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); | 411 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
480 } | 412 } |
481 | 413 |
514 &ui_info, /**< ui_info */ | 446 &ui_info, /**< ui_info */ |
515 NULL /**< extra_info */ | 447 NULL /**< extra_info */ |
516 }; | 448 }; |
517 | 449 |
518 static void | 450 static void |
519 __init_plugin(GaimPlugin *plugin) | 451 init_plugin(GaimPlugin *plugin) |
520 { | 452 { |
521 } | 453 gaim_prefs_add_none("/plugins/gtk/win32"); |
522 | 454 gaim_prefs_add_none("/plugins/gtk/win32/wintrans"); |
523 GAIM_INIT_PLUGIN(wintrans, __init_plugin, info); | 455 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_enabled", FALSE); |
456 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/im_alpha", 255); | |
457 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_slider", FALSE); | |
458 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_enabled", FALSE); | |
459 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/bl_alpha", 255); | |
460 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_on_top", FALSE); | |
461 } | |
462 | |
463 GAIM_INIT_PLUGIN(wintrans, init_plugin, info); |