pidgin/plugins/transparency.c

Thu, 25 Aug 2022 22:30:30 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 25 Aug 2022 22:30:30 -0500
branch
gtk4
changeset 41594
30ad4d17661f
parent 41314
0dc72eacd8bf
child 41658
eef0cabd6340
permissions
-rw-r--r--

Remove the use of the removed popup-menu signal and fix the popup menu not displaying

Testing Done:
Double clicked a buddy to open a conversation and right clicked a buddy to make sure the contact menu came up.

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

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
41177
9e78b5799658 Remove usage of pidgin_conv_is_hidden from transparency plugin
Sorvival <sorvival@tutanota.com>
parents: 41081
diff changeset
356 if(type == PURPLE_CONVERSATION_UPDATE_UNSEEN
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
41177
9e78b5799658 Remove usage of pidgin_conv_is_hidden from transparency plugin
Sorvival <sorvival@tutanota.com>
parents: 41081
diff changeset
364 if(!has_focus || !purple_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS)) {
38775
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);
41177
9e78b5799658 Remove usage of pidgin_conv_is_hidden from transparency plugin
Sorvival <sorvival@tutanota.com>
parents: 41081
diff changeset
366 }
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
367
41177
9e78b5799658 Remove usage of pidgin_conv_is_hidden from transparency plugin
Sorvival <sorvival@tutanota.com>
parents: 41081
diff changeset
368 if(g_signal_handler_find(G_OBJECT(window), G_SIGNAL_MATCH_FUNC,
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
369 0, 0, NULL, G_CALLBACK(focus_conv_win_cb), NULL) == 0) {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
370 g_signal_connect(G_OBJECT(window), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
371 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
372 g_signal_connect(G_OBJECT(window), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
373 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
374 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
375 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
376 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
377
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
378 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
379 new_conversation_cb(PurpleConversation *conv) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
380 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
381
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
382 /* If it is the first conversation in the window,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
383 * add the sliders, and set transparency */
41177
9e78b5799658 Remove usage of pidgin_conv_is_hidden from transparency plugin
Sorvival <sorvival@tutanota.com>
parents: 41081
diff changeset
384 if(pidgin_conv_window_get_gtkconv_count(win) == 1) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
385 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
386
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
387 set_conv_window_trans(NULL, win);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
388
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
389 g_signal_connect(G_OBJECT(window), "focus_in_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
390 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
391 g_signal_connect(G_OBJECT(window), "focus_out_event",
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
392 G_CALLBACK(focus_conv_win_cb), window);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
393 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
394 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
395
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
396 static void
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
397 blist_created_cb(PurpleBuddyList *purple_blist, gpointer data) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
398 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
399 if (window != NULL) {
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
400 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
401 set_wintrans(window,
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
402 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
403 TRUE,
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
404 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
405 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
406
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
407 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
408 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
409 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
410 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
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
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
414 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
415 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
416 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
417
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
418 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
419 PidginConvWindow *win = wins->data;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
420 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
421 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
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
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
425 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
426 {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
427 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
428 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
429 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
430
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
431 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
432 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
433 if (window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
434 change_alpha(w, window);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
435 }
38775
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
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
438 static void update_existing_convs() {
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
439 GList *wins;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
440
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
441 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
442 PidginConvWindow *win = wins->data;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
443 GtkWidget *window = win->window;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
444
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
445 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
446
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
447 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
448 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
449 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
450 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
451 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
452 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
453
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
454 static GtkWidget *
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
455 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
456 GtkWidget *ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
457 GtkWidget *imtransbox, *bltransbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
458 GtkWidget *hbox;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
459 GtkWidget *label, *slider;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
460 GtkWidget *button;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
461 GtkWidget *trans_box;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
462
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
463 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
464 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
465
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
466 /* IM Convo trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
467 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
468 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
469 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
470 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
471 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
472 (gpointer) OPT_WINTRANS_IM_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
473
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
474 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
475 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
476 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
477 G_BINDING_SYNC_CREATE);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
478
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
479 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
480 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
481 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
482 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
483 (gpointer) OPT_WINTRANS_IM_SLIDER);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
484
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
485 button = pidgin_prefs_checkbox(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
486 _("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
487 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
488
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
489 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
490 trans_box);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
491 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
492 G_CALLBACK(update_convs_wintrans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
493 (gpointer) OPT_WINTRANS_IM_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
494
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
495 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
496
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
497 /* IM transparency slider */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
498 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
499
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
500 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
501 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
502
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
503 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
504 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
505 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
506
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
507 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
508 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
509 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
510 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
511 (gpointer) OPT_WINTRANS_IM_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
512
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
513 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
514
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
515 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
516
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
517 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
518
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
519 /* Buddy List trans options */
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
520 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
521 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
522 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
523 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
524 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
525 (gpointer) OPT_WINTRANS_BL_ENABLED);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
526
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
527 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
528 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
529 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
530 G_BINDING_SYNC_CREATE);
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
531 button = pidgin_prefs_checkbox(
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
532 _("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
533 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
534 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
535 trans_box);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
536 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
537 G_CALLBACK(set_blist_trans),
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
538 (gpointer) OPT_WINTRANS_BL_ONTOP);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
539 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
540
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
541 /* IM transparency slider */
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
542 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
543
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
544 label = gtk_label_new(_("Opacity:"));
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
545 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
546
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
547 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
548 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
549 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
550
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
551 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
552 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
553 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
554 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
555 (gpointer) OPT_WINTRANS_BL_ALPHA);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
556
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
557 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
558
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
559 gtk_widget_show_all(hbox);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
560
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
561 gtk_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
562
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
563 gtk_widget_show_all(ret);
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
564 return ret;
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
565 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
566
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
567 static GPluginPluginInfo *
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
568 transparency_query(GError **error) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
569 const gchar * const authors[] = {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
570 "Pidgin Developers <devel@pidgin.im>",
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
571 NULL
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
572 };
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
573
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
574 return pidgin_plugin_info_new(
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
575 "id", WINTRANS_PLUGIN_ID,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
576 "name", N_("Transparency"),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
577 "version", DISPLAY_VERSION,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
578 "category", N_("User interface"),
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
579 "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
580 "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
581 "authors", authors,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
582 "website", PURPLE_WEBSITE,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
583 "abi-version", PURPLE_ABI_VERSION,
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
584 "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
585 NULL
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
586 );
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
587 }
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
588
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
589 static gboolean
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
590 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
591 GtkWidget *window = NULL;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
592 gpointer conv_handle = NULL;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
593
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");
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
595 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
596 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
597 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
598 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
599 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
600 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
601 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
602 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
603 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
604 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
605 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
606
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
607 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
608 purple_signal_connect(conv_handle, "conversation-created", plugin,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41299
diff changeset
609 G_CALLBACK(new_conversation_cb), NULL);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
610
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
611 /* 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
612 purple_signal_connect(conv_handle, "deleting-conversation", plugin,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41299
diff changeset
613 G_CALLBACK(conversation_delete_cb), NULL);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
614
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
615 purple_signal_connect(conv_handle, "conversation-updated", plugin,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41299
diff changeset
616 G_CALLBACK(conv_updated_cb), NULL);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
617
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
618 update_existing_convs();
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 window = get_buddy_list_window();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
621 if(window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
622 blist_created_cb(NULL, NULL);
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
623 } else {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
624 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
625 "gtkblist-created", plugin,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41299
diff changeset
626 G_CALLBACK(blist_created_cb), NULL);
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
627 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
628
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
629 return TRUE;
38775
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
630 }
138239f698a9 Port transparency plugin from WinAPI to GTK. Fixes #3124
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
diff changeset
631
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
632 static gboolean
41081
0c1c063d71f6 Add the unload parameter to a few plugins that I missed on the gplugin 0.35.0 update
Gary Kramlich <grim@reaperworld.com>
parents: 40994
diff changeset
633 transparency_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) {
40994
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
634 GtkWidget *window = NULL;
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
635
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
636 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
637
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
638 remove_convs_wintrans(TRUE);
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 window = get_buddy_list_window();
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
641 if (window != NULL) {
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
642 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
643 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
644
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
645 /* Remove the focus cbs */
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
646 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
647 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
648 }
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
649
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
650 return TRUE;
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
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
653 GPLUGIN_NATIVE_PLUGIN_DECLARE(transparency)
1eb6d260980d Update the transparency plugin so it'll load again.
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
654

mercurial