Mercurial > pidgin
annotate plugins/notify.c @ 3722:5ab55c267294
[gaim-migrate @ 3855]
allow old (busted) gaim packets to be displayed (paco-paco)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 16 Oct 2002 23:33:02 +0000 |
parents | 03ba413ca20b |
children | 4cea75cf291d |
rev | line source |
---|---|
3392 | 1 /* Rewritten by Etan Reisner <deryni@eden.rutgers.edu> |
3374 | 2 * |
3 * Added config dialog | |
4 * Added control over notification method | |
5 * Added control over when to release notification | |
3392 | 6 * |
7 * Thanks to Carles Pina i Estany <carles@pinux.info> | |
8 * for count of new messages option | |
9 */ | |
10 | |
3710 | 11 #ifndef GAIM_PLUGINS |
12 #define GAIM_PLUGINS | |
13 #endif | |
3374 | 14 |
191 | 15 #include "gaim.h" |
3428 | 16 #include <string.h> |
17 #include <ctype.h> | |
18 #include <stdlib.h> | |
191 | 19 #include <gtk/gtk.h> |
3385 | 20 #include <X11/Xlib.h> |
3374 | 21 #include <X11/Xutil.h> |
3392 | 22 #include <X11/Xatom.h> |
3374 | 23 #include <gdk/gdkx.h> |
24 | |
3710 | 25 guint type = 1; |
26 #define TYPE_IM 0x00000001 | |
27 #define TYPE_CHAT 0x00000002 | |
28 | |
3392 | 29 guint choice = 1; |
30 #define NOTIFY_FOCUS 0x00000001 | |
31 #define NOTIFY_TYPE 0x00000002 | |
32 #define NOTIFY_IN_FOCUS 0x00000004 | |
3710 | 33 #define NOTIFY_CLICK 0x00000008 |
3374 | 34 |
3392 | 35 guint method = 1; |
36 #define METHOD_STRING 0x00000001 | |
37 #define METHOD_QUOTE 0x00000002 | |
38 #define METHOD_URGENT 0x00000004 | |
39 #define METHOD_COUNT 0x00000008 | |
191 | 40 |
41 void *handle; | |
3392 | 42 /* I really don't like this but I was having trouble getting any |
43 * other way of removing the signal callbacks to work and not crash gaim | |
44 */ | |
45 GtkWidget *really_evil_hack; | |
3565 | 46 GtkWidget *Entry; |
3392 | 47 gchar *title_string = "(*) "; |
191 | 48 |
3374 | 49 /* predefine some functions, less warnings */ |
50 void options(GtkWidget *widget, gpointer data); | |
51 void un_star(GtkWidget *widget, gpointer data); | |
3511 | 52 int un_star_window(GtkWidget *widget, gpointer data); |
3374 | 53 void string_remove(GtkWidget *widget); |
3392 | 54 void count_remove(GtkWidget *widget); |
3374 | 55 void quote_remove(GtkWidget *widget); |
56 void urgent_remove(struct conversation *c); | |
3428 | 57 int counter (char *buf, int *length); |
3374 | 58 |
3710 | 59 struct conversation *find_chat(struct gaim_connection *gc, int id) { |
60 GList *cnv = chats; | |
61 struct conversation *c; | |
62 | |
63 while (cnv) { | |
64 c = (struct conversation *) cnv->data; | |
65 | |
66 if (c && (c->gc == gc) && c->is_chat && (c->id == id)) | |
67 return c; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
68 |
3710 | 69 cnv = cnv->next; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
70 } |
3710 | 71 return NULL; |
72 } | |
191 | 73 |
3710 | 74 int notify(struct conversation *cnv) { |
75 char buf[256]; | |
76 GtkWindow *win; | |
77 Window focus_return; | |
78 int revert_to_return, c, length; | |
191 | 79 |
80 win = (GtkWindow *)cnv->window; | |
81 | |
3374 | 82 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return); |
83 | |
3392 | 84 if ((choice & NOTIFY_IN_FOCUS) || focus_return != GDK_WINDOW_XWINDOW(cnv->window->window)) { |
3374 | 85 if (method & METHOD_STRING) { |
3392 | 86 strncpy(buf, win->title, sizeof(buf)); |
3374 | 87 if (!strstr(buf, title_string)) { |
3392 | 88 g_snprintf(buf, sizeof(buf), "%s%s", title_string, win->title); |
3374 | 89 gtk_window_set_title(win, buf); |
90 } | |
91 } | |
3392 | 92 if (method & METHOD_COUNT) { |
93 strncpy(buf, win->title, sizeof(buf)); | |
94 c = counter(buf, &length); | |
95 if (!c) { | |
96 g_snprintf(buf, sizeof(buf), "[1] %s", win->title); | |
97 } | |
98 else if (!g_strncasecmp(buf, "[", 1)) { | |
99 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]); | |
100 } | |
101 gtk_window_set_title(win, buf); | |
102 } | |
3374 | 103 if (method & METHOD_QUOTE) { |
3392 | 104 strncpy(buf, win->title, sizeof(buf)); |
3374 | 105 if (g_strncasecmp(buf, "\"", 1)) { |
106 g_snprintf(buf, sizeof(buf), "\"%s\"", win->title); | |
107 gtk_window_set_title(win, buf); | |
108 } | |
109 } | |
110 if (method & METHOD_URGENT) { | |
3392 | 111 /* do it the gdk way for windows compatibility(?) if I can figure it out */ |
112 /* Sean says this is a bad thing, and I should try using gtk_property_get first */ | |
113 /* I'll want to pay attention to note on dev.gnome.org though */ | |
3710 | 114 /* gdk_property_change(win->window, WM_HINTS, WM_HINTS, 32, GDK_PROP_MODE_REPLACE, XUrgencyHint, 1); */ |
3374 | 115 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window)); |
116 hints->flags |= XUrgencyHint; | |
117 XSetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window), hints); | |
118 } | |
119 } | |
120 return 0; | |
121 } | |
122 | |
3710 | 123 int unnotify(struct conversation *c) { |
3374 | 124 if (method & METHOD_QUOTE) |
3392 | 125 quote_remove(c->window); |
126 if (method & METHOD_COUNT) | |
127 count_remove(c->window); | |
3374 | 128 if (method & METHOD_STRING) |
3392 | 129 string_remove(c->window); |
3374 | 130 if (method & METHOD_URGENT) |
131 urgent_remove(c); | |
132 return 0; | |
133 } | |
134 | |
3710 | 135 void chat_recv_im(struct gaim_connection *gc, int id, char **who, char **text) { |
136 struct conversation *c = find_chat(gc, id); | |
137 | |
138 if (c && (type & TYPE_CHAT)) | |
139 notify(c); | |
140 return; | |
141 } | |
142 | |
143 void chat_sent_im(struct gaim_connection *gc, int id, char **text) { | |
144 struct conversation *c = find_chat(gc, id); | |
145 | |
146 if (c && (type & TYPE_CHAT)) | |
147 unnotify(c); | |
148 return; | |
149 } | |
150 | |
151 int im_recv_im(struct gaim_connection *gc, char **who, char **what, void *m) { | |
152 struct conversation *c = find_conversation(*who); | |
153 | |
154 if (c && (type & TYPE_IM)) | |
155 notify(c); | |
156 return 0; | |
157 } | |
158 | |
159 int im_sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { | |
3374 | 160 struct conversation *c = find_conversation(who); |
161 | |
3710 | 162 if (c && (type & TYPE_IM)) |
163 unnotify(c); | |
164 return 0; | |
165 } | |
3392 | 166 |
3710 | 167 int attach_signals(struct conversation *c) { |
3392 | 168 if (choice & NOTIFY_FOCUS) { |
169 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "focus-in-event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack)); | |
3374 | 170 gtk_object_set_user_data(GTK_OBJECT(c->window), c); |
171 } | |
3710 | 172 |
173 if (choice & NOTIFY_CLICK) { | |
3392 | 174 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "button_press_event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack)); |
3374 | 175 gtk_object_set_user_data(GTK_OBJECT(c->window), c); |
3392 | 176 gtk_signal_connect_while_alive(GTK_OBJECT(c->text), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); |
3374 | 177 gtk_object_set_user_data(GTK_OBJECT(c->text), c); |
3392 | 178 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); |
3374 | 179 gtk_object_set_user_data(GTK_OBJECT(c->entry), c); |
180 } | |
181 | |
3392 | 182 if (choice & NOTIFY_TYPE) { |
183 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); | |
3374 | 184 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c); |
191 | 185 } |
3428 | 186 return 0; |
191 | 187 } |
188 | |
3710 | 189 void new_conv(char *who) { |
190 struct conversation *c = find_conversation(who); | |
191 | |
192 if (c && (type & TYPE_IM)) | |
193 attach_signals(c); | |
194 return; | |
195 } | |
196 | |
197 void chat_join(struct gaim_connection *gc, int id, char *room) { | |
198 struct conversation *c = find_chat(gc, id); | |
199 | |
200 if (type & TYPE_CHAT) | |
201 attach_signals(c); | |
202 return; | |
203 } | |
204 | |
3374 | 205 void un_star(GtkWidget *widget, gpointer data) { |
206 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget)); | |
207 | |
208 if (method & METHOD_QUOTE) | |
209 quote_remove(widget); | |
3392 | 210 if (method & METHOD_COUNT) |
211 count_remove(widget); | |
3374 | 212 if (method & METHOD_STRING) |
213 string_remove(widget); | |
214 if (method & METHOD_URGENT) | |
215 urgent_remove(c); | |
216 return; | |
217 } | |
218 | |
3511 | 219 int un_star_window(GtkWidget *widget, gpointer data) { |
3374 | 220 GtkWidget *parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); |
221 gtk_object_set_user_data(GTK_OBJECT(parent), gtk_object_get_user_data(GTK_OBJECT(widget))); | |
222 un_star(parent, data); | |
3511 | 223 return 0; |
3374 | 224 } |
225 | |
3392 | 226 /* This function returns the number in [ ]'s or 0 */ |
227 int counter (char *buf, int *length) { | |
228 char temp[256]; | |
229 int i = 1; | |
230 *length = 0; | |
231 | |
232 while (isdigit(buf[i]) && i<sizeof(buf)) { | |
233 temp[i-1] = buf[i]; | |
234 (*length)++; | |
235 i++; | |
236 } | |
237 temp[i] = '\0'; | |
238 | |
239 if (buf[i] != ']') { | |
240 *length = 0; | |
241 return (0); | |
242 } | |
243 | |
244 return (atoi(temp)); | |
245 } | |
246 | |
3374 | 247 void string_remove(GtkWidget *widget) { |
191 | 248 char buf[256]; |
3374 | 249 GtkWindow *win = GTK_WINDOW(widget); |
250 | |
3392 | 251 strncpy(buf, win->title, sizeof(buf)); |
3374 | 252 if (strstr(buf, title_string)) { |
253 g_snprintf(buf, sizeof(buf), "%s", &win->title[strlen(title_string)]); | |
254 gtk_window_set_title(win, buf); | |
255 } | |
256 return; | |
257 } | |
258 | |
3392 | 259 void count_remove(GtkWidget *widget) { |
260 char buf[256]; | |
261 GtkWindow *win = GTK_WINDOW(widget); | |
262 int length; | |
263 | |
264 strncpy(buf, win->title, sizeof(buf)); | |
265 if (!g_strncasecmp(buf, "[", 1)) { | |
266 counter(buf, &length); | |
267 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); | |
268 gtk_window_set_title(win, buf); | |
269 } | |
270 return; | |
271 } | |
272 | |
3374 | 273 void quote_remove(GtkWidget *widget) { |
274 char buf[256]; | |
275 GtkWindow *win = GTK_WINDOW(widget); | |
191 | 276 |
3392 | 277 strncpy(buf, win->title, sizeof(buf)); |
3374 | 278 if (!g_strncasecmp(buf, "\"", 1)) { |
279 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]); | |
191 | 280 gtk_window_set_title(win, buf); |
281 } | |
3374 | 282 return; |
283 } | |
284 | |
285 void urgent_remove(struct conversation *c) { | |
286 GdkWindow *win = c->window->window; | |
287 | |
3428 | 288 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
3374 | 289 hints->flags &= ~XUrgencyHint; |
3428 | 290 XSetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win), hints); |
3374 | 291 return; |
292 } | |
293 | |
294 void save_notify_prefs() { | |
3392 | 295 gchar buf[1000]; |
3374 | 296 FILE *fp; |
297 | |
298 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME")); | |
299 if (!(fp = fopen(buf, "w"))) { | |
3561 | 300 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR); |
3374 | 301 return; |
302 } | |
303 | |
3710 | 304 fprintf(fp, "%d=TYPE\n", type); |
3392 | 305 fprintf(fp, "%d=CHOICE\n", choice); |
306 fprintf(fp, "%d=METHOD\n", method); | |
307 fprintf(fp, "%s=STRING\n", title_string); | |
3374 | 308 fclose(fp); |
309 } | |
310 | |
311 void load_notify_prefs() { | |
312 gchar buf[1000]; | |
313 gchar **parsed; | |
314 FILE *fp; | |
315 | |
316 g_snprintf(buf, sizeof(buf), "%s/.gaim/.notify", getenv("HOME")); | |
317 if (!(fp = fopen(buf, "r"))) | |
318 return; | |
319 | |
320 while (fgets(buf, 1000, fp) != NULL) { | |
321 parsed = g_strsplit(g_strchomp(buf), "=", 2); | |
322 if (parsed[0] && parsed[1]) { | |
3710 | 323 if (!strcmp(parsed[1], "TYPE")) |
324 type = atoi(parsed[0]); | |
3392 | 325 if (!strcmp(parsed[1], "CHOICE")) |
326 choice = atoi(parsed[0]); | |
327 if (!strcmp(parsed[1], "METHOD")) | |
328 method = atoi(parsed[0]); | |
329 if (!strcmp(parsed[1], "STRING")) | |
330 if (title_string != NULL) g_free(title_string); | |
3710 | 331 title_string = g_strdup(parsed[0]); |
3374 | 332 } |
3392 | 333 g_strfreev(parsed); |
3374 | 334 } |
335 fclose(fp); | |
336 return; | |
337 } | |
338 | |
339 void options(GtkWidget *widget, gpointer data) { | |
3710 | 340 gint option = GPOINTER_TO_INT(data); |
3374 | 341 |
342 if (option == 0) | |
3392 | 343 choice ^= NOTIFY_FOCUS; |
3374 | 344 else if (option == 1) |
3710 | 345 choice ^= NOTIFY_CLICK; |
346 else if (option == 2) | |
3392 | 347 choice ^= NOTIFY_TYPE; |
3710 | 348 else if (option == 3) { |
3374 | 349 method ^= METHOD_STRING; |
350 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) | |
351 gtk_widget_set_sensitive(Entry, TRUE); | |
352 else | |
353 gtk_widget_set_sensitive(Entry, FALSE); | |
354 } | |
3710 | 355 else if (option == 4) |
3374 | 356 method ^= METHOD_QUOTE; |
3710 | 357 else if (option == 5) |
3374 | 358 method ^= METHOD_URGENT; |
3710 | 359 else if (option == 6) |
3392 | 360 choice ^= NOTIFY_IN_FOCUS; |
3710 | 361 else if (option == 7) |
3392 | 362 method ^= METHOD_COUNT; |
3710 | 363 else if (option == 8) |
364 type ^= TYPE_IM; | |
365 else if (option == 9) | |
366 type ^= TYPE_CHAT; | |
367 | |
368 save_notify_prefs(); | |
3374 | 369 } |
370 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
371 char *gaim_plugin_init(GModule *hndl) { |
191 | 372 handle = hndl; |
373 | |
3392 | 374 really_evil_hack = gtk_label_new(""); |
375 | |
3374 | 376 load_notify_prefs(); |
377 | |
3710 | 378 gaim_signal_connect(handle, event_im_recv, im_recv_im, NULL); |
379 gaim_signal_connect(handle, event_chat_recv, chat_recv_im, NULL); | |
380 gaim_signal_connect(handle, event_im_send, im_sent_im, NULL); | |
381 gaim_signal_connect(handle, event_chat_send, chat_sent_im, NULL); | |
3374 | 382 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL); |
3710 | 383 gaim_signal_connect(handle, event_chat_join, chat_join, NULL); |
1052
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
384 return NULL; |
191 | 385 } |
386 | |
3392 | 387 void gaim_plugin_remove() { |
388 GList *c = conversations; | |
389 | |
390 gtk_widget_destroy(really_evil_hack); | |
391 | |
392 while (c) { | |
393 struct conversation *cnv = (struct conversation *)c->data; | |
3710 | 394 |
395 un_star(cnv->window, NULL); | |
396 | |
397 c = c->next; | |
3392 | 398 } |
399 } | |
400 | |
3551 | 401 struct gaim_plugin_description desc; |
402 struct gaim_plugin_description *gaim_plugin_desc() { | |
403 desc.api_version = PLUGIN_API_VERSION; | |
404 desc.name = g_strdup("Message Notification"); | |
405 desc.version = g_strdup(VERSION); | |
406 desc.description = g_strdup("Provides a variety of ways of notifying you of unread messages."); | |
407 desc.authors = g_strdup("Etan Reisner <deryni@eden.rutgers.edu>"); | |
408 desc.url = g_strdup(WEBSITE); | |
409 return &desc; | |
410 } | |
411 | |
191 | 412 char *name() { |
413 return "Visual Notification"; | |
414 } | |
415 | |
416 char *description() { | |
417 return "Puts an asterisk in the title bar of all conversations" | |
418 " where you have not responded to a message yet."; | |
419 } | |
3374 | 420 |
3565 | 421 GtkWidget *gaim_plugin_config_gtk() { |
422 GtkWidget *ret; | |
423 GtkWidget *vbox, *hbox; | |
424 GtkWidget *toggle; | |
425 ret = gtk_vbox_new(FALSE, 18); | |
426 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3392 | 427 |
3710 | 428 vbox = make_frame(ret, _("Notify For")); |
429 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); | |
430 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
431 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_IM); | |
432 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(7)); | |
433 | |
434 toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows")); | |
435 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
436 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_CHAT); | |
437 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(8)); | |
438 | |
439 /*--------------*/ | |
3565 | 440 vbox = make_frame(ret, _("Notification Methods")); |
441 hbox = gtk_hbox_new(FALSE, 18); | |
442 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
443 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); | |
444 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING); | |
3710 | 445 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3)); |
3565 | 446 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
3374 | 447 Entry = gtk_entry_new_with_max_length(7); |
3565 | 448 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); |
449 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); | |
3392 | 450 gtk_entry_set_text(GTK_ENTRY(Entry), title_string); |
3374 | 451 |
3710 | 452 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title")); |
3565 | 453 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
454 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE); | |
3710 | 455 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4)); |
3374 | 456 |
3565 | 457 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); |
458 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
459 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT); | |
3710 | 460 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(5)); |
3565 | 461 |
3710 | 462 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); |
3565 | 463 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT); |
464 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
3710 | 465 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(7)); |
466 | |
467 toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus")); | |
468 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_IN_FOCUS); | |
469 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
3565 | 470 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(6)); |
3392 | 471 |
3565 | 472 /*--------------*/ |
473 vbox = make_frame(ret, _("Notification Removal")); | |
3710 | 474 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus")); |
3565 | 475 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
476 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS); | |
477 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0)); | |
3374 | 478 |
3710 | 479 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); |
480 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
481 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_CLICK); | |
482 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(1)); | |
483 | |
3565 | 484 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); |
485 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
486 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE); | |
3710 | 487 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2)); |
3565 | 488 |
489 gtk_widget_show_all(ret); | |
490 return ret; | |
3374 | 491 } |