comparison src/gtkblist.c @ 10074:2e225cd35615

[gaim-migrate @ 11054] This is some sound related stuff. Add a "No Sounds" sound method for those who like their Gaim to be really really quiet, switched to using the prefs API for mute_sounds, added a Mute Sounds entry to the buddy list tools menu so those without a system tray icon can use this, and kill off old child sound processes (any older than 15 seconds) which should fix bug #1034209. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 02 Oct 2004 18:53:19 +0000
parents dcdda2857ca8
children f8e2e8ee9aa0
comparison
equal deleted inserted replaced
10073:06fa76a16ac0 10074:2e225cd35615
46 #include "gtklog.h" 46 #include "gtklog.h"
47 #include "gtkpounce.h" 47 #include "gtkpounce.h"
48 #include "gtkprefs.h" 48 #include "gtkprefs.h"
49 #include "gtkprivacy.h" 49 #include "gtkprivacy.h"
50 #include "gtkroomlist.h" 50 #include "gtkroomlist.h"
51 #include "gtksound.h"
51 #include "gtkutils.h" 52 #include "gtkutils.h"
52 53
53 #include "gaim.h" 54 #include "gaim.h"
54 55
55 #include <gdk/gdkkeysyms.h> 56 #include <gdk/gdkkeysyms.h>
1536 if(gtkblist->window->window) { 1537 if(gtkblist->window->window) {
1537 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR); 1538 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
1538 gdk_window_set_cursor(gtkblist->window->window, cursor); 1539 gdk_window_set_cursor(gtkblist->window->window, cursor);
1539 gdk_cursor_unref(cursor); 1540 gdk_cursor_unref(cursor);
1540 } 1541 }
1542 }
1543
1544 static void gaim_gtk_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item)
1545 {
1546 gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(item)->active);
1547 }
1548
1549 static void gaim_gtk_blist_mute_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data)
1550 {
1551 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift,
1552 N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value));
1553 }
1554
1555 static void gaim_gtk_blist_sound_method_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data)
1556 {
1557 gboolean sensitive = TRUE;
1558
1559 if(!strcmp(value, "none"))
1560 sensitive = FALSE;
1561
1562 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive);
1541 } 1563 }
1542 1564
1543 static void 1565 static void
1544 add_buddies_from_vcard(const char *prpl_id, GaimGroup *group, GList *list, 1566 add_buddies_from_vcard(const char *prpl_id, GaimGroup *group, GList *list,
1545 const char *alias) 1567 const char *alias)
2421 { N_("/Tools/A_ccounts"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS }, 2443 { N_("/Tools/A_ccounts"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
2422 { N_("/Tools/_File Transfers"), "<CTL>T", gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, 2444 { N_("/Tools/_File Transfers"), "<CTL>T", gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER },
2423 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, NULL }, 2445 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, NULL },
2424 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES }, 2446 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
2425 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, NULL }, 2447 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, NULL },
2448 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>"},
2426 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" }, 2449 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
2427 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, NULL }, 2450 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, NULL },
2428 2451
2429 /* Help */ 2452 /* Help */
2430 { N_("/_Help"), NULL, NULL, 0, "<Branch>" }, 2453 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
3297 */ 3320 */
3298 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Offline Buddies"))), 3321 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Offline Buddies"))),
3299 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")); 3322 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
3300 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Empty Groups"))), 3323 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Empty Groups"))),
3301 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups")); 3324 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
3325 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))),
3326 gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
3327 if(!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"))
3328 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE);
3302 3329
3303 /* OK... let's show this bad boy. */ 3330 /* OK... let's show this bad boy. */
3304 gaim_gtk_blist_refresh(list); 3331 gaim_gtk_blist_refresh(list);
3305 gaim_gtk_blist_restore_position(); 3332 gaim_gtk_blist_restore_position();
3306 gtk_widget_show_all(gtkblist->window); 3333 gtk_widget_show_all(gtkblist->window);
3421 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks, 3448 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
3422 GINT_TO_POINTER( 3449 GINT_TO_POINTER(
3423 gaim_prefs_connect_callback("/gaim/gtk/blist/show_warning_level", 3450 gaim_prefs_connect_callback("/gaim/gtk/blist/show_warning_level",
3424 gaim_gtk_blist_update_columns, NULL))); 3451 gaim_gtk_blist_update_columns, NULL)));
3425 3452
3453 /* menus */
3454 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
3455 GINT_TO_POINTER(
3456 gaim_prefs_connect_callback("/gaim/gtk/sound/mute",
3457 gaim_gtk_blist_mute_pref_cb, NULL)));
3458 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
3459 GINT_TO_POINTER(
3460 gaim_prefs_connect_callback("/gaim/gtk/sound/method",
3461 gaim_gtk_blist_sound_method_pref_cb, NULL)));
3462
3426 /* Setup some gaim signal handlers. */ 3463 /* Setup some gaim signal handlers. */
3427 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", 3464 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
3428 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list); 3465 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
3429 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", 3466 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
3430 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list); 3467 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);