annotate plugins/win32/transparency/win2ktrans.c @ 4105:e92d7712b8ba

[gaim-migrate @ 4320] Buddy List now has trans options committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Fri, 20 Dec 2002 18:08:47 +0000
parents 72d973958607
children 6c38239ff612
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * win2ktrans
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net>
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
5 *
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
6 * Contributions by Herman Bloggs <hermanator12002@yahoo.com>
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * this program is free software; you can redistribute it and/or modify
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * it under the terms of the gnu general public license as published by
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * the free software foundation; either version 2 of the license, or
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * (at your option) any later version.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * this program is distributed in the hope that it will be useful,
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * but without any warranty; without even the implied warranty of
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * merchantability or fitness for a particular purpose. see the
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * gnu general public license for more details.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * you should have received a copy of the gnu general public license
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * along with this program; if not, write to the free software
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 */
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #define GAIM_PLUGINS
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include "gaim.h"
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
28 #include "win32dep.h"
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
51 * GLOBALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
52 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
53 G_MODULE_IMPORT guint im_options;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
54 G_MODULE_IMPORT GtkWidget *all_convos;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
55 G_MODULE_IMPORT GtkWidget *blist;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
56
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
57 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
58 * LOCALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
59 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
60 static GtkWidget *slider_box=NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
61 static int imalpha = 255;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
62 static int blalpha = 255;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
63 guint trans_options=0;
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 * PROTOS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
67 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
68 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
69 extern GtkWidget *gaim_button(const char*, guint*, int, GtkWidget*);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
70 static void save_trans_prefs();
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 * CODE
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 /* Set window transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
76 void set_wintrans(GtkWidget *window, int trans) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
77 if(MySetLayeredWindowAttributes) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
78 HWND hWnd = GDK_WINDOW_HWND(window->window);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
79 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
80 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
81 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
82 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
83
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
84 void set_wintrans_off(GtkWidget *window) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
85 if(MySetLayeredWindowAttributes) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
86 HWND hWnd = GDK_WINDOW_HWND(window->window);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
87 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
88
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
89 /* Ask the window and its children to repaint */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
90 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
91 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
92 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
93
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
94 static void change_alpha(GtkWidget *w, gpointer data) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
95 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
96 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
97
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
98 int has_transparency() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
99 return MySetLayeredWindowAttributes ? TRUE : FALSE;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
100 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
101
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
102 GtkWidget *wintrans_slider(GtkWidget *win) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
103 GtkWidget *hbox;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
104 GtkWidget *label, *slider;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
105 GtkWidget *frame;
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 frame = gtk_frame_new(NULL);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
108 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
109 gtk_widget_show(frame);
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 hbox = gtk_hbox_new(FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
112 gtk_container_add(GTK_CONTAINER(frame), hbox);
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 label = gtk_label_new(_("Opacity:"));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
115 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
116 gtk_widget_show(hbox);
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 slider = gtk_hscale_new_with_range(50,255,1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
119 gtk_range_set_value(GTK_RANGE(slider), imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
120 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
121
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
122 /* On slider val change, update window's transparency level */
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
123 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
124
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
125 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
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 /* Set the initial transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
128 set_wintrans(win, imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
129
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
130 gtk_widget_show_all(hbox);
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 return frame;
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
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
135 static void gaim_del_conversation(char *who) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
136 if(!all_convos)
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
137 slider_box = NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
138 }
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140 static void gaim_new_conversation(char *who) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
141 GList *wl, *wl1;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
142 GtkWidget *vbox=NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
143
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
144 struct conversation *c = find_conversation(who);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
145
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
146 /* Single convo window */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
147 if((im_options & OPT_IM_ONE_WINDOW)) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
148 /* check prefs to see if we want trans */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
149 if ((trans_options & OPT_WGAIM_IMTRANS) &&
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
150 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
151 if(!slider_box) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
152 /* Get vbox which to add slider to.. */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
153 for ( wl1 = wl = gtk_container_children(GTK_CONTAINER(c->window));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
154 wl != NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
155 wl = wl->next ) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
156 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) )
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
157 vbox = GTK_WIDGET(wl->data);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
158 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
159 debug_printf("no vbox found\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
160 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
161 g_list_free(wl1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
162
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
163 slider_box = wintrans_slider(c->window);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
164 gtk_box_pack_start(GTK_BOX(vbox),
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
165 slider_box,
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
166 FALSE, FALSE, 0);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
167 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
168 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
169 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
170 /* One window per convo */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
171 else {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
172 if ((trans_options & OPT_WGAIM_IMTRANS) &&
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
173 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
174 GtkWidget *paned;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
175
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
176 /* Get container which to add slider to.. */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
177 wl = gtk_container_children(GTK_CONTAINER(c->window));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
178 paned = GTK_WIDGET(wl->data);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
179 g_list_free(wl);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
180 wl = gtk_container_children(GTK_CONTAINER(paned));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
181 /* 2nd child */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
182 vbox = GTK_WIDGET((wl->next)->data);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
183 g_list_free(wl);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
184
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
185 if(!GTK_IS_VBOX(vbox))
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
186 debug_printf("vbox isn't a vbox widget\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
187
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
188 gtk_box_pack_start(GTK_BOX(vbox),
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
189 wintrans_slider(c->window),
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
190 FALSE, FALSE, 0);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
191 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
192 }
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 if((trans_options & OPT_WGAIM_IMTRANS) &&
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
195 !(trans_options & OPT_WGAIM_SHOW_IMTRANS)) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
196 set_wintrans(c->window, imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
197 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
198 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
199
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
200 static void blist_created() {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
201 if(blist) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
202 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
203 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
204 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
205 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
206
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
207 if(trans_options & OPT_WGAIM_BLTRANS)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
208 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
209 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
210 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
211 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
212 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
213
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
214 static void alpha_change(GtkWidget *w, gpointer data) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
215 int *alpha = (int*)data;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
216 *alpha = gtk_range_get_value(GTK_RANGE(w));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
217 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
218
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
219 static void bl_alpha_change(GtkWidget *w, gpointer data) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
220 alpha_change(w, data);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
221 if(blist)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
222 change_alpha(w, blist);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
224
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
225 /* Load options */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
226 static void load_trans_prefs() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
227 FILE *f;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
228 char buf[1024];
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
229 int ver=0;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
230 char tag[256];
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
231
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
232 if (gaim_home_dir())
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
233 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
234 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
235 return;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
236
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
237 if ((f = fopen(buf, "r"))) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
238 fgets(buf, sizeof(buf), f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
239 sscanf(buf, "# wintransrc v%d", &ver);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
240 if ((ver > 1) || (buf[0] != '#'))
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
241 return;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
242
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
243 while (!feof(f)) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
244 fgets(buf, sizeof(buf), f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
245 sscanf(buf, "%s {", tag);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
246 if (strcmp(tag, "options")==0) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
247 fgets(buf, sizeof(buf), f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
248 sscanf(buf, "\ttrans_options { %d", &trans_options);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
249 continue;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
250 } else if (strcmp(tag, "trans")==0) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
251 int num;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
252 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
253 sscanf(buf, "\t%s { %d", tag, &num);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
254 if(strcmp(tag, "imalpha")==0) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
255 imalpha = num;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
256 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
257 else if(strcmp(tag, "blalpha")==0) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
258 blalpha = num;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
259 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
260 }
4096
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 }
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 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
265 save_trans_prefs();
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
266 blist_created();
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
267 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
268
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
269 /* Save options */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
270
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
271 static void write_options(FILE *f) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
272 fprintf(f, "options {\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
273 fprintf(f, "\ttrans_options { %u }\n", trans_options);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
274 fprintf(f, "}\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
275 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
276
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
277 static void write_trans(FILE *f) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
278 fprintf(f, "trans {\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
279 fprintf(f, "\timalpha { %d }\n", imalpha);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
280 fprintf(f, "\tblalpha { %d }\n", blalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
281 fprintf(f, "}\n");
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 static void save_trans_prefs() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
285 FILE *f;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
286 char buf[1024];
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 if (gaim_home_dir()) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
289 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
290 }
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
291 else
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
292 return;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
293
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
294 if ((f = fopen(buf, "w"))) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
295 fprintf(f, "# wintransrc v%d\n", WINTRANS_VERSION);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
296 write_trans(f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
297 write_options(f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
298 fclose(f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
299 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
300 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
301 debug_printf("Error opening wintransrc\n");
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
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
304 static void set_trans_option(GtkWidget *w, int option) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
305 trans_options ^= option;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
306 save_trans_prefs();
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
307
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
308 if(option == OPT_WGAIM_BUDDYWIN_ONTOP) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
309 if(blist) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
310 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
311 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
312 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
313 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
314 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
315 } else if(option == OPT_WGAIM_BLTRANS) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
316 if(blist) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
317 if(trans_options & OPT_WGAIM_BLTRANS)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
318 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
319 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
320 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
321 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
322 }
4096
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
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
325 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
326 * EXPORTED FUNCTIONS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
327 */
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
328
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
329 G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
330 gaim_signal_connect(handle, event_new_conversation, gaim_new_conversation, NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
331 gaim_signal_connect(handle, event_del_conversation, gaim_del_conversation, NULL);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
332 gaim_signal_connect(handle, event_signon, blist_created, NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
333 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
334 load_trans_prefs();
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336 return NULL;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
338
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339 G_MODULE_EXPORT void gaim_plugin_remove() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
341
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342 struct gaim_plugin_description desc;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
343
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
345 desc.api_version = PLUGIN_API_VERSION;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
346 desc.name = g_strdup(_("Transparency"));
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
347 desc.version = g_strdup(VERSION);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348 desc.description = g_strdup(_("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP."));
3831
0d1d4ba2c843 [gaim-migrate @ 3980]
Rob Flynn <gaim@robflynn.com>
parents: 3740
diff changeset
349 desc.authors = g_strdup(_("Rob Flynn &lt;rob@marko.net&gt;"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
350 desc.url = g_strdup(WEBSITE);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
351 return &desc;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
353
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
354 G_MODULE_EXPORT char *name() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
355 return _("Transparency");
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358 G_MODULE_EXPORT char *description() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
359 return _("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP.");
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
361
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
362 G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
363 GtkWidget *ret;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
364 GtkWidget *imtransbox, *bltransbox;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365 GtkWidget *hbox;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366 GtkWidget *label, *slider;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
367 GtkWidget *button;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
368 GtkWidget *trans_box;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
369
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
370 ret = gtk_vbox_new(FALSE, 18);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
371 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
372
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
373 /* IM Convo trans options */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
374 imtransbox = make_frame (ret, _("IM Conversation Windows"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
375 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
376 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
377
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
378 trans_box = gtk_vbox_new(FALSE, 18);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
379 if (!(trans_options & OPT_WGAIM_IMTRANS))
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
380 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
381 gtk_widget_show(trans_box);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
382
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
383 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), trans_box);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
384
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
385 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
386 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
387
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
388 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
389
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
390 /* IM transparency slider */
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
391 hbox = gtk_hbox_new(FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
392
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
393 label = gtk_label_new(_("Opacity:"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
395
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
396 slider = gtk_hscale_new_with_range(50,255,1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
397 gtk_range_set_value(GTK_RANGE(slider), imalpha);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
399
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
400 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), (void*)&imalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
401 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405 gtk_widget_show_all(hbox);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
407 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
408
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
409 /* Buddy List trans options */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
410 bltransbox = make_frame (ret, _("Buddy List Window"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
411 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
412 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
413
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
414 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
415 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
416
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
417 trans_box = gtk_vbox_new(FALSE, 18);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
418 if (!(trans_options & OPT_WGAIM_BLTRANS))
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
419 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
420 gtk_widget_show(trans_box);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
421 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), trans_box);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
422 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
423
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
424 /* IM transparency slider */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
425 hbox = gtk_hbox_new(FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
426
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
427 label = gtk_label_new(_("Opacity:"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
428 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
429
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
430 slider = gtk_hscale_new_with_range(50,255,1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
431 gtk_range_set_value(GTK_RANGE(slider), blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
432 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
433
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
434 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
435 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
436
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
437 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
438
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
439 gtk_widget_show_all(hbox);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
440
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
441 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
442
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
443 /* 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
444 if(!has_transparency()) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
445 debug_printf("This version of windows dosn't support transparency\n");
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
446 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
447 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
448 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
449 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
450
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
451 gtk_widget_show_all(ret);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
452 return ret;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
453 }