Mercurial > pidgin
annotate plugins/notify.c @ 9478:0efa260e384f
[gaim-migrate @ 10303]
" This patch adds the following features for zephyr, in order
of usefulness :-)
Protocol action (Retrieve subscriptions from server) to
list user's subscriptions (chats) in a popup window.
Typing notification - (both sending and receiving --
using zephyrs with opcode ping).
Correct interpretation of %host% and %canon% entries in
.zephyr.subs . These are often used to subscribe to
system messages concerning a specific machine (by
hostname and canonical hostname, respectively).
An updated .todo list." --Arun A Tharuvai
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 07 Jul 2004 21:56:57 +0000 |
parents | fe931c791fc0 |
children | 4a15962c344a |
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 | |
9303 | 359 #if 0 |
6977 | 360 static void |
361 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) | |
362 { | |
9298 | 363 GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv); |
6302 | 364 |
9298 | 365 printf("conv_switched - %p - %p\n", old_conv, new_conv); |
366 printf("count - %d\n", count_messages(gaimwin)); | |
367 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
368 unnotify(new_conv, FALSE); | |
369 else { | |
370 /* if we don't have notification on the window then we don't want to | |
371 * re-notify it */ | |
372 if (count_messages(gaimwin)) | |
373 notify_win(gaimwin); | |
374 } | |
6977 | 375 } |
9303 | 376 #endif |
6302 | 377 |
6977 | 378 static void |
379 deleting_conv(GaimConversation *conv) | |
380 { | |
9298 | 381 GaimConvWindow *gaimwin = NULL; |
382 | |
6977 | 383 detach_signals(conv); |
3392 | 384 |
9298 | 385 unnotify(conv, TRUE); |
6977 | 386 |
9298 | 387 gaimwin = gaim_conversation_get_window(conv); |
388 if (count_messages(gaimwin)) | |
389 notify_win(gaimwin); | |
6977 | 390 } |
391 | |
9303 | 392 #if 0 |
6977 | 393 static void |
9298 | 394 conversation_drag_ended(GaimConversation *active_conv, |
395 GaimConvWindow *old_gaimwin, | |
396 GaimConvWindow *new_gaimwin) | |
6977 | 397 { |
9298 | 398 if (old_gaimwin != new_gaimwin) { |
399 if (old_gaimwin == NULL) { | |
400 /* | |
401 gaim_conversation_autoset_title(active_conv); | |
402 handle_urgent(new_gaimwin, FALSE); | |
403 */ | |
404 | |
405 if (count_messages(new_gaimwin)) | |
406 notify_win(new_gaimwin); | |
407 } else { | |
408 printf("if else count = %d\n", count_messages(new_gaimwin)); | |
409 printf("if else count = %d\n", count_messages(old_gaimwin)); | |
410 /* | |
411 GaimConversation *old_active_conv = NULL; | |
412 old_active_conv = gaim_conv_window_get_active_conversation(new_gaimwin); | |
413 | |
414 gaim_conversation_autoset_title(old_active_conv); | |
415 handle_urgent(old_gaimwin, FALSE); | |
6302 | 416 |
9298 | 417 if (count_messages(old_gaimwin)) |
418 notify_win(old_gaimwin); | |
419 | |
420 gaim_conversation_autoset_title(active_conv); | |
421 handle_urgent(new_gaimwin, FALSE); | |
422 | |
423 if (count_messages(new_gaimwin)) | |
424 notify_win(new_gaimwin); | |
425 */ | |
426 } | |
427 } else { | |
428 printf("else count = %d\n", count_messages(new_gaimwin)); | |
429 printf("else count = %d\n", count_messages(old_gaimwin)); | |
430 /* | |
431 gaim_conversation_autoset_title(active_conv); | |
432 handle_urgent(old_gaimwin, FALSE); | |
433 | |
434 if (count_messages(old_gaimwin)) | |
435 notify_win(old_gaimwin); | |
436 */ | |
437 } | |
4035 | 438 } |
9303 | 439 #endif |
4035 | 440 |
6977 | 441 static void |
9298 | 442 handle_string(GaimConvWindow *gaimwin) |
443 { | |
444 GtkWindow *window = NULL; | |
445 gchar newtitle[256]; | |
446 | |
447 g_return_if_fail(gaimwin != NULL); | |
448 | |
449 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
450 g_return_if_fail(window != NULL); | |
451 | |
452 g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
453 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), | |
454 gtk_window_get_title(window)); | |
455 gtk_window_set_title(window, newtitle); | |
456 } | |
457 | |
458 static void | |
459 handle_count(GaimConvWindow *gaimwin) | |
460 { | |
461 GtkWindow *window; | |
462 char newtitle[256]; | |
463 | |
464 g_return_if_fail(gaimwin != NULL); | |
465 | |
466 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
467 g_return_if_fail(window != NULL); | |
468 | |
469 g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", count_messages(gaimwin), | |
470 gtk_window_get_title(window)); | |
471 gtk_window_set_title(window, newtitle); | |
472 } | |
473 | |
474 static void | |
475 handle_urgent(GaimConvWindow *gaimwin, gboolean add) | |
6977 | 476 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
477 XWMHints *hints; |
9298 | 478 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaimwin); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
479 |
9298 | 480 g_return_if_fail(gtkwin != NULL); |
481 g_return_if_fail(gtkwin->window != NULL); | |
482 g_return_if_fail(gtkwin->window->window != NULL); | |
483 | |
484 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); | |
6977 | 485 if (add) |
486 hints->flags |= XUrgencyHint; | |
487 else | |
488 hints->flags &= ~XUrgencyHint; | |
9298 | 489 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), |
490 GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); | |
4218 | 491 XFree(hints); |
4035 | 492 } |
493 | |
6977 | 494 static void |
495 type_toggle_cb(GtkWidget *widget, gpointer data) | |
496 { | |
497 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
498 gchar pref[256]; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
499 |
6977 | 500 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
|
501 |
6977 | 502 gaim_prefs_set_bool(pref, on); |
3374 | 503 } |
504 | |
6977 | 505 static void |
506 method_toggle_cb(GtkWidget *widget, gpointer data) | |
507 { | |
508 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
509 gchar pref[256]; | |
510 | |
511 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); | |
3374 | 512 |
6977 | 513 gaim_prefs_set_bool(pref, on); |
514 | |
515 if (!strcmp(data, "method_string")) { | |
516 GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); | |
517 gtk_widget_set_sensitive(entry, on); | |
518 | |
519 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(entry))); | |
520 } | |
521 | |
522 apply_method(); | |
3374 | 523 } |
524 | |
6977 | 525 static void |
526 notify_toggle_cb(GtkWidget *widget, gpointer data) | |
527 { | |
528 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
529 gchar pref[256]; | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
530 |
6977 | 531 g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", (char *)data); |
3374 | 532 |
6977 | 533 gaim_prefs_set_bool(pref, on); |
534 | |
535 apply_notify(); | |
3374 | 536 } |
537 | |
6977 | 538 static gboolean |
539 options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
540 { | |
541 if (data == NULL) | |
6982 | 542 return FALSE; |
6302 | 543 |
6977 | 544 if (!strcmp(data, "method_string")) { |
545 gaim_prefs_set_string("/plugins/gtk/X11/notify/title_string", gtk_entry_get_text(GTK_ENTRY(widget))); | |
3374 | 546 } |
6302 | 547 |
6977 | 548 apply_method(); |
6302 | 549 |
550 return FALSE; | |
551 } | |
552 | |
6977 | 553 static void |
554 apply_method() { | |
555 GList *convs = gaim_get_conversations(); | |
9298 | 556 GaimConvWindow *gaimwin = NULL; |
6977 | 557 |
9298 | 558 for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) { |
6977 | 559 GaimConversation *conv = (GaimConversation *)convs->data; |
6302 | 560 |
6977 | 561 /* remove notifications */ |
9298 | 562 unnotify(conv, FALSE); |
563 | |
564 gaimwin = gaim_conversation_get_window(conv); | |
565 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) | |
6977 | 566 /* reattach appropriate notifications */ |
567 notify(conv, FALSE); | |
568 } | |
3374 | 569 } |
570 | |
6977 | 571 static void |
572 apply_notify() | |
573 { | |
574 GList *convs = gaim_get_conversations(); | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
575 |
6977 | 576 while (convs) { |
577 GaimConversation *conv = (GaimConversation *)convs->data; | |
4203
ec6d0c5e5c23
[gaim-migrate @ 4439]
Christian Hammond <chipx86@chipx86.com>
parents:
4202
diff
changeset
|
578 |
6977 | 579 /* detach signals */ |
580 detach_signals(conv); | |
581 /* reattach appropriate signals */ | |
582 attach_signals(conv); | |
4035 | 583 |
6977 | 584 convs = convs->next; |
4035 | 585 } |
586 } | |
587 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
588 static GtkWidget * |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
589 get_config_frame(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
590 { |
6977 | 591 GtkWidget *ret = NULL, *frame = NULL; |
592 GtkWidget *vbox = NULL, *hbox = NULL; | |
593 GtkWidget *toggle = NULL, *entry = NULL; | |
6302 | 594 |
3565 | 595 ret = gtk_vbox_new(FALSE, 18); |
6302 | 596 gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
3392 | 597 |
6302 | 598 /*---------- "Notify For" ----------*/ |
599 frame = gaim_gtk_make_frame(ret, _("Notify For")); | |
600 vbox = gtk_vbox_new(FALSE, 5); | |
601 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
602 | |
3710 | 603 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
604 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
6977 | 605 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
9298 | 606 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
6977 | 607 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 608 G_CALLBACK(type_toggle_cb), "type_im"); |
3710 | 609 |
6977 | 610 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
3710 | 611 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
6977 | 612 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
9298 | 613 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
6977 | 614 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 615 G_CALLBACK(type_toggle_cb), "type_chat"); |
6977 | 616 |
617 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); | |
618 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
619 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 620 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
6977 | 621 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 622 G_CALLBACK(type_toggle_cb), "type_focused"); |
3710 | 623 |
6302 | 624 /*---------- "Notification Methods" ----------*/ |
625 frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | |
626 vbox = gtk_vbox_new(FALSE, 5); | |
627 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
628 | |
6977 | 629 /* String method button */ |
3565 | 630 hbox = gtk_hbox_new(FALSE, 18); |
631 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6302 | 632 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
6977 | 633 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
9298 | 634 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
3565 | 635 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
6977 | 636 |
6302 | 637 entry = gtk_entry_new(); |
638 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
639 gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
6977 | 640 gtk_widget_set_sensitive(GTK_WIDGET(entry), |
9298 | 641 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
6977 | 642 gtk_entry_set_text(GTK_ENTRY(entry), |
9298 | 643 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
6977 | 644 g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
645 g_signal_connect(G_OBJECT(toggle), "toggled", | |
9298 | 646 G_CALLBACK(method_toggle_cb), "method_string"); |
6977 | 647 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
9298 | 648 G_CALLBACK(options_entry_cb), "method_string"); |
3374 | 649 |
6977 | 650 /* Count method button */ |
651 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
652 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 653 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
6977 | 654 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
655 g_signal_connect(G_OBJECT(toggle), "toggled", | |
9298 | 656 G_CALLBACK(method_toggle_cb), "method_count"); |
4035 | 657 |
6977 | 658 /* Urgent method button */ |
659 toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); | |
660 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
661 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 662 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
663 g_signal_connect(G_OBJECT(toggle), "toggled", | |
664 G_CALLBACK(method_toggle_cb), "method_urgent"); | |
3710 | 665 |
6977 | 666 /*---------- "Notification Removals" ----------*/ |
6302 | 667 frame = gaim_gtk_make_frame(ret, _("Notification Removal")); |
668 vbox = gtk_vbox_new(FALSE, 5); | |
669 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
3374 | 670 |
6977 | 671 /* Remove on focus button */ |
672 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
673 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
674 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 675 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
6977 | 676 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
677 | |
678 /* Remove on click button */ | |
679 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
680 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
681 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 682 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
6977 | 683 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 684 G_CALLBACK(notify_toggle_cb), "notify_click"); |
3710 | 685 |
6977 | 686 /* Remove on type button */ |
687 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
688 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
689 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 690 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
6977 | 691 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 692 G_CALLBACK(notify_toggle_cb), "notify_type"); |
4035 | 693 |
6977 | 694 /* Remove on message send button */ |
695 toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
696 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
697 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 698 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
6977 | 699 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 700 G_CALLBACK(notify_toggle_cb), "notify_send"); |
3565 | 701 |
6977 | 702 #if 0 |
703 /* Remove on conversation switch button */ | |
9298 | 704 toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
6977 | 705 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
706 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
9298 | 707 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
6977 | 708 g_signal_connect(G_OBJECT(toggle), "toggled", |
9298 | 709 G_CALLBACK(notify_toggle_cb), "notify_switch"); |
6977 | 710 #endif |
711 | |
712 gtk_widget_show_all(ret); | |
713 return ret; | |
3374 | 714 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
715 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
716 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
717 plugin_load(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
718 { |
6977 | 719 GList *convs = gaim_get_conversations(); |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
720 void *conv_handle = gaim_conversations_get_handle(); |
9298 | 721 /* |
722 void *gtk_conv_handle = gaim_gtk_conversations_get_handle(); | |
723 */ | |
6302 | 724 |
725 my_plugin = plugin; | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
726 |
6977 | 727 gaim_signal_connect(conv_handle, "received-im-msg", plugin, |
9298 | 728 GAIM_CALLBACK(im_recv_im), NULL); |
6977 | 729 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, |
9298 | 730 GAIM_CALLBACK(chat_recv_im), NULL); |
6977 | 731 gaim_signal_connect(conv_handle, "sent-im-msg", plugin, |
9298 | 732 GAIM_CALLBACK(im_sent_im), NULL); |
6977 | 733 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, |
9298 | 734 GAIM_CALLBACK(chat_sent_im), NULL); |
6977 | 735 gaim_signal_connect(conv_handle, "conversation-created", plugin, |
9298 | 736 GAIM_CALLBACK(conv_created), NULL); |
6977 | 737 gaim_signal_connect(conv_handle, "chat-joined", plugin, |
9298 | 738 GAIM_CALLBACK(conv_created), NULL); |
6977 | 739 gaim_signal_connect(conv_handle, "deleting-conversation", plugin, |
9298 | 740 GAIM_CALLBACK(deleting_conv), NULL); |
9303 | 741 #if 0 |
6977 | 742 gaim_signal_connect(conv_handle, "conversation-switched", plugin, |
9298 | 743 GAIM_CALLBACK(conv_switched), NULL); |
744 gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin, | |
745 GAIM_CALLBACK(conversation_drag_ended), NULL); | |
9303 | 746 #endif |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
747 |
6977 | 748 while (convs) { |
749 GaimConversation *conv = (GaimConversation *)convs->data; | |
6302 | 750 |
751 /* attach signals */ | |
6977 | 752 attach_signals(conv); |
6302 | 753 |
6977 | 754 convs = convs->next; |
6302 | 755 } |
756 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
757 return TRUE; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
758 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
759 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
760 static gboolean |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
761 plugin_unload(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
762 { |
6977 | 763 GList *convs = gaim_get_conversations(); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
764 |
6977 | 765 while (convs) { |
766 GaimConversation *conv = (GaimConversation *)convs->data; | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
767 |
6302 | 768 /* kill signals */ |
6977 | 769 detach_signals(conv); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
770 |
6977 | 771 convs = convs->next; |
5205
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
774 return TRUE; |
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 static GaimGtkPluginUiInfo ui_info = |
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 get_config_frame |
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
782 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
783 { |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
7486
diff
changeset
|
784 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
785 GAIM_PLUGIN_STANDARD, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
786 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
787 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
788 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
789 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
790 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
791 NOTIFY_PLUGIN_ID, /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
792 N_("Message Notification"), /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
793 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
794 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
795 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
|
796 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
797 N_("Provides a variety of ways of notifying you of unread messages."), |
9298 | 798 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu>", |
6302 | 799 /**< author */ |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
800 GAIM_WEBSITE, /**< homepage */ |
5205
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 plugin_load, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
803 plugin_unload, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
804 NULL, /**< destroy */ |
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 &ui_info, /**< ui_info */ |
8993 | 807 NULL, /**< extra_info */ |
808 NULL, | |
809 NULL | |
5205
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 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
812 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
813 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
814 { |
6302 | 815 gaim_prefs_add_none("/plugins/gtk"); |
816 gaim_prefs_add_none("/plugins/gtk/X11"); | |
817 gaim_prefs_add_none("/plugins/gtk/X11/notify"); | |
818 | |
6464 | 819 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
820 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
821 gaim_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
6302 | 822 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
823 gaim_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
824 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
825 gaim_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
826 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", FALSE); | |
827 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
828 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
6464 | 829 gaim_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
830 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
|
831 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
832 |
6063 | 833 GAIM_INIT_PLUGIN(notify, init_plugin, info) |