pidgin/plugins/transparency.c

Fri, 23 Jul 2021 04:34:08 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 23 Jul 2021 04:34:08 -0500
changeset 40994
1eb6d260980d
parent 40360
e21f3bbcc2a5
child 41081
0c1c063d71f6
permissions
-rw-r--r--

Update the transparency plugin so it'll load again.

Testing Done:
Ran and loaded the plugin, but was unable to actually test it because the configuration frames for plugins are currently not working.

Reviewed at https://reviews.imfreedom.org/r/828/

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 */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
24
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
25 #include <glib.h>
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
26 #include <glib/gi18n-lib.h>
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
27
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 39173
diff changeset
28 #include <purple.h>
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
29
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
30 #include <gplugin.h>
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
31 #include <gplugin-native.h>
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
32
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
33 #include <pidgin.h>
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
34
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
35 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
36 * MACROS & DEFINES
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
37 */
38777
b9031c159dd3 Add comment about the plugin name being unchanged
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38776
diff changeset
38 /* 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
39 * 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
40 #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
41
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
42 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
43 * DATA STRUCTS
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 typedef struct {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
46 GtkWidget *win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
47 GtkWidget *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
48 } slider_win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
49
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 * LOCALS
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
52 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
53 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
54 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
55 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
56 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
57 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
58 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
59 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
60 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
61 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
62 static GSList *window_list = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
63
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
64 /*
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
65 * CODE
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
66 */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
67
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
68 static GtkWidget *
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
69 get_buddy_list_window(void) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
70 PurpleBuddyList *purple_blist = NULL;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
71
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
72 purple_blist = purple_blist_get_default();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
73 if(PIDGIN_IS_BUDDY_LIST(purple_blist)) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
74 PidginBuddyList *pidgin_blist = PIDGIN_BUDDY_LIST(purple_blist);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
75
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
76 return pidgin_blist->window;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
77 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
78
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
79 return NULL;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
80 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
81
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
82 /* Set window transparency level */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
83 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
84 gboolean always_on_top) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
85 GdkWindow *gdk_window = gtk_widget_get_window(window);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
86
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
87 if (enabled) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
88 gdk_window_set_opacity(gdk_window, alpha / 255.0);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
89 gdk_window_set_keep_above(gdk_window, always_on_top);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
90 } else {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
91 gdk_window_set_opacity(gdk_window, 1);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
92 gdk_window_set_keep_above(gdk_window, 0);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
93 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
94 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
95
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
96 /* 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
97 * deal with transparency */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
98 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
99 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
100 && 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
101 GtkWidget *window = (GtkWidget *) d;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
102 if (e->in) { /* Focused */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
103 set_wintrans(window, 0, FALSE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
104 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
105 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
106 set_wintrans(window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
107 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
108 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
109 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
110 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
111 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
112 return FALSE;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
113 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
114
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
115 /* 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
116 * 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
117 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
118 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
119 && 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
120 GtkWidget *window = (GtkWidget *) d;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
121 if (e->in) { /* Focused */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
122 set_wintrans(window, 0, FALSE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
123 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
124 } else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
125 set_wintrans(window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
126 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
127 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
128 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
129 }
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 return FALSE;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
132 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
133
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
134 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
135 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
136 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
137
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
138 /* 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
139 * don't take effect immediately */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
140 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
141 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
142 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
143 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
144
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 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
147 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
148 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
149 GtkWidget *frame;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
150
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
151 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
152
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
153 frame = gtk_frame_new(NULL);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
154 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
155 gtk_widget_show(frame);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
156
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
157 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
158 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
159
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
160 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
161 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
162 gtk_widget_show(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
163
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
164 slider = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 50, 255, 1);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
165 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
166
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
167 /* On slider val change, update window's transparency level */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
168 g_signal_connect(G_OBJECT(slider), "value-changed",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
169 G_CALLBACK(change_alpha), win);
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_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
172
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
173 /* Set the initial transparency level */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
174 set_wintrans(win, imalpha, TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
175 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
176
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
177 gtk_widget_show_all(hbox);
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 return frame;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
180 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
181
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
182 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
183 GSList *tmp = window_list;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
184
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
185 while (tmp) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
186 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
187 return (slider_win*) tmp->data;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
188 tmp = tmp->next;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
189 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
190 return 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
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
193 /* Clean up transparency stuff for the conv window */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
194 static void cleanup_conv_window(PidginConvWindow *win) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
195 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
196 slider_win *slidwin = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
197
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
198 /* 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
199 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
200 "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
201
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
202 if ((slidwin = find_slidwin(window))) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
203 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
204 g_free(slidwin);
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
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
207 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
208 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
209 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
210 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
211
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
212 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
213 conversation_delete_cb(PurpleConversation *conv) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
214 PidginConvWindow *win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv));
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
215 /* 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
216 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
217 cleanup_conv_window(win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
218 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
219
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
220 static void set_blist_trans(GtkWidget *w, const char *pref) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
221 GtkWidget *window = get_buddy_list_window();
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
222 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
223 purple_prefs_set_bool(pref, enabled);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
224 if (window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
225 set_wintrans(window, purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA),
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
226 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
227 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
228 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
229 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
230
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
231 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
232 GList *wl, *wl1;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
233 GtkWidget *vbox = NULL;
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 /* 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
236 if (!find_slidwin(win)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
237 GtkWidget *slider_box = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
238 slider_win *slidwin = NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
239
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
240 /* Get top vbox */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
241 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
242 GTK_CONTAINER(win));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
243 wl != NULL;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
244 wl = wl->next) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
245 if (GTK_IS_BOX(G_OBJECT(wl->data)))
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
246 vbox = GTK_WIDGET(wl->data);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
247 else {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
248 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
249 "no vbox found\n");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
250 return;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
251 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
252 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
253 g_list_free(wl1);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
254
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
255 slider_box = wintrans_slider(win);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
256 gtk_box_pack_start(GTK_BOX(vbox), slider_box, FALSE, FALSE, 0);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
257
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
258 /* 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
259 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
260 slidwin->win = win;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
261 slidwin->slider = slider_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
262 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
263 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
264 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
265
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
266 static void remove_sliders() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
267 if (window_list) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
268 GSList *tmp = window_list;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
269 while (tmp) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
270 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
271 if (slidwin != NULL &&
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
272 GTK_IS_WINDOW(slidwin->win)) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
273 gtk_widget_destroy(slidwin->slider);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
274 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
275 g_free(slidwin);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
276 tmp = tmp->next;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
277 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
278 g_slist_free(window_list);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
279 window_list = NULL;
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 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
282
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
283 /* 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
284 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
285 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
286
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
287 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
288 PidginConvWindow *win = wins->data;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
289 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
290
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
291 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
292 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
293
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
294 /* Remove the focus cbs */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
295 if (remove_signal)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
296 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
297 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
298 }
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 remove_sliders();
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
301 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
302
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
303 static void set_conv_window_trans(PidginConvWindow *oldwin, PidginConvWindow *newwin) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
304 GtkWidget *win = newwin->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
305
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
306 /* 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
307 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
308 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
309 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
310
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
311 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
312 add_slider(win);
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 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
315
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
316 /* 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
317 * 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
318 if (oldwin != NULL && oldwin != newwin) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
319 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
320 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
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 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
323 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
324 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
325
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
326 /* 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
327 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
328 cleanup_conv_window(oldwin);
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 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
331
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
332 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
333 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
334 GTK_TOGGLE_BUTTON(toggle_btn)));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
335
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
336 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
337 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
338
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
339 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
340 PidginConvWindow *win = wins->data;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
341 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
342 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
343
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
344 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
345 remove_sliders();
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
346 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
347 else
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
348 remove_convs_wintrans(FALSE);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
349 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
350
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
351 static void
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
352 conv_updated_cb(PurpleConversation *conv, PurpleConversationUpdateType type) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
353 PidginConversation *pconv = PIDGIN_CONVERSATION(conv);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
354 PidginConvWindow *win = pidgin_conv_get_window(pconv);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
355
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
356 if (type == PURPLE_CONVERSATION_UPDATE_UNSEEN && !pidgin_conv_is_hidden(pconv)
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
357 && 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
358 && 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
359 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
360 gboolean has_focus;
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 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
363
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
364 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
365 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
366
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
367 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
368 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
369 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
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 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
372 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
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 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
376
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
377 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
378 new_conversation_cb(PurpleConversation *conv) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
379 PidginConvWindow *win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv));
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
380
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
381 /* 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
382 * 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
383 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
384 GtkWidget *window = win->window;
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 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
387
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_in_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 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
391 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
392 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
393 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
394
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
395 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
396 blist_created_cb(PurpleBuddyList *purple_blist, gpointer data) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
397 GtkWidget *window = get_buddy_list_window();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
398 if (window != NULL) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
399 if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
400 set_wintrans(window,
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
401 purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
402 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
403 purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
404 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
405
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
406 g_signal_connect(G_OBJECT(window), "focus_in_event",
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
407 G_CALLBACK(focus_blist_win_cb), window);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
408 g_signal_connect(G_OBJECT(window), "focus_out_event",
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
409 G_CALLBACK(focus_blist_win_cb), window);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
410 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
411 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
412
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
413 static void alpha_change(GtkWidget *w, gpointer data) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
414 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
415 int imalpha = gtk_range_get_value(GTK_RANGE(w));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
416
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
417 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
418 PidginConvWindow *win = wins->data;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
419 set_wintrans(win->window, imalpha, TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
420 purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
421 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
422 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
423
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
424 static void alpha_pref_set_int (GtkWidget *w, GdkEventFocus *e, const char *pref)
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
425 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
426 int alpha = gtk_range_get_value(GTK_RANGE(w));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
427 purple_prefs_set_int(pref, alpha);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
428 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
429
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
430 static void bl_alpha_change(GtkWidget *w, gpointer data) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
431 GtkWidget *window = get_buddy_list_window();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
432 if (window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
433 change_alpha(w, window);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
434 }
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
435 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
436
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
437 static void update_existing_convs() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
438 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
439
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
440 for (wins = pidgin_conv_windows_get_list(); wins; wins = wins->next) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
441 PidginConvWindow *win = wins->data;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
442 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
443
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
444 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
445
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
446 g_signal_connect(G_OBJECT(window), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
447 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
448 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
449 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
450 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
451 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
452
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
453 static GtkWidget *
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
454 get_config_frame(PurplePlugin *plugin) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
455 GtkWidget *ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
456 GtkWidget *imtransbox, *bltransbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
457 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
458 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
459 GtkWidget *button;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
460 GtkWidget *trans_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
461
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
462 ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
463 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
464
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
465 /* IM Convo trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
466 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
467 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
468 OPT_WINTRANS_IM_ENABLED, imtransbox);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
469 g_signal_connect(G_OBJECT(button), "clicked",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
470 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
471 (gpointer) OPT_WINTRANS_IM_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
472
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
473 trans_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
474 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
475 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
476 G_BINDING_SYNC_CREATE);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
477
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
478 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
479 OPT_WINTRANS_IM_SLIDER, trans_box);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
480 g_signal_connect(G_OBJECT(button), "clicked",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
481 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
482 (gpointer) OPT_WINTRANS_IM_SLIDER);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
483
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
484 button = pidgin_prefs_checkbox(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
485 _("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
486 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
487
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
488 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
489 trans_box);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
490 g_signal_connect(G_OBJECT(button), "clicked",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
491 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
492 (gpointer) OPT_WINTRANS_IM_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
493
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
494 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
495
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
496 /* IM transparency slider */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
497 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
38775
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 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
500 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
501
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
502 slider = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 50, 255, 1);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
503 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
504 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
505
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
506 g_signal_connect(G_OBJECT(slider), "value-changed",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
507 G_CALLBACK(alpha_change), NULL);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
508 g_signal_connect(G_OBJECT(slider), "focus-out-event",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
509 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
510 (gpointer) OPT_WINTRANS_IM_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
511
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
512 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
513
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
514 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
515
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
516 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
517
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
518 /* Buddy List trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
519 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
520 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
521 OPT_WINTRANS_BL_ENABLED, bltransbox);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
522 g_signal_connect(G_OBJECT(button), "clicked",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
523 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
524 (gpointer) OPT_WINTRANS_BL_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
525
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
526 trans_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
527 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
528 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
529 G_BINDING_SYNC_CREATE);
38775
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 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
532 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
533 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
534 trans_box);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
535 g_signal_connect(G_OBJECT(button), "clicked",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
536 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
537 (gpointer) OPT_WINTRANS_BL_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
538 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
539
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
540 /* IM transparency slider */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
541 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
542
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
543 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
544 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
545
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
546 slider = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 50, 255, 1);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
547 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
548 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
549
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
550 g_signal_connect(G_OBJECT(slider), "value-changed",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
551 G_CALLBACK(bl_alpha_change), NULL);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
552 g_signal_connect(G_OBJECT(slider), "focus-out-event",
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
553 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
554 (gpointer) OPT_WINTRANS_BL_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
555
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
556 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
557
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
558 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
559
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
560 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
561
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
562 gtk_widget_show_all(ret);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
563 return ret;
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
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
566 static GPluginPluginInfo *
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
567 transparency_query(GError **error) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
568 const gchar * const authors[] = {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
569 "Pidgin Developers <devel@pidgin.im>",
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
570 NULL
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
571 };
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
572
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
573 return pidgin_plugin_info_new(
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
574 "id", WINTRANS_PLUGIN_ID,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
575 "name", N_("Transparency"),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
576 "version", DISPLAY_VERSION,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
577 "category", N_("User interface"),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
578 "summary", N_("Variable Transparency for the buddy list and conversations."),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
579 "description", N_("This plugin enables variable alpha transparency on conversation windows and the buddy list."),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
580 "authors", authors,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
581 "website", PURPLE_WEBSITE,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
582 "abi-version", PURPLE_ABI_VERSION,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
583 "gtk-config-frame-cb", get_config_frame,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
584 NULL
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
585 );
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
586 }
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
587
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
588 static gboolean
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
589 transparency_load(GPluginPlugin *plugin, GError **error) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
590 GtkWidget *window = NULL;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
591 gpointer conv_handle = NULL;
38775
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 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
594 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
595 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
596 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
597 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
598 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
599 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
600 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
601 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
602 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
603 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
604 purple_prefs_rename("/plugins/gtk/win32/wintrans", "/plugins/gtk/transparency");
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
605
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
606 conv_handle = purple_conversations_get_handle();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
607 purple_signal_connect(conv_handle, "conversation-created", plugin,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
608 PURPLE_CALLBACK(new_conversation_cb), NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
609
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
610 /* Set callback to remove window from the list, if the window is destroyed */
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
611 purple_signal_connect(conv_handle, "deleting-conversation", plugin,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
612 PURPLE_CALLBACK(conversation_delete_cb), NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
613
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
614 purple_signal_connect(conv_handle, "conversation-dragging", plugin,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
615 PURPLE_CALLBACK(set_conv_window_trans), NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
616
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
617 purple_signal_connect(conv_handle, "conversation-updated", plugin,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
618 PURPLE_CALLBACK(conv_updated_cb), NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
619
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
620 update_existing_convs();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
621
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
622 window = get_buddy_list_window();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
623 if(window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
624 blist_created_cb(NULL, NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
625 } else {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
626 purple_signal_connect(pidgin_blist_get_handle(),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
627 "gtkblist-created", plugin,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
628 PURPLE_CALLBACK(blist_created_cb), NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
629 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
630
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
631 return TRUE;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
632 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
633
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
634 static gboolean
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
635 transparency_unload(GPluginPlugin *plugin, GError **error) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
636 GtkWidget *window = NULL;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
637
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
638 purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading transparency plugin\n");
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
639
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
640 remove_convs_wintrans(TRUE);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
641
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
642 window = get_buddy_list_window();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
643 if (window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
644 if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
645 set_wintrans(window, 0, FALSE, FALSE);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
646
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
647 /* Remove the focus cbs */
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
648 g_signal_handlers_disconnect_by_func(G_OBJECT(window),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
649 G_CALLBACK(focus_blist_win_cb), window);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
650 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
651
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
652 return TRUE;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
653 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
654
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
655 GPLUGIN_NATIVE_PLUGIN_DECLARE(transparency)
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
656

mercurial