annotate plugins/win32/transparency/win2ktrans.c @ 10087:9fdbfe832fac

[gaim-migrate @ 11098] gaim_prefs_connect_callback() now takes a handle that can be used to disconnect the callbacks later on. The callback id's remain, so people can still use those if they want, although I'm not sure if there's any need for them any more. I also switched the order for initializing the prefs subsystem and statically compiled protocol plugins so that prpl prefs can work for statically compiled prpls. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Tue, 12 Oct 2004 00:49:19 +0000
parents a9fb4493ae22
children 67db2cbc0294
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
6435
53a613fed06d [gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6408
diff changeset
2 * gaim - Transparency plugin
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net>
6435
53a613fed06d [gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6408
diff changeset
5 * copyright (c) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * this program is free software; you can redistribute it and/or modify
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * it under the terms of the gnu general public license as published by
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * the free software foundation; either version 2 of the license, or
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * (at your option) any later version.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * this program is distributed in the hope that it will be useful,
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * but without any warranty; without even the implied warranty of
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * merchantability or fitness for a particular purpose. see the
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * gnu general public license for more details.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * you should have received a copy of the gnu general public license
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * along with this program; if not, write to the free software
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
22 #include <gdk/gdkwin32.h>
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
23 #include "internal.h"
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
24
6494
4f93f10ddc75 [gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6435
diff changeset
25 #include "core.h"
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
26 #include "prefs.h"
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
27 #include "debug.h"
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
28
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
29 #include "gtkconv.h"
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
30 #include "gtkplugin.h"
5248
d635e8fe2fba [gaim-migrate @ 5620]
Mark Doliner <mark@kingant.net>
parents: 5224
diff changeset
31 #include "gtkblist.h"
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
32 #include "gtkutils.h"
6494
4f93f10ddc75 [gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6435
diff changeset
33 #include "signals.h"
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9915
diff changeset
34 #include "version.h"
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
36 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
37 * MACROS & DEFINES
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
38 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
39 #define WINTRANS_PLUGIN_ID "gtk-win-trans"
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
40 #define WINTRANS_VERSION 1
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
41
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
42 /* These defines aren't found in mingw's winuser.h */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
43 #ifndef LWA_ALPHA
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
44 #define LWA_ALPHA 0x00000002
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
45 #endif
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
46
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
47 #ifndef WS_EX_LAYERED
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
48 #define WS_EX_LAYERED 0x00080000
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
49 #endif
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
50
4726
0b1c01fd68f1 [gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
51 #define blist (gaim_get_blist()?(GAIM_GTK_BLIST(gaim_get_blist())?((GAIM_GTK_BLIST(gaim_get_blist()))->window):NULL):NULL)
0b1c01fd68f1 [gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
52
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
53 /*
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
54 * DATA STRUCTS
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
55 */
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
56 typedef struct {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
57 GtkWidget *win;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
58 GtkWidget *slider;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
59 } slider_win;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
60
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
61
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
62 /*
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
63 * GLOBALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
64 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
65
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
66 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
67 * LOCALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
68 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
69 static const char *OPT_WINTRANS_IM_ENABLED="/plugins/gtk/win32/wintrans/im_enabled";
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
70 static const char *OPT_WINTRANS_IM_ALPHA ="/plugins/gtk/win32/wintrans/im_alpha";
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
71 static const char *OPT_WINTRANS_IM_SLIDER ="/plugins/gtk/win32/wintrans/im_slider";
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
72 static const char *OPT_WINTRANS_BL_ENABLED="/plugins/gtk/win32/wintrans/bl_enabled";
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
73 static const char *OPT_WINTRANS_BL_ALPHA ="/plugins/gtk/win32/wintrans/bl_alpha";
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
74 static int imalpha = 255;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
75 static int blalpha = 255;
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
76 static GList *window_list = NULL;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
77
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
78 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
79 * PROTOS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
80 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
81 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
82
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
83 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
84 * CODE
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
85 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
86 static GtkWidget *wgaim_button(const char *text, const char *pref, GtkWidget *page) {
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
87 GtkWidget *button;
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
88 button = gtk_check_button_new_with_mnemonic(text);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
89 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), gaim_prefs_get_bool(pref));
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
90 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0);
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
91 gtk_widget_show(button);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
92 return button;
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
93 }
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
94
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
95 /* Set window transparency level */
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
96 static void set_wintrans(GtkWidget *window, int trans) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
97 if(MySetLayeredWindowAttributes) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
98 HWND hWnd = GDK_WINDOW_HWND(window->window);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
99 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
100 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
101 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
102 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
103
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
104 static void set_wintrans_off(GtkWidget *window) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
105 if(MySetLayeredWindowAttributes) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
106 HWND hWnd = GDK_WINDOW_HWND(window->window);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
107 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
108
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
109 /* Ask the window and its children to repaint */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
110 RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
111 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
112 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
113
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
114 static void change_alpha(GtkWidget *w, gpointer data) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
115 set_wintrans(GTK_WIDGET(data), gtk_range_get_value(GTK_RANGE(w)));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
116 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
117
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
118 static int has_transparency() {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
119 return MySetLayeredWindowAttributes ? TRUE : FALSE;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
120 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
121
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
122 static GtkWidget *wintrans_slider(GtkWidget *win) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
123 GtkWidget *hbox;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
124 GtkWidget *label, *slider;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
125 GtkWidget *frame;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
126
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
127 frame = gtk_frame_new(NULL);
9915
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
128 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
129 gtk_widget_show(frame);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
130
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
131 hbox = gtk_hbox_new(FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
132 gtk_container_add(GTK_CONTAINER(frame), hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
133
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
134 label = gtk_label_new(_("Opacity:"));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
135 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
136 gtk_widget_show(hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
137
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
138 slider = gtk_hscale_new_with_range(50,255,1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
139 gtk_range_set_value(GTK_RANGE(slider), imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
140 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
141
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
142 /* On slider val change, update window's transparency level */
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
143 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(change_alpha), win);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
144
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
145 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
146
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
147 /* Set the initial transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
148 set_wintrans(win, imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
149
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
150 gtk_widget_show_all(hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
151
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
152 return frame;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
153 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
154
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
155 static slider_win* find_slidwin( GtkWidget *win ) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
156 GList *tmp = window_list;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
157
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
158 while(tmp) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
159 if( ((slider_win*)(tmp->data))->win == win)
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
160 return (slider_win*)tmp->data;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
161 tmp = tmp->next;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
162 }
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
163 return NULL;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
164 }
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
165
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
166 static gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
167 slider_win *slidwin=NULL;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
168 /* Remove window from the window list */
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
169 gaim_debug_info(WINTRANS_PLUGIN_ID, "Conv window destoyed.. removing from list\n");
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
170
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
171 if((slidwin=find_slidwin(widget))) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
172 window_list = g_list_remove(window_list, (gpointer)slidwin);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
173 g_free(slidwin);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
174 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
175 return FALSE;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
176 }
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
177
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
178 static void set_trans_option(GtkWidget *w, const char *pref) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
179 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
180 if(pref == OPT_WINTRANS_BL_ENABLED) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
181 if(blist) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
182 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
183 set_wintrans(blist, blalpha);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
184 else
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
185 set_wintrans_off(blist);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
186 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
187 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
188 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
189
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
190 static void add_slider(GtkWidget *win) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
191 GList *wl, *wl1;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
192 GtkWidget *vbox=NULL;
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
193
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
194 /* Look up this window to see if it already has a slider */
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
195 if(!find_slidwin(win)) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
196 GtkWidget *slider_box=NULL;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
197 slider_win *slidwin=NULL;
9915
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
198 GtkRequisition slidereq;
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
199 gint width, height;
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
200
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
201 /* Get top vbox */
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
202 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win));
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
203 wl != NULL;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
204 wl = wl->next ) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
205 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) )
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
206 vbox = GTK_WIDGET(wl->data);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
207 else {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
208 gaim_debug_error(WINTRANS_PLUGIN_ID, "no vbox found\n");
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
209 return;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
210 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
211 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
212 g_list_free(wl1);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
213
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
214 slider_box = wintrans_slider(win);
9915
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
215 /* Figure out how tall the slider wants to be */
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
216 gtk_widget_size_request(slider_box, &slidereq);
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
217 gtk_window_get_size(GTK_WINDOW(win), &width, &height);
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
218 gtk_box_pack_start(GTK_BOX(vbox),
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
219 slider_box,
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
220 FALSE, FALSE, 0);
9915
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
221 /* Make window taller so we don't slowly collapse its message area */
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
222 gtk_window_resize(GTK_WINDOW(win), width, (height + slidereq.height));
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
223 /* Add window to list, to track that it has a slider */
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
224 slidwin = g_new0( slider_win, 1 );
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
225 slidwin->win = win;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
226 slidwin->slider = slider_box;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
227 window_list = g_list_append(window_list, (gpointer)slidwin);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
228 /* Set callback to remove window from the list, if the window is destroyed */
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
229 g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
230 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
231 }
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
232
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
233 static void remove_sliders() {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
234 if(window_list) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
235 GList *tmp=window_list;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
236 while(tmp) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
237 slider_win *slidwin = (slider_win*)tmp->data;
9915
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
238 if (slidwin != NULL && GTK_IS_WINDOW(slidwin->win)) {
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
239 GtkRequisition slidereq;
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
240 gint width, height;
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
241 /* Figure out how tall the slider was */
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
242 gtk_widget_size_request(slidwin->slider, &slidereq);
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
243 gtk_window_get_size(GTK_WINDOW(slidwin->win), &width, &height);
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
244
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
245 gtk_widget_destroy(slidwin->slider);
9915
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
246
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
247 gtk_window_resize(GTK_WINDOW(slidwin->win), width, (height - slidereq.height));
0ddc84d81eac [gaim-migrate @ 10807]
Luke Schierer <lschiere@pidgin.im>
parents: 9840
diff changeset
248 }
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
249 g_free(slidwin);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
250 tmp=tmp->next;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
251 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
252 g_list_free(window_list);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
253 window_list = NULL;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
254 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
255 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
256
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
257 static void remove_convs_wintrans() {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
258 GList *conv;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
259
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
260 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next)
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
261 set_wintrans_off(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
262 }
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
263
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
264 static void update_convs_wintrans(GtkWidget *w, const char *pref) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
265 GList *conv;
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
266
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
267 if (w != NULL)
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
268 set_trans_option(w, pref);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
269
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
270 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
271 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next)
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
272 set_wintrans(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window, gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA));
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
273 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
274 else
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
275 remove_convs_wintrans();
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
276
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
277 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
278 && gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
279 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next)
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
280 add_slider(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
281 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
282 else
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
283 remove_sliders();
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
284 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
285
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
286 static void set_window_trans(GaimConvWindow *oldwin, GaimConvWindow *newwin) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
287 GtkWidget *win = GAIM_GTK_WINDOW(newwin)->window;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
289 /* check prefs to see if we want trans */
6435
53a613fed06d [gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6408
diff changeset
290 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) && gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
291 add_slider(win);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
292 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
293
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
294 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) &&
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
295 !gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
296 set_wintrans(win, imalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
297 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
298 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
299
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
300 static void gaim_new_conversation(GaimConversation *c) {
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
301 GaimConvWindow *win = gaim_conversation_get_window(c);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
302 set_window_trans(NULL, win);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
303 }
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
304
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
305 static void blist_created() {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
306 if(blist) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
307 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
308 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
309 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
310 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
311 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
312 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
313
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
314 static void alpha_change(GtkWidget *w, gpointer data) {
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
315 GList *conv;
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
316 imalpha = gtk_range_get_value(GTK_RANGE(w));
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
317
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
318 for(conv = gaim_get_conversations(); conv != NULL; conv = conv->next)
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
319 set_wintrans(GAIM_GTK_WINDOW(gaim_conversation_get_window(conv->data))->window, imalpha);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
320 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
321
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
322 static void alpha_pref_set_int(GtkWidget *w, GdkEventFocus *e, const char *pref)
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
323 {
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
324 if (pref == OPT_WINTRANS_IM_ALPHA)
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
325 gaim_prefs_set_int(pref, imalpha);
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
326 else if (pref == OPT_WINTRANS_BL_ALPHA)
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
327 gaim_prefs_set_int(pref, blalpha);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
328 }
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
329
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
330 static void bl_alpha_change(GtkWidget *w, gpointer data) {
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
331 blalpha = gtk_range_get_value(GTK_RANGE(w));
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
332 if(blist)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
333 change_alpha(w, blist);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
334 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
336 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
337 * EXPORTED FUNCTIONS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
338 */
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
339 gboolean plugin_load(GaimPlugin *plugin) {
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
340 imalpha = gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA);
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
341 blalpha = gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
342
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
343 gaim_signal_connect((void*)gaim_conversations_get_handle(),
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
344 "conversation-created",
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
345 plugin,
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
346 GAIM_CALLBACK(gaim_new_conversation),
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
347 NULL);
6494
4f93f10ddc75 [gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6435
diff changeset
348 gaim_signal_connect((void*)gaim_connections_get_handle(), "signed-on", plugin, GAIM_CALLBACK(blist_created), NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
349 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
350
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
351 gaim_signal_connect((void*)gaim_gtk_conversations_get_handle(), "conversation-drag-ended", plugin, GAIM_CALLBACK(set_window_trans), NULL);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
352
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
353 update_convs_wintrans(NULL, NULL);
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
354
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
355 if(blist)
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
356 blist_created();
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
358 return TRUE;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
359 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
361 gboolean plugin_unload(GaimPlugin *plugin) {
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
362 gaim_debug_info(WINTRANS_PLUGIN_ID, "Removing win2ktrans.dll plugin\n");
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
363
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
364 remove_convs_wintrans();
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
365 remove_sliders();
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
366
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
367 if(blist)
4492
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
368 set_wintrans_off(blist);
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
369
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
370 return TRUE;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
373 GtkWidget *get_config_frame(GaimPlugin *plugin) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
374 GtkWidget *ret;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
375 GtkWidget *imtransbox, *bltransbox;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
376 GtkWidget *hbox;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
377 GtkWidget *label, *slider;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
378 GtkWidget *button;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
379 GtkWidget *trans_box;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
380
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
381 ret = gtk_vbox_new(FALSE, 18);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
382 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
383
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
384 /* IM Convo trans options */
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
385 imtransbox = gaim_gtk_make_frame (ret, _("IM Conversation Windows"));
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
386 button = wgaim_button(_("_IM window transparency"), OPT_WINTRANS_IM_ENABLED, imtransbox);
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
387 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_convs_wintrans), (void *)OPT_WINTRANS_IM_ENABLED);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
388
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
389 trans_box = gtk_vbox_new(FALSE, 18);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
390 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED))
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
391 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
392 gtk_widget_show(trans_box);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
393
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
394 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box);
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
395
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
396 button = wgaim_button(_("_Show slider bar in IM window"), OPT_WINTRANS_IM_SLIDER, trans_box);
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
397 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_convs_wintrans), (void *)OPT_WINTRANS_IM_SLIDER);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
398
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
399 gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
400
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
401 /* IM transparency slider */
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402 hbox = gtk_hbox_new(FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
404 label = gtk_label_new(_("Opacity:"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
407 slider = gtk_hscale_new_with_range(50,255,1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
408 gtk_range_set_value(GTK_RANGE(slider), imalpha);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
409 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
410
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
411 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), NULL);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
412 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(alpha_pref_set_int), (void *)OPT_WINTRANS_IM_ALPHA);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
413
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
414 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
415
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
416 gtk_widget_show_all(hbox);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
417
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
418 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
419
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
420 /* Buddy List trans options */
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
421 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window"));
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
422 button = wgaim_button(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
423 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ENABLED);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
424
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
425 trans_box = gtk_vbox_new(FALSE, 18);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
426 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
427 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
428 gtk_widget_show(trans_box);
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
429 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
430 gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
431
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
432 /* IM transparency slider */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
433 hbox = gtk_hbox_new(FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
434
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
435 label = gtk_label_new(_("Opacity:"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
436 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
437
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
438 slider = gtk_hscale_new_with_range(50,255,1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
439 gtk_range_set_value(GTK_RANGE(slider), blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
440 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
441
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
442 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), NULL);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
443 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(alpha_pref_set_int), (void *)OPT_WINTRANS_BL_ALPHA);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
444
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
445 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
446
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
447 gtk_widget_show_all(hbox);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
448
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
449 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
450
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
451 /* If this version of Windows dosn't support Transparency, grey out options */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
452 if(!has_transparency()) {
8961
92e061a1db10 [gaim-migrate @ 9735]
Luke Schierer <lschiere@pidgin.im>
parents: 8779
diff changeset
453 gaim_debug_warning(WINTRANS_PLUGIN_ID, "This version of windows dosn't support transparency\n");
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
454 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
455 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
456 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
457 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
458
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
459 gtk_widget_show_all(ret);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
460 return ret;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461 }
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
462
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
463 static GaimGtkPluginUiInfo ui_info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
464 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
465 get_config_frame
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
466 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
467
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
468 static GaimPluginInfo info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
469 {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9915
diff changeset
470 GAIM_PLUGIN_MAGIC,
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9915
diff changeset
471 GAIM_MAJOR_VERSION,
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9915
diff changeset
472 GAIM_MINOR_VERSION,
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
473 GAIM_PLUGIN_STANDARD, /**< type */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
474 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
475 0, /**< flags */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
476 NULL, /**< dependencies */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
477 GAIM_PRIORITY_DEFAULT, /**< priority */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
478
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
479 WINTRANS_PLUGIN_ID, /**< id */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
480 N_("Transparency"), /**< name */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
481 VERSION, /**< version */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
482 /** summary */
8779
4b0b96196cfb [gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 8749
diff changeset
483 N_("Variable Transparency for the buddy list and conversations."),
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
484 /** description */
8779
4b0b96196cfb [gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 8749
diff changeset
485 N_("This plugin enables variable alpha transparency on conversation windows and the buddy list.\n\n"
4b0b96196cfb [gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 8749
diff changeset
486 "* Note: This plugin requires Win2000 or WinXP."),
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
487 "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */
6408
90fc2199c156 [gaim-migrate @ 6914]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
488 GAIM_WEBSITE, /**< homepage */
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
489
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
490 plugin_load, /**< load */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
491 plugin_unload, /**< unload */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
492 NULL, /**< destroy */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
493
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
494 &ui_info, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8961
diff changeset
495 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8961
diff changeset
496 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8961
diff changeset
497 NULL
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
498 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
499
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
500 static void
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
501 init_plugin(GaimPlugin *plugin)
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
502 {
9840
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
503 gaim_prefs_add_none("/plugins/gtk/win32");
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
504 gaim_prefs_add_none("/plugins/gtk/win32/wintrans");
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
505 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_enabled", FALSE);
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
506 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/im_alpha", 255);
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
507 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_slider", FALSE);
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
508 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_enabled", FALSE);
e8caffe42e38 [gaim-migrate @ 10717]
Mark Doliner <mark@kingant.net>
parents: 9446
diff changeset
509 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/bl_alpha", 255);
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
510 }
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
511
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5912
diff changeset
512 GAIM_INIT_PLUGIN(wintrans, init_plugin, info)