plugins/win32/winprefs/winprefs.c

changeset 14250
913f78723213
parent 13770
ae2645f9f109
equal deleted inserted replaced
14249:4b883c522193 14250:913f78723213
50 static const char *PREF_DBLIST_DOCKED = "/plugins/gtk/win32/winprefs/dblist_docked"; 50 static const char *PREF_DBLIST_DOCKED = "/plugins/gtk/win32/winprefs/dblist_docked";
51 static const char *PREF_DBLIST_HEIGHT = "/plugins/gtk/win32/winprefs/dblist_height"; 51 static const char *PREF_DBLIST_HEIGHT = "/plugins/gtk/win32/winprefs/dblist_height";
52 static const char *PREF_DBLIST_SIDE = "/plugins/gtk/win32/winprefs/dblist_side"; 52 static const char *PREF_DBLIST_SIDE = "/plugins/gtk/win32/winprefs/dblist_side";
53 static const char *PREF_BLIST_ON_TOP = "/plugins/gtk/win32/winprefs/blist_on_top"; 53 static const char *PREF_BLIST_ON_TOP = "/plugins/gtk/win32/winprefs/blist_on_top";
54 static const char *PREF_IM_BLINK = "/plugins/gtk/win32/winprefs/im_blink"; 54 static const char *PREF_IM_BLINK = "/plugins/gtk/win32/winprefs/im_blink";
55 static const char *PREF_CHAT_BLINK = "/plugins/gtk/win32/winprefs/chat_blink";
55 56
56 /* Deprecated */ 57 /* Deprecated */
57 static const char *PREF_DBLIST_ON_TOP = "/plugins/gtk/win32/winprefs/dblist_on_top"; 58 static const char *PREF_DBLIST_ON_TOP = "/plugins/gtk/win32/winprefs/dblist_on_top";
58 59
59 static GaimPlugin *handle = NULL; 60 static GaimPlugin *handle = NULL;
315 } 316 }
316 317
317 /* FlashWindowEx is only supported by Win98+ and WinNT5+. If it's 318 /* FlashWindowEx is only supported by Win98+ and WinNT5+. If it's
318 not supported we do it our own way */ 319 not supported we do it our own way */
319 static gboolean 320 static gboolean
320 wgaim_conv_im_blink(GaimAccount *account, const char *who, char **message, 321 wgaim_conv_blink(GaimConversation *conv, int flags)
321 GaimConversation *conv, int flags, void *data)
322 { 322 {
323 GaimGtkWindow *win; 323 GaimGtkWindow *win;
324 GtkWidget *window; 324 GtkWidget *window;
325 325
326 /* Don't flash for our own messages or system messages */ 326 /* Don't flash for our own messages or system messages */
327 if(flags & GAIM_MESSAGE_SEND || flags & GAIM_MESSAGE_SYSTEM) 327 if(flags & GAIM_MESSAGE_SEND || flags & GAIM_MESSAGE_SYSTEM)
328 return FALSE;
329
330 if(!gaim_prefs_get_bool(PREF_IM_BLINK))
331 return FALSE; 328 return FALSE;
332 329
333 if(conv == NULL) { 330 if(conv == NULL) {
334 gaim_debug_info("winprefs", "gar!\n"); 331 gaim_debug_info("winprefs", "gar!\n");
335 return FALSE; 332 return FALSE;
366 } 363 }
367 364
368 return FALSE; 365 return FALSE;
369 } 366 }
370 367
368 static gboolean
369 wgaim_conv_im_blink(GaimAccount *account, const char *who, char **message,
370 GaimConversation *conv, int flags, void *data)
371 {
372 if(!gaim_prefs_get_bool(PREF_IM_BLINK))
373 return FALSE;
374
375 return wgaim_conv_blink(conv, flags);
376
377 }
378
379 static gboolean
380 wgaim_conv_chat_blink(GaimAccount *account, const char *who, char **message,
381 GaimConversation *conv, int flags, void *data)
382 {
383 if(!gaim_prefs_get_bool(PREF_CHAT_BLINK))
384 return FALSE;
385
386 return wgaim_conv_blink(conv, flags);
387 }
388
371 389
372 /* 390 /*
373 * EXPORTED FUNCTIONS 391 * EXPORTED FUNCTIONS
374 */ 392 */
375 393
390 gaim_signal_connect(gaim_gtk_blist_get_handle(), "gtkblist-created", 408 gaim_signal_connect(gaim_gtk_blist_get_handle(), "gtkblist-created",
391 plugin, GAIM_CALLBACK(blist_create_cb), NULL); 409 plugin, GAIM_CALLBACK(blist_create_cb), NULL);
392 410
393 gaim_signal_connect(gaim_gtk_conversations_get_handle(), 411 gaim_signal_connect(gaim_gtk_conversations_get_handle(),
394 "displaying-im-msg", plugin, GAIM_CALLBACK(wgaim_conv_im_blink), 412 "displaying-im-msg", plugin, GAIM_CALLBACK(wgaim_conv_im_blink),
413 NULL);
414
415 gaim_signal_connect(gaim_gtk_conversations_get_handle(),
416 "displaying-chat-msg", plugin, GAIM_CALLBACK(wgaim_conv_chat_blink),
395 NULL); 417 NULL);
396 418
397 gaim_signal_connect((void*)gaim_get_core(), "quitting", plugin, 419 gaim_signal_connect((void*)gaim_get_core(), "quitting", plugin,
398 GAIM_CALLBACK(gaim_quit_cb), NULL); 420 GAIM_CALLBACK(gaim_quit_cb), NULL);
399 421
465 _("Only when docked"), BLIST_TOP_DOCKED, 487 _("Only when docked"), BLIST_TOP_DOCKED,
466 NULL); 488 NULL);
467 489
468 /* Conversations */ 490 /* Conversations */
469 vbox = gaim_gtk_make_frame(ret, _("Conversations")); 491 vbox = gaim_gtk_make_frame(ret, _("Conversations"));
470 gaim_gtk_prefs_checkbox(_("_Flash window when messages are received"), 492 gaim_gtk_prefs_checkbox(_("_Flash window when IMs are received"),
471 PREF_IM_BLINK, vbox); 493 PREF_IM_BLINK, vbox);
494 gaim_gtk_prefs_checkbox(_("_Flash window when chat messages are received"),
495 PREF_CHAT_BLINK, vbox);
472 496
473 gtk_widget_show_all(ret); 497 gtk_widget_show_all(ret);
474 return ret; 498 return ret;
475 } 499 }
476 500
515 gaim_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE); 539 gaim_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE);
516 gaim_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE); 540 gaim_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE);
517 gaim_prefs_add_int(PREF_DBLIST_HEIGHT, 0); 541 gaim_prefs_add_int(PREF_DBLIST_HEIGHT, 0);
518 gaim_prefs_add_int(PREF_DBLIST_SIDE, 0); 542 gaim_prefs_add_int(PREF_DBLIST_SIDE, 0);
519 gaim_prefs_add_bool(PREF_IM_BLINK, TRUE); 543 gaim_prefs_add_bool(PREF_IM_BLINK, TRUE);
544 gaim_prefs_add_bool(PREF_CHAT_BLINK, FALSE);
520 545
521 /* Convert old preferences */ 546 /* Convert old preferences */
522 if(gaim_prefs_exists(PREF_DBLIST_ON_TOP)) { 547 if(gaim_prefs_exists(PREF_DBLIST_ON_TOP)) {
523 gint blist_top = BLIST_TOP_NEVER; 548 gint blist_top = BLIST_TOP_NEVER;
524 if(gaim_prefs_get_bool(PREF_BLIST_ON_TOP)) 549 if(gaim_prefs_get_bool(PREF_BLIST_ON_TOP))

mercurial