Mercurial > pidgin
annotate plugins/notify.c @ 3565:154c4a9d9b6d
[gaim-migrate @ 3660]
Now you can configure your plugins.
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Sat, 28 Sep 2002 21:39:45 +0000 |
| parents | 333551497ff8 |
| children | 03ba413ca20b |
| 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 | |
| 11 /* if my flash messages patch gets merged in can use cnv->local | |
| 12 * to notify on new messages also | |
| 3374 | 13 */ |
| 14 | |
| 191 | 15 #define GAIM_PLUGINS |
| 16 #include "gaim.h" | |
| 17 | |
| 3428 | 18 #include <string.h> |
| 19 #include <ctype.h> | |
| 20 #include <stdlib.h> | |
| 191 | 21 #include <gtk/gtk.h> |
| 3385 | 22 #include <X11/Xlib.h> |
| 3374 | 23 #include <X11/Xutil.h> |
| 3392 | 24 #include <X11/Xatom.h> |
| 3374 | 25 #include <gdk/gdkx.h> |
| 26 | |
| 3392 | 27 guint choice = 1; |
| 28 #define NOTIFY_FOCUS 0x00000001 | |
| 29 #define NOTIFY_TYPE 0x00000002 | |
| 30 #define NOTIFY_IN_FOCUS 0x00000004 | |
| 3374 | 31 |
| 3392 | 32 guint method = 1; |
| 33 #define METHOD_STRING 0x00000001 | |
| 34 #define METHOD_QUOTE 0x00000002 | |
| 35 #define METHOD_URGENT 0x00000004 | |
| 36 #define METHOD_COUNT 0x00000008 | |
| 191 | 37 |
| 38 void *handle; | |
| 3392 | 39 /* 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 | |
| 41 */ | |
| 42 GtkWidget *really_evil_hack; | |
| 43 /* GHashTable *hash = NULL; */ | |
| 3565 | 44 GtkWidget *Entry; |
| 3392 | 45 gchar *title_string = "(*) "; |
| 191 | 46 |
| 3374 | 47 /* predefine some functions, less warnings */ |
| 48 void options(GtkWidget *widget, gpointer data); | |
| 49 void un_star(GtkWidget *widget, gpointer data); | |
| 3511 | 50 int un_star_window(GtkWidget *widget, gpointer data); |
| 3374 | 51 void string_remove(GtkWidget *widget); |
| 3392 | 52 void count_remove(GtkWidget *widget); |
| 3374 | 53 void quote_remove(GtkWidget *widget); |
| 54 void urgent_remove(struct conversation *c); | |
| 3428 | 55 int counter (char *buf, int *length); |
| 3374 | 56 |
| 57 int received_im(struct gaim_connection *gc, char **who, char **what, void *m) { | |
| 191 | 58 char buf[256]; |
| 59 struct conversation *cnv = find_conversation(*who); | |
| 60 GtkWindow *win; | |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
61 char *me = g_strdup(normalize(gc->username)); |
| 3374 | 62 int revert_to_return; |
| 63 Window focus_return; | |
| 3392 | 64 int c, length; |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
65 |
|
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
66 if (!strcmp(me, normalize(*who))) { |
|
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
67 g_free(me); |
| 3374 | 68 return 0; |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
69 } |
|
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
70 g_free(me); |
| 191 | 71 |
| 72 if (cnv == NULL) | |
| 3374 | 73 { |
| 74 if (away_options & OPT_AWAY_QUEUE) | |
| 75 return 0; | |
| 1835 | 76 |
| 3374 | 77 cnv = new_conversation(*who); |
| 78 } | |
| 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 */ | |
| 3374 | 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)); | |
| 116 hints->flags |= XUrgencyHint; | |
| 117 XSetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window), hints); | |
| 118 } | |
| 119 } | |
| 120 | |
| 121 return 0; | |
| 122 } | |
| 123 | |
| 124 int sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { | |
| 3428 | 125 /* char buf[256]; */ |
| 3374 | 126 struct conversation *c = find_conversation(who); |
| 127 | |
| 128 if (method & METHOD_QUOTE) | |
| 3392 | 129 quote_remove(c->window); |
| 130 if (method & METHOD_COUNT) | |
| 131 count_remove(c->window); | |
| 3374 | 132 if (method & METHOD_STRING) |
| 3392 | 133 string_remove(c->window); |
| 3374 | 134 if (method & METHOD_URGENT) |
| 135 urgent_remove(c); | |
| 136 return 0; | |
| 137 } | |
| 138 | |
| 139 int new_conv(char *who) { | |
| 140 struct conversation *c = find_conversation(who); | |
| 141 | |
| 3392 | 142 /* g_hash_table_insert(hash, who, GINT_TO_POINTER(choice)); */ |
| 143 | |
| 144 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)); | |
| 3374 | 146 gtk_object_set_user_data(GTK_OBJECT(c->window), c); |
| 147 } | |
| 148 else { | |
| 3392 | 149 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "button_press_event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack)); |
| 3374 | 150 gtk_object_set_user_data(GTK_OBJECT(c->window), c); |
| 3392 | 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)); |
| 3374 | 152 gtk_object_set_user_data(GTK_OBJECT(c->text), c); |
| 3392 | 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)); |
| 3374 | 154 gtk_object_set_user_data(GTK_OBJECT(c->entry), c); |
| 155 } | |
| 156 | |
| 3392 | 157 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)); | |
| 3374 | 159 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c); |
| 191 | 160 } |
| 3428 | 161 return 0; |
| 191 | 162 } |
| 163 | |
| 3374 | 164 void un_star(GtkWidget *widget, gpointer data) { |
| 165 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget)); | |
| 166 | |
| 167 if (method & METHOD_QUOTE) | |
| 168 quote_remove(widget); | |
| 3392 | 169 if (method & METHOD_COUNT) |
| 170 count_remove(widget); | |
| 3374 | 171 if (method & METHOD_STRING) |
| 172 string_remove(widget); | |
| 173 if (method & METHOD_URGENT) | |
| 174 urgent_remove(c); | |
| 175 return; | |
| 176 } | |
| 177 | |
| 3511 | 178 int un_star_window(GtkWidget *widget, gpointer data) { |
| 3374 | 179 GtkWidget *parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); |
| 180 gtk_object_set_user_data(GTK_OBJECT(parent), gtk_object_get_user_data(GTK_OBJECT(widget))); | |
| 181 un_star(parent, data); | |
| 3511 | 182 return 0; |
| 3374 | 183 } |
| 184 | |
| 3392 | 185 /* This function returns the number in [ ]'s or 0 */ |
| 186 int counter (char *buf, int *length) { | |
| 187 char temp[256]; | |
| 188 int i = 1; | |
| 189 *length = 0; | |
| 190 | |
| 191 /* if (buf[0] != '[') */ | |
| 192 /* return (0); */ | |
| 193 | |
| 194 while (isdigit(buf[i]) && i<sizeof(buf)) { | |
| 195 temp[i-1] = buf[i]; | |
| 196 (*length)++; | |
| 197 i++; | |
| 198 } | |
| 199 temp[i] = '\0'; | |
| 200 | |
| 201 if (buf[i] != ']') { | |
| 202 *length = 0; | |
| 203 return (0); | |
| 204 } | |
| 205 | |
| 206 return (atoi(temp)); | |
| 207 } | |
| 208 | |
| 3374 | 209 void string_remove(GtkWidget *widget) { |
| 191 | 210 char buf[256]; |
| 3374 | 211 GtkWindow *win = GTK_WINDOW(widget); |
| 212 | |
| 3392 | 213 strncpy(buf, win->title, sizeof(buf)); |
| 3374 | 214 if (strstr(buf, title_string)) { |
| 215 g_snprintf(buf, sizeof(buf), "%s", &win->title[strlen(title_string)]); | |
| 216 gtk_window_set_title(win, buf); | |
| 217 } | |
| 218 return; | |
| 219 } | |
| 220 | |
| 3392 | 221 void count_remove(GtkWidget *widget) { |
| 222 char buf[256]; | |
| 223 GtkWindow *win = GTK_WINDOW(widget); | |
| 224 int length; | |
| 225 | |
| 226 strncpy(buf, win->title, sizeof(buf)); | |
| 227 if (!g_strncasecmp(buf, "[", 1)) { | |
| 228 counter(buf, &length); | |
| 229 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); | |
| 230 gtk_window_set_title(win, buf); | |
| 231 } | |
| 232 return; | |
| 233 } | |
| 234 | |
| 3374 | 235 void quote_remove(GtkWidget *widget) { |
| 236 char buf[256]; | |
| 237 GtkWindow *win = GTK_WINDOW(widget); | |
| 191 | 238 |
| 3392 | 239 strncpy(buf, win->title, sizeof(buf)); |
| 3374 | 240 if (!g_strncasecmp(buf, "\"", 1)) { |
| 241 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]); | |
| 191 | 242 gtk_window_set_title(win, buf); |
| 243 } | |
| 3374 | 244 return; |
| 245 } | |
| 246 | |
| 247 void urgent_remove(struct conversation *c) { | |
| 248 GdkWindow *win = c->window->window; | |
| 249 | |
| 3428 | 250 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
| 3374 | 251 hints->flags &= ~XUrgencyHint; |
| 3428 | 252 XSetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win), hints); |
| 3374 | 253 return; |
| 254 } | |
| 255 | |
| 256 void save_notify_prefs() { | |
| 3392 | 257 gchar buf[1000]; |
| 3374 | 258 FILE *fp; |
| 259 | |
| 260 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME")); | |
| 261 if (!(fp = fopen(buf, "w"))) { | |
| 3561 | 262 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR); |
| 3374 | 263 return; |
| 264 } | |
| 265 | |
| 3392 | 266 fprintf(fp, "%d=CHOICE\n", choice); |
| 267 fprintf(fp, "%d=METHOD\n", method); | |
| 268 fprintf(fp, "%s=STRING\n", title_string); | |
| 3374 | 269 fclose(fp); |
| 270 } | |
| 271 | |
| 272 void load_notify_prefs() { | |
| 273 gchar buf[1000]; | |
| 274 gchar **parsed; | |
| 275 FILE *fp; | |
| 276 | |
| 277 g_snprintf(buf, sizeof(buf), "%s/.gaim/.notify", getenv("HOME")); | |
| 278 if (!(fp = fopen(buf, "r"))) | |
| 279 return; | |
| 280 | |
| 281 while (fgets(buf, 1000, fp) != NULL) { | |
| 282 parsed = g_strsplit(g_strchomp(buf), "=", 2); | |
| 283 if (parsed[0] && parsed[1]) { | |
| 3392 | 284 if (!strcmp(parsed[1], "CHOICE")) |
| 285 choice = atoi(parsed[0]); | |
| 286 if (!strcmp(parsed[1], "METHOD")) | |
| 287 method = atoi(parsed[0]); | |
| 288 if (!strcmp(parsed[1], "STRING")) | |
| 289 if (title_string != NULL) g_free(title_string); | |
| 290 title_string = g_strdup(parsed[0]); | |
| 3374 | 291 } |
| 3392 | 292 g_strfreev(parsed); |
| 3374 | 293 } |
| 294 fclose(fp); | |
| 295 return; | |
| 296 } | |
| 297 | |
| 298 void options(GtkWidget *widget, gpointer data) { | |
| 299 gint option = GPOINTER_TO_INT(data); | |
| 300 | |
| 301 if (option == 0) | |
| 3392 | 302 choice ^= NOTIFY_FOCUS; |
| 3374 | 303 else if (option == 1) |
| 3392 | 304 choice ^= NOTIFY_TYPE; |
| 3374 | 305 else if (option == 2) { |
| 306 method ^= METHOD_STRING; | |
| 307 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) | |
| 308 gtk_widget_set_sensitive(Entry, TRUE); | |
| 309 else | |
| 310 gtk_widget_set_sensitive(Entry, FALSE); | |
| 311 } | |
| 312 else if (option == 3) | |
| 313 method ^= METHOD_QUOTE; | |
| 314 else if (option == 4) | |
| 315 method ^= METHOD_URGENT; | |
| 3392 | 316 else if (option == 5) |
| 317 choice ^= NOTIFY_IN_FOCUS; | |
| 318 else if (option == 6) | |
| 319 method ^= METHOD_COUNT; | |
| 3374 | 320 } |
| 321 | |
|
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
322 char *gaim_plugin_init(GModule *hndl) { |
| 191 | 323 handle = hndl; |
| 324 | |
| 3392 | 325 really_evil_hack = gtk_label_new(""); |
| 326 /* hash = g_hash_table_new(g_str_hash, g_int_equal); */ | |
| 327 | |
| 3374 | 328 load_notify_prefs(); |
| 329 | |
| 191 | 330 gaim_signal_connect(handle, event_im_recv, received_im, NULL); |
| 331 gaim_signal_connect(handle, event_im_send, sent_im, NULL); | |
| 3374 | 332 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL); |
|
1052
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
333 |
|
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
334 return NULL; |
| 191 | 335 } |
| 336 | |
| 3392 | 337 void gaim_plugin_remove() { |
| 338 GList *c = conversations; | |
| 3428 | 339 /* guint options; */ |
| 3392 | 340 |
| 341 gtk_widget_destroy(really_evil_hack); | |
| 342 | |
| 343 while (c) { | |
| 344 struct conversation *cnv = (struct conversation *)c->data; | |
| 345 /* if (options = GPOINTER_TO_INT(g_hash_table_lookup(hash, cnv->name))) { */ | |
| 346 un_star(cnv->window, NULL); | |
| 347 /* if (options & REMOVE_FOCUS) */ | |
| 348 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->window), GTK_SIGNAL_FUNC(un_star), NULL); */ | |
| 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 } | |
| 359 } | |
| 360 | |
| 3551 | 361 struct gaim_plugin_description desc; |
| 362 struct gaim_plugin_description *gaim_plugin_desc() { | |
| 363 desc.api_version = PLUGIN_API_VERSION; | |
| 364 desc.name = g_strdup("Message Notification"); | |
| 365 desc.version = g_strdup(VERSION); | |
| 366 desc.description = g_strdup("Provides a variety of ways of notifying you of unread messages."); | |
| 367 desc.authors = g_strdup("Etan Reisner <deryni@eden.rutgers.edu>"); | |
| 368 desc.url = g_strdup(WEBSITE); | |
| 369 return &desc; | |
| 370 } | |
| 371 | |
| 191 | 372 char *name() { |
| 373 return "Visual Notification"; | |
| 374 } | |
| 375 | |
| 376 char *description() { | |
| 377 return "Puts an asterisk in the title bar of all conversations" | |
| 378 " where you have not responded to a message yet."; | |
| 379 } | |
| 3374 | 380 |
| 3565 | 381 GtkWidget *gaim_plugin_config_gtk() { |
| 382 GtkWidget *ret; | |
| 383 GtkWidget *vbox, *hbox; | |
| 384 GtkWidget *toggle; | |
| 385 ret = gtk_vbox_new(FALSE, 18); | |
| 386 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
| 3392 | 387 |
| 3565 | 388 vbox = make_frame(ret, _("Notification Methods")); |
| 389 hbox = gtk_hbox_new(FALSE, 18); | |
| 390 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
| 391 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); | |
| 393 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2)); | |
| 394 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); | |
| 3374 | 395 Entry = gtk_entry_new_with_max_length(7); |
| 3565 | 396 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); |
| 397 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); | |
| 3392 | 398 gtk_entry_set_text(GTK_ENTRY(Entry), title_string); |
| 3374 | 399 |
| 3565 | 400 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title.")); |
| 401 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 402 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)); | |
| 3374 | 404 |
| 3565 | 405 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); |
| 406 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 407 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)); | |
| 409 | |
| 410 toggle = gtk_check_button_new_with_mnemonic(_("Insert _count of new messages into window title")); | |
| 411 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT); | |
| 412 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)); | |
| 3392 | 414 |
| 3565 | 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)); | |
| 3392 | 419 |
| 3565 | 420 /*--------------*/ |
| 421 vbox = make_frame(ret, _("Notification Removal")); | |
| 422 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); | |
| 424 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)); | |
| 3374 | 426 |
| 3565 | 427 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); | |
| 429 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)); | |
| 431 | |
| 432 gtk_widget_show_all(ret); | |
| 433 return ret; | |
| 3374 | 434 } |
