Mercurial > pidgin
annotate plugins/win32/transparency/win2ktrans.c @ 4569:7f2de19d052d
[gaim-migrate @ 4850]
Bug fix. Gaim would crash if using the IM convo window slider bars after plugin removal.
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Tue, 11 Feb 2003 00:58:28 +0000 |
parents | d629e7989a8a |
children | 864518c3767d |
rev | line source |
---|---|
3729 | 1 /* |
2 * win2ktrans | |
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 | 7 * |
8 * this program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the gnu general public license as published by | |
10 * the free software foundation; either version 2 of the license, or | |
11 * (at your option) any later version. | |
12 * | |
13 * this program is distributed in the hope that it will be useful, | |
14 * but without any warranty; without even the implied warranty of | |
15 * merchantability or fitness for a particular purpose. see the | |
16 * gnu general public license for more details. | |
17 * | |
18 * you should have received a copy of the gnu general public license | |
19 * along with this program; if not, write to the free software | |
20 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa | |
21 * | |
22 */ | |
23 #define GAIM_PLUGINS | |
24 | |
25 #include <gtk/gtk.h> | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
26 #include <gdk/gdkwin32.h> |
3729 | 27 #include "gaim.h" |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
28 #include "win32dep.h" |
3729 | 29 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
30 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
31 * MACROS & DEFINES |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
32 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
33 #define WINTRANS_VERSION 1 |
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 /* These defines aren't found in mingw's winuser.h */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
36 #ifndef LWA_ALPHA |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
37 #define LWA_ALPHA 0x00000002 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
38 #endif |
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 #ifndef WS_EX_LAYERED |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
41 #define WS_EX_LAYERED 0x00080000 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
42 #endif |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
43 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
44 /* Transparency plugin configuration */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
45 #define OPT_WGAIM_IMTRANS 0x00000001 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
46 #define OPT_WGAIM_SHOW_IMTRANS 0x00000002 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
47 #define OPT_WGAIM_BLTRANS 0x00000004 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
48 #define OPT_WGAIM_BUDDYWIN_ONTOP 0x00000008 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
49 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
50 /* |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
51 * DATA STRUCTS |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
52 */ |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
53 typedef struct { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
54 GtkWidget *win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
55 GtkWidget *slider; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
56 } slider_win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
57 |
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 /* |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
60 * GLOBALS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
61 */ |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
62 G_MODULE_IMPORT GtkWidget *blist; |
4096
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 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
67 static int imalpha = 255; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
68 static int blalpha = 255; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
69 guint trans_options = 0; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
70 GList *window_list = NULL; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
71 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
72 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
73 * PROTOS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
74 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
75 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
76 extern GtkWidget *gaim_button(const char*, guint*, int, GtkWidget*); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
77 static void save_trans_prefs(); |
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 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
80 * CODE |
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 /* Set window transparency level */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
83 void set_wintrans(GtkWidget *window, int trans) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
84 if(MySetLayeredWindowAttributes) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
85 HWND hWnd = GDK_WINDOW_HWND(window->window); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
86 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
87 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
88 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
89 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
90 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
91 void set_wintrans_off(GtkWidget *window) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
92 if(MySetLayeredWindowAttributes) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
93 HWND hWnd = GDK_WINDOW_HWND(window->window); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
94 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
95 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
96 /* Ask the window and its children to repaint */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
97 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
|
98 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
99 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
100 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
101 static void change_alpha(GtkWidget *w, gpointer data) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
102 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
|
103 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
104 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
105 int has_transparency() { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
106 return MySetLayeredWindowAttributes ? TRUE : FALSE; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
107 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
108 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
109 GtkWidget *wintrans_slider(GtkWidget *win) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
110 GtkWidget *hbox; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
111 GtkWidget *label, *slider; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
112 GtkWidget *frame; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
113 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
114 frame = gtk_frame_new(NULL); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
115 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
116 gtk_widget_show(frame); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
117 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
118 hbox = gtk_hbox_new(FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
119 gtk_container_add(GTK_CONTAINER(frame), hbox); |
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 label = gtk_label_new(_("Opacity:")); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
122 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
123 gtk_widget_show(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
124 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
125 slider = gtk_hscale_new_with_range(50,255,1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
126 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
127 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
128 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
129 /* On slider val change, update window's transparency level */ |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
130 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
|
131 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
132 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
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 /* Set the initial transparency level */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
135 set_wintrans(win, imalpha); |
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 gtk_widget_show_all(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
138 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
139 return frame; |
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 |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
142 static slider_win* find_slidwin( GtkWidget *win ) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
143 GList *tmp = window_list; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
144 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
145 while(tmp) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
146 if( ((slider_win*)(tmp->data))->win == win) |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
147 return (slider_win*)tmp->data; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
148 tmp = tmp->next; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
149 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
150 return NULL; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
151 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
152 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
153 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
|
154 slider_win *slidwin=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
155 /* Remove window from the window list */ |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
156 debug_printf("win2ktrans.dll: Conv window destoyed.. removing from list\n"); |
4569
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 if((slidwin=find_slidwin(widget))) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
159 window_list = g_list_remove(window_list, (gpointer)slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
160 g_free(slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
161 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
162 return FALSE; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
163 } |
3729 | 164 |
165 static void gaim_new_conversation(char *who) { | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
166 GList *wl, *wl1; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
167 GtkWidget *vbox=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
168 GtkWidget *win=NULL; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
169 struct gaim_gtk_window *gaimwin; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
170 struct gaim_conversation *c; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
171 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
172 c = gaim_find_conversation(who); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
173 gaimwin = GAIM_GTK_WINDOW(c->window); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
174 win = gaimwin->window; |
3729 | 175 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
176 /* check prefs to see if we want trans */ |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
177 if ((trans_options & OPT_WGAIM_IMTRANS) && |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
178 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) { |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
179 /* 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
|
180 if(!find_slidwin(win)) { |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
181 GtkWidget *slider_box=NULL; |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
182 slider_win *slidwin=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
183 |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
184 /* Get top vbox */ |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
185 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win)); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
186 wl != NULL; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
187 wl = wl->next ) { |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
188 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) ) |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
189 vbox = GTK_WIDGET(wl->data); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
190 else { |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
191 debug_printf("no vbox found\n"); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
192 return; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
193 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
194 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
195 g_list_free(wl1); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
196 |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
197 slider_box = wintrans_slider(win); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
198 gtk_box_pack_start(GTK_BOX(vbox), |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
199 slider_box, |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
200 FALSE, FALSE, 0); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
201 /* Add window to list, to track that it has a slider */ |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
202 slidwin = g_new0( slider_win, 1 ); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
203 slidwin->win = win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
204 slidwin->slider = slider_box; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
205 window_list = g_list_append(window_list, (gpointer)slidwin); |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
206 /* 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
|
207 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
|
208 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
209 else |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
210 return; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
211 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
212 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
213 if((trans_options & OPT_WGAIM_IMTRANS) && |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
214 !(trans_options & OPT_WGAIM_SHOW_IMTRANS)) { |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
215 set_wintrans(win, imalpha); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
216 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
217 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
218 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
219 static void blist_created() { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
220 if(blist) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
221 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
222 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
|
223 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
224 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
|
225 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
226 if(trans_options & OPT_WGAIM_BLTRANS) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
227 set_wintrans(blist, blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
228 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
229 set_wintrans_off(blist); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
230 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
231 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
232 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
233 static void alpha_change(GtkWidget *w, gpointer data) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
234 int *alpha = (int*)data; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
235 *alpha = gtk_range_get_value(GTK_RANGE(w)); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
236 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
237 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
238 static void bl_alpha_change(GtkWidget *w, gpointer data) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
239 alpha_change(w, data); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
240 if(blist) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
241 change_alpha(w, blist); |
3729 | 242 } |
243 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
244 /* Load options */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
245 static void load_trans_prefs() { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
246 FILE *f; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
247 char buf[1024]; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
248 int ver=0; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
249 char tag[256]; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
250 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
251 if (gaim_home_dir()) |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
252 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "wintransrc", gaim_home_dir()); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
253 else |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
254 return; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
255 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
256 if ((f = fopen(buf, "r"))) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
257 fgets(buf, sizeof(buf), f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
258 sscanf(buf, "# wintransrc v%d", &ver); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
259 if ((ver > 1) || (buf[0] != '#')) |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
260 return; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
261 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
262 while (!feof(f)) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
263 fgets(buf, sizeof(buf), f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
264 sscanf(buf, "%s {", tag); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
265 if (strcmp(tag, "options")==0) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
266 fgets(buf, sizeof(buf), f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
267 sscanf(buf, "\ttrans_options { %d", &trans_options); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
268 continue; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
269 } else if (strcmp(tag, "trans")==0) { |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
270 int num; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
271 for(fgets(buf, sizeof(buf), f);buf[0] != '}' && !feof(f);fgets(buf, sizeof(buf), f)) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
272 sscanf(buf, "\t%s { %d", tag, &num); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
273 if(strcmp(tag, "imalpha")==0) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
274 imalpha = num; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
275 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
276 else if(strcmp(tag, "blalpha")==0) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
277 blalpha = num; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
278 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
279 } |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
280 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
281 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
282 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
283 else |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
284 save_trans_prefs(); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
285 blist_created(); |
4096
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 /* Save options */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
289 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
290 static void write_options(FILE *f) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
291 fprintf(f, "options {\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
292 fprintf(f, "\ttrans_options { %u }\n", trans_options); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
293 fprintf(f, "}\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
294 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
295 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
296 static void write_trans(FILE *f) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
297 fprintf(f, "trans {\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
298 fprintf(f, "\timalpha { %d }\n", imalpha); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
299 fprintf(f, "\tblalpha { %d }\n", blalpha); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
300 fprintf(f, "}\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
301 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
302 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
303 static void save_trans_prefs() { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
304 FILE *f; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
305 char buf[1024]; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
306 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
307 if (gaim_home_dir()) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
308 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "wintransrc", gaim_home_dir()); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
309 } |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
310 else |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
311 return; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
312 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
313 if ((f = fopen(buf, "w"))) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
314 fprintf(f, "# wintransrc v%d\n", WINTRANS_VERSION); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
315 write_trans(f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
316 write_options(f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
317 fclose(f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
318 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
319 else |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
320 debug_printf("Error opening wintransrc\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
321 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
322 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
323 static void set_trans_option(GtkWidget *w, int option) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
324 trans_options ^= option; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
325 save_trans_prefs(); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
326 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
327 if(option == OPT_WGAIM_BUDDYWIN_ONTOP) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
328 if(blist) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
329 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
330 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
|
331 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
332 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
|
333 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
334 } else if(option == OPT_WGAIM_BLTRANS) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
335 if(blist) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
336 if(trans_options & OPT_WGAIM_BLTRANS) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
337 set_wintrans(blist, blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
338 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
339 set_wintrans_off(blist); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
340 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
341 } |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
342 } |
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 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
345 * EXPORTED FUNCTIONS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
346 */ |
3729 | 347 |
348 G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) { | |
349 gaim_signal_connect(handle, event_new_conversation, gaim_new_conversation, NULL); | |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
350 gaim_signal_connect(handle, event_signon, blist_created, NULL); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
351 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" ); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
352 load_trans_prefs(); |
3729 | 353 |
354 return NULL; | |
355 } | |
356 | |
357 G_MODULE_EXPORT void gaim_plugin_remove() { | |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
358 debug_printf("Removing win2ktrans.dll plugin\n"); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
359 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
360 /* Remove slider bars */ |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
361 if(window_list) { |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
362 GList *tmp=window_list; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
363 while(tmp) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
364 slider_win *slidwin = (slider_win*)tmp->data; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
365 gtk_widget_destroy(slidwin->slider); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
366 set_wintrans_off(slidwin->win); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
367 g_free(slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
368 tmp=tmp->next; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
369 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
370 g_list_free(window_list); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
371 window_list = NULL; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
372 } |
4492
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
373 if(blist) { |
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
374 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
|
375 set_wintrans_off(blist); |
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
376 } |
3729 | 377 } |
378 | |
379 struct gaim_plugin_description desc; | |
380 | |
381 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() { | |
382 desc.api_version = PLUGIN_API_VERSION; | |
383 desc.name = g_strdup(_("Transparency")); | |
384 desc.version = g_strdup(VERSION); | |
385 desc.description = g_strdup(_("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP.")); | |
3831 | 386 desc.authors = g_strdup(_("Rob Flynn <rob@marko.net>")); |
3729 | 387 desc.url = g_strdup(WEBSITE); |
388 return &desc; | |
389 } | |
390 | |
391 G_MODULE_EXPORT char *name() { | |
392 return _("Transparency"); | |
393 } | |
394 | |
395 G_MODULE_EXPORT char *description() { | |
396 return _("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP."); | |
397 } | |
398 | |
399 G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() { | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
400 GtkWidget *ret; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
401 GtkWidget *imtransbox, *bltransbox; |
3729 | 402 GtkWidget *hbox; |
403 GtkWidget *label, *slider; | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
404 GtkWidget *button; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
405 GtkWidget *trans_box; |
3729 | 406 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
407 ret = gtk_vbox_new(FALSE, 18); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
408 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
409 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
410 /* IM Convo trans options */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
411 imtransbox = make_frame (ret, _("IM Conversation Windows")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
412 button = gaim_button(_("_IM window transparency"), &trans_options, OPT_WGAIM_IMTRANS, imtransbox); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
413 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_IMTRANS); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
414 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
415 trans_box = gtk_vbox_new(FALSE, 18); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
416 if (!(trans_options & OPT_WGAIM_IMTRANS)) |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
417 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
418 gtk_widget_show(trans_box); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
419 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
420 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
|
421 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
422 button = gaim_button(_("_Show slider bar in IM window"), &trans_options, OPT_WGAIM_SHOW_IMTRANS, trans_box); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
423 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_SHOW_IMTRANS); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
424 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
425 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
|
426 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
427 /* IM transparency slider */ |
3729 | 428 hbox = gtk_hbox_new(FALSE, 5); |
429 | |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
430 label = gtk_label_new(_("Opacity:")); |
3729 | 431 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
432 | |
433 slider = gtk_hscale_new_with_range(50,255,1); | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
434 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
3729 | 435 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
436 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
437 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), (void*)&imalpha); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
438 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL); |
3729 | 439 |
440 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
441 | |
442 gtk_widget_show_all(hbox); | |
443 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
444 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
|
445 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
446 /* Buddy List trans options */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
447 bltransbox = make_frame (ret, _("Buddy List Window")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
448 button = gaim_button(_("_Keep Buddy List window on top"), &trans_options, OPT_WGAIM_BUDDYWIN_ONTOP, bltransbox); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
449 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_BUDDYWIN_ONTOP); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
450 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
451 button = gaim_button(_("_Buddy List window transparency"), &trans_options, OPT_WGAIM_BLTRANS, bltransbox); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
452 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_BLTRANS); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
453 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
454 trans_box = gtk_vbox_new(FALSE, 18); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
455 if (!(trans_options & OPT_WGAIM_BLTRANS)) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
456 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
457 gtk_widget_show(trans_box); |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
458 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
|
459 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
|
460 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
461 /* IM transparency slider */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
462 hbox = gtk_hbox_new(FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
463 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
464 label = gtk_label_new(_("Opacity:")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
465 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
466 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
467 slider = gtk_hscale_new_with_range(50,255,1); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
468 gtk_range_set_value(GTK_RANGE(slider), blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
469 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
470 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
471 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), (void*)&blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
472 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
473 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
474 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
475 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
476 gtk_widget_show_all(hbox); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
477 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
478 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
|
479 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
480 /* 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
|
481 if(!has_transparency()) { |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
482 debug_printf("This version of windows dosn't support transparency\n"); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
483 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
484 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
485 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
486 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
487 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
488 gtk_widget_show_all(ret); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
489 return ret; |
3729 | 490 } |