pidgin/plugins/transparency.c

Fri, 09 Aug 2019 00:41:13 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Fri, 09 Aug 2019 00:41:13 -0400
changeset 39785
aa7e3b71802d
parent 39173
7adf95ad7b4a
child 40360
e21f3bbcc2a5
permissions
-rw-r--r--

Split pidgin_account_option_menu into its own files.

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,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
79 gboolean always_on_top) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
80 if (enabled) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
81 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
82 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
83 } else {
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, 1);
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, 0);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
86 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
87 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
88
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
89 /* 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
90 * deal with transparency */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
91 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
92 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
93 && 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
94 GtkWidget *window = (GtkWidget *) d;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
95 if (e->in) { /* Focused */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
96 set_wintrans(window, 0, FALSE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
97 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
98 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
99 set_wintrans(window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
100 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
101 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
102 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
103 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
104 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
105 return FALSE;
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 /* 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
109 * 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
110 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
111 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
112 && 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
113 GtkWidget *window = (GtkWidget *) d;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
114 if (e->in) { /* Focused */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
115 set_wintrans(window, 0, FALSE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
116 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
117 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
118 set_wintrans(window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
119 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
120 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
121 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
122 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
123 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
124 return FALSE;
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 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
128 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
129 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
130
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
131 /* 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
132 * don't take effect immediately */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
133 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
134 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
135 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
136 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
137
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
138
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
139 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
140 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
141 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
142 GtkWidget *frame;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
143
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
144 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
145
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
146 frame = gtk_frame_new(NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
147 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
148 gtk_widget_show(frame);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
149
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
150 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
151 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
152
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
153 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
154 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
155 gtk_widget_show(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
156
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
157 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
158 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
159 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
160
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
161 /* 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
162 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
163 G_CALLBACK(change_alpha), win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
164
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
165 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
166
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
167 /* Set the initial transparency level */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
168 set_wintrans(win, imalpha, TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
169 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
170
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
171 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
172
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
173 return frame;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
174 }
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 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
177 GSList *tmp = window_list;
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 while (tmp) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
180 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
181 return (slider_win*) tmp->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
182 tmp = tmp->next;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
183 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
184 return NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
185 }
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 /* 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
188 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
189 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
190 slider_win *slidwin = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
191
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
192 /* 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
193 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
194 "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
195
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
196 if ((slidwin = find_slidwin(window))) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
197 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
198 g_free(slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
199 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
200
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
201 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
202 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
203 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
204 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
205
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
206 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
207 conversation_delete_cb(PurpleConversation *conv) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
208 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
209 /* 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
210 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
211 cleanup_conv_window(win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
212 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
213
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
214 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
215 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
216 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
217 if (blist) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
218 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
219 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
220 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
221 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
222 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
223
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
224 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
225 GList *wl, *wl1;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
226 GtkWidget *vbox = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
227
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
228 /* 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
229 if (!find_slidwin(win)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
230 GtkWidget *slider_box = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
231 slider_win *slidwin = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
232 GtkRequisition slidereq;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
233 gint width, height;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
234
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
235 /* Get top vbox */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
236 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
237 GTK_CONTAINER(win));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
238 wl != NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
239 wl = wl->next) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
240 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
241 vbox = GTK_WIDGET(wl->data);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
242 else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
243 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
244 "no vbox found\n");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
245 return;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
246 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
247 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
248 g_list_free(wl1);
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 slider_box = wintrans_slider(win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
251 /* 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
252 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
253 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
254 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
255 slider_box, FALSE, FALSE, 0);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
256 /* 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
257 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
258 slidwin->win = win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
259 slidwin->slider = slider_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
260 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
261 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
262 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
263
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
264 static void remove_sliders() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
265 if (window_list) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
266 GSList *tmp = window_list;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
267 while (tmp) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
268 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
269 if (slidwin != NULL &&
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
270 GTK_IS_WINDOW(slidwin->win)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
271 gtk_widget_destroy(slidwin->slider);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
272 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
273 g_free(slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
274 tmp = tmp->next;
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_slist_free(window_list);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
277 window_list = NULL;
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 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
280
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
281 /* 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
282 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
283 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
284
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
285 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
286 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
287 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
288
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
289 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
290 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
291
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
292 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
293 if (remove_signal)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
294 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
295 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
296 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
297
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
298 remove_sliders();
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 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
302 GtkWidget *win = newwin->window;
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 /* 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
305 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
306 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
307 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
308
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
309 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
310 add_slider(win);
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 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
313
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
314 /* 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
315 * 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
316 if (oldwin != NULL && oldwin != newwin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
317 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
318 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
319 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
320 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
321 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
322 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
323
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
324 /* 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
325 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
326 cleanup_conv_window(oldwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
327 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
328 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
329
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
330 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
331 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
332 GTK_TOGGLE_BUTTON(toggle_btn)));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
333
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
334 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
335 GList *wins;
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 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
338 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
339 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
340 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
341
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
342 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
343 remove_sliders();
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 else
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
346 remove_convs_wintrans(FALSE);
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
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
349 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
350 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
351 PidginConversation *pconv = PIDGIN_CONVERSATION(conv);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
352 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
353
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
354 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
355 && 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
356 && 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
357 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
358 gboolean has_focus;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
359
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
360 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
361
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
362 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
363 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
364
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
365 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
366 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
367 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
368 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
369 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
370 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
371 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
372 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
373 }
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 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
376 new_conversation_cb(PurpleConversation *conv) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
377 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
378
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
379 /* 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
380 * 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
381 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
382 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
383
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
384 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
385
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
386 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
387 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
388 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
389 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
390 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
391 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
392
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
393 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
394 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
395 if (blist) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
396 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
397 set_wintrans(blist,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
398 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
399 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
400 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
401 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
402
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
403 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
404 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
405 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
406 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
407 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
408 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
409
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
410 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
411 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
412 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
413
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
414 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
415 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
416 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
417 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
418 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
419 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
420
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
421 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
422 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
423 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
424 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
425 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
426
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
427 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
428 if (blist)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
429 change_alpha(w, blist);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
430 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
431
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
432 static void update_existing_convs() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
433 GList *wins;
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 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
436 PidginWindow *win = wins->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
437 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
438
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
439 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
440
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
441 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
442 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
443 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
444 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
445 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
446 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
447
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 * EXPORTED FUNCTIONS
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 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
452
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
453 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
454 "conversation-created", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
455 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
456
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
457 /* 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
458 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
459 "deleting-conversation", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
460 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
461
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
462 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
463 "conversation-dragging", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
464 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
465
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
466 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
467 "conversation-updated", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
468 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
469
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
470 update_existing_convs();
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
471
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
472 if (blist)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
473 blist_created_cb(NULL, NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
474 else
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
475 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
476 "gtkblist-created", plugin,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
477 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
478
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
479
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
480 return TRUE;
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 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
484 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
485
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
486 remove_convs_wintrans(TRUE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
487
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
488 if (blist) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
489 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
490 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
491
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
492 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
493 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
494 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
495 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
496
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
497 return TRUE;
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 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
501 GtkWidget *ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
502 GtkWidget *imtransbox, *bltransbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
503 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
504 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
505 GtkWidget *button;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
506 GtkWidget *trans_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
507
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
508 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
509 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
510
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
511 /* IM Convo trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
512 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
513 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
514 OPT_WINTRANS_IM_ENABLED, imtransbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
515 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
516 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
517 (gpointer) OPT_WINTRANS_IM_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
518
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
519 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
520 gtk_widget_show(trans_box);
39173
7adf95ad7b4a Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38777
diff changeset
521 g_object_bind_property(button, "active", trans_box, "sensitive",
7adf95ad7b4a Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38777
diff changeset
522 G_BINDING_SYNC_CREATE);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
523
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
524 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
525 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
526 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
527 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
528 (gpointer) OPT_WINTRANS_IM_SLIDER);
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(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
531 _("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
532 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
533
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
534 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
535 trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
536 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
537 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
538 (gpointer) OPT_WINTRANS_IM_ONTOP);
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 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
541
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
542 /* IM transparency slider */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
543 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
544
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
545 label = gtk_label_new(_("Opacity:"));
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(hbox), label, 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 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
549 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
550 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
551 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
552
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
553 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
554 G_CALLBACK(alpha_change), NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
555 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
556 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
557 (gpointer) OPT_WINTRANS_IM_ALPHA);
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 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
560
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
561 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
562
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
563 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
564
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
565 /* Buddy List trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
566 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
567 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
568 OPT_WINTRANS_BL_ENABLED, bltransbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
569 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
570 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
571 (gpointer) OPT_WINTRANS_BL_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
572
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
573 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
574 gtk_widget_show(trans_box);
39173
7adf95ad7b4a Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38777
diff changeset
575 g_object_bind_property(button, "active", trans_box, "sensitive",
7adf95ad7b4a Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38777
diff changeset
576 G_BINDING_SYNC_CREATE);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
577 button = pidgin_prefs_checkbox(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
578 _("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
579 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
580 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
581 trans_box);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
582 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
583 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
584 (gpointer) OPT_WINTRANS_BL_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
585 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
586
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
587 /* IM transparency slider */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
588 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
589
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
590 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
591 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
592
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
593 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
594 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
595 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
596
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
597 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
598
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
599 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
600 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
601 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
602 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
603 (gpointer) 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_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
606
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
607 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
608
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
609 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
610
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
611 gtk_widget_show_all(ret);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
612 return ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
613 }
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 static PidginPluginUiInfo ui_info =
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 get_config_frame,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
618 0, /* page_num (Reserved) */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
619
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
620 /* padding */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
621 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
622 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
623 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
624 NULL
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
625 };
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
626
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
627 static PurplePluginInfo info =
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
628 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
629 PURPLE_PLUGIN_MAGIC,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
630 PURPLE_MAJOR_VERSION,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
631 PURPLE_MINOR_VERSION,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
632 PURPLE_PLUGIN_STANDARD, /**< type */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
633 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
634 0, /**< flags */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
635 NULL, /**< dependencies */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
636 PURPLE_PRIORITY_DEFAULT, /**< priority */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
637 WINTRANS_PLUGIN_ID, /**< id */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
638 N_("Transparency"), /**< name */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
639 DISPLAY_VERSION, /**< version */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
640 /** summary */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
641 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
642 /** description */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
643 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
644 "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
645 PURPLE_WEBSITE, /**< homepage */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
646 plugin_load, /**< load */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
647 plugin_unload, /**< unload */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
648 NULL, /**< destroy */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
649 &ui_info, /**< ui_info */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
650 NULL, /**< extra_info */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
651 NULL, /**< prefs_info */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
652 NULL, /**< actions */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
653
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
654 /* padding */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
655 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
656 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
657 NULL,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
658 NULL
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
659 };
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
660
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
661 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
662 init_plugin(PurplePlugin *plugin)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
663 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
664 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
665 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
666 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
667 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
668 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
669 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
670 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
671 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
672 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
673 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
674 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
675 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
676 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
677
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
678 PURPLE_INIT_PLUGIN(wintrans, init_plugin, info)

mercurial