Mercurial > pidgin.yaz
annotate plugins/win32/transparency/win2ktrans.c @ 13197:22f8ed4e5294
[gaim-migrate @ 15560]
Never auto-delete our currently in-use status. I ran into this
when I was doing some crazy shit.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 09 Feb 2006 03:14:59 +0000 |
parents | ae13e73e4fd9 |
children | 983921e78632 |
rev | line source |
---|---|
3729 | 1 /* |
6435
53a613fed06d
[gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6408
diff
changeset
|
2 * gaim - Transparency plugin |
3729 | 3 * |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net> |
6435
53a613fed06d
[gaim-migrate @ 6943]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6408
diff
changeset
|
5 * copyright (c) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
6 * copyright (c) 2005, Daniel Atallah <daniel_atallah@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 */ | |
11600
ae13e73e4fd9
[gaim-migrate @ 13870]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11596
diff
changeset
|
23 #ifndef _WIN32_WINNT |
ae13e73e4fd9
[gaim-migrate @ 13870]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11596
diff
changeset
|
24 #define _WIN32_WINNT 0x0500 |
ae13e73e4fd9
[gaim-migrate @ 13870]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11596
diff
changeset
|
25 #endif |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
26 #include <gdk/gdkwin32.h> |
5912
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
27 #include "internal.h" |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
28 |
6494
4f93f10ddc75
[gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6435
diff
changeset
|
29 #include "core.h" |
5912
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
30 #include "prefs.h" |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
31 #include "debug.h" |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
32 |
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
33 #include "gtkconv.h" |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
34 #include "gtkplugin.h" |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
35 #include "gtkprefs.h" |
5248 | 36 #include "gtkblist.h" |
5912
b3c412884a22
[gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
37 #include "gtkutils.h" |
6494
4f93f10ddc75
[gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6435
diff
changeset
|
38 #include "signals.h" |
9954 | 39 #include "version.h" |
3729 | 40 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
41 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
42 * MACROS & DEFINES |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
43 */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
44 #define WINTRANS_PLUGIN_ID "gtk-win-trans" |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
45 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
46 #define blist (gaim_get_blist() \ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
47 ? (GAIM_GTK_BLIST(gaim_get_blist()) \ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
48 ? ((GAIM_GTK_BLIST(gaim_get_blist()))->window) \ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
49 : NULL) \ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
50 : NULL) |
4726
0b1c01fd68f1
[gaim-migrate @ 5039]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4606
diff
changeset
|
51 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
52 /* |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
53 * DATA STRUCTS |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
54 */ |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
55 typedef struct { |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
56 GtkWidget *win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
57 GtkWidget *slider; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
58 } slider_win; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
59 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
60 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
61 * LOCALS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
62 */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
63 static const char *OPT_WINTRANS_IM_ENABLED= "/plugins/gtk/win32/wintrans/im_enabled"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
64 static const char *OPT_WINTRANS_IM_ALPHA = "/plugins/gtk/win32/wintrans/im_alpha"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
65 static const char *OPT_WINTRANS_IM_SLIDER = "/plugins/gtk/win32/wintrans/im_slider"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
66 static const char *OPT_WINTRANS_IM_ONFOCUS= "/plugins/gtk/win32/wintrans/im_solid_onfocus"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
67 static const char *OPT_WINTRANS_IM_ONTOP = "/plugins/gtk/win32/wintrans/im_always_on_top"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
68 static const char *OPT_WINTRANS_BL_ENABLED= "/plugins/gtk/win32/wintrans/bl_enabled"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
69 static const char *OPT_WINTRANS_BL_ALPHA = "/plugins/gtk/win32/wintrans/bl_alpha"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
70 static const char *OPT_WINTRANS_BL_ONFOCUS= "/plugins/gtk/win32/wintrans/bl_solid_onfocus"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
71 static const char *OPT_WINTRANS_BL_ONTOP = "/plugins/gtk/win32/wintrans/bl_always_on_top"; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
72 static GSList *window_list = NULL; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
73 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
74 static BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags) = NULL; |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
75 |
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 * CODE |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
78 */ |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
79 static GtkWidget *wgaim_button(const char *text, const char *pref, GtkWidget *page) { |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
80 GtkWidget *button; |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
81 button = gtk_check_button_new_with_mnemonic(text); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
82 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
83 gaim_prefs_get_bool(pref)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
84 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
85 gtk_widget_show(button); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
86 return button; |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
87 } |
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
88 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
89 /* Set window transparency level */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
90 static void set_wintrans(GtkWidget *window, int alpha, gboolean enabled, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
91 gboolean always_on_top) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
92 if (MySetLayeredWindowAttributes) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
93 HWND hWnd = GDK_WINDOW_HWND(window->window); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
94 LONG style = GetWindowLong(hWnd, GWL_EXSTYLE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
95 if (enabled) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
96 style |= WS_EX_LAYERED; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
97 } else { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
98 style &= ~WS_EX_LAYERED; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
99 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
100 SetWindowLong(hWnd, GWL_EXSTYLE, style); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
101 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
102 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
103 if (enabled) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
104 SetWindowPos(hWnd, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
105 always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
106 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
107 MySetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
108 } else { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
109 /* Ask the window and its children to repaint */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
110 SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
111 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
112 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
113 RedrawWindow(hWnd, NULL, NULL, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
114 RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
115 } |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
116 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
117 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
118 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
119 /* When a conv window is focused, if we're only transparent when unfocused, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
120 * deal with transparency */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
121 static gboolean focus_conv_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
122 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
123 && gaim_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
124 GtkWidget *window = (GtkWidget *) d; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
125 if (e->in) { /* Focused */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
126 set_wintrans(window, 0, FALSE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
127 gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
128 } else { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
129 set_wintrans(window, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
130 gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
131 TRUE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
132 gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
133 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
134 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
135 return FALSE; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
136 } |
8961 | 137 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
138 /* When buddy list window is focused, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
139 * if we're only transparent when unfocused, deal with transparency */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
140 static gboolean focus_blist_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
141 if (gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
142 && gaim_prefs_get_bool(OPT_WINTRANS_BL_ONFOCUS)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
143 GtkWidget *window = (GtkWidget *) d; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
144 if (e->in) { /* Focused */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
145 set_wintrans(window, 0, FALSE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
146 gaim_prefs_get_bool(OPT_WINTRANS_BL_ONTOP)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
147 } else { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
148 set_wintrans(window, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
149 gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
150 TRUE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
151 gaim_prefs_get_bool(OPT_WINTRANS_BL_ONTOP)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
152 } |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
153 } |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
154 return FALSE; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
155 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
156 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
157 static void change_alpha(GtkWidget *w, gpointer data) { |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
158 int alpha = gtk_range_get_value(GTK_RANGE(w)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
159 gaim_prefs_set_int(OPT_WINTRANS_IM_ALPHA, alpha); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
160 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
161 /* If we're in no-transparency on focus mode, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
162 * don't take effect immediately */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
163 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS)) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
164 set_wintrans(GTK_WIDGET(data), alpha, TRUE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
165 gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
166 } |
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 |
9840 | 169 static GtkWidget *wintrans_slider(GtkWidget *win) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
170 GtkWidget *hbox; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
171 GtkWidget *label, *slider; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
172 GtkWidget *frame; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
173 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
174 int imalpha = gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
175 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
176 frame = gtk_frame_new(NULL); |
9915 | 177 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
178 gtk_widget_show(frame); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
179 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
180 hbox = gtk_hbox_new(FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
181 gtk_container_add(GTK_CONTAINER(frame), hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
182 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
183 label = gtk_label_new(_("Opacity:")); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
184 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
185 gtk_widget_show(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
186 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
187 slider = gtk_hscale_new_with_range(50, 255, 1); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
188 gtk_range_set_value(GTK_RANGE(slider), imalpha); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
189 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
190 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
191 /* On slider val change, update window's transparency level */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
192 g_signal_connect(GTK_OBJECT(slider), "value-changed", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
193 GTK_SIGNAL_FUNC(change_alpha), win); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
194 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
195 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
196 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
197 /* Set the initial transparency level */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
198 set_wintrans(win, imalpha, TRUE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
199 gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
200 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
201 gtk_widget_show_all(hbox); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
202 |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
203 return frame; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
204 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
205 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
206 static slider_win* find_slidwin(GtkWidget *win) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
207 GSList *tmp = window_list; |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
208 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
209 while (tmp) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
210 if (((slider_win*) (tmp->data))->win == win) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
211 return (slider_win*) tmp->data; |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
212 tmp = tmp->next; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
213 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
214 return NULL; |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
215 } |
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
216 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
217 /* Clean up transparency stuff for the conv window */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
218 static void cleanup_conv_window(GaimGtkWindow *win) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
219 GtkWidget *window = win->window; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
220 slider_win *slidwin = NULL; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
221 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
222 /* Remove window from the window list */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
223 gaim_debug_info(WINTRANS_PLUGIN_ID, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
224 "Conv window destroyed... removing from list\n"); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
225 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
226 if ((slidwin = find_slidwin(window))) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
227 window_list = g_slist_remove(window_list, slidwin); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
228 g_free(slidwin); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
229 } |
10928
80a4e8e40057
[gaim-migrate @ 12705]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10338
diff
changeset
|
230 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
231 /* Remove the focus cbs */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
232 g_signal_handlers_disconnect_by_func(G_OBJECT(window), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
233 G_CALLBACK(focus_conv_win_cb), window); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
234 } |
3729 | 235 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
236 static void gaim_conversation_delete(GaimConversation *conv) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
237 GaimGtkWindow *win = gaim_gtkconv_get_window(GAIM_GTK_CONVERSATION(conv)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
238 /* If it is the last conversation in the window, cleanup */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
239 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
240 cleanup_conv_window(win); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
241 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
242 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
243 static void set_blist_trans(GtkWidget *w, const char *pref) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
244 gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
245 gaim_prefs_set_bool(pref, enabled); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
246 if (blist) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
247 set_wintrans(blist, gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
248 gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
249 gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
8961 | 250 } |
251 } | |
252 | |
253 static void add_slider(GtkWidget *win) { | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
254 GList *wl, *wl1; |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
255 GtkWidget *vbox = NULL; |
8961 | 256 |
257 /* Look up this window to see if it already has a slider */ | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
258 if (!find_slidwin(win)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
259 GtkWidget *slider_box = NULL; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
260 slider_win *slidwin = NULL; |
9915 | 261 GtkRequisition slidereq; |
262 gint width, height; | |
8961 | 263 |
264 /* Get top vbox */ | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
265 for (wl1 = wl = gtk_container_get_children( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
266 GTK_CONTAINER(win)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
267 wl != NULL; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
268 wl = wl->next) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
269 if (GTK_IS_VBOX(GTK_OBJECT(wl->data))) |
8961 | 270 vbox = GTK_WIDGET(wl->data); |
271 else { | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
272 gaim_debug_error(WINTRANS_PLUGIN_ID, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
273 "no vbox found\n"); |
8961 | 274 return; |
275 } | |
276 } | |
277 g_list_free(wl1); | |
278 | |
279 slider_box = wintrans_slider(win); | |
9915 | 280 /* Figure out how tall the slider wants to be */ |
281 gtk_widget_size_request(slider_box, &slidereq); | |
282 gtk_window_get_size(GTK_WINDOW(win), &width, &height); | |
8961 | 283 gtk_box_pack_start(GTK_BOX(vbox), |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
284 slider_box, FALSE, FALSE, 0); |
9915 | 285 /* Make window taller so we don't slowly collapse its message area */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
286 gtk_window_resize(GTK_WINDOW(win), width, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
287 (height + slidereq.height)); |
8961 | 288 /* Add window to list, to track that it has a slider */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
289 slidwin = g_new0(slider_win, 1); |
8961 | 290 slidwin->win = win; |
291 slidwin->slider = slider_box; | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
292 window_list = g_slist_append(window_list, slidwin); |
8961 | 293 } |
294 } | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
295 |
8961 | 296 static void remove_sliders() { |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
297 if (window_list) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
298 GSList *tmp = window_list; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
299 while (tmp) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
300 slider_win *slidwin = (slider_win*) tmp->data; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
301 if (slidwin != NULL && |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
302 GTK_IS_WINDOW(slidwin->win)) { |
9915 | 303 GtkRequisition slidereq; |
304 gint width, height; | |
305 /* Figure out how tall the slider was */ | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
306 gtk_widget_size_request( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
307 slidwin->slider, &slidereq); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
308 gtk_window_get_size( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
309 GTK_WINDOW(slidwin->win), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
310 &width, &height); |
9915 | 311 |
9840 | 312 gtk_widget_destroy(slidwin->slider); |
9915 | 313 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
314 gtk_window_resize( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
315 GTK_WINDOW(slidwin->win), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
316 width, (height - slidereq.height)); |
9915 | 317 } |
8961 | 318 g_free(slidwin); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
319 tmp = tmp->next; |
8961 | 320 } |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
321 g_slist_free(window_list); |
8961 | 322 window_list = NULL; |
323 } | |
324 } | |
325 | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
326 /* Remove all transparency related aspects from conversation windows */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
327 static void remove_convs_wintrans(gboolean remove_signal) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
328 GList *wins; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
329 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
330 for (wins = gaim_gtk_conv_windows_get_list(); wins; wins = wins->next) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
331 GaimGtkWindow *win = wins->data; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
332 GtkWidget *window = win->window; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
333 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
334 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
335 set_wintrans(window, 0, FALSE, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
336 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
337 /* Remove the focus cbs */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
338 if (remove_signal) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
339 g_signal_handlers_disconnect_by_func(G_OBJECT(window), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
340 G_CALLBACK(focus_conv_win_cb), window); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
341 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
342 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
343 remove_sliders(); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
344 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
345 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
346 static void set_conv_window_trans(GaimGtkWindow *oldwin, GaimGtkWindow *newwin) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
347 GtkWidget *win = newwin->window; |
8961 | 348 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
349 /* check prefs to see if we want trans */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
350 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
351 set_wintrans(win, gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
352 TRUE, gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
353 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
354 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
355 add_slider(win); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
356 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
357 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
358 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
359 /* If we're moving from one window to another, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
360 * add the focus listeners to the new window if not already there */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
361 if (oldwin != NULL && oldwin != newwin) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
362 if (gaim_gtk_conv_window_get_gtkconv_count(newwin) == 0) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
363 g_signal_connect(G_OBJECT(win), "focus_in_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
364 G_CALLBACK(focus_conv_win_cb), win); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
365 g_signal_connect(G_OBJECT(win), "focus_out_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
366 G_CALLBACK(focus_conv_win_cb), win); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
367 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
368 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
369 /* If we've moved the last conversation, cleanup the window */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
370 if (gaim_gtk_conv_window_get_gtkconv_count(oldwin) == 1) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
371 cleanup_conv_window(oldwin); |
11591
9835c4c5800d
[gaim-migrate @ 13861]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11447
diff
changeset
|
372 } |
8961 | 373 } |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
374 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
375 static void update_convs_wintrans(GtkWidget *toggle_btn, const char *pref) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
376 gaim_prefs_set_bool(pref, gtk_toggle_button_get_active( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
377 GTK_TOGGLE_BUTTON(toggle_btn))); |
8961 | 378 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
379 if (gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
380 GList *wins; |
8961 | 381 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
382 for (wins = gaim_gtk_conv_windows_get_list(); wins; wins = wins->next) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
383 GaimGtkWindow *win = wins->data; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
384 set_conv_window_trans(NULL, win); |
11591
9835c4c5800d
[gaim-migrate @ 13861]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11447
diff
changeset
|
385 } |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
386 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
387 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
388 remove_sliders(); |
8961 | 389 } |
390 else | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
391 remove_convs_wintrans(FALSE); |
8961 | 392 } |
393 | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
394 static void gaim_new_conversation(GaimConversation *conv) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
395 GaimGtkWindow *win = gaim_gtkconv_get_window(GAIM_GTK_CONVERSATION(conv)); |
3729 | 396 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
397 /* If it is the first conversation in the window, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
398 * add the sliders, and set transparency */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
399 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
400 GtkWidget *window = win->window; |
4400
6c38239ff612
[gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4105
diff
changeset
|
401 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
402 set_conv_window_trans(NULL, win); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
403 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
404 g_signal_connect(G_OBJECT(window), "focus_in_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
405 G_CALLBACK(focus_conv_win_cb), window); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
406 g_signal_connect(G_OBJECT(window), "focus_out_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
407 G_CALLBACK(focus_conv_win_cb), window); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
408 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
409 } |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
410 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
411 static void blist_created_cb(GaimBuddyList *gaim_blist, gpointer data) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
412 if (blist) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
413 if (gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
414 set_wintrans(blist, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
415 gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
416 TRUE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
417 gaim_prefs_get_bool(OPT_WINTRANS_BL_ONTOP)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
418 } |
8961 | 419 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
420 g_signal_connect(G_OBJECT(blist), "focus_in_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
421 G_CALLBACK(focus_blist_win_cb), blist); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
422 g_signal_connect(G_OBJECT(blist), "focus_out_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
423 G_CALLBACK(focus_blist_win_cb), blist); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
424 } |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
425 } |
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 static void alpha_change(GtkWidget *w, gpointer data) { |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
428 GList *wins; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
429 int imalpha = gtk_range_get_value(GTK_RANGE(w)); |
8961 | 430 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
431 for (wins = gaim_gtk_conv_windows_get_list(); wins; wins = wins->next) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
432 GaimGtkWindow *win = wins->data; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
433 set_wintrans(win->window, imalpha, TRUE, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
434 gaim_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
11591
9835c4c5800d
[gaim-migrate @ 13861]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11447
diff
changeset
|
435 } |
4105
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 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
438 static void alpha_pref_set_int (GtkWidget *w, GdkEventFocus *e, const char *pref) |
9840 | 439 { |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
440 int alpha = gtk_range_get_value(GTK_RANGE(w)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
441 gaim_prefs_set_int(pref, alpha); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
442 } |
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
443 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
444 static void bl_alpha_change(GtkWidget *w, gpointer data) { |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
445 if (blist) |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
446 change_alpha(w, blist); |
3729 | 447 } |
448 | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
449 static void update_existing_convs() { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
450 GList *wins; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
451 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
452 for (wins = gaim_gtk_conv_windows_get_list(); wins; wins = wins->next) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
453 GaimGtkWindow *win = wins->data; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
454 GtkWidget *window = win->window; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
455 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
456 set_conv_window_trans(NULL, win); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
457 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
458 g_signal_connect(G_OBJECT(window), "focus_in_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
459 G_CALLBACK(focus_conv_win_cb), window); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
460 g_signal_connect(G_OBJECT(window), "focus_out_event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
461 G_CALLBACK(focus_conv_win_cb), window); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
462 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
463 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
464 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
465 /* |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
466 * EXPORTED FUNCTIONS |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
467 */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
468 static gboolean plugin_load(GaimPlugin *plugin) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
469 MySetLayeredWindowAttributes = (void*) wgaim_find_and_loadproc( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
470 "user32.dll", "SetLayeredWindowAttributes"); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
471 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
472 if (!MySetLayeredWindowAttributes) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
473 gaim_debug_error(WINTRANS_PLUGIN_ID, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
474 "SetLayeredWindowAttributes API not found (Required W2K+)\n"); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
475 return FALSE; |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
476 } |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
477 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
478 gaim_signal_connect(gaim_conversations_get_handle(), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
479 "conversation-created", plugin, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
480 GAIM_CALLBACK(gaim_new_conversation), NULL); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
481 |
10928
80a4e8e40057
[gaim-migrate @ 12705]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10338
diff
changeset
|
482 /* Set callback to remove window from the list, if the window is destroyed */ |
80a4e8e40057
[gaim-migrate @ 12705]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10338
diff
changeset
|
483 gaim_signal_connect(gaim_conversations_get_handle(), |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
484 "deleting-conversation", plugin, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
485 GAIM_CALLBACK(gaim_conversation_delete), NULL); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
486 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
487 gaim_signal_connect(gaim_gtk_conversations_get_handle(), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
488 "conversation-dragging", plugin, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
489 GAIM_CALLBACK(set_conv_window_trans), NULL); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
490 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
491 update_existing_convs(); |
8961 | 492 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
493 if (blist) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
494 blist_created_cb(NULL, NULL); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
495 else |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
496 gaim_signal_connect(gaim_gtk_blist_get_handle(), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
497 "gtkblist-created", plugin, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
498 GAIM_CALLBACK(blist_created_cb), NULL); |
8961 | 499 |
3729 | 500 |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
501 return TRUE; |
3729 | 502 } |
503 | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
504 static gboolean plugin_unload(GaimPlugin *plugin) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
505 gaim_debug_info(WINTRANS_PLUGIN_ID, "Unloading win2ktrans plugin\n"); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
506 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
507 remove_convs_wintrans(TRUE); |
4569
7f2de19d052d
[gaim-migrate @ 4850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4492
diff
changeset
|
508 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
509 if (blist) { |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
510 if (gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
511 set_wintrans(blist, 0, FALSE, FALSE); |
8961 | 512 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
513 /* Remove the focus cbs */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
514 g_signal_handlers_disconnect_by_func(G_OBJECT(blist), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
515 G_CALLBACK(focus_blist_win_cb), blist); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
516 } |
9840 | 517 |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
518 return TRUE; |
3729 | 519 } |
520 | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
521 static GtkWidget *get_config_frame(GaimPlugin *plugin) { |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
522 GtkWidget *ret; |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
523 GtkWidget *imtransbox, *bltransbox; |
3729 | 524 GtkWidget *hbox; |
525 GtkWidget *label, *slider; | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
526 GtkWidget *button; |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
527 GtkWidget *trans_box; |
3729 | 528 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
529 ret = gtk_vbox_new(FALSE, 18); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
530 gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
531 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
532 /* IM Convo trans options */ |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
533 imtransbox = gaim_gtk_make_frame(ret, _("IM Conversation Windows")); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
534 button = wgaim_button(_("_IM window transparency"), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
535 OPT_WINTRANS_IM_ENABLED, imtransbox); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
536 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
537 GTK_SIGNAL_FUNC(update_convs_wintrans), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
538 (gpointer) OPT_WINTRANS_IM_ENABLED); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
539 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
540 trans_box = gtk_vbox_new(FALSE, 18); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
541 if (!gaim_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
542 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
543 gtk_widget_show(trans_box); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
544 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
545 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
546 GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
547 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
548 button = wgaim_button(_("_Show slider bar in IM window"), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
549 OPT_WINTRANS_IM_SLIDER, trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
550 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
551 GTK_SIGNAL_FUNC(update_convs_wintrans), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
552 (gpointer) OPT_WINTRANS_IM_SLIDER); |
9840 | 553 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
554 button = gaim_gtk_prefs_checkbox( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
555 _("Remove IM window transparency on focus"), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
556 OPT_WINTRANS_IM_ONFOCUS, trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
557 |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
558 button = wgaim_button(_("Always on top"), OPT_WINTRANS_IM_ONTOP, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
559 trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
560 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
561 GTK_SIGNAL_FUNC(update_convs_wintrans), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
562 (gpointer) OPT_WINTRANS_IM_ONTOP); |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
563 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
564 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
|
565 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
566 /* IM transparency slider */ |
3729 | 567 hbox = gtk_hbox_new(FALSE, 5); |
568 | |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
569 label = gtk_label_new(_("Opacity:")); |
3729 | 570 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
571 | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
572 slider = gtk_hscale_new_with_range(50, 255, 1); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
573 gtk_range_set_value(GTK_RANGE(slider), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
574 gaim_prefs_get_int(OPT_WINTRANS_IM_ALPHA)); |
3729 | 575 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
9840 | 576 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
577 g_signal_connect(GTK_OBJECT(slider), "value-changed", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
578 GTK_SIGNAL_FUNC(alpha_change), NULL); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
579 g_signal_connect(GTK_OBJECT(slider), "focus-out-event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
580 GTK_SIGNAL_FUNC(alpha_pref_set_int), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
581 (gpointer) OPT_WINTRANS_IM_ALPHA); |
3729 | 582 |
583 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
584 | |
585 gtk_widget_show_all(hbox); | |
586 | |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
587 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); |
9840 | 588 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
589 /* Buddy List trans options */ |
5749
6d6ae91c5de7
[gaim-migrate @ 6174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5248
diff
changeset
|
590 bltransbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
591 button = wgaim_button(_("_Buddy List window transparency"), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
592 OPT_WINTRANS_BL_ENABLED, bltransbox); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
593 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
594 GTK_SIGNAL_FUNC(set_blist_trans), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
595 (gpointer) OPT_WINTRANS_BL_ENABLED); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
596 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
597 trans_box = gtk_vbox_new(FALSE, 18); |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
598 if (!gaim_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
599 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
600 gtk_widget_show(trans_box); |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
601 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
602 GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
603 button = gaim_gtk_prefs_checkbox( |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
604 _("Remove Buddy List window transparency on focus"), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
605 OPT_WINTRANS_BL_ONFOCUS, trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
606 button = wgaim_button(_("Always on top"), OPT_WINTRANS_BL_ONTOP, |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
607 trans_box); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
608 g_signal_connect(GTK_OBJECT(button), "clicked", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
609 GTK_SIGNAL_FUNC(set_blist_trans), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
610 (gpointer) OPT_WINTRANS_BL_ONTOP); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
611 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
|
612 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
613 /* IM transparency slider */ |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
614 hbox = gtk_hbox_new(FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
615 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
616 label = gtk_label_new(_("Opacity:")); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
617 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
618 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
619 slider = gtk_hscale_new_with_range(50, 255, 1); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
620 gtk_range_set_value(GTK_RANGE(slider), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
621 gaim_prefs_get_int(OPT_WINTRANS_BL_ALPHA)); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
622 |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
623 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
9840 | 624 |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
625 g_signal_connect(GTK_OBJECT(slider), "value-changed", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
626 GTK_SIGNAL_FUNC(bl_alpha_change), NULL); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
627 g_signal_connect(GTK_OBJECT(slider), "focus-out-event", |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
628 GTK_SIGNAL_FUNC(alpha_pref_set_int), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
629 (gpointer) OPT_WINTRANS_BL_ALPHA); |
4105
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
630 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
631 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
632 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
633 gtk_widget_show_all(hbox); |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
634 |
e92d7712b8ba
[gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4096
diff
changeset
|
635 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
|
636 |
4096
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
637 gtk_widget_show_all(ret); |
72d973958607
[gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3831
diff
changeset
|
638 return ret; |
3729 | 639 } |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
640 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
641 static GaimGtkPluginUiInfo ui_info = |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
642 { |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
643 get_config_frame |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
644 }; |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
645 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
646 static GaimPluginInfo info = |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
647 { |
9954 | 648 GAIM_PLUGIN_MAGIC, |
649 GAIM_MAJOR_VERSION, | |
650 GAIM_MINOR_VERSION, | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
651 GAIM_PLUGIN_STANDARD, /**< type */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
652 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
653 0, /**< flags */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
654 NULL, /**< dependencies */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
655 GAIM_PRIORITY_DEFAULT, /**< priority */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
656 WINTRANS_PLUGIN_ID, /**< id */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
657 N_("Transparency"), /**< name */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
658 VERSION, /**< version */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
659 /** summary */ |
8779
4b0b96196cfb
[gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
8749
diff
changeset
|
660 N_("Variable Transparency for the buddy list and conversations."), |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
661 /** description */ |
8779
4b0b96196cfb
[gaim-migrate @ 9541]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
8749
diff
changeset
|
662 N_("This plugin enables variable alpha transparency on conversation windows and the buddy list.\n\n" |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
663 "* Note: This plugin requires Win2000 or greater."), |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
664 "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
665 GAIM_WEBSITE, /**< homepage */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
666 plugin_load, /**< load */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
667 plugin_unload, /**< unload */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
668 NULL, /**< destroy */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
669 &ui_info, /**< ui_info */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
670 NULL, /**< extra_info */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
671 NULL, /**< prefs_info */ |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
672 NULL /**< actions */ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
673 }; |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
674 |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
675 static void |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5749
diff
changeset
|
676 init_plugin(GaimPlugin *plugin) |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
677 { |
9840 | 678 gaim_prefs_add_none("/plugins/gtk/win32"); |
679 gaim_prefs_add_none("/plugins/gtk/win32/wintrans"); | |
11596
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
680 gaim_prefs_add_bool(OPT_WINTRANS_IM_ENABLED, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
681 gaim_prefs_add_int(OPT_WINTRANS_IM_ALPHA, 255); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
682 gaim_prefs_add_bool(OPT_WINTRANS_IM_SLIDER, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
683 gaim_prefs_add_bool(OPT_WINTRANS_IM_ONFOCUS, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
684 gaim_prefs_add_bool(OPT_WINTRANS_IM_ONTOP, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
685 gaim_prefs_add_bool(OPT_WINTRANS_BL_ENABLED, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
686 gaim_prefs_add_int(OPT_WINTRANS_BL_ALPHA, 255); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
687 gaim_prefs_add_bool(OPT_WINTRANS_BL_ONFOCUS, FALSE); |
944dadd28161
[gaim-migrate @ 13866]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11591
diff
changeset
|
688 gaim_prefs_add_bool(OPT_WINTRANS_BL_ONTOP, FALSE); |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
689 } |
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4726
diff
changeset
|
690 |
6063 | 691 GAIM_INIT_PLUGIN(wintrans, init_plugin, info) |