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