Mercurial > pidgin
annotate plugins/win32/transparency/win2ktrans.c @ 5366:23898d72679c
[gaim-migrate @ 5742]
control-a is already used.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 14 May 2003 01:15:58 +0000 |
parents | d635e8fe2fba |
children | 6d6ae91c5de7 |
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 */ | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
23 #include <gdk/gdkwin32.h> |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
24 #include <gmodule.h> |
3729 | 25 #include "gaim.h" |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
26 #include "gtkplugin.h" |
5248 | 27 #include "gtkblist.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 */ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
33 #define WINTRANS_PLUGIN_ID "win-gaim-trans" |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
34 #define WINTRANS_VERSION 1 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
35 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
36 /* These defines aren't found in mingw's winuser.h */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
37 #ifndef LWA_ALPHA |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
38 #define LWA_ALPHA 0x00000002 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
39 #endif |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
40 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
41 #ifndef WS_EX_LAYERED |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
42 #define WS_EX_LAYERED 0x00080000 |
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 /* Transparency plugin configuration */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
46 #define OPT_WGAIM_IMTRANS 0x00000001 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
47 #define OPT_WGAIM_SHOW_IMTRANS 0x00000002 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
48 #define OPT_WGAIM_BLTRANS 0x00000004 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
49 #define OPT_WGAIM_BUDDYWIN_ONTOP 0x00000008 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
50 |
4726
0b1c01fd68f1
[gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4606
diff
changeset
|
51 #define blist (gaim_get_blist()?(GAIM_GTK_BLIST(gaim_get_blist())?((GAIM_GTK_BLIST(gaim_get_blist()))->window):NULL):NULL) |
0b1c01fd68f1
[gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4606
diff
changeset
|
52 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
53 /* |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
54 * DATA STRUCTS |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
55 */ |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
56 typedef struct { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
57 GtkWidget *win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
58 GtkWidget *slider; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
59 } slider_win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
60 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
61 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
62 /* |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
63 * GLOBALS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
64 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
65 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
66 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
67 * LOCALS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
68 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
69 static int imalpha = 255; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
70 static int blalpha = 255; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
71 guint trans_options = 0; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
72 GList *window_list = NULL; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
73 |
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 * PROTOS |
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 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
78 extern GtkWidget *gaim_button(const char*, guint*, int, GtkWidget*); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
79 static void save_trans_prefs(); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
80 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
81 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
82 * CODE |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
83 */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
84 /* Set window transparency level */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
85 void set_wintrans(GtkWidget *window, int trans) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
86 if(MySetLayeredWindowAttributes) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
87 HWND hWnd = GDK_WINDOW_HWND(window->window); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
88 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
89 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
90 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
91 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
92 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
93 void set_wintrans_off(GtkWidget *window) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
94 if(MySetLayeredWindowAttributes) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
95 HWND hWnd = GDK_WINDOW_HWND(window->window); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
96 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
97 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
98 /* Ask the window and its children to repaint */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
99 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
|
100 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
101 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
102 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
103 static void change_alpha(GtkWidget *w, gpointer data) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
104 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
|
105 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
106 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
107 int has_transparency() { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
108 return MySetLayeredWindowAttributes ? TRUE : FALSE; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
109 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
110 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
111 GtkWidget *wintrans_slider(GtkWidget *win) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
112 GtkWidget *hbox; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
113 GtkWidget *label, *slider; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
114 GtkWidget *frame; |
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 frame = gtk_frame_new(NULL); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
117 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
118 gtk_widget_show(frame); |
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 hbox = gtk_hbox_new(FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
121 gtk_container_add(GTK_CONTAINER(frame), hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
122 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
123 label = gtk_label_new(_("Opacity:")); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
124 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
125 gtk_widget_show(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
126 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
127 slider = gtk_hscale_new_with_range(50,255,1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
128 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
129 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
130 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
131 /* On slider val change, update window's transparency level */ |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
132 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
|
133 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
134 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
135 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
136 /* Set the initial transparency level */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
137 set_wintrans(win, imalpha); |
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 gtk_widget_show_all(hbox); |
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 return frame; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
142 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
143 |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
144 static slider_win* find_slidwin( GtkWidget *win ) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
145 GList *tmp = window_list; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
146 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
147 while(tmp) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
148 if( ((slider_win*)(tmp->data))->win == win) |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
149 return (slider_win*)tmp->data; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
150 tmp = tmp->next; |
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 return NULL; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
153 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
154 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
155 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
|
156 slider_win *slidwin=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
157 /* Remove window from the window list */ |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
158 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
|
159 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
160 if((slidwin=find_slidwin(widget))) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
161 window_list = g_list_remove(window_list, (gpointer)slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
162 g_free(slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
163 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
164 return FALSE; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
165 } |
3729 | 166 |
167 static void gaim_new_conversation(char *who) { | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
168 GList *wl, *wl1; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
169 GtkWidget *vbox=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
170 GtkWidget *win=NULL; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
171 struct gaim_gtk_window *gaimwin; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
172 struct gaim_conversation *c; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
173 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
174 c = gaim_find_conversation(who); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
175 gaimwin = GAIM_GTK_WINDOW(c->window); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
176 win = gaimwin->window; |
3729 | 177 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
178 /* check prefs to see if we want trans */ |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
179 if ((trans_options & OPT_WGAIM_IMTRANS) && |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
180 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) { |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
181 /* 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
|
182 if(!find_slidwin(win)) { |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
183 GtkWidget *slider_box=NULL; |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
184 slider_win *slidwin=NULL; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
185 |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
186 /* Get top vbox */ |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
187 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win)); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
188 wl != NULL; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
189 wl = wl->next ) { |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
190 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) ) |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
191 vbox = GTK_WIDGET(wl->data); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
192 else { |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
193 debug_printf("no vbox found\n"); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
194 return; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
195 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
196 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
197 g_list_free(wl1); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
198 |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
199 slider_box = wintrans_slider(win); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
200 gtk_box_pack_start(GTK_BOX(vbox), |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
201 slider_box, |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
202 FALSE, FALSE, 0); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
203 /* Add window to list, to track that it has a slider */ |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
204 slidwin = g_new0( slider_win, 1 ); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
205 slidwin->win = win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
206 slidwin->slider = slider_box; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
207 window_list = g_list_append(window_list, (gpointer)slidwin); |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
208 /* 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
|
209 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
|
210 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
211 else |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
212 return; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
213 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
214 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
215 if((trans_options & OPT_WGAIM_IMTRANS) && |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
216 !(trans_options & OPT_WGAIM_SHOW_IMTRANS)) { |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
217 set_wintrans(win, imalpha); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
218 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
219 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
220 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
221 static void blist_created() { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
222 if(blist) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
223 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
224 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
|
225 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
226 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
|
227 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
228 if(trans_options & OPT_WGAIM_BLTRANS) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
229 set_wintrans(blist, blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
230 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
231 set_wintrans_off(blist); |
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 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
234 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
235 static void alpha_change(GtkWidget *w, gpointer data) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
236 int *alpha = (int*)data; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
237 *alpha = gtk_range_get_value(GTK_RANGE(w)); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
238 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
239 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
240 static void bl_alpha_change(GtkWidget *w, gpointer data) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
241 alpha_change(w, data); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
242 if(blist) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
243 change_alpha(w, blist); |
3729 | 244 } |
245 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
246 /* Load options */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
247 static void load_trans_prefs() { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
248 FILE *f; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
249 char buf[1024]; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
250 int ver=0; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
251 char tag[256]; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
252 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
253 if (gaim_home_dir()) |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
254 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
|
255 else |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
256 return; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
257 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
258 if ((f = fopen(buf, "r"))) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
259 fgets(buf, sizeof(buf), f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
260 sscanf(buf, "# wintransrc v%d", &ver); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
261 if ((ver > 1) || (buf[0] != '#')) |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
262 return; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
263 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
264 while (!feof(f)) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
265 fgets(buf, sizeof(buf), f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
266 sscanf(buf, "%s {", tag); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
267 if (strcmp(tag, "options")==0) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
268 fgets(buf, sizeof(buf), f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
269 sscanf(buf, "\ttrans_options { %d", &trans_options); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
270 continue; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
271 } else if (strcmp(tag, "trans")==0) { |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
272 int num; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
273 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
|
274 sscanf(buf, "\t%s { %d", tag, &num); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
275 if(strcmp(tag, "imalpha")==0) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
276 imalpha = num; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
277 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
278 else if(strcmp(tag, "blalpha")==0) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
279 blalpha = num; |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
280 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
281 } |
4096
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 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
284 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
285 else |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
286 save_trans_prefs(); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
287 blist_created(); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
288 } |
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 /* Save options */ |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
291 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
292 static void write_options(FILE *f) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
293 fprintf(f, "options {\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
294 fprintf(f, "\ttrans_options { %u }\n", trans_options); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
295 fprintf(f, "}\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
296 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
297 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
298 static void write_trans(FILE *f) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
299 fprintf(f, "trans {\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
300 fprintf(f, "\timalpha { %d }\n", imalpha); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
301 fprintf(f, "\tblalpha { %d }\n", blalpha); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
302 fprintf(f, "}\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
303 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
304 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
305 static void save_trans_prefs() { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
306 FILE *f; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
307 char buf[1024]; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
308 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
309 if (gaim_home_dir()) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
310 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
|
311 } |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
312 else |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
313 return; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
314 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
315 if ((f = fopen(buf, "w"))) { |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
316 fprintf(f, "# wintransrc v%d\n", WINTRANS_VERSION); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
317 write_trans(f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
318 write_options(f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
319 fclose(f); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
320 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
321 else |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
322 debug_printf("Error opening wintransrc\n"); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
323 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
324 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
325 static void set_trans_option(GtkWidget *w, int option) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
326 trans_options ^= option; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
327 save_trans_prefs(); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
328 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
329 if(option == OPT_WGAIM_BUDDYWIN_ONTOP) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
330 if(blist) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
331 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
332 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
|
333 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
334 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
|
335 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
336 } else if(option == OPT_WGAIM_BLTRANS) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
337 if(blist) { |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
338 if(trans_options & OPT_WGAIM_BLTRANS) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
339 set_wintrans(blist, blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
340 else |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
341 set_wintrans_off(blist); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
342 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
343 } |
4096
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 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
346 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
347 * EXPORTED FUNCTIONS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
348 */ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
349 G_MODULE_EXPORT gboolean plugin_load(GaimPlugin *plugin) { |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
350 gaim_signal_connect(plugin, event_new_conversation, gaim_new_conversation, NULL); |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
351 gaim_signal_connect(plugin, event_signon, blist_created, NULL); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
352 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" ); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
353 load_trans_prefs(); |
3729 | 354 |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
355 return TRUE; |
3729 | 356 } |
357 | |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
358 G_MODULE_EXPORT gboolean plugin_unload(GaimPlugin *plugin) { |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
359 debug_printf("Removing win2ktrans.dll plugin\n"); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
360 |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
361 /* Remove slider bars */ |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
362 if(window_list) { |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
363 GList *tmp=window_list; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
364 while(tmp) { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
365 slider_win *slidwin = (slider_win*)tmp->data; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
366 gtk_widget_destroy(slidwin->slider); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
367 set_wintrans_off(slidwin->win); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
368 g_free(slidwin); |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
369 tmp=tmp->next; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
370 } |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
371 g_list_free(window_list); |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
372 window_list = NULL; |
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
373 } |
4492
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
374 if(blist) { |
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
375 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
|
376 set_wintrans_off(blist); |
d629e7989a8a
[gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4400
diff
changeset
|
377 } |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
378 return TRUE; |
3729 | 379 } |
380 | |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
381 G_MODULE_EXPORT GtkWidget *get_config_frame(GaimPlugin *plugin) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
382 GtkWidget *ret; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
383 GtkWidget *imtransbox, *bltransbox; |
3729 | 384 GtkWidget *hbox; |
385 GtkWidget *label, *slider; | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
386 GtkWidget *button; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
387 GtkWidget *trans_box; |
3729 | 388 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
389 ret = gtk_vbox_new(FALSE, 18); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
390 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
391 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
392 /* IM Convo trans options */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
393 imtransbox = make_frame (ret, _("IM Conversation Windows")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
394 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
|
395 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
|
396 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
397 trans_box = gtk_vbox_new(FALSE, 18); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
398 if (!(trans_options & OPT_WGAIM_IMTRANS)) |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
399 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
400 gtk_widget_show(trans_box); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
401 |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
402 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
|
403 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
404 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
|
405 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
|
406 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
407 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
|
408 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
409 /* IM transparency slider */ |
3729 | 410 hbox = gtk_hbox_new(FALSE, 5); |
411 | |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
412 label = gtk_label_new(_("Opacity:")); |
3729 | 413 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
414 | |
415 slider = gtk_hscale_new_with_range(50,255,1); | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
416 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
3729 | 417 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
418 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
419 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
|
420 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL); |
3729 | 421 |
422 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
423 | |
424 gtk_widget_show_all(hbox); | |
425 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
426 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
|
427 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
428 /* Buddy List trans options */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
429 bltransbox = make_frame (ret, _("Buddy List Window")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
430 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
|
431 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
|
432 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
433 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
|
434 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
|
435 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
436 trans_box = gtk_vbox_new(FALSE, 18); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
437 if (!(trans_options & OPT_WGAIM_BLTRANS)) |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
438 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
439 gtk_widget_show(trans_box); |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
440 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
|
441 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
|
442 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
443 /* IM transparency slider */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
444 hbox = gtk_hbox_new(FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
445 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
446 label = gtk_label_new(_("Opacity:")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
447 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
448 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
449 slider = gtk_hscale_new_with_range(50,255,1); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
450 gtk_range_set_value(GTK_RANGE(slider), blalpha); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
451 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
452 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
453 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
|
454 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
|
455 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
456 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
457 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
458 gtk_widget_show_all(hbox); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
459 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
460 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
|
461 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
462 /* 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
|
463 if(!has_transparency()) { |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
464 debug_printf("This version of windows dosn't support transparency\n"); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
465 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
466 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
467 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
468 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
469 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
470 gtk_widget_show_all(ret); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
471 return ret; |
3729 | 472 } |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
473 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
474 static GaimGtkPluginUiInfo ui_info = |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
475 { |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
476 get_config_frame |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
477 }; |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
478 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
479 static GaimPluginInfo info = |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
480 { |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
481 2, /**< api_version */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
482 GAIM_PLUGIN_STANDARD, /**< type */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
483 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
484 0, /**< flags */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
485 NULL, /**< dependencies */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
486 GAIM_PRIORITY_DEFAULT, /**< priority */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
487 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
488 WINTRANS_PLUGIN_ID, /**< id */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
489 N_("Transparency"), /**< name */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
490 VERSION, /**< version */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
491 /** summary */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
492 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
|
493 /** description */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
494 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
|
495 "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
496 WEBSITE, /**< homepage */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
497 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
498 plugin_load, /**< load */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
499 plugin_unload, /**< unload */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
500 NULL, /**< destroy */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
501 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
502 &ui_info, /**< ui_info */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
503 NULL /**< extra_info */ |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
504 }; |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
505 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
506 static void |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
507 __init_plugin(GaimPlugin *plugin) |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
508 { |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
509 } |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
510 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
511 GAIM_INIT_PLUGIN(wintrans, __init_plugin, info); |