Mercurial > pidgin
comparison plugins/notify.c @ 4203:ec6d0c5e5c23
[gaim-migrate @ 4439]
- Should fix the Urgent hint crash (really this time).
- Fixes the apply to conversations button (count is now kept across
applications).
- Other general cleanups.
Thanks deryni.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sun, 05 Jan 2003 04:36:41 +0000 |
| parents | 59751fe608c5 |
| children | fac89c0d55c2 |
comparison
equal
deleted
inserted
replaced
| 4202:59751fe608c5 | 4203:ec6d0c5e5c23 |
|---|---|
| 8 * Cleaned up code | 8 * Cleaned up code |
| 9 * Added option to notify on click as it's own option | 9 * Added option to notify on click as it's own option |
| 10 * rather then as what happens when on focus isn't clicked | 10 * rather then as what happens when on focus isn't clicked |
| 11 * Added apply button to change the denotification methods for | 11 * Added apply button to change the denotification methods for |
| 12 * open conversation windows | 12 * open conversation windows |
| 13 * Fixed apply to conversations, count now keeps count across applies | |
| 14 * Fixed(?) memory leak, and in the process fixed some stupidities | |
| 15 * Hit enter when done editing the title string entry box to save it | |
| 13 * | 16 * |
| 14 * Thanks to Carles Pina i Estany <carles@pinux.info> | 17 * Thanks to Carles Pina i Estany <carles@pinux.info> |
| 15 * for count of new messages option | 18 * for count of new messages option |
| 16 */ | 19 */ |
| 17 | 20 |
| 47 #define METHOD_URGENT 0x00000004 | 50 #define METHOD_URGENT 0x00000004 |
| 48 #define METHOD_COUNT 0x00000008 | 51 #define METHOD_COUNT 0x00000008 |
| 49 | 52 |
| 50 void *handle; | 53 void *handle; |
| 51 GtkWidget *Entry; | 54 GtkWidget *Entry; |
| 52 gchar *title_string = "(*) "; | 55 gchar *title_string; |
| 56 int Number = 0; | |
| 53 | 57 |
| 54 /* predefine some functions, less warnings */ | 58 /* predefine some functions, less warnings */ |
| 55 void options(GtkWidget *widget, gpointer data); | 59 void options(GtkWidget *widget, gpointer data); |
| 56 void un_star(GtkWidget *widget, gpointer data); | |
| 57 /* this returns an int so that typing events don't get stopped here */ | 60 /* this returns an int so that typing events don't get stopped here */ |
| 58 int un_star_window(GtkWidget *widget, gpointer data); | 61 int un_star(GtkWidget *widget, gpointer data); |
| 59 int counter (char *buf, int *length); | 62 int counter (char *buf, int *length); |
| 60 /*string functions */ | 63 /*string functions */ |
| 61 void string_add(GtkWidget *widget); | 64 void string_add(GtkWidget *widget); |
| 62 gboolean string_remove(GtkWidget *widget); | 65 gboolean string_remove(GtkWidget *widget); |
| 63 /* count functions */ | 66 /* count functions */ |
| 64 void count_add(GtkWidget *widget); | 67 void count_add(GtkWidget *widget, int number); |
| 65 gboolean count_remove(GtkWidget *widget); | 68 gboolean count_remove(GtkWidget *widget); |
| 66 /* quote functions */ | 69 /* quote functions */ |
| 67 void quote_add(GtkWidget *widget); | 70 void quote_add(GtkWidget *widget); |
| 68 gboolean quote_remove(GtkWidget *widget); | 71 gboolean quote_remove(GtkWidget *widget); |
| 69 /* urgent functions */ | 72 /* urgent functions */ |
| 89 Window focus_return; | 92 Window focus_return; |
| 90 int revert_to_return; | 93 int revert_to_return; |
| 91 | 94 |
| 92 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return); | 95 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return); |
| 93 | 96 |
| 94 if ((choice & NOTIFY_IN_FOCUS) || focus_return != GDK_WINDOW_XWINDOW(cnv->window->window)) { | 97 if ((choice & NOTIFY_IN_FOCUS) || |
| 98 focus_return != GDK_WINDOW_XWINDOW(cnv->window->window)) { | |
| 95 if (method & METHOD_STRING) | 99 if (method & METHOD_STRING) |
| 96 string_add(cnv->window); | 100 string_add(cnv->window); |
| 97 if (method & METHOD_COUNT) | 101 if (method & METHOD_COUNT) |
| 98 count_add(cnv->window); | 102 count_add(cnv->window, 0); |
| 99 if (method & METHOD_QUOTE) | 103 if (method & METHOD_QUOTE) |
| 100 quote_add(cnv->window); | 104 quote_add(cnv->window); |
| 101 if (method & METHOD_URGENT) | 105 if (method & METHOD_URGENT) |
| 102 urgent_add(cnv); | 106 urgent_add(cnv); |
| 103 } | 107 } |
| 114 * and if that method is currently selected. | 118 * and if that method is currently selected. |
| 115 * If we did and it is then set option so that it can be re-added */ | 119 * If we did and it is then set option so that it can be re-added */ |
| 116 if (clean || (method & METHOD_QUOTE)) | 120 if (clean || (method & METHOD_QUOTE)) |
| 117 if (quote_remove(c->window) && (method & METHOD_QUOTE)) | 121 if (quote_remove(c->window) && (method & METHOD_QUOTE)) |
| 118 option ^= METHOD_QUOTE; | 122 option ^= METHOD_QUOTE; |
| 123 | |
| 119 if (clean || (method & METHOD_COUNT)) | 124 if (clean || (method & METHOD_COUNT)) |
| 120 if (count_remove(c->window) && (method & METHOD_COUNT)) | 125 if (count_remove(c->window) && (method & METHOD_COUNT)) |
| 121 option ^= METHOD_COUNT; | 126 option ^= METHOD_COUNT; |
| 127 | |
| 122 if (clean || (method & METHOD_STRING)) | 128 if (clean || (method & METHOD_STRING)) |
| 123 if (string_remove(c->window) && (method & METHOD_STRING)) | 129 if (string_remove(c->window) && (method & METHOD_STRING)) |
| 124 option ^= METHOD_STRING; | 130 option ^= METHOD_STRING; |
| 131 | |
| 125 if (clean || (method & METHOD_URGENT)) | 132 if (clean || (method & METHOD_URGENT)) |
| 126 if (urgent_remove(c) && (method & METHOD_URGENT)) | 133 if (urgent_remove(c) && (method & METHOD_URGENT)) |
| 127 option ^= METHOD_URGENT; | 134 option ^= METHOD_URGENT; |
| 135 | |
| 128 return option; | 136 return option; |
| 129 } | 137 } |
| 130 | 138 |
| 131 void chat_recv_im(struct gaim_connection *gc, int id, char **who, char **text) { | 139 void chat_recv_im(struct gaim_connection *gc, int id, char **who, char **text) { |
| 132 struct conversation *c = find_chat(gc, id); | 140 struct conversation *c = find_chat(gc, id); |
| 166 } | 174 } |
| 167 | 175 |
| 168 if (choice & NOTIFY_CLICK) { | 176 if (choice & NOTIFY_CLICK) { |
| 169 g_signal_connect(G_OBJECT(c->window), "button_press_event", G_CALLBACK(un_star), NULL); | 177 g_signal_connect(G_OBJECT(c->window), "button_press_event", G_CALLBACK(un_star), NULL); |
| 170 | 178 |
| 171 g_signal_connect(G_OBJECT(c->text), "button_press_event", G_CALLBACK(un_star_window), NULL); | 179 g_signal_connect_swapped(G_OBJECT(c->text), "button_press_event", G_CALLBACK(un_star), G_OBJECT(c->window)); |
| 172 | 180 |
| 173 g_signal_connect(G_OBJECT(c->entry), "button_press_event", G_CALLBACK(un_star_window), NULL); | 181 g_signal_connect_swapped(G_OBJECT(c->entry), "button_press_event", G_CALLBACK(un_star), G_OBJECT(c->window)); |
| 174 } | 182 } |
| 175 | 183 |
| 176 if (choice & NOTIFY_TYPE) { | 184 if (choice & NOTIFY_TYPE) { |
| 177 g_signal_connect(G_OBJECT(c->entry), "key-press-event", G_CALLBACK(un_star_window), NULL); | 185 g_signal_connect_swapped(G_OBJECT(c->entry), "key-press-event", G_CALLBACK(un_star), G_OBJECT(c->window)); |
| 178 } | 186 } |
| 179 | 187 |
| 180 g_object_set_data(G_OBJECT(c->window), "user_data", c); | 188 g_object_set_data(G_OBJECT(c->window), "user_data", c); |
| 181 g_object_set_data(G_OBJECT(c->window), "notify_data", GUINT_TO_POINTER(choice)); | 189 g_object_set_data(G_OBJECT(c->window), "notify_data", GUINT_TO_POINTER(choice)); |
| 182 return 0; | 190 return 0; |
| 183 } | 191 } |
| 184 | 192 |
| 193 void detach_signals(struct conversation *c) { | |
| 194 guint options = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(c->window), "notify_data")); | |
| 195 | |
| 196 if (options & NOTIFY_FOCUS) { | |
| 197 g_signal_handlers_disconnect_by_func(G_OBJECT(c->window), un_star, NULL); | |
| 198 } | |
| 199 if (options & NOTIFY_CLICK) { | |
| 200 g_signal_handlers_disconnect_by_func(G_OBJECT(c->window), un_star, NULL); | |
| 201 g_signal_handlers_disconnect_by_func(G_OBJECT(c->text), un_star, c->window); | |
| 202 g_signal_handlers_disconnect_by_func(G_OBJECT(c->entry), un_star, c->window); | |
| 203 } | |
| 204 | |
| 205 if (options & NOTIFY_TYPE) { | |
| 206 g_signal_handlers_disconnect_by_func(G_OBJECT(c->entry), un_star, c->window); | |
| 207 } | |
| 208 } | |
| 209 | |
| 185 void new_conv(char *who) { | 210 void new_conv(char *who) { |
| 186 struct conversation *c = find_conversation(who); | 211 struct conversation *c = find_conversation(who); |
| 187 | 212 |
| 188 if (c && (type & TYPE_IM)) | 213 if (c && (type & TYPE_IM)) |
| 189 attach_signals(c); | 214 attach_signals(c); |
| 196 if (c && (type & TYPE_CHAT)) | 221 if (c && (type & TYPE_CHAT)) |
| 197 attach_signals(c); | 222 attach_signals(c); |
| 198 return; | 223 return; |
| 199 } | 224 } |
| 200 | 225 |
| 201 void un_star(GtkWidget *widget, gpointer data) { | 226 int un_star(GtkWidget *widget, gpointer data) { |
| 202 struct conversation *c = g_object_get_data(G_OBJECT(widget), "user_data"); | 227 struct conversation *c = g_object_get_data(G_OBJECT(widget), "user_data"); |
| 203 | 228 |
| 204 if (method & METHOD_QUOTE) | 229 if (method & METHOD_QUOTE) |
| 205 quote_remove(widget); | 230 quote_remove(widget); |
| 206 if (method & METHOD_COUNT) | 231 if (method & METHOD_COUNT) |
| 207 count_remove(widget); | 232 count_remove(widget); |
| 208 if (method & METHOD_STRING) | 233 if (method & METHOD_STRING) |
| 209 string_remove(widget); | 234 string_remove(widget); |
| 210 if (c && method & METHOD_URGENT) | 235 if (c && method & METHOD_URGENT) |
| 211 urgent_remove(c); | 236 urgent_remove(c); |
| 212 return; | |
| 213 } | |
| 214 | |
| 215 int un_star_window(GtkWidget *widget, gpointer data) { | |
| 216 GtkWidget *parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); | |
| 217 un_star(parent, data); | |
| 218 /* return 0 so that the event continues to propagate */ | |
| 219 return 0; | 237 return 0; |
| 220 } | 238 } |
| 221 | 239 |
| 222 /* This function returns the number in [ ]'s or 0 */ | 240 /* This function returns the number in [ ]'s or 0 */ |
| 223 int counter (char *buf, int *length) { | 241 int counter (char *buf, int *length) { |
| 262 return TRUE; | 280 return TRUE; |
| 263 } | 281 } |
| 264 return FALSE; | 282 return FALSE; |
| 265 } | 283 } |
| 266 | 284 |
| 267 void count_add(GtkWidget *widget) { | 285 void count_add(GtkWidget *widget, int number) { |
| 268 char buf[256]; | 286 char buf[256]; |
| 269 int c, length; | 287 int c, length; |
| 270 GtkWindow *win = GTK_WINDOW(widget); | 288 GtkWindow *win = GTK_WINDOW(widget); |
| 271 | 289 |
| 272 strncpy(buf, win->title, sizeof(buf)); | 290 strncpy(buf, win->title, sizeof(buf)); |
| 273 c = counter(buf, &length); | 291 c = counter(buf, &length); |
| 274 if (!c) { | 292 if (number) { |
| 293 g_snprintf(buf, sizeof(buf), "[%d] %s", number, win->title); | |
| 294 } else if (!c) { | |
| 275 g_snprintf(buf, sizeof(buf), "[1] %s", win->title); | 295 g_snprintf(buf, sizeof(buf), "[1] %s", win->title); |
| 276 } | 296 } else if (!g_strncasecmp(buf, "[", 1)) { |
| 277 else if (!g_strncasecmp(buf, "[", 1)) { | |
| 278 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]); | 297 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]); |
| 279 } | 298 } |
| 280 gtk_window_set_title(win, buf); | 299 gtk_window_set_title(win, buf); |
| 281 } | 300 } |
| 282 | 301 |
| 285 GtkWindow *win = GTK_WINDOW(widget); | 304 GtkWindow *win = GTK_WINDOW(widget); |
| 286 int length; | 305 int length; |
| 287 | 306 |
| 288 strncpy(buf, win->title, sizeof(buf)); | 307 strncpy(buf, win->title, sizeof(buf)); |
| 289 if (!g_strncasecmp(buf, "[", 1)) { | 308 if (!g_strncasecmp(buf, "[", 1)) { |
| 290 counter(buf, &length); | 309 Number = counter(buf, &length); |
| 291 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); | 310 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); |
| 292 gtk_window_set_title(win, buf); | 311 gtk_window_set_title(win, buf); |
| 293 return TRUE; | 312 return TRUE; |
| 294 } | 313 } |
| 295 return FALSE; | 314 return FALSE; |
| 324 hints->flags |= XUrgencyHint; | 343 hints->flags |= XUrgencyHint; |
| 325 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); | 344 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); |
| 326 } | 345 } |
| 327 | 346 |
| 328 gboolean urgent_remove(struct conversation *c) { | 347 gboolean urgent_remove(struct conversation *c) { |
| 329 GdkWindow *win = c->window->window; | 348 if ((c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW)) || (!c->is_chat && (im_options & OPT_IM_ONE_WINDOW))) { |
| 330 | 349 if (c->is_chat) { |
| 331 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); | 350 struct conversation *c = (struct conversation *)chats->data; |
| 332 if (hints->flags & XUrgencyHint) { | 351 GdkWindow *win = c->window->window; |
| 333 hints->flags &= ~XUrgencyHint; | 352 |
| 334 XSetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win), hints); | 353 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); |
| 335 return TRUE; | 354 if (hints->flags & XUrgencyHint) { |
| 336 } | 355 hints->flags &= ~XUrgencyHint; |
| 337 return FALSE; | 356 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); |
| 357 return TRUE; | |
| 358 } | |
| 359 return FALSE; | |
| 360 } else { | |
| 361 struct conversation *c = (struct conversation *)conversations->data; | |
| 362 GdkWindow *win = c->window->window; | |
| 363 | |
| 364 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win)); | |
| 365 if (hints->flags & XUrgencyHint) { | |
| 366 hints->flags &= ~XUrgencyHint; | |
| 367 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); | |
| 368 return TRUE; | |
| 369 } | |
| 370 return FALSE; | |
| 371 } | |
| 372 } else { | |
| 373 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window)); | |
| 374 if (hints->flags & XUrgencyHint) { | |
| 375 hints->flags &= ~XUrgencyHint; | |
| 376 XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints); | |
| 377 return TRUE; | |
| 378 } | |
| 379 return FALSE; | |
| 380 } | |
| 338 } | 381 } |
| 339 | 382 |
| 340 void save_notify_prefs() { | 383 void save_notify_prefs() { |
| 341 gchar buf[1000]; | 384 gchar buf[1000]; |
| 342 FILE *fp; | 385 FILE *fp; |
| 370 type = atoi(parsed[0]); | 413 type = atoi(parsed[0]); |
| 371 if (!strcmp(parsed[1], "CHOICE")) | 414 if (!strcmp(parsed[1], "CHOICE")) |
| 372 choice = atoi(parsed[0]); | 415 choice = atoi(parsed[0]); |
| 373 if (!strcmp(parsed[1], "METHOD")) | 416 if (!strcmp(parsed[1], "METHOD")) |
| 374 method = atoi(parsed[0]); | 417 method = atoi(parsed[0]); |
| 375 if (!strcmp(parsed[1], "STRING")) | 418 if (!strcmp(parsed[1], "STRING")) { |
| 376 if (title_string != NULL) g_free(title_string); | 419 if (title_string != NULL) |
| 377 title_string = g_strdup(parsed[0]); | 420 g_free(title_string); |
| 421 title_string = g_strdup(parsed[0]); | |
| 422 } | |
| 378 } | 423 } |
| 379 g_strfreev(parsed); | 424 g_strfreev(parsed); |
| 380 } | 425 } |
| 381 fclose(fp); | 426 fclose(fp); |
| 382 return; | 427 return; |
| 408 method ^= METHOD_COUNT; | 453 method ^= METHOD_COUNT; |
| 409 else if (option == 8) | 454 else if (option == 8) |
| 410 type ^= TYPE_IM; | 455 type ^= TYPE_IM; |
| 411 else if (option == 9) | 456 else if (option == 9) |
| 412 type ^= TYPE_CHAT; | 457 type ^= TYPE_CHAT; |
| 458 else if (option == 10) { | |
| 459 /* I made an option for this as at least a way to have it save correctly | |
| 460 * I'd much rather there were better ways, and I don't want to save this | |
| 461 * no matter which pref is changed, that's too much of a hack */ | |
| 462 if (title_string != NULL) { | |
| 463 g_free(title_string); | |
| 464 title_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(Entry))); | |
| 465 } | |
| 466 } | |
| 413 | 467 |
| 414 save_notify_prefs(); | 468 save_notify_prefs(); |
| 415 } | 469 } |
| 416 | 470 |
| 417 void apply_options(GtkWidget *widget, gpointer data) { | 471 void apply_options(GtkWidget *widget, gpointer data) { |
| 418 GList *cnv = conversations; | 472 GList *cnv = conversations; |
| 419 | 473 |
| 420 while (cnv) { | 474 while (cnv) { |
| 421 guint notification; | 475 guint notification; |
| 422 struct conversation *c = (struct conversation *) cnv->data; | 476 struct conversation *c = (struct conversation *) cnv->data; |
| 423 guint options = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(c->window), "notify_data")); | 477 |
| 424 | 478 /* remove old notification signals */ |
| 425 if (options & NOTIFY_FOCUS) | 479 detach_signals(c); |
| 426 g_signal_handlers_disconnect_by_func(G_OBJECT(c->window), un_star, NULL); | 480 |
| 427 | |
| 428 if (options & NOTIFY_CLICK) { | |
| 429 g_signal_handlers_disconnect_by_func(G_OBJECT(c->window), un_star, NULL); | |
| 430 g_signal_handlers_disconnect_by_func(G_OBJECT(c->text), un_star_window, NULL); | |
| 431 g_signal_handlers_disconnect_by_func(G_OBJECT(c->entry), un_star_window, NULL); | |
| 432 } | |
| 433 | |
| 434 if (options & NOTIFY_TYPE) | |
| 435 g_signal_handlers_disconnect_by_func(G_OBJECT(c->entry), un_star_window, NULL); | |
| 436 | |
| 437 /* works except for count, always get reset to [1] */ | |
| 438 /* clean off all notification markings */ | 481 /* clean off all notification markings */ |
| 439 notification = unnotify(c, TRUE); | 482 notification = unnotify(c, TRUE); |
| 483 | |
| 440 /* re-add appropriate notification methods cleaned above */ | 484 /* re-add appropriate notification methods cleaned above */ |
| 441 if (notification & METHOD_STRING) /* re-add string */ | 485 if (notification & METHOD_STRING) /* re-add string */ |
| 442 string_add(c->window); | 486 string_add(c->window); |
| 443 if (notification & METHOD_QUOTE) /* re-add quote */ | 487 if (notification & METHOD_QUOTE) /* re-add quote */ |
| 444 quote_add(c->window); | 488 quote_add(c->window); |
| 445 if (notification & METHOD_COUNT) /* re-add count */ | 489 if (notification & METHOD_COUNT) /* re-add count */ |
| 446 count_add(c->window); | 490 count_add(c->window, Number); |
| 447 if (notification & METHOD_URGENT) /* re-add urgent */ | 491 if (notification & METHOD_URGENT) /* re-add urgent */ |
| 448 urgent_add(c); | 492 urgent_add(c); |
| 493 | |
| 449 /* attach new unnotification signals */ | 494 /* attach new unnotification signals */ |
| 450 attach_signals(c); | 495 attach_signals(c); |
| 451 | 496 |
| 452 cnv = cnv->next; | 497 cnv = cnv->next; |
| 453 } | 498 } |
| 455 return; | 500 return; |
| 456 } | 501 } |
| 457 | 502 |
| 458 char *gaim_plugin_init(GModule *hndl) { | 503 char *gaim_plugin_init(GModule *hndl) { |
| 459 handle = hndl; | 504 handle = hndl; |
| 505 title_string = g_strdup("(*) "); | |
| 460 | 506 |
| 461 load_notify_prefs(); | 507 load_notify_prefs(); |
| 462 | 508 |
| 463 gaim_signal_connect(handle, event_im_recv, im_recv_im, NULL); | 509 gaim_signal_connect(handle, event_im_recv, im_recv_im, NULL); |
| 464 gaim_signal_connect(handle, event_chat_recv, chat_recv_im, NULL); | 510 gaim_signal_connect(handle, event_chat_recv, chat_recv_im, NULL); |
| 472 void gaim_plugin_remove() { | 518 void gaim_plugin_remove() { |
| 473 GList *c = conversations; | 519 GList *c = conversations; |
| 474 | 520 |
| 475 while (c) { | 521 while (c) { |
| 476 struct conversation *cnv = (struct conversation *)c->data; | 522 struct conversation *cnv = (struct conversation *)c->data; |
| 523 | |
| 524 detach_signals(cnv); | |
| 477 un_star(cnv->window, NULL); | 525 un_star(cnv->window, NULL); |
| 526 | |
| 478 c = c->next; | 527 c = c->next; |
| 479 } | 528 } |
| 529 | |
| 530 /* this might be a hack I'm not sure, I don't think so but... */ | |
| 531 g_free(title_string); | |
| 480 } | 532 } |
| 481 | 533 |
| 482 struct gaim_plugin_description desc; | 534 struct gaim_plugin_description desc; |
| 483 struct gaim_plugin_description *gaim_plugin_desc() { | 535 struct gaim_plugin_description *gaim_plugin_desc() { |
| 484 desc.api_version = PLUGIN_API_VERSION; | 536 desc.api_version = PLUGIN_API_VERSION; |
| 508 | 560 |
| 509 vbox = make_frame(ret, _("Notify For")); | 561 vbox = make_frame(ret, _("Notify For")); |
| 510 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); | 562 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 511 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 563 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 512 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_IM); | 564 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_IM); |
| 513 g_signal_connect(GTK_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(7)); | 565 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(8)); |
| 514 | 566 |
| 515 toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows")); | 567 toggle = gtk_check_button_new_with_mnemonic(_("_Chat windows")); |
| 516 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 568 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 517 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_CHAT); | 569 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), type & TYPE_CHAT); |
| 518 g_signal_connect(GTK_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(8)); | 570 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(9)); |
| 519 | 571 |
| 520 /*--------------*/ | 572 /*--------------*/ |
| 521 vbox = make_frame(ret, _("Notification Methods")); | 573 vbox = make_frame(ret, _("Notification Methods")); |
| 522 hbox = gtk_hbox_new(FALSE, 18); | 574 hbox = gtk_hbox_new(FALSE, 18); |
| 523 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 575 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 524 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); | 576 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title (hit enter to save):")); |
| 525 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING); | 577 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING); |
| 526 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(3)); | 578 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(3)); |
| 527 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); | 579 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 528 Entry = gtk_entry_new_with_max_length(7); | 580 Entry = gtk_entry_new(); |
| 581 gtk_entry_set_max_length(GTK_ENTRY(Entry), 10); | |
| 529 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); | 582 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); |
| 530 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); | 583 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); |
| 531 gtk_entry_set_text(GTK_ENTRY(Entry), title_string); | 584 gtk_entry_set_text(GTK_ENTRY(Entry), title_string); |
| 585 g_signal_connect(G_OBJECT(Entry), "activate", G_CALLBACK(options), GINT_TO_POINTER(10)); | |
| 532 | 586 |
| 533 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title")); | 587 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title")); |
| 534 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 588 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 535 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE); | 589 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE); |
| 536 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(4)); | 590 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(options), GINT_TO_POINTER(4)); |
