Sat, 08 Sep 2007 03:09:35 +0000
The FSF changed its address a while ago; our files were out of date.
This is a quick update done with a for loop, find, and sed.
| 14286 | 1 | /* |
| 15884 | 2 | * purple - Transparency plugin |
| 14286 | 3 | * |
| 4 | * copyright (c) 1998-2002, rob flynn <rob@marko.net> | |
| 5 | * copyright (c) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> | |
| 6 | * copyright (c) 2005, Daniel Atallah <daniel_atallah@yahoo.com> | |
| 7 | * | |
| 8 | * this program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the gnu general public license as published by | |
| 10 | * the free software foundation; either version 2 of the license, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * this program is distributed in the hope that it will be useful, | |
| 14 | * but without any warranty; without even the implied warranty of | |
| 15 | * merchantability or fitness for a particular purpose. see the | |
| 16 | * gnu general public license for more details. | |
| 17 | * | |
| 18 | * you should have received a copy of the gnu general public license | |
| 19 | * along with this program; if not, write to the free software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19661
diff
changeset
|
20 | * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1301 usa |
| 14286 | 21 | * |
| 22 | */ | |
| 23 | #ifndef _WIN32_WINNT | |
| 24 | #define _WIN32_WINNT 0x0500 | |
| 25 | #endif | |
| 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" | |
| 36 | #include "gtkblist.h" | |
| 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 | static BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags) = NULL; | |
| 75 | ||
| 76 | /* | |
| 77 | * CODE | |
| 78 | */ | |
| 79 | ||
| 80 | /* Set window transparency level */ | |
| 81 | static void set_wintrans(GtkWidget *window, int alpha, gboolean enabled, | |
| 82 | gboolean always_on_top) { | |
| 83 | if (MySetLayeredWindowAttributes) { | |
| 84 | HWND hWnd = GDK_WINDOW_HWND(window->window); | |
| 85 | LONG style = GetWindowLong(hWnd, GWL_EXSTYLE); | |
| 86 | if (enabled) { | |
| 87 | style |= WS_EX_LAYERED; | |
| 88 | } else { | |
| 89 | style &= ~WS_EX_LAYERED; | |
| 90 | } | |
| 91 | SetWindowLong(hWnd, GWL_EXSTYLE, style); | |
| 92 | ||
| 93 | ||
| 94 | if (enabled) { | |
| 95 | SetWindowPos(hWnd, | |
| 96 | always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, | |
| 97 | 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | |
| 98 | MySetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA); | |
| 99 | } else { | |
| 100 | /* Ask the window and its children to repaint */ | |
| 101 | SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, | |
| 102 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | |
| 103 | ||
| 104 | RedrawWindow(hWnd, NULL, NULL, | |
| 105 | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); | |
| 106 | } | |
| 107 | } | |
| 108 | } | |
| 109 | ||
| 110 | /* When a conv window is focused, if we're only transparent when unfocused, | |
| 111 | * deal with transparency */ | |
| 112 | static gboolean focus_conv_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) { | |
| 15884 | 113 | if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED) |
| 114 | && purple_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS)) { | |
| 14286 | 115 | GtkWidget *window = (GtkWidget *) d; |
| 116 | if (e->in) { /* Focused */ | |
| 117 | set_wintrans(window, 0, FALSE, | |
| 15884 | 118 | purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
| 14286 | 119 | } else { |
| 120 | set_wintrans(window, | |
| 15884 | 121 | purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA), |
| 14286 | 122 | TRUE, |
| 15884 | 123 | purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
| 14286 | 124 | } |
| 125 | } | |
| 126 | return FALSE; | |
| 127 | } | |
| 128 | ||
| 129 | /* When buddy list window is focused, | |
| 130 | * if we're only transparent when unfocused, deal with transparency */ | |
| 131 | static gboolean focus_blist_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) { | |
| 15884 | 132 | if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED) |
| 133 | && purple_prefs_get_bool(OPT_WINTRANS_BL_ONFOCUS)) { | |
| 14286 | 134 | GtkWidget *window = (GtkWidget *) d; |
| 135 | if (e->in) { /* Focused */ | |
| 136 | set_wintrans(window, 0, FALSE, | |
| 15884 | 137 | purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP)); |
| 14286 | 138 | } else { |
| 139 | set_wintrans(window, | |
| 15884 | 140 | purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA), |
| 14286 | 141 | TRUE, |
| 15884 | 142 | purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP)); |
| 14286 | 143 | } |
| 144 | } | |
| 145 | return FALSE; | |
| 146 | } | |
| 147 | ||
| 148 | static void change_alpha(GtkWidget *w, gpointer data) { | |
| 149 | int alpha = gtk_range_get_value(GTK_RANGE(w)); | |
| 15884 | 150 | purple_prefs_set_int(OPT_WINTRANS_IM_ALPHA, alpha); |
| 14286 | 151 | |
| 152 | /* If we're in no-transparency on focus mode, | |
| 153 | * don't take effect immediately */ | |
| 15884 | 154 | if (!purple_prefs_get_bool(OPT_WINTRANS_IM_ONFOCUS)) |
| 14286 | 155 | set_wintrans(GTK_WIDGET(data), alpha, TRUE, |
| 15884 | 156 | purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
| 14286 | 157 | } |
| 158 | ||
| 159 | ||
| 160 | static GtkWidget *wintrans_slider(GtkWidget *win) { | |
| 161 | GtkWidget *hbox; | |
| 162 | GtkWidget *label, *slider; | |
| 163 | GtkWidget *frame; | |
| 164 | ||
| 15884 | 165 | int imalpha = purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA); |
| 14286 | 166 | |
| 167 | frame = gtk_frame_new(NULL); | |
| 168 | gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE); | |
| 169 | gtk_widget_show(frame); | |
| 170 | ||
| 171 | hbox = gtk_hbox_new(FALSE, 5); | |
| 172 | gtk_container_add(GTK_CONTAINER(frame), hbox); | |
| 173 | ||
| 174 | label = gtk_label_new(_("Opacity:")); | |
| 175 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 176 | gtk_widget_show(hbox); | |
| 177 | ||
| 178 | slider = gtk_hscale_new_with_range(50, 255, 1); | |
| 179 | gtk_range_set_value(GTK_RANGE(slider), imalpha); | |
| 180 | gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); | |
| 181 | ||
| 182 | /* On slider val change, update window's transparency level */ | |
| 183 | g_signal_connect(GTK_OBJECT(slider), "value-changed", | |
| 184 | GTK_SIGNAL_FUNC(change_alpha), win); | |
| 185 | ||
| 186 | gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
| 187 | ||
| 188 | /* Set the initial transparency level */ | |
| 189 | set_wintrans(win, imalpha, TRUE, | |
| 15884 | 190 | purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
| 14286 | 191 | |
| 192 | gtk_widget_show_all(hbox); | |
| 193 | ||
| 194 | return frame; | |
| 195 | } | |
| 196 | ||
| 197 | static slider_win* find_slidwin(GtkWidget *win) { | |
| 198 | GSList *tmp = window_list; | |
| 199 | ||
| 200 | while (tmp) { | |
| 201 | if (((slider_win*) (tmp->data))->win == win) | |
| 202 | return (slider_win*) tmp->data; | |
| 203 | tmp = tmp->next; | |
| 204 | } | |
| 205 | return NULL; | |
| 206 | } | |
| 207 | ||
| 208 | /* 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
|
209 | static void cleanup_conv_window(PidginWindow *win) { |
| 14286 | 210 | GtkWidget *window = win->window; |
| 211 | slider_win *slidwin = NULL; | |
| 212 | ||
| 213 | /* Remove window from the window list */ | |
| 15884 | 214 | purple_debug_info(WINTRANS_PLUGIN_ID, |
| 14286 | 215 | "Conv window destroyed... removing from list\n"); |
| 216 | ||
| 217 | if ((slidwin = find_slidwin(window))) { | |
| 218 | window_list = g_slist_remove(window_list, slidwin); | |
| 219 | g_free(slidwin); | |
| 220 | } | |
| 221 | ||
| 222 | /* Remove the focus cbs */ | |
| 223 | g_signal_handlers_disconnect_by_func(G_OBJECT(window), | |
| 224 | G_CALLBACK(focus_conv_win_cb), window); | |
| 225 | } | |
| 226 | ||
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
227 | static void |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
228 | conversation_delete_cb(PurpleConversation *conv) { |
| 15563 | 229 | PidginWindow *win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv)); |
| 14286 | 230 | /* If it is the last conversation in the window, cleanup */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
231 | if (pidgin_conv_window_get_gtkconv_count(win) == 1) |
| 14286 | 232 | cleanup_conv_window(win); |
| 233 | } | |
| 234 | ||
| 235 | static void set_blist_trans(GtkWidget *w, const char *pref) { | |
| 236 | gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); | |
| 15884 | 237 | purple_prefs_set_bool(pref, enabled); |
| 14286 | 238 | if (blist) { |
| 15884 | 239 | set_wintrans(blist, purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA), |
| 240 | purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED), | |
| 241 | purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); | |
| 14286 | 242 | } |
| 243 | } | |
| 244 | ||
| 245 | static void add_slider(GtkWidget *win) { | |
| 246 | GList *wl, *wl1; | |
| 247 | GtkWidget *vbox = NULL; | |
| 248 | ||
| 249 | /* Look up this window to see if it already has a slider */ | |
| 250 | if (!find_slidwin(win)) { | |
| 251 | GtkWidget *slider_box = NULL; | |
| 252 | slider_win *slidwin = NULL; | |
| 253 | GtkRequisition slidereq; | |
| 254 | gint width, height; | |
| 255 | ||
| 256 | /* Get top vbox */ | |
| 257 | for (wl1 = wl = gtk_container_get_children( | |
| 258 | GTK_CONTAINER(win)); | |
| 259 | wl != NULL; | |
| 260 | wl = wl->next) { | |
| 261 | if (GTK_IS_VBOX(GTK_OBJECT(wl->data))) | |
| 262 | vbox = GTK_WIDGET(wl->data); | |
| 263 | else { | |
| 15884 | 264 | purple_debug_error(WINTRANS_PLUGIN_ID, |
| 14286 | 265 | "no vbox found\n"); |
| 266 | return; | |
| 267 | } | |
| 268 | } | |
| 269 | g_list_free(wl1); | |
| 270 | ||
| 271 | slider_box = wintrans_slider(win); | |
| 272 | /* Figure out how tall the slider wants to be */ | |
| 273 | gtk_widget_size_request(slider_box, &slidereq); | |
| 274 | gtk_window_get_size(GTK_WINDOW(win), &width, &height); | |
| 275 | gtk_box_pack_start(GTK_BOX(vbox), | |
| 276 | 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
|
277 | #if 0 /*Now that we save window sizes, don't resize it or else it causes windows to grow*/ |
| 14286 | 278 | /* Make window taller so we don't slowly collapse its message area */ |
| 279 | gtk_window_resize(GTK_WINDOW(win), width, | |
| 280 | (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
|
281 | #endif |
| 14286 | 282 | /* Add window to list, to track that it has a slider */ |
| 283 | slidwin = g_new0(slider_win, 1); | |
| 284 | slidwin->win = win; | |
| 285 | slidwin->slider = slider_box; | |
| 286 | window_list = g_slist_append(window_list, slidwin); | |
| 287 | } | |
| 288 | } | |
| 289 | ||
| 290 | static void remove_sliders() { | |
| 291 | if (window_list) { | |
| 292 | GSList *tmp = window_list; | |
| 293 | while (tmp) { | |
| 294 | slider_win *slidwin = (slider_win*) tmp->data; | |
| 295 | if (slidwin != NULL && | |
| 296 | 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
|
297 | #if 0 |
| 14286 | 298 | GtkRequisition slidereq; |
| 299 | gint width, height; | |
| 300 | /* Figure out how tall the slider was */ | |
| 301 | gtk_widget_size_request( | |
| 302 | slidwin->slider, &slidereq); | |
| 303 | gtk_window_get_size( | |
| 304 | GTK_WINDOW(slidwin->win), | |
| 305 | &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
|
306 | #endif |
| 14286 | 307 | 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
|
308 | #if 0 |
| 14286 | 309 | gtk_window_resize( |
| 310 | GTK_WINDOW(slidwin->win), | |
| 311 | 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
|
312 | #endif |
| 14286 | 313 | } |
| 314 | g_free(slidwin); | |
| 315 | tmp = tmp->next; | |
| 316 | } | |
| 317 | g_slist_free(window_list); | |
| 318 | window_list = NULL; | |
| 319 | } | |
| 320 | } | |
| 321 | ||
| 322 | /* Remove all transparency related aspects from conversation windows */ | |
| 323 | static void remove_convs_wintrans(gboolean remove_signal) { | |
| 324 | GList *wins; | |
| 325 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
326 | 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
|
327 | PidginWindow *win = wins->data; |
| 14286 | 328 | GtkWidget *window = win->window; |
| 329 | ||
| 15884 | 330 | if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) |
| 14286 | 331 | set_wintrans(window, 0, FALSE, FALSE); |
| 332 | ||
| 333 | /* Remove the focus cbs */ | |
| 334 | if (remove_signal) | |
| 335 | g_signal_handlers_disconnect_by_func(G_OBJECT(window), | |
| 336 | G_CALLBACK(focus_conv_win_cb), window); | |
| 337 | } | |
| 338 | ||
| 339 | remove_sliders(); | |
| 340 | } | |
| 341 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
342 | static void set_conv_window_trans(PidginWindow *oldwin, PidginWindow *newwin) { |
| 14286 | 343 | GtkWidget *win = newwin->window; |
| 344 | ||
| 345 | /* check prefs to see if we want trans */ | |
| 15884 | 346 | if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) { |
| 347 | set_wintrans(win, purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA), | |
| 348 | TRUE, purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); | |
| 14286 | 349 | |
| 15884 | 350 | if (purple_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) { |
| 14286 | 351 | add_slider(win); |
| 352 | } | |
| 353 | } | |
| 354 | ||
| 355 | /* If we're moving from one window to another, | |
| 356 | * add the focus listeners to the new window if not already there */ | |
| 357 | if (oldwin != NULL && oldwin != newwin) { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
358 | if (pidgin_conv_window_get_gtkconv_count(newwin) == 0) { |
| 14286 | 359 | g_signal_connect(G_OBJECT(win), "focus_in_event", |
| 360 | G_CALLBACK(focus_conv_win_cb), win); | |
| 361 | g_signal_connect(G_OBJECT(win), "focus_out_event", | |
| 362 | G_CALLBACK(focus_conv_win_cb), win); | |
| 363 | } | |
| 364 | ||
| 365 | /* 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
|
366 | if (pidgin_conv_window_get_gtkconv_count(oldwin) == 1) |
| 14286 | 367 | cleanup_conv_window(oldwin); |
| 368 | } | |
| 369 | } | |
| 370 | ||
| 371 | static void update_convs_wintrans(GtkWidget *toggle_btn, const char *pref) { | |
| 15884 | 372 | purple_prefs_set_bool(pref, gtk_toggle_button_get_active( |
| 14286 | 373 | GTK_TOGGLE_BUTTON(toggle_btn))); |
| 374 | ||
| 15884 | 375 | if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) { |
| 14286 | 376 | GList *wins; |
| 377 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
378 | 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
|
379 | PidginWindow *win = wins->data; |
| 14286 | 380 | set_conv_window_trans(NULL, win); |
| 381 | } | |
| 382 | ||
| 15884 | 383 | if (!purple_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) |
| 14286 | 384 | remove_sliders(); |
| 385 | } | |
| 386 | else | |
| 387 | remove_convs_wintrans(FALSE); | |
| 388 | } | |
| 389 | ||
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
390 | static void |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
391 | conv_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type) { |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
392 | 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
|
393 | 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
|
394 | |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
395 | if (type == PURPLE_CONV_UPDATE_UNSEEN && !pidgin_conv_is_hidden(pconv) |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
396 | && 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
|
397 | && 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
|
398 | 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
|
399 | gboolean has_focus; |
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
400 | |
|
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
|
401 | 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
|
402 | |
|
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
|
403 | 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
|
404 | 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
|
405 | |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
406 | 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
|
407 | 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
|
408 | 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
|
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 | 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
|
411 | 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
|
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 | } |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
415 | |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
416 | static void |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
417 | new_conversation_cb(PurpleConversation *conv) { |
| 15563 | 418 | PidginWindow *win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv)); |
| 14286 | 419 | |
| 420 | /* If it is the first conversation in the window, | |
| 421 | * 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
|
422 | if (!pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) && pidgin_conv_window_get_gtkconv_count(win) == 1) { |
| 14286 | 423 | GtkWidget *window = win->window; |
| 424 | ||
| 425 | set_conv_window_trans(NULL, win); | |
| 426 | ||
| 427 | g_signal_connect(G_OBJECT(window), "focus_in_event", | |
| 428 | G_CALLBACK(focus_conv_win_cb), window); | |
| 429 | g_signal_connect(G_OBJECT(window), "focus_out_event", | |
| 430 | G_CALLBACK(focus_conv_win_cb), window); | |
| 431 | } | |
| 432 | } | |
| 433 | ||
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
434 | static void |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
435 | blist_created_cb(PurpleBuddyList *purple_blist, gpointer data) { |
| 14286 | 436 | if (blist) { |
| 15884 | 437 | if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) { |
| 14286 | 438 | set_wintrans(blist, |
| 15884 | 439 | purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA), |
| 14286 | 440 | TRUE, |
| 15884 | 441 | purple_prefs_get_bool(OPT_WINTRANS_BL_ONTOP)); |
| 14286 | 442 | } |
| 443 | ||
| 444 | g_signal_connect(G_OBJECT(blist), "focus_in_event", | |
| 445 | G_CALLBACK(focus_blist_win_cb), blist); | |
| 446 | g_signal_connect(G_OBJECT(blist), "focus_out_event", | |
| 447 | G_CALLBACK(focus_blist_win_cb), blist); | |
| 448 | } | |
| 449 | } | |
| 450 | ||
| 451 | static void alpha_change(GtkWidget *w, gpointer data) { | |
| 452 | GList *wins; | |
| 453 | int imalpha = gtk_range_get_value(GTK_RANGE(w)); | |
| 454 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
455 | 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
|
456 | PidginWindow *win = wins->data; |
| 14286 | 457 | set_wintrans(win->window, imalpha, TRUE, |
| 15884 | 458 | purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP)); |
| 14286 | 459 | } |
| 460 | } | |
| 461 | ||
| 462 | static void alpha_pref_set_int (GtkWidget *w, GdkEventFocus *e, const char *pref) | |
| 463 | { | |
| 464 | int alpha = gtk_range_get_value(GTK_RANGE(w)); | |
| 15884 | 465 | purple_prefs_set_int(pref, alpha); |
| 14286 | 466 | } |
| 467 | ||
| 468 | static void bl_alpha_change(GtkWidget *w, gpointer data) { | |
| 469 | if (blist) | |
| 470 | change_alpha(w, blist); | |
| 471 | } | |
| 472 | ||
| 473 | static void update_existing_convs() { | |
| 474 | GList *wins; | |
| 475 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
476 | 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
|
477 | PidginWindow *win = wins->data; |
| 14286 | 478 | GtkWidget *window = win->window; |
| 479 | ||
| 480 | set_conv_window_trans(NULL, win); | |
| 481 | ||
| 482 | g_signal_connect(G_OBJECT(window), "focus_in_event", | |
| 483 | G_CALLBACK(focus_conv_win_cb), window); | |
| 484 | g_signal_connect(G_OBJECT(window), "focus_out_event", | |
| 485 | G_CALLBACK(focus_conv_win_cb), window); | |
| 486 | } | |
| 487 | } | |
| 488 | ||
| 489 | /* | |
| 490 | * EXPORTED FUNCTIONS | |
| 491 | */ | |
| 15884 | 492 | static gboolean plugin_load(PurplePlugin *plugin) { |
| 493 | MySetLayeredWindowAttributes = (void*) wpurple_find_and_loadproc( | |
| 14286 | 494 | "user32.dll", "SetLayeredWindowAttributes"); |
| 495 | ||
| 496 | if (!MySetLayeredWindowAttributes) { | |
| 15884 | 497 | purple_debug_error(WINTRANS_PLUGIN_ID, |
| 14286 | 498 | "SetLayeredWindowAttributes API not found (Required W2K+)\n"); |
| 499 | return FALSE; | |
| 500 | } | |
| 501 | ||
| 15884 | 502 | purple_signal_connect(purple_conversations_get_handle(), |
| 14286 | 503 | "conversation-created", plugin, |
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
504 | PURPLE_CALLBACK(new_conversation_cb), NULL); |
| 14286 | 505 | |
| 506 | /* Set callback to remove window from the list, if the window is destroyed */ | |
| 15884 | 507 | purple_signal_connect(purple_conversations_get_handle(), |
| 14286 | 508 | "deleting-conversation", plugin, |
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
509 | PURPLE_CALLBACK(conversation_delete_cb), NULL); |
| 14286 | 510 | |
| 15884 | 511 | purple_signal_connect(pidgin_conversations_get_handle(), |
| 14286 | 512 | "conversation-dragging", plugin, |
| 15884 | 513 | PURPLE_CALLBACK(set_conv_window_trans), NULL); |
| 14286 | 514 | |
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
515 | 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
|
516 | "conversation-updated", plugin, |
|
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
517 | 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
|
518 | |
| 14286 | 519 | update_existing_convs(); |
| 520 | ||
| 521 | if (blist) | |
| 522 | blist_created_cb(NULL, NULL); | |
| 523 | else | |
| 15884 | 524 | purple_signal_connect(pidgin_blist_get_handle(), |
| 14286 | 525 | "gtkblist-created", plugin, |
| 15884 | 526 | PURPLE_CALLBACK(blist_created_cb), NULL); |
| 14286 | 527 | |
| 528 | ||
| 529 | return TRUE; | |
| 530 | } | |
| 531 | ||
| 15884 | 532 | static gboolean plugin_unload(PurplePlugin *plugin) { |
| 533 | purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading win2ktrans plugin\n"); | |
| 14286 | 534 | |
| 535 | remove_convs_wintrans(TRUE); | |
| 536 | ||
| 537 | if (blist) { | |
| 15884 | 538 | if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
| 14286 | 539 | set_wintrans(blist, 0, FALSE, FALSE); |
| 540 | ||
| 541 | /* Remove the focus cbs */ | |
| 542 | g_signal_handlers_disconnect_by_func(G_OBJECT(blist), | |
| 543 | G_CALLBACK(focus_blist_win_cb), blist); | |
| 544 | } | |
| 545 | ||
| 546 | return TRUE; | |
| 547 | } | |
| 548 | ||
| 15884 | 549 | static GtkWidget *get_config_frame(PurplePlugin *plugin) { |
| 14286 | 550 | GtkWidget *ret; |
| 551 | GtkWidget *imtransbox, *bltransbox; | |
| 552 | GtkWidget *hbox; | |
| 553 | GtkWidget *label, *slider; | |
| 554 | GtkWidget *button; | |
| 555 | GtkWidget *trans_box; | |
| 556 | ||
| 557 | ret = gtk_vbox_new(FALSE, 18); | |
| 558 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); | |
| 559 | ||
| 560 | /* IM Convo trans options */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
561 | 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
|
562 | button = pidgin_prefs_checkbox(_("_IM window transparency"), |
| 14286 | 563 | OPT_WINTRANS_IM_ENABLED, imtransbox); |
| 564 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
| 565 | GTK_SIGNAL_FUNC(update_convs_wintrans), | |
| 566 | (gpointer) OPT_WINTRANS_IM_ENABLED); | |
| 567 | ||
| 568 | trans_box = gtk_vbox_new(FALSE, 18); | |
| 15884 | 569 | if (!purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) |
| 14286 | 570 | gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
| 571 | gtk_widget_show(trans_box); | |
| 572 | ||
| 573 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
574 | GTK_SIGNAL_FUNC(pidgin_toggle_sensitive), trans_box); |
| 14286 | 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(_("_Show slider bar in IM window"), |
| 14286 | 577 | OPT_WINTRANS_IM_SLIDER, trans_box); |
| 578 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
| 579 | GTK_SIGNAL_FUNC(update_convs_wintrans), | |
| 580 | (gpointer) OPT_WINTRANS_IM_SLIDER); | |
| 581 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
582 | button = pidgin_prefs_checkbox( |
| 14286 | 583 | _("Remove IM window transparency on focus"), |
| 584 | OPT_WINTRANS_IM_ONFOCUS, trans_box); | |
| 585 | ||
|
18669
872d7d81d212
Fix transparency not being applied when showing a hidden conversation.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
586 | button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_IM_ONTOP, |
| 14286 | 587 | trans_box); |
| 588 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
| 589 | GTK_SIGNAL_FUNC(update_convs_wintrans), | |
| 590 | (gpointer) OPT_WINTRANS_IM_ONTOP); | |
| 591 | ||
| 592 | gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5); | |
| 593 | ||
| 594 | /* IM transparency slider */ | |
| 595 | hbox = gtk_hbox_new(FALSE, 5); | |
| 596 | ||
| 597 | label = gtk_label_new(_("Opacity:")); | |
| 598 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 599 | ||
| 600 | slider = gtk_hscale_new_with_range(50, 255, 1); | |
| 601 | gtk_range_set_value(GTK_RANGE(slider), | |
| 15884 | 602 | purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA)); |
| 14286 | 603 | gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); |
| 604 | ||
| 605 | g_signal_connect(GTK_OBJECT(slider), "value-changed", | |
| 606 | GTK_SIGNAL_FUNC(alpha_change), NULL); | |
| 607 | g_signal_connect(GTK_OBJECT(slider), "focus-out-event", | |
| 608 | GTK_SIGNAL_FUNC(alpha_pref_set_int), | |
| 609 | (gpointer) OPT_WINTRANS_IM_ALPHA); | |
| 610 | ||
| 611 | gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
| 612 | ||
| 613 | gtk_widget_show_all(hbox); | |
| 614 | ||
| 615 | gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); | |
| 616 | ||
| 617 | /* Buddy List trans options */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
618 | 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
|
619 | button = pidgin_prefs_checkbox(_("_Buddy List window transparency"), |
| 14286 | 620 | OPT_WINTRANS_BL_ENABLED, bltransbox); |
| 621 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
| 622 | GTK_SIGNAL_FUNC(set_blist_trans), | |
| 623 | (gpointer) OPT_WINTRANS_BL_ENABLED); | |
| 624 | ||
| 625 | trans_box = gtk_vbox_new(FALSE, 18); | |
| 15884 | 626 | if (!purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) |
| 14286 | 627 | gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); |
| 628 | gtk_widget_show(trans_box); | |
| 629 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
630 | GTK_SIGNAL_FUNC(pidgin_toggle_sensitive), trans_box); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
631 | button = pidgin_prefs_checkbox( |
| 14286 | 632 | _("Remove Buddy List window transparency on focus"), |
| 633 | 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
|
634 | button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_BL_ONTOP, |
| 14286 | 635 | trans_box); |
| 636 | g_signal_connect(GTK_OBJECT(button), "clicked", | |
| 637 | GTK_SIGNAL_FUNC(set_blist_trans), | |
| 638 | (gpointer) OPT_WINTRANS_BL_ONTOP); | |
| 639 | gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5); | |
| 640 | ||
| 641 | /* IM transparency slider */ | |
| 642 | hbox = gtk_hbox_new(FALSE, 5); | |
| 643 | ||
| 644 | label = gtk_label_new(_("Opacity:")); | |
| 645 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 646 | ||
| 647 | slider = gtk_hscale_new_with_range(50, 255, 1); | |
| 648 | gtk_range_set_value(GTK_RANGE(slider), | |
| 15884 | 649 | purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA)); |
| 14286 | 650 | |
| 651 | gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); | |
| 652 | ||
| 653 | g_signal_connect(GTK_OBJECT(slider), "value-changed", | |
| 654 | GTK_SIGNAL_FUNC(bl_alpha_change), NULL); | |
| 655 | g_signal_connect(GTK_OBJECT(slider), "focus-out-event", | |
| 656 | GTK_SIGNAL_FUNC(alpha_pref_set_int), | |
| 657 | (gpointer) OPT_WINTRANS_BL_ALPHA); | |
| 658 | ||
| 659 | gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); | |
| 660 | ||
| 661 | gtk_widget_show_all(hbox); | |
| 662 | ||
| 663 | gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); | |
| 664 | ||
| 665 | gtk_widget_show_all(ret); | |
| 666 | return ret; | |
| 667 | } | |
| 668 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
669 | static PidginPluginUiInfo ui_info = |
| 14286 | 670 | { |
| 671 | 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
|
672 | 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
|
673 | |
|
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
|
674 | /* 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
|
675 | 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
|
676 | 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
|
677 | 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
|
678 | NULL |
| 14286 | 679 | }; |
| 680 | ||
| 15884 | 681 | static PurplePluginInfo info = |
| 14286 | 682 | { |
| 15884 | 683 | PURPLE_PLUGIN_MAGIC, |
| 684 | PURPLE_MAJOR_VERSION, | |
| 685 | PURPLE_MINOR_VERSION, | |
| 686 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
687 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
| 14286 | 688 | 0, /**< flags */ |
| 689 | NULL, /**< dependencies */ | |
| 15884 | 690 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 14286 | 691 | WINTRANS_PLUGIN_ID, /**< id */ |
| 692 | N_("Transparency"), /**< name */ | |
| 693 | VERSION, /**< version */ | |
| 694 | /** summary */ | |
| 695 | N_("Variable Transparency for the buddy list and conversations."), | |
| 696 | /** description */ | |
| 697 | N_("This plugin enables variable alpha transparency on conversation windows and the buddy list.\n\n" | |
| 698 | "* Note: This plugin requires Win2000 or greater."), | |
| 699 | "Herman Bloggs <hermanator12002@yahoo.com>", /**< author */ | |
| 15884 | 700 | PURPLE_WEBSITE, /**< homepage */ |
| 14286 | 701 | plugin_load, /**< load */ |
| 702 | plugin_unload, /**< unload */ | |
| 703 | NULL, /**< destroy */ | |
| 704 | &ui_info, /**< ui_info */ | |
| 705 | NULL, /**< extra_info */ | |
| 706 | 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
|
707 | 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
|
708 | |
|
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
|
709 | /* 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
|
710 | 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
|
711 | 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
|
712 | 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
|
713 | NULL |
| 14286 | 714 | }; |
| 715 | ||
| 716 | static void | |
| 15884 | 717 | init_plugin(PurplePlugin *plugin) |
| 14286 | 718 | { |
| 15884 | 719 | purple_prefs_add_none("/plugins/gtk/win32"); |
| 720 | purple_prefs_add_none("/plugins/gtk/win32/wintrans"); | |
| 721 | purple_prefs_add_bool(OPT_WINTRANS_IM_ENABLED, FALSE); | |
| 722 | purple_prefs_add_int(OPT_WINTRANS_IM_ALPHA, 255); | |
| 723 | purple_prefs_add_bool(OPT_WINTRANS_IM_SLIDER, FALSE); | |
| 724 | purple_prefs_add_bool(OPT_WINTRANS_IM_ONFOCUS, FALSE); | |
| 725 | purple_prefs_add_bool(OPT_WINTRANS_IM_ONTOP, FALSE); | |
| 726 | purple_prefs_add_bool(OPT_WINTRANS_BL_ENABLED, FALSE); | |
| 727 | purple_prefs_add_int(OPT_WINTRANS_BL_ALPHA, 255); | |
| 728 | purple_prefs_add_bool(OPT_WINTRANS_BL_ONFOCUS, FALSE); | |
| 729 | purple_prefs_add_bool(OPT_WINTRANS_BL_ONTOP, FALSE); | |
| 14286 | 730 | } |
| 731 | ||
| 15884 | 732 | PURPLE_INIT_PLUGIN(wintrans, init_plugin, info) |