comparison plugins/notify.c @ 3710:03ba413ca20b

[gaim-migrate @ 3843] notification in chats (deryni) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 16 Oct 2002 13:42:07 +0000
parents 154c4a9d9b6d
children 4cea75cf291d
comparison
equal deleted inserted replaced
3709:03e58c078917 3710:03ba413ca20b
6 * 6 *
7 * Thanks to Carles Pina i Estany <carles@pinux.info> 7 * Thanks to Carles Pina i Estany <carles@pinux.info>
8 * for count of new messages option 8 * for count of new messages option
9 */ 9 */
10 10
11 /* if my flash messages patch gets merged in can use cnv->local 11 #ifndef GAIM_PLUGINS
12 * to notify on new messages also
13 */
14
15 #define GAIM_PLUGINS 12 #define GAIM_PLUGINS
13 #endif
14
16 #include "gaim.h" 15 #include "gaim.h"
17
18 #include <string.h> 16 #include <string.h>
19 #include <ctype.h> 17 #include <ctype.h>
20 #include <stdlib.h> 18 #include <stdlib.h>
21 #include <gtk/gtk.h> 19 #include <gtk/gtk.h>
22 #include <X11/Xlib.h> 20 #include <X11/Xlib.h>
23 #include <X11/Xutil.h> 21 #include <X11/Xutil.h>
24 #include <X11/Xatom.h> 22 #include <X11/Xatom.h>
25 #include <gdk/gdkx.h> 23 #include <gdk/gdkx.h>
26 24
25 guint type = 1;
26 #define TYPE_IM 0x00000001
27 #define TYPE_CHAT 0x00000002
28
27 guint choice = 1; 29 guint choice = 1;
28 #define NOTIFY_FOCUS 0x00000001 30 #define NOTIFY_FOCUS 0x00000001
29 #define NOTIFY_TYPE 0x00000002 31 #define NOTIFY_TYPE 0x00000002
30 #define NOTIFY_IN_FOCUS 0x00000004 32 #define NOTIFY_IN_FOCUS 0x00000004
33 #define NOTIFY_CLICK 0x00000008
31 34
32 guint method = 1; 35 guint method = 1;
33 #define METHOD_STRING 0x00000001 36 #define METHOD_STRING 0x00000001
34 #define METHOD_QUOTE 0x00000002 37 #define METHOD_QUOTE 0x00000002
35 #define METHOD_URGENT 0x00000004 38 #define METHOD_URGENT 0x00000004
38 void *handle; 41 void *handle;
39 /* I really don't like this but I was having trouble getting any 42 /* I really don't like this but I was having trouble getting any
40 * other way of removing the signal callbacks to work and not crash gaim 43 * other way of removing the signal callbacks to work and not crash gaim
41 */ 44 */
42 GtkWidget *really_evil_hack; 45 GtkWidget *really_evil_hack;
43 /* GHashTable *hash = NULL; */
44 GtkWidget *Entry; 46 GtkWidget *Entry;
45 gchar *title_string = "(*) "; 47 gchar *title_string = "(*) ";
46 48
47 /* predefine some functions, less warnings */ 49 /* predefine some functions, less warnings */
48 void options(GtkWidget *widget, gpointer data); 50 void options(GtkWidget *widget, gpointer data);
52 void count_remove(GtkWidget *widget); 54 void count_remove(GtkWidget *widget);
53 void quote_remove(GtkWidget *widget); 55 void quote_remove(GtkWidget *widget);
54 void urgent_remove(struct conversation *c); 56 void urgent_remove(struct conversation *c);
55 int counter (char *buf, int *length); 57 int counter (char *buf, int *length);
56 58
57 int received_im(struct gaim_connection *gc, char **who, char **what, void *m) { 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;
68
69 cnv = cnv->next;
70 }
71 return NULL;
72 }
73
74 int notify(struct conversation *cnv) {
58 char buf[256]; 75 char buf[256];
59 struct conversation *cnv = find_conversation(*who);
60 GtkWindow *win; 76 GtkWindow *win;
61 char *me = g_strdup(normalize(gc->username));
62 int revert_to_return;
63 Window focus_return; 77 Window focus_return;
64 int c, length; 78 int revert_to_return, c, length;
65
66 if (!strcmp(me, normalize(*who))) {
67 g_free(me);
68 return 0;
69 }
70 g_free(me);
71
72 if (cnv == NULL)
73 {
74 if (away_options & OPT_AWAY_QUEUE)
75 return 0;
76
77 cnv = new_conversation(*who);
78 }
79 79
80 win = (GtkWindow *)cnv->window; 80 win = (GtkWindow *)cnv->window;
81 81
82 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return); 82 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return);
83 83
109 } 109 }
110 if (method & METHOD_URGENT) { 110 if (method & METHOD_URGENT) {
111 /* do it the gdk way for windows compatibility(?) if I can figure it out */ 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 */ 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 */ 113 /* I'll want to pay attention to note on dev.gnome.org though */
114 /* gdk_property_change(win->window, WM_HINTS, WM_HINTS, 32, GDK_PROP_MODE_REPLACE, XUrgencyHint, 1); */ 114 /* gdk_property_change(win->window, WM_HINTS, WM_HINTS, 32, GDK_PROP_MODE_REPLACE, XUrgencyHint, 1); */
115 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window)); 115 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window));
116 hints->flags |= XUrgencyHint; 116 hints->flags |= XUrgencyHint;
117 XSetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window), hints); 117 XSetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window), hints);
118 } 118 }
119 } 119 }
120 120 return 0;
121 return 0; 121 }
122 } 122
123 123 int unnotify(struct conversation *c) {
124 int sent_im(struct gaim_connection *gc, char *who, char **what, void *m) {
125 /* char buf[256]; */
126 struct conversation *c = find_conversation(who);
127
128 if (method & METHOD_QUOTE) 124 if (method & METHOD_QUOTE)
129 quote_remove(c->window); 125 quote_remove(c->window);
130 if (method & METHOD_COUNT) 126 if (method & METHOD_COUNT)
131 count_remove(c->window); 127 count_remove(c->window);
132 if (method & METHOD_STRING) 128 if (method & METHOD_STRING)
134 if (method & METHOD_URGENT) 130 if (method & METHOD_URGENT)
135 urgent_remove(c); 131 urgent_remove(c);
136 return 0; 132 return 0;
137 } 133 }
138 134
139 int new_conv(char *who) { 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) {
140 struct conversation *c = find_conversation(who); 160 struct conversation *c = find_conversation(who);
141 161
142 /* g_hash_table_insert(hash, who, GINT_TO_POINTER(choice)); */ 162 if (c && (type & TYPE_IM))
143 163 unnotify(c);
164 return 0;
165 }
166
167 int attach_signals(struct conversation *c) {
144 if (choice & NOTIFY_FOCUS) { 168 if (choice & NOTIFY_FOCUS) {
145 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "focus-in-event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack)); 169 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "focus-in-event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack));
146 gtk_object_set_user_data(GTK_OBJECT(c->window), c); 170 gtk_object_set_user_data(GTK_OBJECT(c->window), c);
147 } 171 }
148 else { 172
173 if (choice & NOTIFY_CLICK) {
149 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "button_press_event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack)); 174 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "button_press_event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack));
150 gtk_object_set_user_data(GTK_OBJECT(c->window), c); 175 gtk_object_set_user_data(GTK_OBJECT(c->window), c);
151 gtk_signal_connect_while_alive(GTK_OBJECT(c->text), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); 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));
152 gtk_object_set_user_data(GTK_OBJECT(c->text), c); 177 gtk_object_set_user_data(GTK_OBJECT(c->text), c);
153 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); 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));
157 if (choice & NOTIFY_TYPE) { 182 if (choice & NOTIFY_TYPE) {
158 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack)); 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));
159 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c); 184 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c);
160 } 185 }
161 return 0; 186 return 0;
187 }
188
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;
162 } 203 }
163 204
164 void un_star(GtkWidget *widget, gpointer data) { 205 void un_star(GtkWidget *widget, gpointer data) {
165 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget)); 206 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget));
166 207
186 int counter (char *buf, int *length) { 227 int counter (char *buf, int *length) {
187 char temp[256]; 228 char temp[256];
188 int i = 1; 229 int i = 1;
189 *length = 0; 230 *length = 0;
190 231
191 /* if (buf[0] != '[') */
192 /* return (0); */
193
194 while (isdigit(buf[i]) && i<sizeof(buf)) { 232 while (isdigit(buf[i]) && i<sizeof(buf)) {
195 temp[i-1] = buf[i]; 233 temp[i-1] = buf[i];
196 (*length)++; 234 (*length)++;
197 i++; 235 i++;
198 } 236 }
261 if (!(fp = fopen(buf, "w"))) { 299 if (!(fp = fopen(buf, "w"))) {
262 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR); 300 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR);
263 return; 301 return;
264 } 302 }
265 303
304 fprintf(fp, "%d=TYPE\n", type);
266 fprintf(fp, "%d=CHOICE\n", choice); 305 fprintf(fp, "%d=CHOICE\n", choice);
267 fprintf(fp, "%d=METHOD\n", method); 306 fprintf(fp, "%d=METHOD\n", method);
268 fprintf(fp, "%s=STRING\n", title_string); 307 fprintf(fp, "%s=STRING\n", title_string);
269 fclose(fp); 308 fclose(fp);
270 } 309 }
279 return; 318 return;
280 319
281 while (fgets(buf, 1000, fp) != NULL) { 320 while (fgets(buf, 1000, fp) != NULL) {
282 parsed = g_strsplit(g_strchomp(buf), "=", 2); 321 parsed = g_strsplit(g_strchomp(buf), "=", 2);
283 if (parsed[0] && parsed[1]) { 322 if (parsed[0] && parsed[1]) {
323 if (!strcmp(parsed[1], "TYPE"))
324 type = atoi(parsed[0]);
284 if (!strcmp(parsed[1], "CHOICE")) 325 if (!strcmp(parsed[1], "CHOICE"))
285 choice = atoi(parsed[0]); 326 choice = atoi(parsed[0]);
286 if (!strcmp(parsed[1], "METHOD")) 327 if (!strcmp(parsed[1], "METHOD"))
287 method = atoi(parsed[0]); 328 method = atoi(parsed[0]);
288 if (!strcmp(parsed[1], "STRING")) 329 if (!strcmp(parsed[1], "STRING"))
289 if (title_string != NULL) g_free(title_string); 330 if (title_string != NULL) g_free(title_string);
290 title_string = g_strdup(parsed[0]); 331 title_string = g_strdup(parsed[0]);
291 } 332 }
292 g_strfreev(parsed); 333 g_strfreev(parsed);
293 } 334 }
294 fclose(fp); 335 fclose(fp);
295 return; 336 return;
296 } 337 }
297 338
298 void options(GtkWidget *widget, gpointer data) { 339 void options(GtkWidget *widget, gpointer data) {
299 gint option = GPOINTER_TO_INT(data); 340 gint option = GPOINTER_TO_INT(data);
300 341
301 if (option == 0) 342 if (option == 0)
302 choice ^= NOTIFY_FOCUS; 343 choice ^= NOTIFY_FOCUS;
303 else if (option == 1) 344 else if (option == 1)
345 choice ^= NOTIFY_CLICK;
346 else if (option == 2)
304 choice ^= NOTIFY_TYPE; 347 choice ^= NOTIFY_TYPE;
305 else if (option == 2) { 348 else if (option == 3) {
306 method ^= METHOD_STRING; 349 method ^= METHOD_STRING;
307 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) 350 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
308 gtk_widget_set_sensitive(Entry, TRUE); 351 gtk_widget_set_sensitive(Entry, TRUE);
309 else 352 else
310 gtk_widget_set_sensitive(Entry, FALSE); 353 gtk_widget_set_sensitive(Entry, FALSE);
311 } 354 }
312 else if (option == 3) 355 else if (option == 4)
313 method ^= METHOD_QUOTE; 356 method ^= METHOD_QUOTE;
314 else if (option == 4) 357 else if (option == 5)
315 method ^= METHOD_URGENT; 358 method ^= METHOD_URGENT;
316 else if (option == 5) 359 else if (option == 6)
317 choice ^= NOTIFY_IN_FOCUS; 360 choice ^= NOTIFY_IN_FOCUS;
318 else if (option == 6) 361 else if (option == 7)
319 method ^= METHOD_COUNT; 362 method ^= METHOD_COUNT;
363 else if (option == 8)
364 type ^= TYPE_IM;
365 else if (option == 9)
366 type ^= TYPE_CHAT;
367
368 save_notify_prefs();
320 } 369 }
321 370
322 char *gaim_plugin_init(GModule *hndl) { 371 char *gaim_plugin_init(GModule *hndl) {
323 handle = hndl; 372 handle = hndl;
324 373
325 really_evil_hack = gtk_label_new(""); 374 really_evil_hack = gtk_label_new("");
326 /* hash = g_hash_table_new(g_str_hash, g_int_equal); */
327 375
328 load_notify_prefs(); 376 load_notify_prefs();
329 377
330 gaim_signal_connect(handle, event_im_recv, received_im, NULL); 378 gaim_signal_connect(handle, event_im_recv, im_recv_im, NULL);
331 gaim_signal_connect(handle, event_im_send, sent_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);
332 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL); 382 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL);
333 383 gaim_signal_connect(handle, event_chat_join, chat_join, NULL);
334 return NULL; 384 return NULL;
335 } 385 }
336 386
337 void gaim_plugin_remove() { 387 void gaim_plugin_remove() {
338 GList *c = conversations; 388 GList *c = conversations;
339 /* guint options; */
340 389
341 gtk_widget_destroy(really_evil_hack); 390 gtk_widget_destroy(really_evil_hack);
342 391
343 while (c) { 392 while (c) {
344 struct conversation *cnv = (struct conversation *)c->data; 393 struct conversation *cnv = (struct conversation *)c->data;
345 /* if (options = GPOINTER_TO_INT(g_hash_table_lookup(hash, cnv->name))) { */ 394
346 un_star(cnv->window, NULL); 395 un_star(cnv->window, NULL);
347 /* if (options & REMOVE_FOCUS) */ 396
348 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->window), GTK_SIGNAL_FUNC(un_star), NULL); */ 397 c = c->next;
349 /* else { */
350 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->window), GTK_SIGNAL_FUNC(un_star), NULL); */
351 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->text), GTK_SIGNAL_FUNC(un_star_window), NULL); */
352 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->entry), GTK_SIGNAL_FUNC(un_star_window), NULL); */
353 /* } */
354 /* if (options & REMOVE_TYPE) */
355 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->entry), GTK_SIGNAL_FUNC(un_star_window), NULL); */
356 /* } */
357 c = c->next;
358 } 398 }
359 } 399 }
360 400
361 struct gaim_plugin_description desc; 401 struct gaim_plugin_description desc;
362 struct gaim_plugin_description *gaim_plugin_desc() { 402 struct gaim_plugin_description *gaim_plugin_desc() {
383 GtkWidget *vbox, *hbox; 423 GtkWidget *vbox, *hbox;
384 GtkWidget *toggle; 424 GtkWidget *toggle;
385 ret = gtk_vbox_new(FALSE, 18); 425 ret = gtk_vbox_new(FALSE, 18);
386 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); 426 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
387 427
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 /*--------------*/
388 vbox = make_frame(ret, _("Notification Methods")); 440 vbox = make_frame(ret, _("Notification Methods"));
389 hbox = gtk_hbox_new(FALSE, 18); 441 hbox = gtk_hbox_new(FALSE, 18);
390 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); 442 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
391 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); 443 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:"));
392 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING); 444 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING);
393 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2)); 445 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3));
394 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); 446 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0);
395 Entry = gtk_entry_new_with_max_length(7); 447 Entry = gtk_entry_new_with_max_length(7);
396 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); 448 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING);
397 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); 449 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0);
398 gtk_entry_set_text(GTK_ENTRY(Entry), title_string); 450 gtk_entry_set_text(GTK_ENTRY(Entry), title_string);
399 451
400 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title.")); 452 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title"));
401 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); 453 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
402 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE); 454 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE);
403 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3)); 455 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4));
404 456
405 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); 457 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint"));
406 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); 458 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
407 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT); 459 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT);
408 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4)); 460 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(5));
409 461
410 toggle = gtk_check_button_new_with_mnemonic(_("Insert _count of new messages into window title")); 462 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title"));
411 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT); 463 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT);
412 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); 464 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
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);
413 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(6)); 470 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(6));
414
415 toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus."));
416 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_IN_FOCUS);
417 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
418 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(5));
419 471
420 /*--------------*/ 472 /*--------------*/
421 vbox = make_frame(ret, _("Notification Removal")); 473 vbox = make_frame(ret, _("Notification Removal"));
422 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus.")); 474 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus"));
423 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); 475 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
424 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS); 476 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS);
425 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0)); 477 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0));
426 478
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
427 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); 484 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window"));
428 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); 485 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
429 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE); 486 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE);
430 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(1)); 487 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2));
431 488
432 gtk_widget_show_all(ret); 489 gtk_widget_show_all(ret);
433 return ret; 490 return ret;
434 } 491 }