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