Mercurial > pidgin.yaz
annotate plugins/notify.c @ 10060:7570908c558f
[gaim-migrate @ 11030]
<seanegan> It removes the Web Browser dropdown if you're running GNOME and uses the GNOME browser instead of what's set in prefs.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Thu, 23 Sep 2004 03:09:46 +0000 |
parents | f8e395a054e2 |
children | 60db14d54914 |
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, |
216 int *flags) | |
6977 | 217 { |
9298 | 218 GaimConversation *conv = gaim_find_conversation_with_account(sender, account); |
6977 | 219 |
220 notify(conv, TRUE); | |
3710 | 221 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
222 return FALSE; |
3710 | 223 } |
224 | |
9298 | 225 static gboolean |
226 chat_recv_im(GaimAccount *account, char *sender, char *message, | |
227 GaimConversation *conv) | |
228 { | |
229 notify(conv, TRUE); | |
230 | |
231 return FALSE; | |
232 } | |
233 | |
6977 | 234 static void |
9298 | 235 im_sent_im(GaimAccount *account, char *receiver, const char *message) { |
236 GaimConversation *conv = NULL; | |
237 | |
238 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | |
239 conv = gaim_find_conversation_with_account(receiver, account); | |
240 unnotify(conv, TRUE); | |
241 } | |
242 } | |
243 | |
244 static void | |
245 chat_sent_im(GaimAccount *account, const char *message, int id) | |
6977 | 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 | |
6977 | 255 static int |
256 attach_signals(GaimConversation *conv) | |
257 { | |
258 GaimGtkConversation *gtkconv = NULL; | |
259 GaimGtkWindow *gtkwin = NULL; | |
260 GSList *window_ids = NULL, *imhtml_ids = NULL, *entry_ids = NULL; | |
261 guint id; | |
262 | |
263 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
264 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
265 |
6977 | 266 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { |
9298 | 267 GtkWidget *child = NULL; |
268 gint page_num; | |
269 | |
270 page_num = gaim_conversation_get_index(conv); | |
271 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), page_num); | |
272 | |
273 /* TODO should really find a way to make this work no matter where the | |
274 * focus is inside the conv window, without having to bind to | |
275 * focus-in-event on the g(d|t)kwindow */ | |
276 /* try setting the signal on the focus-in-event for | |
277 * gtkwin->notebook->container? */ | |
278 id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
279 G_CALLBACK(unnotify_cb), conv); | |
280 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | |
281 | |
282 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event", | |
283 G_CALLBACK(unnotify_cb), conv); | |
6977 | 284 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); |
285 } | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
286 |
6977 | 287 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
9298 | 288 /* TODO similarly should really find a way to allow for clicking in other |
289 * places of the window */ | |
290 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", | |
291 G_CALLBACK(unnotify_cb), conv); | |
6977 | 292 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); |
293 | |
9298 | 294 id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", |
295 G_CALLBACK(unnotify_cb), conv); | |
6977 | 296 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
3374 | 297 } |
3710 | 298 |
6977 | 299 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
9298 | 300 id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", |
301 G_CALLBACK(unnotify_cb), conv); | |
6977 | 302 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
3374 | 303 } |
304 | |
6977 | 305 gaim_conversation_set_data(conv, "notify-window-signals", window_ids); |
306 gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); | |
307 gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids); | |
4035 | 308 |
3428 | 309 return 0; |
191 | 310 } |
311 | |
6977 | 312 static void |
313 detach_signals(GaimConversation *conv) | |
314 { | |
315 GaimGtkConversation *gtkconv = NULL; | |
316 GaimGtkWindow *gtkwin = NULL; | |
317 GSList *ids = NULL; | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
318 |
6977 | 319 gtkconv = GAIM_GTK_CONVERSATION(conv); |
320 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
321 |
6977 | 322 ids = gaim_conversation_get_data(conv, "notify-window-signals"); |
323 for (; ids != NULL; ids = ids->next) | |
324 g_signal_handler_disconnect(gtkwin->window, GPOINTER_TO_INT(ids->data)); | |
6302 | 325 |
6977 | 326 ids = gaim_conversation_get_data(conv, "notify-imhtml-signals"); |
327 for (; ids != NULL; ids = ids->next) | |
328 g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(ids->data)); | |
6302 | 329 |
6977 | 330 ids = gaim_conversation_get_data(conv, "notify-entry-signals"); |
331 for (; ids != NULL; ids = ids->next) | |
332 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data)); | |
3710 | 333 |
9298 | 334 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
3710 | 335 |
6977 | 336 gaim_conversation_set_data(conv, "notify-window-signals", NULL); |
337 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL); | |
338 gaim_conversation_set_data(conv, "notify-entry-signals", NULL); | |
3710 | 339 } |
340 | |
6977 | 341 static void |
342 conv_created(GaimConversation *conv) | |
343 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
344 GaimConvWindow *gaimwin = NULL; |
6977 | 345 GaimGtkWindow *gtkwin = NULL; |
6302 | 346 |
6977 | 347 gaimwin = gaim_conversation_get_window(conv); |
6302 | 348 |
6977 | 349 if (gaimwin == NULL) |
6302 | 350 return; |
3374 | 351 |
6977 | 352 gtkwin = GAIM_GTK_WINDOW(gaimwin); |
353 | |
9298 | 354 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
6302 | 355 |
6977 | 356 /* always attach the signals, notify() will take care of conversation type |
357 * checking */ | |
358 attach_signals(conv); | |
3374 | 359 } |
360 | |
9303 | 361 #if 0 |
6977 | 362 static void |
363 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) | |
364 { | |
9298 | 365 GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv); |
6302 | 366 |
9298 | 367 printf("conv_switched - %p - %p\n", old_conv, new_conv); |
368 printf("count - %d\n", count_messages(gaimwin)); | |
369 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
370 unnotify(new_conv, FALSE); | |
371 else { | |
372 /* if we don't have notification on the window then we don't want to | |
373 * re-notify it */ | |
374 if (count_messages(gaimwin)) | |
375 notify_win(gaimwin); | |
376 } | |
6977 | 377 } |
9303 | 378 #endif |
6302 | 379 |
6977 | 380 static void |
381 deleting_conv(GaimConversation *conv) | |
382 { | |
9298 | 383 GaimConvWindow *gaimwin = NULL; |
384 | |
6977 | 385 detach_signals(conv); |
3392 | 386 |
9298 | 387 unnotify(conv, TRUE); |
6977 | 388 |
9298 | 389 gaimwin = gaim_conversation_get_window(conv); |
390 if (count_messages(gaimwin)) | |
391 notify_win(gaimwin); | |
6977 | 392 } |
393 | |
9303 | 394 #if 0 |
6977 | 395 static void |
9298 | 396 conversation_drag_ended(GaimConversation *active_conv, |
397 GaimConvWindow *old_gaimwin, | |
398 GaimConvWindow *new_gaimwin) | |
6977 | 399 { |
9298 | 400 if (old_gaimwin != new_gaimwin) { |
401 if (old_gaimwin == NULL) { | |
402 /* | |
403 gaim_conversation_autoset_title(active_conv); | |
404 handle_urgent(new_gaimwin, FALSE); | |
405 */ | |
406 | |
407 if (count_messages(new_gaimwin)) | |
408 notify_win(new_gaimwin); | |
409 } else { | |
410 printf("if else count = %d\n", count_messages(new_gaimwin)); | |
411 printf("if else count = %d\n", count_messages(old_gaimwin)); | |
412 /* | |
413 GaimConversation *old_active_conv = NULL; | |
414 old_active_conv = gaim_conv_window_get_active_conversation(new_gaimwin); | |
415 | |
416 gaim_conversation_autoset_title(old_active_conv); | |
417 handle_urgent(old_gaimwin, FALSE); | |
6302 | 418 |
9298 | 419 if (count_messages(old_gaimwin)) |
420 notify_win(old_gaimwin); | |
421 | |
422 gaim_conversation_autoset_title(active_conv); | |
423 handle_urgent(new_gaimwin, FALSE); | |
424 | |
425 if (count_messages(new_gaimwin)) | |
426 notify_win(new_gaimwin); | |
427 */ | |
428 } | |
429 } else { | |
430 printf("else count = %d\n", count_messages(new_gaimwin)); | |
431 printf("else count = %d\n", count_messages(old_gaimwin)); | |
432 /* | |
433 gaim_conversation_autoset_title(active_conv); | |
434 handle_urgent(old_gaimwin, FALSE); | |
435 | |
436 if (count_messages(old_gaimwin)) | |
437 notify_win(old_gaimwin); | |
438 */ | |
439 } | |
4035 | 440 } |
9303 | 441 #endif |
4035 | 442 |
6977 | 443 static void |
9298 | 444 handle_string(GaimConvWindow *gaimwin) |
445 { | |
446 GtkWindow *window = NULL; | |
447 gchar newtitle[256]; | |
448 | |
449 g_return_if_fail(gaimwin != NULL); | |
450 | |
451 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
452 g_return_if_fail(window != NULL); | |
453 | |
454 g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
455 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), | |
456 gtk_window_get_title(window)); | |
457 gtk_window_set_title(window, newtitle); | |
458 } | |
459 | |
460 static void | |
461 handle_count(GaimConvWindow *gaimwin) | |
462 { | |
463 GtkWindow *window; | |
464 char newtitle[256]; | |
465 | |
466 g_return_if_fail(gaimwin != NULL); | |
467 | |
468 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
469 g_return_if_fail(window != NULL); | |
470 | |
471 g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", count_messages(gaimwin), | |
472 gtk_window_get_title(window)); | |
473 gtk_window_set_title(window, newtitle); | |
474 } | |
475 | |
476 static void | |
477 handle_urgent(GaimConvWindow *gaimwin, gboolean add) | |
6977 | 478 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
479 XWMHints *hints; |
9298 | 480 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaimwin); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
481 |
9298 | 482 g_return_if_fail(gtkwin != NULL); |
483 g_return_if_fail(gtkwin->window != NULL); | |
484 g_return_if_fail(gtkwin->window->window != NULL); | |
485 | |
486 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); | |
6977 | 487 if (add) |
488 hints->flags |= XUrgencyHint; | |
489 else | |
490 hints->flags &= ~XUrgencyHint; | |
9298 | 491 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), |
492 GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); | |
4218 | 493 XFree(hints); |
4035 | 494 } |
495 | |
6977 | 496 static void |
497 type_toggle_cb(GtkWidget *widget, gpointer data) | |
498 { | |
499 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
500 gchar pref[256]; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
501 |
6977 | 502 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
|
503 |
6977 | 504 gaim_prefs_set_bool(pref, on); |
3374 | 505 } |
506 | |
6977 | 507 static void |
508 method_toggle_cb(GtkWidget *widget, gpointer data) | |
509 { | |
510 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
511 gchar pref[256]; | |
512 | |
513 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); | |
3374 | 514 |
6977 | 515 gaim_prefs_set_bool(pref, on); |
516 | |
517 if (!strcmp(data, "method_string")) { | |
518 GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); | |
519 gtk_widget_set_sensitive(entry, on); | |
520 | |
521 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(entry))); | |
522 } | |
523 | |
524 apply_method(); | |
3374 | 525 } |
526 | |
6977 | 527 static void |
528 notify_toggle_cb(GtkWidget *widget, gpointer data) | |
529 { | |
530 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
531 gchar pref[256]; | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
532 |
6977 | 533 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); |
3374 | 534 |
6977 | 535 gaim_prefs_set_bool(pref, on); |
536 | |
537 apply_notify(); | |
3374 | 538 } |
539 | |
6977 | 540 static gboolean |
541 options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
542 { | |
543 if (data == NULL) | |
6982 | 544 return FALSE; |
6302 | 545 |
6977 | 546 if (!strcmp(data, "method_string")) { |
547 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(widget))); | |
3374 | 548 } |
6302 | 549 |
6977 | 550 apply_method(); |
6302 | 551 |
552 return FALSE; | |
553 } | |
554 | |
6977 | 555 static void |
556 apply_method() { | |
557 GList *convs = gaim_get_conversations(); | |
9298 | 558 GaimConvWindow *gaimwin = NULL; |
6977 | 559 |
9298 | 560 for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) { |
6977 | 561 GaimConversation *conv = (GaimConversation *)convs->data; |
6302 | 562 |
6977 | 563 /* remove notifications */ |
9298 | 564 unnotify(conv, FALSE); |
565 | |
566 gaimwin = gaim_conversation_get_window(conv); | |
567 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) | |
6977 | 568 /* reattach appropriate notifications */ |
569 notify(conv, FALSE); | |
570 } | |
3374 | 571 } |
572 | |
6977 | 573 static void |
574 apply_notify() | |
575 { | |
576 GList *convs = gaim_get_conversations(); | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
577 |
6977 | 578 while (convs) { |
579 GaimConversation *conv = (GaimConversation *)convs->data; | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
580 |
6977 | 581 /* detach signals */ |
582 detach_signals(conv); | |
583 /* reattach appropriate signals */ | |
584 attach_signals(conv); | |
4035 | 585 |
6977 | 586 convs = convs->next; |
4035 | 587 } |
588 } | |
589 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
590 static GtkWidget * |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
591 get_config_frame(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
592 { |
6977 | 593 GtkWidget *ret = NULL, *frame = NULL; |
594 GtkWidget *vbox = NULL, *hbox = NULL; | |
595 GtkWidget *toggle = NULL, *entry = NULL; | |
6302 | 596 |
3565 | 597 ret = gtk_vbox_new(FALSE, 18); |
6302 | 598 gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
3392 | 599 |
6302 | 600 /*---------- "Notify For" ----------*/ |
601 frame = gaim_gtk_make_frame(ret, _("Notify For")); | |
602 vbox = gtk_vbox_new(FALSE, 5); | |
603 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
604 | |
3710 | 605 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
606 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
6977 | 607 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
9298 | 608 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
6977 | 609 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 610 G_CALLBACK(type_toggle_cb), "type_im"); |
3710 | 611 |
6977 | 612 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
3710 | 613 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
6977 | 614 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
9298 | 615 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
6977 | 616 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 617 G_CALLBACK(type_toggle_cb), "type_chat"); |
6977 | 618 |
619 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); | |
620 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
621 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 622 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
6977 | 623 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 624 G_CALLBACK(type_toggle_cb), "type_focused"); |
3710 | 625 |
6302 | 626 /*---------- "Notification Methods" ----------*/ |
627 frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | |
628 vbox = gtk_vbox_new(FALSE, 5); | |
629 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
630 | |
6977 | 631 /* String method button */ |
3565 | 632 hbox = gtk_hbox_new(FALSE, 18); |
633 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6302 | 634 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
6977 | 635 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
9298 | 636 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
3565 | 637 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
6977 | 638 |
6302 | 639 entry = gtk_entry_new(); |
640 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
641 gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
6977 | 642 gtk_widget_set_sensitive(GTK_WIDGET(entry), |
9298 | 643 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
6977 | 644 gtk_entry_set_text(GTK_ENTRY(entry), |
9298 | 645 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
6977 | 646 g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
647 g_signal_connect(G_OBJECT(toggle), "toggled", | |
9298 | 648 G_CALLBACK(method_toggle_cb), "method_string"); |
6977 | 649 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
9298 | 650 G_CALLBACK(options_entry_cb), "method_string"); |
3374 | 651 |
6977 | 652 /* Count method button */ |
653 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
654 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 655 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
6977 | 656 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
657 g_signal_connect(G_OBJECT(toggle), "toggled", | |
9298 | 658 G_CALLBACK(method_toggle_cb), "method_count"); |
4035 | 659 |
6977 | 660 /* Urgent method button */ |
661 toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); | |
662 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
663 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 664 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
665 g_signal_connect(G_OBJECT(toggle), "toggled", | |
666 G_CALLBACK(method_toggle_cb), "method_urgent"); | |
3710 | 667 |
6977 | 668 /*---------- "Notification Removals" ----------*/ |
6302 | 669 frame = gaim_gtk_make_frame(ret, _("Notification Removal")); |
670 vbox = gtk_vbox_new(FALSE, 5); | |
671 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
3374 | 672 |
6977 | 673 /* Remove on focus button */ |
674 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
675 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
676 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 677 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
6977 | 678 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
679 | |
680 /* Remove on click button */ | |
681 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
682 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
683 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 684 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
6977 | 685 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 686 G_CALLBACK(notify_toggle_cb), "notify_click"); |
3710 | 687 |
6977 | 688 /* Remove on type button */ |
689 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
690 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
691 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 692 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
6977 | 693 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 694 G_CALLBACK(notify_toggle_cb), "notify_type"); |
4035 | 695 |
6977 | 696 /* Remove on message send button */ |
697 toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
698 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
699 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 700 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
6977 | 701 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 702 G_CALLBACK(notify_toggle_cb), "notify_send"); |
3565 | 703 |
6977 | 704 #if 0 |
705 /* Remove on conversation switch button */ | |
9298 | 706 toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
6977 | 707 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
708 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 709 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
6977 | 710 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 711 G_CALLBACK(notify_toggle_cb), "notify_switch"); |
6977 | 712 #endif |
713 | |
714 gtk_widget_show_all(ret); | |
715 return ret; | |
3374 | 716 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
717 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
718 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
719 plugin_load(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
720 { |
6977 | 721 GList *convs = gaim_get_conversations(); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
722 void *conv_handle = gaim_conversations_get_handle(); |
9298 | 723 /* |
724 void *gtk_conv_handle = gaim_gtk_conversations_get_handle(); | |
725 */ | |
6302 | 726 |
727 my_plugin = plugin; | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
728 |
6977 | 729 gaim_signal_connect(conv_handle, "received-im-msg", plugin, |
9298 | 730 GAIM_CALLBACK(im_recv_im), NULL); |
6977 | 731 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, |
9298 | 732 GAIM_CALLBACK(chat_recv_im), NULL); |
6977 | 733 gaim_signal_connect(conv_handle, "sent-im-msg", plugin, |
9298 | 734 GAIM_CALLBACK(im_sent_im), NULL); |
6977 | 735 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, |
9298 | 736 GAIM_CALLBACK(chat_sent_im), NULL); |
6977 | 737 gaim_signal_connect(conv_handle, "conversation-created", plugin, |
9298 | 738 GAIM_CALLBACK(conv_created), NULL); |
6977 | 739 gaim_signal_connect(conv_handle, "chat-joined", plugin, |
9298 | 740 GAIM_CALLBACK(conv_created), NULL); |
6977 | 741 gaim_signal_connect(conv_handle, "deleting-conversation", plugin, |
9298 | 742 GAIM_CALLBACK(deleting_conv), NULL); |
9303 | 743 #if 0 |
6977 | 744 gaim_signal_connect(conv_handle, "conversation-switched", plugin, |
9298 | 745 GAIM_CALLBACK(conv_switched), NULL); |
746 gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin, | |
747 GAIM_CALLBACK(conversation_drag_ended), NULL); | |
9303 | 748 #endif |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
749 |
6977 | 750 while (convs) { |
751 GaimConversation *conv = (GaimConversation *)convs->data; | |
6302 | 752 |
753 /* attach signals */ | |
6977 | 754 attach_signals(conv); |
6302 | 755 |
6977 | 756 convs = convs->next; |
6302 | 757 } |
758 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
759 return TRUE; |
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
762 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
763 plugin_unload(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
764 { |
6977 | 765 GList *convs = gaim_get_conversations(); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
766 |
6977 | 767 while (convs) { |
768 GaimConversation *conv = (GaimConversation *)convs->data; | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
769 |
6302 | 770 /* kill signals */ |
6977 | 771 detach_signals(conv); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
772 |
6977 | 773 convs = convs->next; |
5205
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
776 return TRUE; |
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
779 static GaimGtkPluginUiInfo ui_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
780 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
781 get_config_frame |
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
784 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
785 { |
9943 | 786 GAIM_PLUGIN_MAGIC, |
787 GAIM_MAJOR_VERSION, | |
788 GAIM_MINOR_VERSION, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
789 GAIM_PLUGIN_STANDARD, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
790 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
791 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
792 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
793 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
794 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
795 NOTIFY_PLUGIN_ID, /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
796 N_("Message Notification"), /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
797 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
798 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
799 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
|
800 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
801 N_("Provides a variety of ways of notifying you of unread messages."), |
9298 | 802 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu>", |
6302 | 803 /**< author */ |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
804 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
805 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
806 plugin_load, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
807 plugin_unload, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
808 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
809 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
810 &ui_info, /**< ui_info */ |
8993 | 811 NULL, /**< extra_info */ |
812 NULL, | |
813 NULL | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
814 }; |
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 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
817 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
818 { |
6302 | 819 gaim_prefs_add_none("/plugins/gtk"); |
820 gaim_prefs_add_none("/plugins/gtk/X11"); | |
821 gaim_prefs_add_none("/plugins/gtk/X11/notify"); | |
822 | |
6464 | 823 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
824 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
825 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
6302 | 826 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
827 gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
828 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
829 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
830 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE); | |
831 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
832 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
6464 | 833 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
834 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
|
835 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
836 |
6063 | 837 GAIM_INIT_PLUGIN(notify, init_plugin, info) |