annotate plugins/win32/transparency/win2ktrans.c @ 6109:0922bb7a7bbc

[gaim-migrate @ 6571] Make attempting to sign on to an account twice not crash Gaim, and make the prompt for password request window only open once at max. I might change this in a few minutes, but this works, and I wanted to commit it before I break something. Move the gaim_request_input() call for "Please enter your password" to connection.c instead of gtkconn.c. There is no need for this to be in gtkconn.c, and doing it in core means less work for UIs. Make closing a notify window call the cancel action. Set the titles for request windows, when given. Remove a bit of odd, un-needed code from main.c (hitting "enter" in the password field was calling doenter which called dologin. Now it just calls dologin). committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 13 Jul 2003 18:33:25 +0000
parents 5239a3b4ab33
children 90fc2199c156
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 /*
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * win2ktrans
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>
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
5 *
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
6 * Contributions by Herman Bloggs <hermanator12002@yahoo.com>
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * this program is free software; you can redistribute it and/or modify
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * 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
10 * the free software foundation; either version 2 of the license, or
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * (at your option) any later version.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * this program is distributed in the hope that it will be useful,
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * but without any warranty; without even the implied warranty of
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * merchantability or fitness for a particular purpose. see the
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * gnu general public license for more details.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * you should have received a copy of the gnu general public license
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * along with this program; if not, write to the free software
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 */
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
23 #include <gdk/gdkwin32.h>
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
24 #include "internal.h"
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
25
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"
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
34 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
35 * MACROS & DEFINES
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
36 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
37 #define WINTRANS_PLUGIN_ID "gtk-win-trans"
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
38 #define WINTRANS_VERSION 1
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
39
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
40 /* These defines aren't found in mingw's winuser.h */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
41 #ifndef LWA_ALPHA
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
42 #define LWA_ALPHA 0x00000002
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
43 #endif
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
44
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
45 #ifndef WS_EX_LAYERED
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
46 #define WS_EX_LAYERED 0x00080000
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
47 #endif
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
48
4726
0b1c01fd68f1 [gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
49 #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
50
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
51 /*
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
52 * DATA STRUCTS
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
53 */
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
54 typedef struct {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
55 GtkWidget *win;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
56 GtkWidget *slider;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
57 } slider_win;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
58
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
59
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
60 /*
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
61 * GLOBALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
62 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
63
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 * LOCALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
66 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
67 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
68 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
69 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
70 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
71 static const char *OPT_WINTRANS_BL_ALPHA ="/plugins/gtk/win32/wintrans/bl_alpha";
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
72 static const char *OPT_WINTRANS_BL_ON_TOP ="/plugins/gtk/win32/wintrans/bl_on_top";
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
73 static int imalpha = 255;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
74 static int blalpha = 255;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
75 GList *window_list = NULL;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
76
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 * PROTOS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
79 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
80 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
81
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 * CODE
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
84 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
85 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
86 GtkWidget *button;
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
87 button = gtk_check_button_new_with_mnemonic(text);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
88 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
89 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
90 gtk_widget_show(button);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
91 return button;
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
92 }
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
93
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
94 /* Set window transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
95 void set_wintrans(GtkWidget *window, int trans) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
96 if(MySetLayeredWindowAttributes) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
97 HWND hWnd = GDK_WINDOW_HWND(window->window);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
98 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
99 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
100 }
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
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
103 void set_wintrans_off(GtkWidget *window) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
104 if(MySetLayeredWindowAttributes) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
105 HWND hWnd = GDK_WINDOW_HWND(window->window);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
106 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
107
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
108 /* Ask the window and its children to repaint */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
109 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
110 }
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 static void change_alpha(GtkWidget *w, gpointer data) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
114 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
115 }
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 int has_transparency() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
118 return MySetLayeredWindowAttributes ? TRUE : FALSE;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
119 }
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 GtkWidget *wintrans_slider(GtkWidget *win) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
122 GtkWidget *hbox;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
123 GtkWidget *label, *slider;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
124 GtkWidget *frame;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
125
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
126 frame = gtk_frame_new(NULL);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
127 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
128 gtk_widget_show(frame);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
129
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
130 hbox = gtk_hbox_new(FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
131 gtk_container_add(GTK_CONTAINER(frame), hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
132
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
133 label = gtk_label_new(_("Opacity:"));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
134 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
135 gtk_widget_show(hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
136
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
137 slider = gtk_hscale_new_with_range(50,255,1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
138 gtk_range_set_value(GTK_RANGE(slider), imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
139 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
140
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
141 /* On slider val change, update window's transparency level */
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
142 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
143
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
144 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
145
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
146 /* Set the initial transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
147 set_wintrans(win, imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
148
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
149 gtk_widget_show_all(hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
150
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
151 return frame;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
152 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
153
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
154 static slider_win* find_slidwin( GtkWidget *win ) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
155 GList *tmp = window_list;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
156
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
157 while(tmp) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
158 if( ((slider_win*)(tmp->data))->win == win)
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
159 return (slider_win*)tmp->data;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
160 tmp = tmp->next;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
161 }
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
162 return NULL;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
163 }
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
164
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
165 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
166 slider_win *slidwin=NULL;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
167 /* Remove window from the window list */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
168 gaim_debug(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
169
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
170 if((slidwin=find_slidwin(widget))) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
171 window_list = g_list_remove(window_list, (gpointer)slidwin);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
172 g_free(slidwin);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
173 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
174 return FALSE;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
175 }
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
177 static void gaim_new_conversation(char *who) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
178 GList *wl, *wl1;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
179 GtkWidget *vbox=NULL;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
180 GtkWidget *win=NULL;
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
181 GaimConversation *c;
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
182 GaimGtkConversation *gtkconv;
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
183 GaimGtkWindow *gtkwin;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
184
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
185 c = gaim_find_conversation(who);
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
186 gtkconv = GAIM_GTK_CONVERSATION(c);
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
187 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(c));
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
188
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
189 win = gtkwin->window;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
190
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
191 /* check prefs to see if we want trans */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
192 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
193 /* Look up this window to see if it already has a scroller */
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
194 if(!find_slidwin(win)) {
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
195 GtkWidget *slider_box=NULL;
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
196 slider_win *slidwin=NULL;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
197
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
198 /* Get top vbox */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
199 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win));
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
200 wl != NULL;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
201 wl = wl->next ) {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
202 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) )
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
203 vbox = GTK_WIDGET(wl->data);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
204 else {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
205 gaim_debug(GAIM_DEBUG_ERROR, WINTRANS_PLUGIN_ID, "no vbox found\n");
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
206 return;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
207 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
208 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
209 g_list_free(wl1);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
210
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
211 slider_box = wintrans_slider(win);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
212 gtk_box_pack_start(GTK_BOX(vbox),
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
213 slider_box,
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
214 FALSE, FALSE, 0);
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
215 /* Add window to list, to track that it has a slider */
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
216 slidwin = g_new0( slider_win, 1 );
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
217 slidwin->win = win;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
218 slidwin->slider = slider_box;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
219 window_list = g_list_append(window_list, (gpointer)slidwin);
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
220 /* Set callback to remove window from the list, if the window is destroyed */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
221 g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
222 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
223 else
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
224 return;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
225 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
226
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
227 if(gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) &&
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
228 !gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
229 set_wintrans(win, imalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
230 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
231 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
232
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
233 static void blist_created() {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
234 if(blist) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
235 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ON_TOP))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
236 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
237 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
238 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
239
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
240 if(gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
241 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
242 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
243 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
244 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
245 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
246
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
247 static void alpha_change(GtkWidget *w, gpointer data) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
248 int *alpha = (int*)data;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
249 *alpha = gtk_range_get_value(GTK_RANGE(w));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
250 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
251
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
252 static void alpha_pref_set_int(GtkWidget *w, GdkEventFocus *e, const char *pref) {
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
253 int alpha = 0;
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
254 if (pref == OPT_WINTRANS_IM_ALPHA)
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
255 alpha = imalpha;
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
256 else if (pref == OPT_WINTRANS_BL_ALPHA)
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
257 alpha = blalpha;
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
258
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
259 gaim_prefs_set_int(pref, alpha);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
260 }
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
261
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
262 static void bl_alpha_change(GtkWidget *w, gpointer data) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
263 alpha_change(w, data);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
264 if(blist)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
265 change_alpha(w, blist);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
266 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
267
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
268 static void set_trans_option(GtkWidget *w, const char *pref) {
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
269 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
270 if(pref == OPT_WINTRANS_BL_ON_TOP) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
271 if(blist) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
272 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
273 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
274 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
275 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
276 }
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
277 } else if(pref == OPT_WINTRANS_BL_ENABLED) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
278 if(blist) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
279 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
280 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
281 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
282 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
283 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
284 }
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
285 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
286
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
287 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
288 * EXPORTED FUNCTIONS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
289 */
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
290 G_MODULE_EXPORT gboolean plugin_load(GaimPlugin *plugin) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
291 imalpha = gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
292 blalpha = gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
293
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
294 gaim_signal_connect(plugin, event_new_conversation, gaim_new_conversation, NULL);
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
295 gaim_signal_connect(plugin, event_signon, blist_created, NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
296 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
297
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
298 if(blist) {
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
299 blist_created();
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
300 }
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
301
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
302 return TRUE;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
303 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
304
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
305 G_MODULE_EXPORT gboolean plugin_unload(GaimPlugin *plugin) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
306 gaim_debug(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
307
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
308 /* Remove slider bars */
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
309 if(window_list) {
4569
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
310 GList *tmp=window_list;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
311 while(tmp) {
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
312 slider_win *slidwin = (slider_win*)tmp->data;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
313 gtk_widget_destroy(slidwin->slider);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
314 set_wintrans_off(slidwin->win);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
315 g_free(slidwin);
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
316 tmp=tmp->next;
7f2de19d052d [gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4492
diff changeset
317 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
318 g_list_free(window_list);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
319 window_list = NULL;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
320 }
4492
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
321 if(blist) {
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
322 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
323 set_wintrans_off(blist);
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
324 }
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
325 return TRUE;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
326 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
328 G_MODULE_EXPORT GtkWidget *get_config_frame(GaimPlugin *plugin) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
329 GtkWidget *ret;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
330 GtkWidget *imtransbox, *bltransbox;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
331 GtkWidget *hbox;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
332 GtkWidget *label, *slider;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
333 GtkWidget *button;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
334 GtkWidget *trans_box;
3729
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 ret = gtk_vbox_new(FALSE, 18);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
337 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
338
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
339 /* IM Convo trans options */
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
340 imtransbox = gaim_gtk_make_frame (ret, _("IM Conversation Windows"));
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
341 button = wgaim_button(_("_IM window transparency"), OPT_WINTRANS_IM_ENABLED, imtransbox);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
342 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_IM_ENABLED);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
343
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
344 trans_box = gtk_vbox_new(FALSE, 18);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
345 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED))
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
346 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
347 gtk_widget_show(trans_box);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
348
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
349 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
350
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
351 button = wgaim_button(_("_Show slider bar in IM window"), OPT_WINTRANS_IM_SLIDER, trans_box);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
352 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_IM_SLIDER);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
353
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
354 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
355
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
356 /* IM transparency slider */
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357 hbox = gtk_hbox_new(FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
359 label = gtk_label_new(_("Opacity:"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
361
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
362 slider = gtk_hscale_new_with_range(50,255,1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
363 gtk_range_set_value(GTK_RANGE(slider), imalpha);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
365
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
366 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), (void*)&imalpha);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
367 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
368
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
369 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371 gtk_widget_show_all(hbox);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
373 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
374
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
375 /* Buddy List trans options */
5749
6d6ae91c5de7 [gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5248
diff changeset
376 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window"));
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
377 button = wgaim_button(_("_Keep Buddy List window on top"), OPT_WINTRANS_BL_ON_TOP, bltransbox);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
378 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (void *)OPT_WINTRANS_BL_ON_TOP);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
379
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
380 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
381 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
382
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
383 trans_box = gtk_vbox_new(FALSE, 18);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
384 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
385 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
386 gtk_widget_show(trans_box);
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
387 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
388 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
389
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
390 /* IM transparency slider */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
391 hbox = gtk_hbox_new(FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
392
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
393 label = gtk_label_new(_("Opacity:"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
394 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
395
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
396 slider = gtk_hscale_new_with_range(50,255,1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
397 gtk_range_set_value(GTK_RANGE(slider), blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
398 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
399
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
400 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), (void*)&blalpha);
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
401 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
402
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
403 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
404
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
405 gtk_widget_show_all(hbox);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
406
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
407 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
408
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
409 /* 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
410 if(!has_transparency()) {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
411 gaim_debug(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
412 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
413 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
414 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
415 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
416
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
417 gtk_widget_show_all(ret);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
418 return ret;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
419 }
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
420
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
421 static GaimGtkPluginUiInfo ui_info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
422 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
423 get_config_frame
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
424 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
425
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
426 static GaimPluginInfo info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
427 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
428 2, /**< api_version */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
429 GAIM_PLUGIN_STANDARD, /**< type */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
430 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
431 0, /**< flags */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
432 NULL, /**< dependencies */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
433 GAIM_PRIORITY_DEFAULT, /**< priority */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
434
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
435 WINTRANS_PLUGIN_ID, /**< id */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
436 N_("Transparency"), /**< name */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
437 VERSION, /**< version */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
438 /** summary */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
439 N_("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP."),
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
440 /** description */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
441 N_("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP."),
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
442 "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
443 WEBSITE, /**< homepage */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
444
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
445 plugin_load, /**< load */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
446 plugin_unload, /**< unload */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
447 NULL, /**< destroy */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
448
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
449 &ui_info, /**< ui_info */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
450 NULL /**< extra_info */
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
451 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
452
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
453 static void
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
454 init_plugin(GaimPlugin *plugin)
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4726
diff changeset
455 {
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
456 gaim_prefs_add_none("/plugins/gtk/win32");
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
457 gaim_prefs_add_none("/plugins/gtk/win32/wintrans");
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
458 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_enabled", FALSE);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
459 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/im_alpha", 255);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
460 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/im_slider", FALSE);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
461 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_enabled", FALSE);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
462 gaim_prefs_add_int("/plugins/gtk/win32/wintrans/bl_alpha", 255);
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5749
diff changeset
463 gaim_prefs_add_bool("/plugins/gtk/win32/wintrans/bl_on_top", FALSE);
5224
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
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5912
diff changeset
466 GAIM_INIT_PLUGIN(wintrans, init_plugin, info)