Mercurial > pidgin
annotate plugins/notify.c @ 9942:3941c39ccff5
[gaim-migrate @ 10834]
Thanks, Stu!
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Fri, 03 Sep 2004 03:05:56 +0000 |
| parents | 4a15962c344a |
| children | f8e395a054e2 |
| rev | line source |
|---|---|
| 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 | 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
70d5122bc3ff
[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
70d5122bc3ff
[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 * |
| 9298 | 54 * Etan again, 12 August 2003: |
| 6977 | 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 | |
| 9298 | 62 * |
| 63 * Etan yet again, 04 April 2004: | |
| 64 * -Re-added Urgent option | |
| 65 * -Re-added unnotify on focus option (still needs work, as it will only | |
| 66 * react to focus-in events when the entry or history widgets are focused) | |
| 3392 | 67 */ |
| 68 | |
| 9791 | 69 #include "internal.h" |
| 70 #include "gtkgaim.h" | |
| 6302 | 71 |
| 72 #include "debug.h" | |
| 73 #include "prefs.h" | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
74 #include "signals.h" |
|
4202
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
75 |
| 6302 | 76 #include "gtkplugin.h" |
| 77 #include "gtkutils.h" | |
| 78 | |
| 6977 | 79 #include <X11/Xatom.h> |
| 3385 | 80 #include <X11/Xlib.h> |
| 3374 | 81 #include <X11/Xutil.h> |
| 82 | |
| 6302 | 83 #define NOTIFY_PLUGIN_ID "gtk-x11-notify" |
| 3710 | 84 |
|
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
85 static GaimPlugin *my_plugin = NULL; |
|
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
86 |
| 6302 | 87 /* notification set/unset */ |
| 6977 | 88 static int notify(GaimConversation *conv, gboolean increment); |
| 9298 | 89 static void notify_win(GaimConvWindow *gaimwin); |
| 90 static void unnotify(GaimConversation *conv, gboolean reset); | |
| 91 static int unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv); | |
| 6302 | 92 |
| 93 /* gtk widget callbacks for prefs panel */ | |
| 6977 | 94 static void type_toggle_cb(GtkWidget *widget, gpointer data); |
| 95 static void method_toggle_cb(GtkWidget *widget, gpointer data); | |
| 96 static void notify_toggle_cb(GtkWidget *widget, gpointer data); | |
| 97 static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data); | |
| 98 static void apply_method(); | |
| 99 static void apply_notify(); | |
| 191 | 100 |
| 6977 | 101 /* string function */ |
| 9298 | 102 static void handle_string(GaimConvWindow *window); |
| 6302 | 103 |
| 6977 | 104 /* count function */ |
| 9298 | 105 static void handle_count(GaimConvWindow *window); |
| 6302 | 106 |
| 6977 | 107 /* urgent function */ |
| 9298 | 108 static void handle_urgent(GaimConvWindow *window, gboolean add); |
| 3710 | 109 |
| 6302 | 110 /****************************************/ |
| 111 /* Begin doing stuff below this line... */ | |
| 112 /****************************************/ | |
| 9298 | 113 static int |
| 114 count_messages(GaimConvWindow *gaimwin) | |
| 115 { | |
| 116 gint count = 0; | |
| 117 GList *convs = NULL; | |
| 118 | |
| 119 for (convs = gaim_conv_window_get_conversations(gaimwin); | |
| 120 convs != NULL; convs = convs->next) { | |
| 121 GaimConversation *conv = convs->data; | |
| 122 count += GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); | |
| 123 } | |
| 124 | |
| 125 return count; | |
| 126 } | |
| 6302 | 127 |
| 6977 | 128 static int |
| 129 notify(GaimConversation *conv, gboolean increment) | |
| 130 { | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
131 GaimConvWindow *gaimwin = NULL; |
| 6302 | 132 gint count; |
| 6977 | 133 gboolean has_focus; |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
134 |
| 6977 | 135 if (conv == NULL) |
| 6302 | 136 return 0; |
| 137 | |
| 6977 | 138 /* We want to remove the notifications, but not reset the counter */ |
| 139 unnotify(conv, FALSE); | |
| 140 | |
| 141 gaimwin = gaim_conversation_get_window(conv); | |
| 5021 | 142 |
| 6977 | 143 /* If we aren't doing notifications for this type of conversation, return */ |
| 144 if (((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && | |
| 9298 | 145 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || |
| 146 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && | |
| 147 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) | |
| 6977 | 148 return 0; |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
149 |
| 9298 | 150 g_object_get(G_OBJECT(GAIM_GTK_WINDOW(gaimwin)->window), |
| 151 "has-toplevel-focus", &has_focus, NULL); | |
| 3374 | 152 |
| 6977 | 153 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || |
| 9298 | 154 (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) || |
| 155 !has_focus) { | |
| 6977 | 156 if (increment) { |
| 157 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); | |
| 158 count++; | |
| 159 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); | |
| 160 } | |
| 6302 | 161 |
| 9298 | 162 notify_win(gaimwin); |
| 6977 | 163 } |
| 6302 | 164 |
| 165 return 0; | |
| 166 } | |
| 167 | |
| 9298 | 168 static void |
| 169 notify_win(GaimConvWindow *gaimwin) | |
| 170 { | |
| 171 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) | |
| 172 handle_count(gaimwin); | |
| 173 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
| 174 handle_string(gaimwin); | |
| 175 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
| 176 handle_urgent(gaimwin, TRUE); | |
| 177 } | |
| 178 | |
| 179 static void | |
| 180 unnotify(GaimConversation *conv, gboolean reset) | |
| 181 { | |
| 182 GaimConversation *active_conv = NULL; | |
| 183 GaimConvWindow *gaimwin = NULL; | |
| 184 | |
| 185 g_return_if_fail(conv != NULL); | |
| 186 | |
| 187 gaimwin = gaim_conversation_get_window(conv); | |
| 188 active_conv = gaim_conv_window_get_active_conversation(gaimwin); | |
| 189 | |
| 190 /* reset the conversation window title */ | |
| 191 gaim_conversation_autoset_title(active_conv); | |
| 192 | |
| 193 if (reset) { | |
| 194 /* Only need to actually remove the urgent hinting here, since removing it | |
| 195 * just to have it readded in re-notify is an unnecessary couple extra RTs | |
| 196 * to the server */ | |
| 197 handle_urgent(gaimwin, FALSE); | |
| 198 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); | |
| 199 } | |
| 200 | |
| 201 return; | |
| 202 } | |
| 203 | |
| 204 static int | |
| 205 unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv) | |
| 206 { | |
| 207 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) | |
| 208 unnotify(conv, TRUE); | |
| 209 | |
| 210 return 0; | |
| 211 } | |
| 212 | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
213 static gboolean |
| 9298 | 214 im_recv_im(GaimAccount *account, char *sender, char *message, |
| 215 int *flags) | |
| 6977 | 216 { |
| 9298 | 217 GaimConversation *conv = gaim_find_conversation_with_account(sender, account); |
| 6977 | 218 |
| 219 notify(conv, TRUE); | |
| 3710 | 220 |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
221 return FALSE; |
| 3710 | 222 } |
| 223 | |
| 9298 | 224 static gboolean |
| 225 chat_recv_im(GaimAccount *account, char *sender, char *message, | |
| 226 GaimConversation *conv) | |
| 227 { | |
| 228 notify(conv, TRUE); | |
| 229 | |
| 230 return FALSE; | |
| 231 } | |
| 232 | |
| 6977 | 233 static void |
| 9298 | 234 im_sent_im(GaimAccount *account, char *receiver, const char *message) { |
| 235 GaimConversation *conv = NULL; | |
| 236 | |
| 237 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | |
| 238 conv = gaim_find_conversation_with_account(receiver, account); | |
| 239 unnotify(conv, TRUE); | |
| 240 } | |
| 241 } | |
| 242 | |
| 243 static void | |
| 244 chat_sent_im(GaimAccount *account, const char *message, int id) | |
| 6977 | 245 { |
| 246 GaimConversation *conv = NULL; | |
| 247 | |
| 248 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | |
| 249 conv = gaim_find_chat(gaim_account_get_connection(account), id); | |
| 250 unnotify(conv, TRUE); | |
| 251 } | |
| 3710 | 252 } |
| 253 | |
| 6977 | 254 static int |
| 255 attach_signals(GaimConversation *conv) | |
| 256 { | |
| 257 GaimGtkConversation *gtkconv = NULL; | |
| 258 GaimGtkWindow *gtkwin = NULL; | |
| 259 GSList *window_ids = NULL, *imhtml_ids = NULL, *entry_ids = NULL; | |
| 260 guint id; | |
| 261 | |
| 262 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
| 263 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
264 |
| 6977 | 265 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { |
| 9298 | 266 GtkWidget *child = NULL; |
| 267 gint page_num; | |
| 268 | |
| 269 page_num = gaim_conversation_get_index(conv); | |
| 270 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), page_num); | |
| 271 | |
| 272 /* TODO should really find a way to make this work no matter where the | |
| 273 * focus is inside the conv window, without having to bind to | |
| 274 * focus-in-event on the g(d|t)kwindow */ | |
| 275 /* try setting the signal on the focus-in-event for | |
| 276 * gtkwin->notebook->container? */ | |
| 277 id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
| 278 G_CALLBACK(unnotify_cb), conv); | |
| 279 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | |
| 280 | |
| 281 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event", | |
| 282 G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 283 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); |
| 284 } | |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
285 |
| 6977 | 286 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
| 9298 | 287 /* TODO similarly should really find a way to allow for clicking in other |
| 288 * places of the window */ | |
| 289 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", | |
| 290 G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 291 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); |
| 292 | |
| 9298 | 293 id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", |
| 294 G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 295 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 3374 | 296 } |
| 3710 | 297 |
| 6977 | 298 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
| 9298 | 299 id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", |
| 300 G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 301 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 3374 | 302 } |
| 303 | |
| 6977 | 304 gaim_conversation_set_data(conv, "notify-window-signals", window_ids); |
| 305 gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); | |
| 306 gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids); | |
| 4035 | 307 |
| 3428 | 308 return 0; |
| 191 | 309 } |
| 310 | |
| 6977 | 311 static void |
| 312 detach_signals(GaimConversation *conv) | |
| 313 { | |
| 314 GaimGtkConversation *gtkconv = NULL; | |
| 315 GaimGtkWindow *gtkwin = NULL; | |
| 316 GSList *ids = NULL; | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
317 |
| 6977 | 318 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 319 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
320 |
| 6977 | 321 ids = gaim_conversation_get_data(conv, "notify-window-signals"); |
| 322 for (; ids != NULL; ids = ids->next) | |
| 323 g_signal_handler_disconnect(gtkwin->window, GPOINTER_TO_INT(ids->data)); | |
| 6302 | 324 |
| 6977 | 325 ids = gaim_conversation_get_data(conv, "notify-imhtml-signals"); |
| 326 for (; ids != NULL; ids = ids->next) | |
| 327 g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(ids->data)); | |
| 6302 | 328 |
| 6977 | 329 ids = gaim_conversation_get_data(conv, "notify-entry-signals"); |
| 330 for (; ids != NULL; ids = ids->next) | |
| 331 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data)); | |
| 3710 | 332 |
| 9298 | 333 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
| 3710 | 334 |
| 6977 | 335 gaim_conversation_set_data(conv, "notify-window-signals", NULL); |
| 336 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL); | |
| 337 gaim_conversation_set_data(conv, "notify-entry-signals", NULL); | |
| 3710 | 338 } |
| 339 | |
| 6977 | 340 static void |
| 341 conv_created(GaimConversation *conv) | |
| 342 { | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
343 GaimConvWindow *gaimwin = NULL; |
| 6977 | 344 GaimGtkWindow *gtkwin = NULL; |
| 6302 | 345 |
| 6977 | 346 gaimwin = gaim_conversation_get_window(conv); |
| 6302 | 347 |
| 6977 | 348 if (gaimwin == NULL) |
| 6302 | 349 return; |
| 3374 | 350 |
| 6977 | 351 gtkwin = GAIM_GTK_WINDOW(gaimwin); |
| 352 | |
| 9298 | 353 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
| 6302 | 354 |
| 6977 | 355 /* always attach the signals, notify() will take care of conversation type |
| 356 * checking */ | |
| 357 attach_signals(conv); | |
| 3374 | 358 } |
| 359 | |
| 9303 | 360 #if 0 |
| 6977 | 361 static void |
| 362 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) | |
| 363 { | |
| 9298 | 364 GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv); |
| 6302 | 365 |
| 9298 | 366 printf("conv_switched - %p - %p\n", old_conv, new_conv); |
| 367 printf("count - %d\n", count_messages(gaimwin)); | |
| 368 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
| 369 unnotify(new_conv, FALSE); | |
| 370 else { | |
| 371 /* if we don't have notification on the window then we don't want to | |
| 372 * re-notify it */ | |
| 373 if (count_messages(gaimwin)) | |
| 374 notify_win(gaimwin); | |
| 375 } | |
| 6977 | 376 } |
| 9303 | 377 #endif |
| 6302 | 378 |
| 6977 | 379 static void |
| 380 deleting_conv(GaimConversation *conv) | |
| 381 { | |
| 9298 | 382 GaimConvWindow *gaimwin = NULL; |
| 383 | |
| 6977 | 384 detach_signals(conv); |
| 3392 | 385 |
| 9298 | 386 unnotify(conv, TRUE); |
| 6977 | 387 |
| 9298 | 388 gaimwin = gaim_conversation_get_window(conv); |
| 389 if (count_messages(gaimwin)) | |
| 390 notify_win(gaimwin); | |
| 6977 | 391 } |
| 392 | |
| 9303 | 393 #if 0 |
| 6977 | 394 static void |
| 9298 | 395 conversation_drag_ended(GaimConversation *active_conv, |
| 396 GaimConvWindow *old_gaimwin, | |
| 397 GaimConvWindow *new_gaimwin) | |
| 6977 | 398 { |
| 9298 | 399 if (old_gaimwin != new_gaimwin) { |
| 400 if (old_gaimwin == NULL) { | |
| 401 /* | |
| 402 gaim_conversation_autoset_title(active_conv); | |
| 403 handle_urgent(new_gaimwin, FALSE); | |
| 404 */ | |
| 405 | |
| 406 if (count_messages(new_gaimwin)) | |
| 407 notify_win(new_gaimwin); | |
| 408 } else { | |
| 409 printf("if else count = %d\n", count_messages(new_gaimwin)); | |
| 410 printf("if else count = %d\n", count_messages(old_gaimwin)); | |
| 411 /* | |
| 412 GaimConversation *old_active_conv = NULL; | |
| 413 old_active_conv = gaim_conv_window_get_active_conversation(new_gaimwin); | |
| 414 | |
| 415 gaim_conversation_autoset_title(old_active_conv); | |
| 416 handle_urgent(old_gaimwin, FALSE); | |
| 6302 | 417 |
| 9298 | 418 if (count_messages(old_gaimwin)) |
| 419 notify_win(old_gaimwin); | |
| 420 | |
| 421 gaim_conversation_autoset_title(active_conv); | |
| 422 handle_urgent(new_gaimwin, FALSE); | |
| 423 | |
| 424 if (count_messages(new_gaimwin)) | |
| 425 notify_win(new_gaimwin); | |
| 426 */ | |
| 427 } | |
| 428 } else { | |
| 429 printf("else count = %d\n", count_messages(new_gaimwin)); | |
| 430 printf("else count = %d\n", count_messages(old_gaimwin)); | |
| 431 /* | |
| 432 gaim_conversation_autoset_title(active_conv); | |
| 433 handle_urgent(old_gaimwin, FALSE); | |
| 434 | |
| 435 if (count_messages(old_gaimwin)) | |
| 436 notify_win(old_gaimwin); | |
| 437 */ | |
| 438 } | |
| 4035 | 439 } |
| 9303 | 440 #endif |
| 4035 | 441 |
| 6977 | 442 static void |
| 9298 | 443 handle_string(GaimConvWindow *gaimwin) |
| 444 { | |
| 445 GtkWindow *window = NULL; | |
| 446 gchar newtitle[256]; | |
| 447 | |
| 448 g_return_if_fail(gaimwin != NULL); | |
| 449 | |
| 450 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
| 451 g_return_if_fail(window != NULL); | |
| 452 | |
| 453 g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
| 454 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), | |
| 455 gtk_window_get_title(window)); | |
| 456 gtk_window_set_title(window, newtitle); | |
| 457 } | |
| 458 | |
| 459 static void | |
| 460 handle_count(GaimConvWindow *gaimwin) | |
| 461 { | |
| 462 GtkWindow *window; | |
| 463 char newtitle[256]; | |
| 464 | |
| 465 g_return_if_fail(gaimwin != NULL); | |
| 466 | |
| 467 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
| 468 g_return_if_fail(window != NULL); | |
| 469 | |
| 470 g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", count_messages(gaimwin), | |
| 471 gtk_window_get_title(window)); | |
| 472 gtk_window_set_title(window, newtitle); | |
| 473 } | |
| 474 | |
| 475 static void | |
| 476 handle_urgent(GaimConvWindow *gaimwin, gboolean add) | |
| 6977 | 477 { |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
478 XWMHints *hints; |
| 9298 | 479 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaimwin); |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
480 |
| 9298 | 481 g_return_if_fail(gtkwin != NULL); |
| 482 g_return_if_fail(gtkwin->window != NULL); | |
| 483 g_return_if_fail(gtkwin->window->window != NULL); | |
| 484 | |
| 485 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); | |
| 6977 | 486 if (add) |
| 487 hints->flags |= XUrgencyHint; | |
| 488 else | |
| 489 hints->flags &= ~XUrgencyHint; | |
| 9298 | 490 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), |
| 491 GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); | |
| 4218 | 492 XFree(hints); |
| 4035 | 493 } |
| 494 | |
| 6977 | 495 static void |
| 496 type_toggle_cb(GtkWidget *widget, gpointer data) | |
| 497 { | |
| 498 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 499 gchar pref[256]; | |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
500 |
| 6977 | 501 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
502 |
| 6977 | 503 gaim_prefs_set_bool(pref, on); |
| 3374 | 504 } |
| 505 | |
| 6977 | 506 static void |
| 507 method_toggle_cb(GtkWidget *widget, gpointer data) | |
| 508 { | |
| 509 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 510 gchar pref[256]; | |
| 511 | |
| 512 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); | |
| 3374 | 513 |
| 6977 | 514 gaim_prefs_set_bool(pref, on); |
| 515 | |
| 516 if (!strcmp(data, "method_string")) { | |
| 517 GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); | |
| 518 gtk_widget_set_sensitive(entry, on); | |
| 519 | |
| 520 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(entry))); | |
| 521 } | |
| 522 | |
| 523 apply_method(); | |
| 3374 | 524 } |
| 525 | |
| 6977 | 526 static void |
| 527 notify_toggle_cb(GtkWidget *widget, gpointer data) | |
| 528 { | |
| 529 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 530 gchar pref[256]; | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
531 |
| 6977 | 532 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); |
| 3374 | 533 |
| 6977 | 534 gaim_prefs_set_bool(pref, on); |
| 535 | |
| 536 apply_notify(); | |
| 3374 | 537 } |
| 538 | |
| 6977 | 539 static gboolean |
| 540 options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
| 541 { | |
| 542 if (data == NULL) | |
| 6982 | 543 return FALSE; |
| 6302 | 544 |
| 6977 | 545 if (!strcmp(data, "method_string")) { |
| 546 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(widget))); | |
| 3374 | 547 } |
| 6302 | 548 |
| 6977 | 549 apply_method(); |
| 6302 | 550 |
| 551 return FALSE; | |
| 552 } | |
| 553 | |
| 6977 | 554 static void |
| 555 apply_method() { | |
| 556 GList *convs = gaim_get_conversations(); | |
| 9298 | 557 GaimConvWindow *gaimwin = NULL; |
| 6977 | 558 |
| 9298 | 559 for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) { |
| 6977 | 560 GaimConversation *conv = (GaimConversation *)convs->data; |
| 6302 | 561 |
| 6977 | 562 /* remove notifications */ |
| 9298 | 563 unnotify(conv, FALSE); |
| 564 | |
| 565 gaimwin = gaim_conversation_get_window(conv); | |
| 566 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) | |
| 6977 | 567 /* reattach appropriate notifications */ |
| 568 notify(conv, FALSE); | |
| 569 } | |
| 3374 | 570 } |
| 571 | |
| 6977 | 572 static void |
| 573 apply_notify() | |
| 574 { | |
| 575 GList *convs = gaim_get_conversations(); | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
576 |
| 6977 | 577 while (convs) { |
| 578 GaimConversation *conv = (GaimConversation *)convs->data; | |
|
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
579 |
| 6977 | 580 /* detach signals */ |
| 581 detach_signals(conv); | |
| 582 /* reattach appropriate signals */ | |
| 583 attach_signals(conv); | |
| 4035 | 584 |
| 6977 | 585 convs = convs->next; |
| 4035 | 586 } |
| 587 } | |
| 588 | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
589 static GtkWidget * |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
590 get_config_frame(GaimPlugin *plugin) |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
591 { |
| 6977 | 592 GtkWidget *ret = NULL, *frame = NULL; |
| 593 GtkWidget *vbox = NULL, *hbox = NULL; | |
| 594 GtkWidget *toggle = NULL, *entry = NULL; | |
| 6302 | 595 |
| 3565 | 596 ret = gtk_vbox_new(FALSE, 18); |
| 6302 | 597 gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 3392 | 598 |
| 6302 | 599 /*---------- "Notify For" ----------*/ |
| 600 frame = gaim_gtk_make_frame(ret, _("Notify For")); | |
| 601 vbox = gtk_vbox_new(FALSE, 5); | |
| 602 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 603 | |
| 3710 | 604 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 605 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6977 | 606 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 9298 | 607 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
| 6977 | 608 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 609 G_CALLBACK(type_toggle_cb), "type_im"); |
| 3710 | 610 |
| 6977 | 611 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
| 3710 | 612 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 6977 | 613 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 9298 | 614 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
| 6977 | 615 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 616 G_CALLBACK(type_toggle_cb), "type_chat"); |
| 6977 | 617 |
| 618 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); | |
| 619 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 620 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 621 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
| 6977 | 622 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 623 G_CALLBACK(type_toggle_cb), "type_focused"); |
| 3710 | 624 |
| 6302 | 625 /*---------- "Notification Methods" ----------*/ |
| 626 frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | |
| 627 vbox = gtk_vbox_new(FALSE, 5); | |
| 628 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 629 | |
| 6977 | 630 /* String method button */ |
| 3565 | 631 hbox = gtk_hbox_new(FALSE, 18); |
| 632 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
| 6302 | 633 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
| 6977 | 634 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 9298 | 635 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 3565 | 636 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 6977 | 637 |
| 6302 | 638 entry = gtk_entry_new(); |
| 639 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
| 640 gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
| 6977 | 641 gtk_widget_set_sensitive(GTK_WIDGET(entry), |
| 9298 | 642 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 6977 | 643 gtk_entry_set_text(GTK_ENTRY(entry), |
| 9298 | 644 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
| 6977 | 645 g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
| 646 g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 647 G_CALLBACK(method_toggle_cb), "method_string"); |
| 6977 | 648 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
| 9298 | 649 G_CALLBACK(options_entry_cb), "method_string"); |
| 3374 | 650 |
| 6977 | 651 /* Count method button */ |
| 652 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
| 653 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 654 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
| 6977 | 655 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 656 g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 657 G_CALLBACK(method_toggle_cb), "method_count"); |
| 4035 | 658 |
| 6977 | 659 /* Urgent method button */ |
| 660 toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); | |
| 661 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 662 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 663 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
| 664 g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 665 G_CALLBACK(method_toggle_cb), "method_urgent"); | |
| 3710 | 666 |
| 6977 | 667 /*---------- "Notification Removals" ----------*/ |
| 6302 | 668 frame = gaim_gtk_make_frame(ret, _("Notification Removal")); |
| 669 vbox = gtk_vbox_new(FALSE, 5); | |
| 670 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 3374 | 671 |
| 6977 | 672 /* Remove on focus button */ |
| 673 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
| 674 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 675 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 676 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
| 6977 | 677 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
| 678 | |
| 679 /* Remove on click button */ | |
| 680 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
| 681 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 682 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 683 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
| 6977 | 684 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 685 G_CALLBACK(notify_toggle_cb), "notify_click"); |
| 3710 | 686 |
| 6977 | 687 /* Remove on type button */ |
| 688 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
| 689 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 690 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 691 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
| 6977 | 692 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 693 G_CALLBACK(notify_toggle_cb), "notify_type"); |
| 4035 | 694 |
| 6977 | 695 /* Remove on message send button */ |
| 696 toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
| 697 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 698 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 699 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
| 6977 | 700 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 701 G_CALLBACK(notify_toggle_cb), "notify_send"); |
| 3565 | 702 |
| 6977 | 703 #if 0 |
| 704 /* Remove on conversation switch button */ | |
| 9298 | 705 toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
| 6977 | 706 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 707 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 9298 | 708 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
| 6977 | 709 g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 710 G_CALLBACK(notify_toggle_cb), "notify_switch"); |
| 6977 | 711 #endif |
| 712 | |
| 713 gtk_widget_show_all(ret); | |
| 714 return ret; | |
| 3374 | 715 } |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
716 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
717 static gboolean |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
718 plugin_load(GaimPlugin *plugin) |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
719 { |
| 6977 | 720 GList *convs = gaim_get_conversations(); |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
721 void *conv_handle = gaim_conversations_get_handle(); |
| 9298 | 722 /* |
| 723 void *gtk_conv_handle = gaim_gtk_conversations_get_handle(); | |
| 724 */ | |
| 6302 | 725 |
| 726 my_plugin = plugin; | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
727 |
| 6977 | 728 gaim_signal_connect(conv_handle, "received-im-msg", plugin, |
| 9298 | 729 GAIM_CALLBACK(im_recv_im), NULL); |
| 6977 | 730 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, |
| 9298 | 731 GAIM_CALLBACK(chat_recv_im), NULL); |
| 6977 | 732 gaim_signal_connect(conv_handle, "sent-im-msg", plugin, |
| 9298 | 733 GAIM_CALLBACK(im_sent_im), NULL); |
| 6977 | 734 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, |
| 9298 | 735 GAIM_CALLBACK(chat_sent_im), NULL); |
| 6977 | 736 gaim_signal_connect(conv_handle, "conversation-created", plugin, |
| 9298 | 737 GAIM_CALLBACK(conv_created), NULL); |
| 6977 | 738 gaim_signal_connect(conv_handle, "chat-joined", plugin, |
| 9298 | 739 GAIM_CALLBACK(conv_created), NULL); |
| 6977 | 740 gaim_signal_connect(conv_handle, "deleting-conversation", plugin, |
| 9298 | 741 GAIM_CALLBACK(deleting_conv), NULL); |
| 9303 | 742 #if 0 |
| 6977 | 743 gaim_signal_connect(conv_handle, "conversation-switched", plugin, |
| 9298 | 744 GAIM_CALLBACK(conv_switched), NULL); |
| 745 gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin, | |
| 746 GAIM_CALLBACK(conversation_drag_ended), NULL); | |
| 9303 | 747 #endif |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
748 |
| 6977 | 749 while (convs) { |
| 750 GaimConversation *conv = (GaimConversation *)convs->data; | |
| 6302 | 751 |
| 752 /* attach signals */ | |
| 6977 | 753 attach_signals(conv); |
| 6302 | 754 |
| 6977 | 755 convs = convs->next; |
| 6302 | 756 } |
| 757 | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
758 return TRUE; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
759 } |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
760 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
761 static gboolean |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
762 plugin_unload(GaimPlugin *plugin) |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
763 { |
| 6977 | 764 GList *convs = gaim_get_conversations(); |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
765 |
| 6977 | 766 while (convs) { |
| 767 GaimConversation *conv = (GaimConversation *)convs->data; | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
768 |
| 6302 | 769 /* kill signals */ |
| 6977 | 770 detach_signals(conv); |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
771 |
| 6977 | 772 convs = convs->next; |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
773 } |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
774 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
775 return TRUE; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
776 } |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
777 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
778 static GaimGtkPluginUiInfo ui_info = |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
779 { |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
780 get_config_frame |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
781 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
782 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
783 static GaimPluginInfo info = |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
784 { |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
7486
diff
changeset
|
785 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
786 GAIM_PLUGIN_STANDARD, /**< type */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
787 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
788 0, /**< flags */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
789 NULL, /**< dependencies */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
790 GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
791 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
792 NOTIFY_PLUGIN_ID, /**< id */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
793 N_("Message Notification"), /**< name */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
794 VERSION, /**< version */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
795 /** summary */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
796 N_("Provides a variety of ways of notifying you of unread messages."), |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
797 /** description */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
798 N_("Provides a variety of ways of notifying you of unread messages."), |
| 9298 | 799 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu>", |
| 6302 | 800 /**< author */ |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
801 GAIM_WEBSITE, /**< homepage */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
802 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
803 plugin_load, /**< load */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
804 plugin_unload, /**< unload */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
805 NULL, /**< destroy */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
806 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
807 &ui_info, /**< ui_info */ |
| 8993 | 808 NULL, /**< extra_info */ |
| 809 NULL, | |
| 810 NULL | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
811 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
812 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
813 static void |
|
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
814 init_plugin(GaimPlugin *plugin) |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
815 { |
| 6302 | 816 gaim_prefs_add_none("/plugins/gtk"); |
| 817 gaim_prefs_add_none("/plugins/gtk/X11"); | |
| 818 gaim_prefs_add_none("/plugins/gtk/X11/notify"); | |
| 819 | |
| 6464 | 820 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
| 821 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
| 822 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
| 6302 | 823 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
| 824 gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
| 825 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
| 826 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
| 827 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE); | |
| 828 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
| 829 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
| 6464 | 830 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
| 831 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
832 } |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
833 |
| 6063 | 834 GAIM_INIT_PLUGIN(notify, init_plugin, info) |
