pidgin/plugins/transparency.c

Sat, 31 Dec 2022 20:57:19 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 31 Dec 2022 20:57:19 -0600
branch
release-2.x.y
changeset 41989
d8476c44a9de
parent 40926
d10bb378f560
permissions
-rw-r--r--

Added tag v2.14.11 for changeset 010d58407f0e

38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
1 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
2 * Pidgin - Transparency plugin
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
3 *
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
4 * Copyright (C) 1998-2002, Rob Flynn <rob@marko.net>
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2005, Daniel Atallah <daniel_atallah@yahoo.com>
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
7 *
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation; either version 2 of the
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
12 *
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
17 *
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
21 * 02111-1301, USA.
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
22 *
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
23 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
24 #include "internal.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
25
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
26 #include "core.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
27 #include "prefs.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
28 #include "debug.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
29
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
30 #include "gtkconv.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
31 #include "gtkplugin.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
32 #include "gtkprefs.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
33 #include "gtkblist.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
34 #include "gtkutils.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
35 #include "signals.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
36 #include "version.h"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
37
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
38 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
39 * MACROS & DEFINES
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
40 */
38777
b9031c159dd3 Add comment about the plugin name being unchanged
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38776
diff changeset
41 /* The plugin name is left unchanged from its WinAPI days in order to keep it
b9031c159dd3 Add comment about the plugin name being unchanged
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38776
diff changeset
42 * loading for users who were using it. */
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
43 #define WINTRANS_PLUGIN_ID "gtk-win-trans"
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
44
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
45 #define blist (purple_get_blist() \
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
46 ? (PIDGIN_BLIST(purple_get_blist()) \
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
47 ? ((PIDGIN_BLIST(purple_get_blist()))->window) \
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
48 : NULL) \
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
49 : NULL)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
50
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
51 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
52 * DATA STRUCTS
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
53 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
54 typedef struct {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
55 GtkWidget *win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
56 GtkWidget *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
57 } slider_win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
58
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
59 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
60 * LOCALS
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
61 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
62 static const char *OPT_WINTRANS_IM_ENABLED= "/plugins/gtk/transparency/im_enabled";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
63 static const char *OPT_WINTRANS_IM_ALPHA = "/plugins/gtk/transparency/im_alpha";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
64 static const char *OPT_WINTRANS_IM_SLIDER = "/plugins/gtk/transparency/im_slider";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
65 static const char *OPT_WINTRANS_IM_ONFOCUS= "/plugins/gtk/transparency/im_solid_onfocus";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
66 static const char *OPT_WINTRANS_IM_ONTOP = "/plugins/gtk/transparency/im_always_on_top";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
67 static const char *OPT_WINTRANS_BL_ENABLED= "/plugins/gtk/transparency/bl_enabled";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
68 static const char *OPT_WINTRANS_BL_ALPHA = "/plugins/gtk/transparency/bl_alpha";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
69 static const char *OPT_WINTRANS_BL_ONFOCUS= "/plugins/gtk/transparency/bl_solid_onfocus";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
70 static const char *OPT_WINTRANS_BL_ONTOP = "/plugins/gtk/transparency/bl_always_on_top";
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
71 static GSList *window_list = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
72
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
73 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
74 * CODE
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
75 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
76
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
77 /* Set window transparency level */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
78 static void set_wintrans(GtkWidget *window, int alpha, gboolean enabled,
40926
d10bb378f560 Fix some null pointer deferences and dead stores that scanbuild found in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 38777
diff changeset
79 gboolean always_on_top)
d10bb378f560 Fix some null pointer deferences and dead stores that scanbuild found in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 38777
diff changeset
80 {
d10bb378f560 Fix some null pointer deferences and dead stores that scanbuild found in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 38777
diff changeset
81 g_return_if_fail(GTK_IS_WIDGET(window));
d10bb378f560 Fix some null pointer deferences and dead stores that scanbuild found in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 38777
diff changeset
82
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
83 if (enabled) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
84 gdk_window_set_opacity(window->window, alpha / 255.0);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
85 gdk_window_set_keep_above(window->window, always_on_top);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
86 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
87 gdk_window_set_opacity(window->window, 1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
88 gdk_window_set_keep_above(window->window, 0);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
89 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
90 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
91
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
92 /* When a conv window is focused, if we're only transparent when unfocused,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
93 * deal with transparency */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
94 static gboolean focus_conv_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
95 if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
96 && purple_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
97 GtkWidget *window = (GtkWidget *) d;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
98 if (e->in) { /* Focused */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
99 set_wintrans(window, 0, FALSE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
100 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
101 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
102 set_wintrans(window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
103 purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
104 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
105 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
106 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
107 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
108 return FALSE;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
109 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
110
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
111 /* When buddy list window is focused,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
112 * if we're only transparent when unfocused, deal with transparency */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
113 static gboolean focus_blist_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
114 if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
115 && purple_prefs_get_bool(OPT_WINTRANS_BL_ONFOCUS)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
116 GtkWidget *window = (GtkWidget *) d;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
117 if (e->in) { /* Focused */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
118 set_wintrans(window, 0, FALSE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
119 purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
120 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
121 set_wintrans(window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
122 purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
123 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
124 purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
125 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
126 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
127 return FALSE;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
128 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
129
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
130 static void change_alpha(GtkWidget *w, gpointer data) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
131 int alpha = gtk_range_get_value(GTK_RANGE(w));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
132 purple_prefs_set_int(OPT_WINTRANS_IM_ALPHA, alpha);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
133
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
134 /* If we're in no-transparency on focus mode,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
135 * don't take effect immediately */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
136 if (!purple_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
137 set_wintrans(GTK_WIDGET(data), alpha, TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
138 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
139 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
140
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
141
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
142 static GtkWidget *wintrans_slider(GtkWidget *win) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
143 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
144 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
145 GtkWidget *frame;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
146
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
147 int imalpha = purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
148
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
149 frame = gtk_frame_new(NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
150 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
151 gtk_widget_show(frame);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
152
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
153 hbox = gtk_hbox_new(FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
154 gtk_container_add(GTK_CONTAINER(frame), hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
155
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
156 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
157 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
158 gtk_widget_show(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
159
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
160 slider = gtk_hscale_new_with_range(50, 255, 1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
161 gtk_range_set_value(GTK_RANGE(slider), imalpha);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
162 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
163
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
164 /* On slider val change, update window's transparency level */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
165 g_signal_connect(GTK_OBJECT(slider), "value-changed",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
166 G_CALLBACK(change_alpha), win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
167
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
168 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
169
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
170 /* Set the initial transparency level */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
171 set_wintrans(win, imalpha, TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
172 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
173
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
174 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
175
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
176 return frame;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
177 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
178
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
179 static slider_win* find_slidwin(GtkWidget *win) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
180 GSList *tmp = window_list;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
181
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
182 while (tmp) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
183 if (((slider_win*) (tmp->data))->win == win)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
184 return (slider_win*) tmp->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
185 tmp = tmp->next;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
186 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
187 return NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
188 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
189
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
190 /* Clean up transparency stuff for the conv window */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
191 static void cleanup_conv_window(PidginWindow *win) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
192 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
193 slider_win *slidwin = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
194
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
195 /* Remove window from the window list */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
196 purple_debug_info(WINTRANS_PLUGIN_ID,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
197 "Conv window destroyed... removing from list\n");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
198
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
199 if ((slidwin = find_slidwin(window))) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
200 window_list = g_slist_remove(window_list, slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
201 g_free(slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
202 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
203
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
204 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
205 g_signal_handlers_disconnect_by_func(G_OBJECT(window),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
206 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
207 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
208
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
209 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
210 conversation_delete_cb(PurpleConversation *conv) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
211 PidginWindow *win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
212 /* If it is the last conversation in the window, cleanup */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
213 if (win != NULL && pidgin_conv_window_get_gtkconv_count(win) == 1)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
214 cleanup_conv_window(win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
215 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
216
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
217 static void set_blist_trans(GtkWidget *w, const char *pref) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
218 gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
219 purple_prefs_set_bool(pref, enabled);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
220 if (blist) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
221 set_wintrans(blist, purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
222 purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
223 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
224 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
225 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
226
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
227 static void add_slider(GtkWidget *win) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
228 GList *wl, *wl1;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
229 GtkWidget *vbox = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
230
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
231 /* Look up this window to see if it already has a slider */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
232 if (!find_slidwin(win)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
233 GtkWidget *slider_box = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
234 slider_win *slidwin = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
235 GtkRequisition slidereq;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
236 gint width, height;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
237
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
238 /* Get top vbox */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
239 for (wl1 = wl = gtk_container_get_children(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
240 GTK_CONTAINER(win));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
241 wl != NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
242 wl = wl->next) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
243 if (GTK_IS_VBOX(GTK_OBJECT(wl->data)))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
244 vbox = GTK_WIDGET(wl->data);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
245 else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
246 purple_debug_error(WINTRANS_PLUGIN_ID,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
247 "no vbox found\n");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
248 return;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
249 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
250 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
251 g_list_free(wl1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
252
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
253 slider_box = wintrans_slider(win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
254 /* Figure out how tall the slider wants to be */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
255 gtk_widget_size_request(slider_box, &slidereq);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
256 gtk_window_get_size(GTK_WINDOW(win), &width, &height);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
257 gtk_box_pack_start(GTK_BOX(vbox),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
258 slider_box, FALSE, FALSE, 0);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
259 /* Add window to list, to track that it has a slider */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
260 slidwin = g_new0(slider_win, 1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
261 slidwin->win = win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
262 slidwin->slider = slider_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
263 window_list = g_slist_append(window_list, slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
264 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
265 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
266
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
267 static void remove_sliders() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
268 if (window_list) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
269 GSList *tmp = window_list;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
270 while (tmp) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
271 slider_win *slidwin = (slider_win*) tmp->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
272 if (slidwin != NULL &&
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
273 GTK_IS_WINDOW(slidwin->win)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
274 gtk_widget_destroy(slidwin->slider);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
275 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
276 g_free(slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
277 tmp = tmp->next;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
278 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
279 g_slist_free(window_list);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
280 window_list = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
281 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
282 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
283
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
284 /* Remove all transparency related aspects from conversation windows */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
285 static void remove_convs_wintrans(gboolean remove_signal) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
286 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
287
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
288 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
289 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
290 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
291
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
292 if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
293 set_wintrans(window, 0, FALSE, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
294
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
295 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
296 if (remove_signal)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
297 g_signal_handlers_disconnect_by_func(G_OBJECT(window),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
298 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
299 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
300
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
301 remove_sliders();
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
302 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
303
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
304 static void set_conv_window_trans(PidginWindow *oldwin, PidginWindow *newwin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
305 GtkWidget *win = newwin->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
306
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
307 /* check prefs to see if we want trans */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
308 if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
309 set_wintrans(win, purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
310 TRUE, purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
311
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
312 if (purple_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
313 add_slider(win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
314 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
315 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
316
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
317 /* If we're moving from one window to another,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
318 * add the focus listeners to the new window if not already there */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
319 if (oldwin != NULL && oldwin != newwin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
320 if (pidgin_conv_window_get_gtkconv_count(newwin) == 0) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
321 g_signal_connect(G_OBJECT(win), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
322 G_CALLBACK(focus_conv_win_cb), win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
323 g_signal_connect(G_OBJECT(win), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
324 G_CALLBACK(focus_conv_win_cb), win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
325 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
326
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
327 /* If we've moved the last conversation, cleanup the window */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
328 if (pidgin_conv_window_get_gtkconv_count(oldwin) == 1)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
329 cleanup_conv_window(oldwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
330 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
331 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
332
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
333 static void update_convs_wintrans(GtkWidget *toggle_btn, const char *pref) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
334 purple_prefs_set_bool(pref, gtk_toggle_button_get_active(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
335 GTK_TOGGLE_BUTTON(toggle_btn)));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
336
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
337 if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
338 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
339
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
340 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
341 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
342 set_conv_window_trans(NULL, win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
343 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
344
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
345 if (!purple_prefs_get_bool(OPT_WINTRANS_IM_SLIDER))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
346 remove_sliders();
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
347 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
348 else
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
349 remove_convs_wintrans(FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
350 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
351
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
352 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
353 conv_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
354 PidginConversation *pconv = PIDGIN_CONVERSATION(conv);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
355 PidginWindow *win = pidgin_conv_get_window(pconv);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
356
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
357 if (type == PURPLE_CONV_UPDATE_UNSEEN && !pidgin_conv_is_hidden(pconv)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
358 && pconv->unseen_state == PIDGIN_UNSEEN_NONE
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
359 && pidgin_conv_window_get_gtkconv_count(win) == 1) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
360 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
361 gboolean has_focus;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
362
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
363 g_object_get(G_OBJECT(window), "has-toplevel-focus", &has_focus, NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
364
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
365 if (!has_focus || !purple_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
366 set_conv_window_trans(NULL, win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
367
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
368 if (g_signal_handler_find(G_OBJECT(window), G_SIGNAL_MATCH_FUNC,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
369 0, 0, NULL, G_CALLBACK(focus_conv_win_cb), NULL) == 0) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
370 g_signal_connect(G_OBJECT(window), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
371 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
372 g_signal_connect(G_OBJECT(window), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
373 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
374 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
375 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
376 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
377
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
378 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
379 new_conversation_cb(PurpleConversation *conv) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
380 PidginWindow *win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
381
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
382 /* If it is the first conversation in the window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
383 * add the sliders, and set transparency */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
384 if (!pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) && pidgin_conv_window_get_gtkconv_count(win) == 1) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
385 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
386
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
387 set_conv_window_trans(NULL, win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
388
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
389 g_signal_connect(G_OBJECT(window), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
390 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
391 g_signal_connect(G_OBJECT(window), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
392 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
393 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
394 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
395
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
396 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
397 blist_created_cb(PurpleBuddyList *purple_blist, gpointer data) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
398 if (blist) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
399 if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
400 set_wintrans(blist,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
401 purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
402 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
403 purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
404 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
405
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
406 g_signal_connect(G_OBJECT(blist), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
407 G_CALLBACK(focus_blist_win_cb), blist);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
408 g_signal_connect(G_OBJECT(blist), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
409 G_CALLBACK(focus_blist_win_cb), blist);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
410 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
411 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
412
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
413 static void alpha_change(GtkWidget *w, gpointer data) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
414 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
415 int imalpha = gtk_range_get_value(GTK_RANGE(w));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
416
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
417 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
418 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
419 set_wintrans(win->window, imalpha, TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
420 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
421 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
422 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
423
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
424 static void alpha_pref_set_int (GtkWidget *w, GdkEventFocus *e, const char *pref)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
425 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
426 int alpha = gtk_range_get_value(GTK_RANGE(w));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
427 purple_prefs_set_int(pref, alpha);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
428 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
429
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
430 static void bl_alpha_change(GtkWidget *w, gpointer data) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
431 if (blist)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
432 change_alpha(w, blist);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
433 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
434
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
435 static void update_existing_convs() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
436 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
437
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
438 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
439 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
440 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
441
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
442 set_conv_window_trans(NULL, win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
443
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
444 g_signal_connect(G_OBJECT(window), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
445 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
446 g_signal_connect(G_OBJECT(window), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
447 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
448 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
449 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
450
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
451 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
452 * EXPORTED FUNCTIONS
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
453 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
454 static gboolean plugin_load(PurplePlugin *plugin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
455
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
456 purple_signal_connect(purple_conversations_get_handle(),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
457 "conversation-created", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
458 PURPLE_CALLBACK(new_conversation_cb), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
459
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
460 /* Set callback to remove window from the list, if the window is destroyed */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
461 purple_signal_connect(purple_conversations_get_handle(),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
462 "deleting-conversation", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
463 PURPLE_CALLBACK(conversation_delete_cb), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
464
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
465 purple_signal_connect(pidgin_conversations_get_handle(),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
466 "conversation-dragging", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
467 PURPLE_CALLBACK(set_conv_window_trans), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
468
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
469 purple_signal_connect(purple_conversations_get_handle(),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
470 "conversation-updated", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
471 PURPLE_CALLBACK(conv_updated_cb), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
472
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
473 update_existing_convs();
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
474
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
475 if (blist)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
476 blist_created_cb(NULL, NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
477 else
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
478 purple_signal_connect(pidgin_blist_get_handle(),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
479 "gtkblist-created", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
480 PURPLE_CALLBACK(blist_created_cb), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
481
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
482
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
483 return TRUE;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
484 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
485
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
486 static gboolean plugin_unload(PurplePlugin *plugin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
487 purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading transparency plugin\n");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
488
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
489 remove_convs_wintrans(TRUE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
490
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
491 if (blist) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
492 if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
493 set_wintrans(blist, 0, FALSE, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
494
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
495 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
496 g_signal_handlers_disconnect_by_func(G_OBJECT(blist),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
497 G_CALLBACK(focus_blist_win_cb), blist);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
498 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
499
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
500 return TRUE;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
501 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
502
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
503 static GtkWidget *get_config_frame(PurplePlugin *plugin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
504 GtkWidget *ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
505 GtkWidget *imtransbox, *bltransbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
506 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
507 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
508 GtkWidget *button;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
509 GtkWidget *trans_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
510
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
511 ret = gtk_vbox_new(FALSE, 18);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
512 gtk_container_set_border_width(GTK_CONTAINER (ret), 12);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
513
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
514 /* IM Convo trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
515 imtransbox = pidgin_make_frame(ret, _("IM Conversation Windows"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
516 button = pidgin_prefs_checkbox(_("_IM window transparency"),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
517 OPT_WINTRANS_IM_ENABLED, imtransbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
518 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
519 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
520 (gpointer) OPT_WINTRANS_IM_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
521
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
522 trans_box = gtk_vbox_new(FALSE, 18);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
523 if (!purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
524 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
525 gtk_widget_show(trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
526
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
527 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
528 G_CALLBACK(pidgin_toggle_sensitive), trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
529
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
530 button = pidgin_prefs_checkbox(_("_Show slider bar in IM window"),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
531 OPT_WINTRANS_IM_SLIDER, trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
532 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
533 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
534 (gpointer) OPT_WINTRANS_IM_SLIDER);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
535
40926
d10bb378f560 Fix some null pointer deferences and dead stores that scanbuild found in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 38777
diff changeset
536 pidgin_prefs_checkbox(
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
537 _("Remove IM window transparency on focus"),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
538 OPT_WINTRANS_IM_ONFOCUS, trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
539
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
540 button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_IM_ONTOP,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
541 trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
542 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
543 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
544 (gpointer) OPT_WINTRANS_IM_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
545
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
546 gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
547
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
548 /* IM transparency slider */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
549 hbox = gtk_hbox_new(FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
550
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
551 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
552 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
553
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
554 slider = gtk_hscale_new_with_range(50, 255, 1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
555 gtk_range_set_value(GTK_RANGE(slider),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
556 purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
557 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
558
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
559 g_signal_connect(GTK_OBJECT(slider), "value-changed",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
560 G_CALLBACK(alpha_change), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
561 g_signal_connect(GTK_OBJECT(slider), "focus-out-event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
562 G_CALLBACK(alpha_pref_set_int),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
563 (gpointer) OPT_WINTRANS_IM_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
564
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
565 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
566
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
567 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
568
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
569 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
570
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
571 /* Buddy List trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
572 bltransbox = pidgin_make_frame (ret, _("Buddy List Window"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
573 button = pidgin_prefs_checkbox(_("_Buddy List window transparency"),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
574 OPT_WINTRANS_BL_ENABLED, bltransbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
575 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
576 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
577 (gpointer) OPT_WINTRANS_BL_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
578
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
579 trans_box = gtk_vbox_new(FALSE, 18);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
580 if (!purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
581 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
582 gtk_widget_show(trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
583 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
584 G_CALLBACK(pidgin_toggle_sensitive), trans_box);
40926
d10bb378f560 Fix some null pointer deferences and dead stores that scanbuild found in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 38777
diff changeset
585 pidgin_prefs_checkbox(
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
586 _("Remove Buddy List window transparency on focus"),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
587 OPT_WINTRANS_BL_ONFOCUS, trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
588 button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_BL_ONTOP,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
589 trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
590 g_signal_connect(GTK_OBJECT(button), "clicked",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
591 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
592 (gpointer) OPT_WINTRANS_BL_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
593 gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
594
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
595 /* IM transparency slider */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
596 hbox = gtk_hbox_new(FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
597
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
598 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
599 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
600
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
601 slider = gtk_hscale_new_with_range(50, 255, 1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
602 gtk_range_set_value(GTK_RANGE(slider),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
603 purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
604
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
605 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
606
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
607 g_signal_connect(GTK_OBJECT(slider), "value-changed",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
608 G_CALLBACK(bl_alpha_change), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
609 g_signal_connect(GTK_OBJECT(slider), "focus-out-event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
610 G_CALLBACK(alpha_pref_set_int),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
611 (gpointer) OPT_WINTRANS_BL_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
612
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
613 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
614
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
615 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
616
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
617 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
618
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
619 gtk_widget_show_all(ret);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
620 return ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
621 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
622
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
623 static PidginPluginUiInfo ui_info =
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
624 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
625 get_config_frame,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
626 0, /* page_num (Reserved) */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
627
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
628 /* padding */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
629 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
630 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
631 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
632 NULL
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
633 };
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
634
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
635 static PurplePluginInfo info =
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
636 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
637 PURPLE_PLUGIN_MAGIC,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
638 PURPLE_MAJOR_VERSION,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
639 PURPLE_MINOR_VERSION,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
640 PURPLE_PLUGIN_STANDARD, /**< type */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
641 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
642 0, /**< flags */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
643 NULL, /**< dependencies */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
644 PURPLE_PRIORITY_DEFAULT, /**< priority */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
645 WINTRANS_PLUGIN_ID, /**< id */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
646 N_("Transparency"), /**< name */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
647 DISPLAY_VERSION, /**< version */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
648 /** summary */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
649 N_("Variable Transparency for the buddy list and conversations."),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
650 /** description */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
651 N_("This plugin enables variable alpha transparency on conversation windows and the buddy list."),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
652 "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
653 PURPLE_WEBSITE, /**< homepage */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
654 plugin_load, /**< load */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
655 plugin_unload, /**< unload */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
656 NULL, /**< destroy */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
657 &ui_info, /**< ui_info */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
658 NULL, /**< extra_info */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
659 NULL, /**< prefs_info */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
660 NULL, /**< actions */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
661
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
662 /* padding */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
663 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
664 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
665 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
666 NULL
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
667 };
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
668
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
669 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
670 init_plugin(PurplePlugin *plugin)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
671 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
672 purple_prefs_add_none("/plugins/gtk");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
673 purple_prefs_add_none("/plugins/gtk/transparency");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
674 purple_prefs_add_bool(OPT_WINTRANS_IM_ENABLED, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
675 purple_prefs_add_int(OPT_WINTRANS_IM_ALPHA, 255);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
676 purple_prefs_add_bool(OPT_WINTRANS_IM_SLIDER, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
677 purple_prefs_add_bool(OPT_WINTRANS_IM_ONFOCUS, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
678 purple_prefs_add_bool(OPT_WINTRANS_IM_ONTOP, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
679 purple_prefs_add_bool(OPT_WINTRANS_BL_ENABLED, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
680 purple_prefs_add_int(OPT_WINTRANS_BL_ALPHA, 255);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
681 purple_prefs_add_bool(OPT_WINTRANS_BL_ONFOCUS, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
682 purple_prefs_add_bool(OPT_WINTRANS_BL_ONTOP, FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
683 purple_prefs_rename("/plugins/gtk/win32/wintrans", "/plugins/gtk/transparency");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
684 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
685
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
686 PURPLE_INIT_PLUGIN(wintrans, init_plugin, info)

mercurial