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