Sat, 27 Sep 2003 19:17:21 +0000
[gaim-migrate @ 7538]
This is Mr. Holland's Opus. And by Mr. Holland I mean Robot101. He
rewrote the coreish IM image support so that the binary data gets
ripped out in the prpl and put in an imgstore instead of just being
passed in the same huge as char string as the actual message. This
is good because it's prpl agnostic, or something. It also means
we don't have a silly length of "-1" with pretty much every send or
receive IM function.
It should be crash free, bug free, and memleak free, but additional
testing is always a good thing.
If you like good stuff then you'll love this patch. But don't take
my word for it--ba dun dunt!
| 6302 | 1 | /* |
| 2 | * Gaim buddy notification plugin. | |
| 3 | * | |
| 4 | * Copyright (C) 2000-2001, Eric Warmenhoven (original code) | |
| 5 | * Copyright (C) 2002, Etan Reisner <deryni@eden.rutgers.edu> (rewritten code) | |
| 6 | * Copyright (C) 2003, Christian Hammond (update for changed API) | |
|
6322
35fdae8a156f
[gaim-migrate @ 6821]
Mark Doliner <markdoliner@pidgin.im>
parents:
6302
diff
changeset
|
7 | * Copyright (C) 2003, Brian Tarricone <bjt23@cornell.edu> (mostly rewritten) |
| 6302 | 8 | * Copyright (C) 2003, Mark Doliner (minor cleanup) |
| 6977 | 9 | * Copyright (C) 2003, Etan Reisner (largely rewritten again) |
| 6302 | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 3374 | 20 | * |
| 6302 | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | * | |
| 25 | */ | |
| 26 | ||
| 27 | /* | |
| 28 | * From Etan, 2002: | |
| 29 | * -Added config dialog | |
| 30 | * -Added control over notification method | |
| 31 | * -Added control over when to release notification | |
| 32 | * | |
| 33 | * -Added option to get notification for chats also | |
| 34 | * -Cleaned up code | |
| 35 | * -Added option to notify on click as it's own option | |
| 36 | * rather then as what happens when on focus isn't clicked | |
| 37 | * -Added apply button to change the denotification methods for | |
| 38 | * open conversation windows | |
| 39 | * -Fixed apply to conversations, count now keeps count across applies | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
40 | * -Fixed(?) memory leak, and in the process fixed some stupidities |
| 6302 | 41 | * -Hit enter when done editing the title string entry box to save it |
| 3392 | 42 | * |
| 43 | * Thanks to Carles Pina i Estany <carles@pinux.info> | |
| 44 | * for count of new messages option | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
45 | * |
| 6302 | 46 | * From Brian, 20 July 2003: |
| 47 | * -Use new xml prefs | |
| 48 | * -Better handling of notification states tracking | |
| 49 | * -Better pref change handling | |
| 50 | * -Fixed a possible memleak and possible crash (rare) | |
| 51 | * -Use gtk_window_get_title() rather than gtkwin->title | |
| 52 | * -Other random fixes and cleanups | |
| 6977 | 53 | * |
| 54 | * Etan again, 12 August 2003: | |
| 55 | * -Better use of the new xml prefs | |
| 56 | * -Removed all bitmask stuff | |
| 57 | * -Even better pref change handling | |
| 58 | * -Removed unnecessary functions | |
| 59 | * -Reworking of notification/unnotification stuff | |
| 60 | * -Header file include cleanup | |
| 61 | * -General code cleanup | |
| 3392 | 62 | */ |
| 63 | ||
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6322
diff
changeset
|
64 | #include "gtkinternal.h" |
| 6302 | 65 | |
| 66 | #include "conversation.h" | |
| 67 | #include "debug.h" | |
| 68 | #include "prefs.h" | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
69 | #include "signals.h" |
|
4202
8b92de3b1c07
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
70 | |
| 6302 | 71 | #include "gtkconv.h" |
| 72 | #include "gtkplugin.h" | |
| 73 | #include "gtkutils.h" | |
| 74 | ||
| 6977 | 75 | #include <X11/Xatom.h> |
| 3385 | 76 | #include <X11/Xlib.h> |
| 3374 | 77 | #include <X11/Xutil.h> |
| 78 | ||
| 6302 | 79 | #define NOTIFY_PLUGIN_ID "gtk-x11-notify" |
| 3710 | 80 | |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
81 | static GaimPlugin *my_plugin = NULL; |
|
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
82 | |
| 6302 | 83 | /* notification set/unset */ |
| 6977 | 84 | static int notify(GaimConversation *conv, gboolean increment); |
| 85 | static gboolean unnotify(GaimConversation *conv, gboolean reset); | |
| 86 | static int unnotify_cb(GtkWidget *widget, GaimConversation *conv); | |
| 87 | static void renotify(GaimWindow *gaimwin); | |
| 6302 | 88 | |
| 89 | /* gtk widget callbacks for prefs panel */ | |
| 6977 | 90 | static void type_toggle_cb(GtkWidget *widget, gpointer data); |
| 91 | static void method_toggle_cb(GtkWidget *widget, gpointer data); | |
| 92 | static void notify_toggle_cb(GtkWidget *widget, gpointer data); | |
| 93 | static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data); | |
| 94 | static void apply_method(); | |
| 95 | static void apply_notify(); | |
| 191 | 96 | |
| 6977 | 97 | /* string function */ |
| 98 | static void handle_string(GtkWidget *widget); | |
| 6302 | 99 | |
| 6977 | 100 | /* count function */ |
| 101 | static void handle_count(GtkWidget *widget); | |
| 6302 | 102 | |
| 6977 | 103 | /* urgent function */ |
| 104 | static void handle_urgent(GtkWidget *widget, gboolean add); | |
| 3710 | 105 | |
| 6302 | 106 | /****************************************/ |
| 107 | /* Begin doing stuff below this line... */ | |
| 108 | /****************************************/ | |
| 109 | ||
| 6977 | 110 | static int |
| 111 | notify(GaimConversation *conv, gboolean increment) | |
| 112 | { | |
| 113 | GaimWindow *gaimwin = NULL; | |
| 114 | GaimGtkWindow *gtkwin = NULL; | |
| 115 | /* | |
| 3710 | 116 | Window focus_return; |
| 6977 | 117 | */ |
| 6302 | 118 | gint count; |
| 6977 | 119 | gboolean has_focus; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
120 | |
| 6977 | 121 | if (conv == NULL) |
| 6302 | 122 | return 0; |
| 123 | ||
| 6977 | 124 | /* We want to remove the notifications, but not reset the counter */ |
| 125 | unnotify(conv, FALSE); | |
| 126 | ||
| 127 | gaimwin = gaim_conversation_get_window(conv); | |
| 128 | gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
| 5021 | 129 | |
| 6977 | 130 | /* If we aren't doing notifications for this type of conversation, return */ |
| 131 | if (((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && | |
| 132 | !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || | |
| 133 | ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && | |
| 134 | !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) | |
| 135 | return 0; | |
| 4203 | 136 | |
| 6977 | 137 | g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
| 3374 | 138 | |
| 6977 | 139 | /* TODO need to test these different levels of having focus |
| 140 | * only still need to test the window has focus, but tab doesn't one */ | |
| 141 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || | |
| 142 | (has_focus && gaim_window_get_active_conversation(gaimwin) != conv) || | |
| 143 | !has_focus) { | |
| 144 | if (increment) { | |
| 145 | count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")); | |
| 146 | count++; | |
| 147 | g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count)); | |
| 6302 | 148 | |
| 6977 | 149 | count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); |
| 150 | count++; | |
| 151 | gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); | |
| 152 | } | |
| 6302 | 153 | |
| 6977 | 154 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) |
| 155 | handle_count(gtkwin->window); | |
| 156 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
| 157 | handle_string(gtkwin->window); | |
| 158 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
| 159 | handle_urgent(gtkwin->window, TRUE); | |
| 160 | } | |
| 6302 | 161 | |
| 162 | return 0; | |
| 163 | } | |
| 164 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
165 | static gboolean |
| 6977 | 166 | unnotify(GaimConversation *conv, gboolean reset) |
| 167 | { | |
| 168 | GaimConversation *active_conv = NULL; | |
| 169 | GaimGtkWindow *gtkwin = NULL; | |
| 170 | GaimWindow *gaimwin = NULL; | |
| 171 | gint count; | |
| 172 | ||
| 173 | if (conv == NULL) | |
| 174 | return FALSE; | |
| 175 | ||
| 176 | gaimwin = gaim_conversation_get_window(conv); | |
| 177 | gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
| 178 | active_conv = gaim_window_get_active_conversation(gaimwin); | |
| 179 | ||
| 180 | /* This should mean that there is no notification on the window */ | |
| 181 | count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); | |
| 182 | if (count == 0) | |
| 183 | return FALSE; | |
| 184 | ||
| 185 | /* reset the conversation window title */ | |
| 186 | gaim_conversation_autoset_title(active_conv); | |
| 187 | ||
| 188 | if (reset) { | |
| 189 | int count2; | |
| 190 | /* There is no point in removing the urgent wm_hint if we are just going | |
| 191 | * to add it back again in a second */ | |
| 192 | handle_urgent(gtkwin->window, FALSE); | |
| 193 | count2 = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")); | |
| 194 | g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count2-count)); | |
| 195 | gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); | |
| 196 | } | |
| 197 | ||
| 198 | renotify(gaimwin); | |
| 199 | ||
| 200 | return TRUE; | |
| 201 | } | |
| 202 | ||
| 203 | static int | |
| 204 | unnotify_cb(GtkWidget *widget, GaimConversation *conv) | |
| 205 | { | |
| 206 | GaimConversation *c = g_object_get_data(G_OBJECT(widget), "notify-conversation"); | |
| 207 | ||
| 208 | unnotify(c, TRUE); | |
| 209 | ||
| 210 | return 0; | |
| 211 | } | |
| 212 | ||
| 213 | static void | |
| 214 | renotify(GaimWindow *gaimwin) | |
| 215 | { | |
| 216 | GList *convs = NULL; | |
| 217 | ||
| 218 | ||
| 219 | for (convs = gaim_window_get_conversations(gaimwin); | |
| 220 | convs != NULL; convs = convs->next) { | |
| 221 | GaimGtkWindow *gtkwin = NULL; | |
| 222 | int count; | |
| 223 | ||
| 224 | gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
| 225 | count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message_count")); | |
| 226 | if (count != 0) { | |
| 227 | notify((GaimConversation *)convs->data, FALSE); | |
| 228 | return; | |
| 229 | } | |
| 230 | } | |
| 231 | } | |
| 232 | ||
| 233 | static gboolean | |
| 6620 | 234 | chat_recv_im(GaimAccount *account, char **who, char **text, int id, void *m) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
235 | { |
| 6977 | 236 | GaimConversation *conv = gaim_find_chat(gaim_account_get_connection(account), |
| 237 | id); | |
| 238 | ||
| 239 | notify(conv, TRUE); | |
| 3710 | 240 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
241 | return FALSE; |
| 3710 | 242 | } |
| 243 | ||
| 6977 | 244 | static void |
| 245 | chat_sent_im(GaimAccount *account, char *text, int id, void *m) | |
| 246 | { | |
| 247 | GaimConversation *conv = NULL; | |
| 248 | ||
| 249 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | |
| 250 | conv = gaim_find_chat(gaim_account_get_connection(account), id); | |
| 251 | unnotify(conv, TRUE); | |
| 252 | } | |
| 3710 | 253 | } |
| 254 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
255 | static gboolean |
| 6620 | 256 | im_recv_im(GaimAccount *account, char **who, char **what, int *flags, void *m) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
257 | { |
| 6620 | 258 | GaimConversation *conv = gaim_find_conversation_with_account(*who, account); |
| 6977 | 259 | |
| 260 | notify(conv, TRUE); | |
| 3710 | 261 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
262 | return FALSE; |
| 3710 | 263 | } |
| 264 | ||
| 6977 | 265 | static void |
| 266 | im_sent_im(GaimAccount *account, char *who, void *m) { | |
| 267 | GaimConversation *conv = NULL; | |
| 6620 | 268 | |
| 6977 | 269 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { |
| 270 | conv = gaim_find_conversation_with_account(who, account); | |
| 271 | unnotify(conv, TRUE); | |
| 272 | } | |
| 3710 | 273 | } |
| 3392 | 274 | |
| 6977 | 275 | static int |
| 276 | attach_signals(GaimConversation *conv) | |
| 277 | { | |
| 278 | /* TODO I can't seem to get passing a GaimConversation to a callback to work | |
| 279 | * correctly, so in the interest of not g_object_set_data'ing on multiple | |
| 280 | * widgets, I'm going to just _set_data on ->entry and _connect_swapped the | |
| 281 | * other signals, if I ever get passing the GaimConversation to work I'll | |
| 282 | * stop this ugliness */ | |
| 283 | GaimGtkConversation *gtkconv = NULL; | |
| 284 | GaimGtkWindow *gtkwin = NULL; | |
| 285 | GSList *window_ids = NULL, *imhtml_ids = NULL, *entry_ids = NULL; | |
| 286 | guint id; | |
| 287 | ||
| 288 | gtkconv = GAIM_GTK_CONVERSATION(conv); | |
| 289 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
290 | |
| 6977 | 291 | /* |
| 292 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { | |
| 293 | id = g_signal_connect(G_OBJECT(gtkwin->window), "focus-in-event", G_CALLBACK(unnotify_cb), conv); | |
| 294 | window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | |
| 295 | } | |
| 296 | */ | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
297 | |
| 6977 | 298 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
| 299 | /* TODO I think this might crash when convs dragged in/out of windows. | |
| 300 | * needs testing | |
| 301 | id = g_signal_connect(G_OBJECT(gtkwin->window), "button-press-event", G_CALLBACK(unnotify_cb), conv); | |
| 302 | window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | |
| 303 | */ | |
| 304 | ||
| 305 | /* | |
| 306 | id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", G_CALLBACK(unnotify_cb), conv); | |
| 307 | */ | |
| 308 | id = g_signal_connect_swapped(G_OBJECT(gtkconv->imhtml), "button-press-event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkconv->entry)); | |
| 309 | imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); | |
| 310 | ||
| 311 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", G_CALLBACK(unnotify_cb), conv); | |
| 312 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); | |
| 3374 | 313 | } |
| 3710 | 314 | |
| 6977 | 315 | if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
| 316 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", G_CALLBACK(unnotify_cb), conv); | |
| 317 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); | |
| 3374 | 318 | } |
| 319 | ||
| 6977 | 320 | g_object_set_data(G_OBJECT(gtkconv->entry), "notify-conversation", conv); |
| 321 | ||
| 322 | gaim_conversation_set_data(conv, "notify-window-signals", window_ids); | |
| 323 | gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); | |
| 324 | gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids); | |
| 4035 | 325 | |
| 3428 | 326 | return 0; |
| 191 | 327 | } |
| 328 | ||
| 6977 | 329 | static void |
| 330 | detach_signals(GaimConversation *conv) | |
| 331 | { | |
| 332 | GaimGtkConversation *gtkconv = NULL; | |
| 333 | GaimGtkWindow *gtkwin = NULL; | |
| 334 | GSList *ids = NULL; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
335 | |
| 6977 | 336 | gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 337 | gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
| 4203 | 338 | |
| 6977 | 339 | ids = gaim_conversation_get_data(conv, "notify-window-signals"); |
| 340 | for (; ids != NULL; ids = ids->next) | |
| 341 | g_signal_handler_disconnect(gtkwin->window, GPOINTER_TO_INT(ids->data)); | |
| 6302 | 342 | |
| 6977 | 343 | ids = gaim_conversation_get_data(conv, "notify-imhtml-signals"); |
| 344 | for (; ids != NULL; ids = ids->next) | |
| 345 | g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(ids->data)); | |
| 6302 | 346 | |
| 6977 | 347 | ids = gaim_conversation_get_data(conv, "notify-entry-signals"); |
| 348 | for (; ids != NULL; ids = ids->next) | |
| 349 | g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data)); | |
| 3710 | 350 | |
| 6977 | 351 | g_object_set_data(G_OBJECT(gtkwin->window), "notify-message_count", GINT_TO_POINTER(0)); |
| 3710 | 352 | |
| 6977 | 353 | gaim_conversation_set_data(conv, "notify-window-signals", NULL); |
| 354 | gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL); | |
| 355 | gaim_conversation_set_data(conv, "notify-entry-signals", NULL); | |
| 3710 | 356 | } |
| 357 | ||
| 6977 | 358 | static void |
| 359 | conv_created(GaimConversation *conv) | |
| 360 | { | |
| 361 | GaimWindow *gaimwin = NULL; | |
| 362 | GaimGtkWindow *gtkwin = NULL; | |
| 6302 | 363 | |
| 6977 | 364 | gaimwin = gaim_conversation_get_window(conv); |
| 6302 | 365 | |
| 6977 | 366 | if (gaimwin == NULL) |
| 6302 | 367 | return; |
| 3374 | 368 | |
| 6977 | 369 | gtkwin = GAIM_GTK_WINDOW(gaimwin); |
| 370 | ||
| 371 | g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(0)); | |
| 6302 | 372 | |
| 6977 | 373 | /* always attach the signals, notify() will take care of conversation type |
| 374 | * checking */ | |
| 375 | attach_signals(conv); | |
| 3374 | 376 | } |
| 377 | ||
| 6977 | 378 | static void |
| 379 | chat_join(GaimConversation *conv) | |
| 380 | { | |
| 381 | GaimWindow *gaimwin = NULL; | |
| 382 | GaimGtkWindow *gtkwin = NULL; | |
| 3392 | 383 | |
| 6977 | 384 | gaimwin = gaim_conversation_get_window(conv); |
| 4035 | 385 | |
| 6977 | 386 | if (gaimwin == NULL) |
| 6302 | 387 | return; |
| 388 | ||
| 6977 | 389 | gtkwin = GAIM_GTK_WINDOW(gaimwin); |
| 3392 | 390 | |
| 6977 | 391 | g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(0)); |
| 3374 | 392 | |
| 6977 | 393 | /* always attach the signals, notify() will take care of conversation type |
| 394 | * checking */ | |
| 395 | attach_signals(conv); | |
| 4035 | 396 | } |
| 397 | ||
| 6977 | 398 | #if 0 |
| 399 | static void | |
| 400 | conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) | |
| 401 | { | |
| 402 | GaimWindow *gaimwin = NULL; | |
| 403 | GaimGtkWindow *gtkwin = NULL; | |
| 404 | /* | |
| 405 | gint count; | |
| 406 | */ | |
| 407 | gaim_debug(GAIM_DEBUG_INFO, "notify", "conv_switch\n"); | |
| 6302 | 408 | |
| 6977 | 409 | if (!gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) { |
| 410 | gaimwin = gaim_conversation_get_window(new_conv); | |
| 6302 | 411 | |
| 6977 | 412 | if (gaimwin == NULL); |
| 3392 | 413 | |
| 6977 | 414 | gtkwin = GAIM_GTK_WINDOW(gaimwin); |
| 6302 | 415 | |
| 6977 | 416 | /* if we don't have notification on the window then we don't want to add |
| 417 | * it back */ | |
| 418 | if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")) != 0) | |
| 419 | notify(new_conv, FALSE); | |
| 420 | } else | |
| 421 | unnotify(new_conv, TRUE); | |
| 422 | } | |
| 423 | #endif | |
| 6302 | 424 | |
| 6977 | 425 | static void |
| 426 | deleting_conv(GaimConversation *conv) | |
| 427 | { | |
| 428 | detach_signals(conv); | |
| 3392 | 429 | } |
| 430 | ||
| 6977 | 431 | static void |
| 432 | handle_string(GtkWidget *widget) | |
| 433 | { | |
| 434 | GtkWindow *win = GTK_WINDOW(widget); | |
| 435 | gchar newtitle[256]; | |
| 436 | ||
| 437 | g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
| 438 | gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), | |
| 439 | gtk_window_get_title(win)); | |
| 440 | gtk_window_set_title(win, newtitle); | |
| 441 | } | |
| 442 | ||
| 443 | static void | |
| 444 | handle_count(GtkWidget *widget) | |
| 445 | { | |
| 4035 | 446 | GtkWindow *win = GTK_WINDOW(widget); |
| 6302 | 447 | char newtitle[256]; |
| 6977 | 448 | gint count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(win), "notify-message-count")); |
| 6302 | 449 | |
| 6977 | 450 | g_snprintf(newtitle, sizeof(newtitle), "[%d]%s", count, |
| 451 | gtk_window_get_title(win)); | |
| 452 | gtk_window_set_title(win, newtitle); | |
| 4035 | 453 | } |
| 454 | ||
| 6977 | 455 | static void |
| 456 | handle_urgent(GtkWidget *widget, gboolean add) | |
| 457 | { | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
458 | XWMHints *hints; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
459 | |
| 6977 | 460 | hints = XGetWMHints(GDK_WINDOW_XDISPLAY(widget->window), GDK_WINDOW_XWINDOW(widget->window)); |
| 461 | if (add) | |
| 462 | hints->flags |= XUrgencyHint; | |
| 463 | else | |
| 464 | hints->flags &= ~XUrgencyHint; | |
| 465 | XSetWMHints(GDK_WINDOW_XDISPLAY(widget->window), GDK_WINDOW_XWINDOW(widget->window), hints); | |
| 4218 | 466 | XFree(hints); |
| 4035 | 467 | } |
| 468 | ||
| 6977 | 469 | static void |
| 470 | type_toggle_cb(GtkWidget *widget, gpointer data) | |
| 471 | { | |
| 472 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 473 | gchar pref[256]; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
474 | |
| 6977 | 475 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
476 | |
| 6977 | 477 | gaim_prefs_set_bool(pref, on); |
| 3374 | 478 | } |
| 479 | ||
| 6977 | 480 | static void |
| 481 | method_toggle_cb(GtkWidget *widget, gpointer data) | |
| 482 | { | |
| 483 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 484 | gchar pref[256]; | |
| 485 | ||
| 486 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); | |
| 3374 | 487 | |
| 6977 | 488 | gaim_prefs_set_bool(pref, on); |
| 489 | ||
| 490 | if (!strcmp(data, "method_string")) { | |
| 491 | GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); | |
| 492 | gtk_widget_set_sensitive(entry, on); | |
| 493 | ||
| 494 | gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(entry))); | |
| 495 | } | |
| 496 | ||
| 497 | apply_method(); | |
| 3374 | 498 | } |
| 499 | ||
| 6977 | 500 | static void |
| 501 | notify_toggle_cb(GtkWidget *widget, gpointer data) | |
| 502 | { | |
| 503 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 504 | gchar pref[256]; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
505 | |
| 6977 | 506 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); |
| 3374 | 507 | |
| 6977 | 508 | gaim_prefs_set_bool(pref, on); |
| 509 | ||
| 510 | apply_notify(); | |
| 3374 | 511 | } |
| 512 | ||
| 6977 | 513 | static gboolean |
| 514 | options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
| 515 | { | |
| 516 | if (data == NULL) | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6977
diff
changeset
|
517 | return FALSE; |
| 6302 | 518 | |
| 6977 | 519 | if (!strcmp(data, "method_string")) { |
| 520 | gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(widget))); | |
| 3374 | 521 | } |
| 6302 | 522 | |
| 6977 | 523 | apply_method(); |
| 6302 | 524 | |
| 525 | return FALSE; | |
| 526 | } | |
| 527 | ||
| 6977 | 528 | static void |
| 529 | apply_method() { | |
| 530 | GList *convs = gaim_get_conversations(); | |
| 531 | ||
| 532 | while (convs) { | |
| 533 | GaimConversation *conv = (GaimConversation *)convs->data; | |
| 6302 | 534 | |
| 6977 | 535 | /* remove notifications */ |
| 536 | if (unnotify(conv, FALSE)) | |
| 537 | /* reattach appropriate notifications */ | |
| 538 | notify(conv, FALSE); | |
| 3710 | 539 | |
| 6977 | 540 | convs = convs->next; |
| 541 | } | |
| 3374 | 542 | } |
| 543 | ||
| 6977 | 544 | static void |
| 545 | apply_notify() | |
| 546 | { | |
| 547 | GList *convs = gaim_get_conversations(); | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
548 | |
| 6977 | 549 | while (convs) { |
| 550 | GaimConversation *conv = (GaimConversation *)convs->data; | |
| 4203 | 551 | |
| 6977 | 552 | /* detach signals */ |
| 553 | detach_signals(conv); | |
| 554 | /* reattach appropriate signals */ | |
| 555 | attach_signals(conv); | |
| 4035 | 556 | |
| 6977 | 557 | convs = convs->next; |
| 4035 | 558 | } |
| 559 | } | |
| 560 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
561 | static GtkWidget * |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
562 | get_config_frame(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
563 | { |
| 6977 | 564 | GtkWidget *ret = NULL, *frame = NULL; |
| 565 | GtkWidget *vbox = NULL, *hbox = NULL; | |
| 566 | GtkWidget *toggle = NULL, *entry = NULL; | |
| 6302 | 567 | |
| 3565 | 568 | ret = gtk_vbox_new(FALSE, 18); |
| 6302 | 569 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 3392 | 570 | |
| 6302 | 571 | /*---------- "Notify For" ----------*/ |
| 572 | frame = gaim_gtk_make_frame(ret, _("Notify For")); | |
| 573 | vbox = gtk_vbox_new(FALSE, 5); | |
| 574 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 575 | ||
| 3710 | 576 | toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 577 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6977 | 578 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 579 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); | |
| 580 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 581 | G_CALLBACK(type_toggle_cb), "type_im"); | |
| 3710 | 582 | |
| 6977 | 583 | toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
| 3710 | 584 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 6977 | 585 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 586 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); | |
| 587 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 588 | G_CALLBACK(type_toggle_cb), "type_chat"); | |
| 589 | ||
| 590 | toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); | |
| 591 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 592 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 593 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); | |
| 594 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 595 | G_CALLBACK(type_toggle_cb), "type_focused"); | |
| 3710 | 596 | |
| 6302 | 597 | /*---------- "Notification Methods" ----------*/ |
| 598 | frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | |
| 599 | vbox = gtk_vbox_new(FALSE, 5); | |
| 600 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 601 | ||
| 6977 | 602 | /* String method button */ |
| 3565 | 603 | hbox = gtk_hbox_new(FALSE, 18); |
| 604 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
| 6302 | 605 | toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
| 6977 | 606 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 607 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); | |
| 3565 | 608 | gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 6977 | 609 | |
| 6302 | 610 | entry = gtk_entry_new(); |
| 611 | gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
| 612 | gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
| 6977 | 613 | gtk_widget_set_sensitive(GTK_WIDGET(entry), |
| 614 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); | |
| 615 | gtk_entry_set_text(GTK_ENTRY(entry), | |
| 616 | gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string")); | |
| 617 | g_object_set_data(G_OBJECT(toggle), "title-entry", entry); | |
| 618 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 619 | G_CALLBACK(method_toggle_cb), "method_string"); | |
| 620 | g_signal_connect(G_OBJECT(entry), "focus-out-event", | |
| 621 | G_CALLBACK(options_entry_cb), NULL); | |
| 3374 | 622 | |
| 6977 | 623 | /* Count method button */ |
| 624 | toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
| 625 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 626 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); | |
| 627 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 628 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 629 | G_CALLBACK(method_toggle_cb), "method_count"); | |
| 4035 | 630 | |
| 6977 | 631 | #if 0 |
| 632 | /* Urgent method button */ | |
| 633 | toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); | |
| 634 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 635 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 636 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); | |
| 637 | #endif | |
| 3710 | 638 | |
| 6977 | 639 | /*---------- "Notification Removals" ----------*/ |
| 6302 | 640 | frame = gaim_gtk_make_frame(ret, _("Notification Removal")); |
| 641 | vbox = gtk_vbox_new(FALSE, 5); | |
| 642 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 3374 | 643 | |
| 6977 | 644 | #if 0 |
| 645 | /* Remove on focus button */ | |
| 646 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
| 647 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 648 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 649 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); | |
| 650 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); | |
| 651 | #endif | |
| 652 | ||
| 653 | /* Remove on click button */ | |
| 654 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
| 655 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 656 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 657 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); | |
| 658 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 659 | G_CALLBACK(notify_toggle_cb), "notify_click"); | |
| 3710 | 660 | |
| 6977 | 661 | /* Remove on type button */ |
| 662 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
| 663 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 664 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 665 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); | |
| 666 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 667 | G_CALLBACK(notify_toggle_cb), "notify_type"); | |
| 4035 | 668 | |
| 6977 | 669 | /* Remove on message send button */ |
| 670 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
| 671 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 672 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 673 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); | |
| 674 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 675 | G_CALLBACK(notify_toggle_cb), "notify_send"); | |
| 3565 | 676 | |
| 6977 | 677 | #if 0 |
| 678 | /* Remove on conversation switch button */ | |
| 679 | toggle = gtk_check_button_new_with_mnemonic(_("Remove on conversation ta_b switch")); | |
| 680 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 681 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 682 | gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); | |
| 683 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 684 | G_CALLBACK(notify_toggle_cb), "notify_switch"); | |
| 685 | #endif | |
| 686 | ||
| 687 | gtk_widget_show_all(ret); | |
| 688 | return ret; | |
| 3374 | 689 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
690 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
691 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
692 | plugin_load(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
693 | { |
| 6977 | 694 | GList *convs = gaim_get_conversations(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
695 | void *conv_handle = gaim_conversations_get_handle(); |
| 6302 | 696 | |
| 697 | my_plugin = plugin; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
698 | |
| 6977 | 699 | gaim_signal_connect(conv_handle, "received-im-msg", plugin, |
| 700 | GAIM_CALLBACK(im_recv_im), NULL); | |
| 701 | gaim_signal_connect(conv_handle, "received-chat-msg", plugin, | |
| 702 | GAIM_CALLBACK(chat_recv_im), NULL); | |
| 703 | gaim_signal_connect(conv_handle, "sent-im-msg", plugin, | |
| 704 | GAIM_CALLBACK(im_sent_im), NULL); | |
| 705 | gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, | |
| 706 | GAIM_CALLBACK(chat_sent_im), NULL); | |
| 707 | gaim_signal_connect(conv_handle, "conversation-created", plugin, | |
| 708 | GAIM_CALLBACK(conv_created), NULL); | |
| 709 | gaim_signal_connect(conv_handle, "chat-joined", plugin, | |
| 710 | GAIM_CALLBACK(chat_join), NULL); | |
| 711 | gaim_signal_connect(conv_handle, "deleting-conversation", plugin, | |
| 712 | GAIM_CALLBACK(deleting_conv), NULL); | |
| 713 | #if 0 | |
| 714 | gaim_signal_connect(conv_handle, "conversation-switched", plugin, | |
| 715 | GAIM_CALLBACK(conv_switched), NULL); | |
| 716 | #endif | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
717 | |
| 6977 | 718 | while (convs) { |
| 719 | GaimConversation *conv = (GaimConversation *)convs->data; | |
| 6302 | 720 | |
| 721 | /* attach signals */ | |
| 6977 | 722 | attach_signals(conv); |
| 6302 | 723 | |
| 6977 | 724 | convs = convs->next; |
| 6302 | 725 | } |
| 726 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
727 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
728 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
729 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
730 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
731 | plugin_unload(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
732 | { |
| 6977 | 733 | GList *convs = gaim_get_conversations(); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
734 | |
| 6977 | 735 | while (convs) { |
| 736 | GaimConversation *conv = (GaimConversation *)convs->data; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
737 | |
| 6302 | 738 | /* kill signals */ |
| 6977 | 739 | detach_signals(conv); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
740 | |
| 6977 | 741 | convs = convs->next; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
742 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
743 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
744 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
745 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
746 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
747 | static GaimGtkPluginUiInfo ui_info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
748 | { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
749 | get_config_frame |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
750 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
751 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
752 | static GaimPluginInfo info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
753 | { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
754 | 2, /**< api_version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
755 | GAIM_PLUGIN_STANDARD, /**< type */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
756 | GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
757 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
758 | NULL, /**< dependencies */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
759 | GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
760 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
761 | NOTIFY_PLUGIN_ID, /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
762 | N_("Message Notification"), /**< name */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
763 | VERSION, /**< version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
764 | /** summary */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
765 | N_("Provides a variety of ways of notifying you of unread messages."), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
766 | /** description */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
767 | N_("Provides a variety of ways of notifying you of unread messages."), |
| 6302 | 768 | "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu", |
| 769 | /**< author */ | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
770 | GAIM_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
771 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
772 | plugin_load, /**< load */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
773 | plugin_unload, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
774 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
775 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
776 | &ui_info, /**< ui_info */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
777 | NULL /**< extra_info */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
778 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
779 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
780 | static void |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
781 | init_plugin(GaimPlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
782 | { |
| 6302 | 783 | gaim_prefs_add_none("/plugins/gtk"); |
| 784 | gaim_prefs_add_none("/plugins/gtk/X11"); | |
| 785 | gaim_prefs_add_none("/plugins/gtk/X11/notify"); | |
| 786 | ||
| 6464 | 787 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
| 788 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
| 789 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
| 6302 | 790 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
| 791 | gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
| 792 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
| 793 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
| 794 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE); | |
| 795 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
| 796 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
| 6464 | 797 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
| 798 | gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
799 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
800 | |
| 6063 | 801 | GAIM_INIT_PLUGIN(notify, init_plugin, info) |