pidgin/pidgin

remove the old sound api

2020-08-13, Gary Kramlich
6748a5ec6644
Parents 2ebcb8eb5c01
Children 09975c2082c5
remove the old sound api

Remove all traces of the old sound api from pidgin

Remove all traces of the old sound api from finch

Remove all references to the old sound api from libpurple

Remove the old sound files

Update ChangeLog.API for all the removals

Testing Done:

Compile tested finch. Ran pidgin, verified the preferences window works, the pounce window dies on something talkatu related but that will be addressed separately.

Reviewed at https://reviews.imfreedom.org/r/58/
--- a/ChangeLog.API Thu Aug 13 21:10:22 2020 -0500
+++ b/ChangeLog.API Thu Aug 13 22:03:41 2020 -0500
@@ -449,6 +449,38 @@
* purple_quotedp_decode. See the GMime library if needed.
* purple_request_certificate
* purple_request_field_list_add
+ * PurpleSoundUiOps
+ * PurpleSoundStatus
+ * PURPLE_SOUND_STATUS_AVAILABLE
+ * PURPLE_SOUND_STATUS_AWAY
+ * PURPLE_SOUND_STATUS_ALWAYS
+ * PurpleSoundEventID
+ * PURPLE_SOUND_BUDDY_ARRIVE
+ * PURPLE_SOUND_BUDDY_LEAVE
+ * PURPLE_SOUND_RECEIVE
+ * PURPLE_SOUND_FIRST_RECEIVE
+ * PURPLE_SOUND_SEND
+ * PURPLE_SOUND_CHAT_JOIN
+ * PURPLE_SOUND_CHAT_LEAVE
+ * PURPLE_SOUND_CHAT_YOU_SAY
+ * PURPLE_SOUND_CHAT_SAY
+ * PURPLE_SOUND_POUNCE_DEFAULT
+ * PURPLE_SOUND_CHAT_NICK
+ * PURPLE_SOUND_GOT_ATTENTION
+ * purple_sound_ui_ops_get_type
+ * purple_sound_play_file
+ * purple_sound_play_event
+ * purple_sound_set_ui_ops
+ * purple_sound_get_ui_ops
+ * purple_sound_init
+ * purple_sound_uninit
+ * purple_sounds_get_handle
+ * purple_sound_theme_get_type
+ * purple_sound_theme_get_file
+ * purple_sound_theme_get_file_full
+ * purple_sound_theme_set_file
+ * purple_sound_theme_loader_get_type
+ * PURPLE_NUM_SOUNDS
* purple_srv_cancel
* purple_srv_resolve_account
* purple_srv_txt_query_destroy
@@ -607,6 +639,11 @@
* pidgin_mini_dialog_links_supported
* pidgin_set_custom_buddy_icon
* pidgin_setup_screenname_autocomplete_with_filter
+ * pidgin_sound_get_event_label
+ * pidgin_sound_get_event_option
+ * pidgin_sound_get_handle
+ * pidgin_sound_get_ui_ops
+ * pidgin_sound_is_customized
* pidgin_toggle_sensitive, pidgin_toggle_sensitive_array, and
pidgin_toggle_showhide; use g_object_bind_property instead
* struct _GtkIMHtmlAnimation
@@ -628,6 +665,14 @@
* gnt_ui_init renamed to finch_ui_init
* gnt_ui_uninit renamed to finch_ui_uninit
+ Removed:
+ * finch_sound_get_active_profile
+ * finch_sound_get_profiles
+ * finch_sound_get_ui_ops
+ * finch_sound_is_enabled
+ * finch_sound_set_active_profile
+ * finch_sounds_show_all
+
libgnt:
Changed:
* ENTRY_CHAR renamed to GNT_ENTRY_CHAR
--- a/finch/gntconv.c Thu Aug 13 21:10:22 2020 -0500
+++ b/finch/gntconv.c Thu Aug 13 22:03:41 2020 -0500
@@ -39,7 +39,6 @@
#include "gntpounce.h"
#include "gntprefs.h"
#include "gntrequest.h"
-#include "gntsound.h"
#include "gntstatus.h"
#include "gnt.h"
@@ -70,13 +69,6 @@
static int color_message_action;
static int color_timestamp;
-static PurpleBuddy *
-find_buddy_for_conversation(PurpleConversation *conv)
-{
- return purple_blist_find_buddy(purple_conversation_get_account(conv),
- purple_conversation_get_name(conv));
-}
-
static PurpleChat *
find_chat_for_conversation(PurpleConversation *conv)
{
@@ -84,21 +76,6 @@
purple_conversation_get_name(conv));
}
-static PurpleBlistNode *
-get_conversation_blist_node(PurpleConversation *conv)
-{
- PurpleBlistNode *node = NULL;
-
- if (PURPLE_IS_IM_CONVERSATION(conv)) {
- node = (PurpleBlistNode*)find_buddy_for_conversation(conv);
- node = node ? purple_blist_node_get_parent(node) : NULL;
- } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
- node = (PurpleBlistNode*)find_chat_for_conversation(conv);
- }
-
- return node;
-}
-
static void
send_typing_notification(GntWidget *w, FinchConv *ggconv)
{
@@ -502,16 +479,6 @@
}
static void
-toggle_sound_cb(GntMenuItem *item, gpointer ggconv)
-{
- FinchConv *fc = ggconv;
- PurpleBlistNode *node = get_conversation_blist_node(fc->active_conv);
- fc->flags ^= FINCH_CONV_NO_SOUND;
- if (node)
- purple_blist_node_set_bool(node, "gnt-mute-sound", !!(fc->flags & FINCH_CONV_NO_SOUND));
-}
-
-static void
send_to_cb(GntMenuItem *m, gpointer n)
{
PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account");
@@ -693,12 +660,6 @@
gnt_menu_add_item(GNT_MENU(sub), item);
gnt_menuitem_set_callback(item, toggle_logging_cb, ggc);
- item = gnt_menuitem_check_new(_("Enable Sounds"));
- gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
- !(ggc->flags & FINCH_CONV_NO_SOUND));
- gnt_menu_add_item(GNT_MENU(sub), item);
- gnt_menuitem_set_callback(item, toggle_sound_cb, ggc);
-
item = gnt_menuitem_new(_("Plugins"));
gnt_menu_add_item(GNT_MENU(menu), item);
ggc->plugins = item;
@@ -889,11 +850,6 @@
if (PURPLE_IS_IM_CONVERSATION(conv))
g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc);
- convnode = get_conversation_blist_node(conv);
- if ((convnode && purple_blist_node_get_bool(convnode, "gnt-mute-sound")) ||
- !finch_sound_is_enabled())
- ggc->flags |= FINCH_CONV_NO_SOUND;
-
gg_create_menu(ggc);
gg_setup_commands(ggc, FALSE);
--- a/finch/gntpounce.c Thu Aug 13 21:10:22 2020 -0500
+++ b/finch/gntpounce.c Thu Aug 13 22:03:41 2020 -0500
@@ -78,7 +78,6 @@
GntWidget *send_msg_entry;
GntWidget *exec_cmd;
GntWidget *exec_cmd_entry;
- GntWidget *play_sound;
GntWidget *save_pounce;
@@ -250,8 +249,6 @@
gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->send_msg)));
purple_pounce_action_set_enabled(dialog->pounce, "execute-command",
gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->exec_cmd)));
- purple_pounce_action_set_enabled(dialog->pounce, "play-beep",
- gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->play_sound)));
purple_pounce_action_set_attribute(dialog->pounce, "send-message",
"message", message);
@@ -269,8 +266,6 @@
gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->send_msg)));
purple_prefs_set_bool("/finch/pounces/default_actions/execute-command",
gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->exec_cmd)));
- purple_prefs_set_bool("/finch/pounces/default_actions/play-beep",
- gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->play_sound)));
purple_pounce_set_save(dialog->pounce,
gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->save_pounce)));
@@ -422,7 +417,6 @@
dialog->popup = gnt_check_box_new(_("Pop up a notification"));
dialog->send_msg = gnt_check_box_new(_("Send a message"));
dialog->exec_cmd = gnt_check_box_new(_("Execute a command"));
- dialog->play_sound = gnt_check_box_new(_("Play a sound"));
dialog->send_msg_entry = gnt_entry_new(NULL);
dialog->exec_cmd_entry = gnt_entry_new(NULL);
@@ -444,9 +438,6 @@
gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd);
gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd_entry);
gnt_box_add_widget(GNT_BOX(window), hbox);
- hbox = gnt_hbox_new(FALSE);
- gnt_box_add_widget(GNT_BOX(hbox), dialog->play_sound);
- gnt_box_add_widget(GNT_BOX(window), hbox);
gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE));
gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Options"), GNT_TEXT_FLAG_BOLD));
@@ -517,8 +508,6 @@
purple_pounce_action_is_enabled(cur_pounce, "send-message"));
gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd),
purple_pounce_action_is_enabled(cur_pounce, "execute-command"));
- gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound),
- purple_pounce_action_is_enabled(cur_pounce, "play-beep"));
gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->save_pounce),
purple_pounce_get_save(cur_pounce));
@@ -595,8 +584,6 @@
purple_prefs_get_bool("/finch/pounces/default_actions/send-message"));
gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd),
purple_prefs_get_bool("/finch/pounces/default_actions/execute-command"));
- gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound),
- purple_prefs_get_bool("/finch/pounces/default_actions/play-beep"));
}
gnt_widget_show(window);
--- a/finch/gntsound.c Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1084 +0,0 @@
-/*
- * finch
- *
- * Finch is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include <config.h>
-
-#include <glib/gi18n-lib.h>
-
-#include "finch.h"
-
-#include NCURSES_HEADER
-
-#ifdef _WIN32
-#include <windows.h>
-#include <mmsystem.h>
-#endif
-
-#ifdef USE_GSTREAMER
-#include <gst/gst.h>
-#endif /* USE_GSTREAMER */
-
-#include <purple.h>
-
-#include "gntconv.h"
-
-#include "gntbox.h"
-#include "gntwindow.h"
-#include "gntcombobox.h"
-#include "gntlabel.h"
-#include "gntconv.h"
-#include "gntsound.h"
-#include "gntwidget.h"
-#include "gntentry.h"
-#include "gntcheckbox.h"
-#include "gntline.h"
-#include "gnttree.h"
-#include "gntfilesel.h"
-
-typedef struct {
- PurpleSoundEventID id;
- char *label;
- char *pref;
- char *def;
- char *file;
-} FinchSoundEvent;
-
-typedef struct {
- GntWidget *method;
- GntWidget *command;
- GntWidget *conv_focus;
- GntWidget *while_status;
- GntWidget *events;
- GntWidget *window;
- GntWidget *selector;
-
- GntWidget *profiles;
- GntWidget *new_profile;
- gchar * original_profile;
-} SoundPrefDialog;
-
-#define DEFAULT_PROFILE "default"
-
-static SoundPrefDialog *pref_dialog;
-
-#define PLAY_SOUND_TIMEOUT 15000
-
-static guint mute_login_sounds_timeout = 0;
-static gboolean mute_login_sounds = FALSE;
-
-#ifdef USE_GSTREAMER
-static gboolean gst_init_failed;
-#endif /* USE_GSTREAMER */
-
-static FinchSoundEvent sounds[PURPLE_NUM_SOUNDS] = {
- {PURPLE_SOUND_BUDDY_ARRIVE, N_("Buddy logs in"), "login", "login.wav", NULL},
- {PURPLE_SOUND_BUDDY_LEAVE, N_("Buddy logs out"), "logout", "logout.wav", NULL},
- {PURPLE_SOUND_RECEIVE, N_("Message received"), "im_recv", "receive.wav", NULL},
- {PURPLE_SOUND_FIRST_RECEIVE, N_("Message received begins conversation"), "first_im_recv", "receive.wav", NULL},
- {PURPLE_SOUND_SEND, N_("Message sent"), "send_im", "send.wav", NULL},
- {PURPLE_SOUND_CHAT_JOIN, N_("Person enters chat"), "join_chat", "login.wav", NULL},
- {PURPLE_SOUND_CHAT_LEAVE, N_("Person leaves chat"), "left_chat", "logout.wav", NULL},
- {PURPLE_SOUND_CHAT_YOU_SAY, N_("You talk in chat"), "send_chat_msg", "send.wav", NULL},
- {PURPLE_SOUND_CHAT_SAY, N_("Others talk in chat"), "chat_msg_recv", "receive.wav", NULL},
- {PURPLE_SOUND_POUNCE_DEFAULT, NULL, "pounce_default", "alert.wav", NULL},
- {PURPLE_SOUND_CHAT_NICK, N_("Someone says your username in chat"), "nick_said", "alert.wav", NULL},
- {PURPLE_SOUND_GOT_ATTENTION, N_("Attention received"), "got_attention", "alert.wav", NULL}
-};
-
-const char *
-finch_sound_get_active_profile()
-{
- return purple_prefs_get_string(FINCH_PREFS_ROOT "/sound/actprofile");
-}
-
-/* This method creates a pref name based on the current active profile.
- * So if "Home" is the current active profile the pref name
- * [FINCH_PREFS_ROOT "/sound/profiles/Home/$NAME"] is created.
- */
-static gchar *
-make_pref(const char *name)
-{
- static char pref_string[512];
- g_snprintf(pref_string, sizeof(pref_string),
- FINCH_PREFS_ROOT "/sound/profiles/%s%s", finch_sound_get_active_profile(), name);
- return pref_string;
-}
-
-
-static gboolean
-unmute_login_sounds_cb(gpointer data)
-{
- mute_login_sounds = FALSE;
- mute_login_sounds_timeout = 0;
- return FALSE;
-}
-
-static gboolean
-chat_nick_matches_name(PurpleChatConversation *chat, const char *aname)
-{
- char *nick = NULL;
- char *name = NULL;
- gboolean ret = FALSE;
- PurpleAccount *account;
-
- if (chat == NULL)
- return ret;
-
- account = purple_conversation_get_account(PURPLE_CONVERSATION(chat));
- nick = g_strdup(purple_normalize(account, purple_chat_conversation_get_nick(chat)));
- name = g_strdup(purple_normalize(account, aname));
-
- if (g_utf8_collate(nick, name) == 0)
- ret = TRUE;
-
- g_free(nick);
- g_free(name);
-
- return ret;
-}
-
-/*
- * play a sound event for a conversation, honoring make_sound flag
- * of conversation and checking for focus if conv_focus pref is set
- */
-static void
-play_conv_event(PurpleConversation *conv, PurpleSoundEventID event)
-{
- /* If we should not play the sound for some reason, then exit early */
- if (conv != NULL)
- {
- FinchConv *gntconv;
- gboolean has_focus;
-
- gntconv = FINCH_CONV(conv);
-
- has_focus = purple_conversation_has_focus(conv);
-
- if ((gntconv->flags & FINCH_CONV_NO_SOUND) ||
- (has_focus && !purple_prefs_get_bool(make_pref("/conv_focus"))))
- {
- return;
- }
- }
-
- purple_sound_play_event(event, conv ? purple_conversation_get_account(conv) : NULL);
-}
-
-static void
-buddy_state_cb(PurpleBuddy *buddy, PurpleSoundEventID event)
-{
- purple_sound_play_event(event, purple_buddy_get_account(buddy));
-}
-
-static void
-im_msg_received_cb(PurpleAccount *account, char *sender,
- char *message, PurpleConversation *conv,
- PurpleMessageFlags flags, PurpleSoundEventID event)
-{
- if (flags & PURPLE_MESSAGE_DELAYED)
- return;
-
- if (conv == NULL) {
- purple_sound_play_event(PURPLE_SOUND_FIRST_RECEIVE, account);
- } else {
- play_conv_event(conv, event);
- }
-}
-
-static void
-im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg,
- PurpleSoundEventID event)
-{
- PurpleIMConversation *im = purple_conversations_find_im_with_account(
- purple_message_get_recipient(msg), account);
- play_conv_event(PURPLE_CONVERSATION(im), event);
-}
-
-static void
-chat_user_join_cb(PurpleChatConversation *chat, const char *name,
- PurpleChatUserFlags flags, gboolean new_arrival,
- PurpleSoundEventID event)
-{
- if (new_arrival && !chat_nick_matches_name(chat, name))
- play_conv_event(PURPLE_CONVERSATION(chat), event);
-}
-
-static void
-chat_user_left_cb(PurpleChatConversation *chat, const char *name,
- const char *reason, PurpleSoundEventID event)
-{
- if (!chat_nick_matches_name(chat, name))
- play_conv_event(PURPLE_CONVERSATION(chat), event);
-}
-
-static void
-chat_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg, int id,
- PurpleSoundEventID event)
-{
- PurpleConnection *conn = purple_account_get_connection(account);
- PurpleChatConversation *chat = NULL;
-
- if (conn!=NULL)
- chat = purple_conversations_find_chat(conn, id);
-
- play_conv_event(PURPLE_CONVERSATION(chat), event);
-}
-
-static void
-chat_msg_received_cb(PurpleAccount *account, char *sender,
- char *message, PurpleChatConversation *chat,
- PurpleMessageFlags flags, PurpleSoundEventID event)
-{
- if (flags & PURPLE_MESSAGE_DELAYED)
- return;
-
- g_return_if_fail(chat != NULL);
-
- if (purple_chat_conversation_is_ignored_user(chat, sender))
- return;
-
- if (chat_nick_matches_name(chat, sender))
- return;
-
- if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_chat_conversation_get_nick(chat)))
- play_conv_event(PURPLE_CONVERSATION(chat), PURPLE_SOUND_CHAT_NICK);
- else
- play_conv_event(PURPLE_CONVERSATION(chat), event);
-}
-
-static void
-got_attention_cb(PurpleAccount *account, const char *who,
- PurpleConversation *conv, guint type, PurpleSoundEventID event)
-{
- play_conv_event(conv, event);
-}
-
-
-/*
- * We mute sounds for the 10 seconds after you log in so that
- * you don't get flooded with sounds when the blist shows all
- * your buddies logging in.
- */
-static void
-account_signon_cb(PurpleConnection *gc, gpointer data)
-{
- if (mute_login_sounds_timeout != 0)
- g_source_remove(mute_login_sounds_timeout);
- mute_login_sounds = TRUE;
- mute_login_sounds_timeout = g_timeout_add_seconds(10, unmute_login_sounds_cb, NULL);
-}
-
-static void *
-finch_sound_get_handle(void)
-{
- static int handle;
-
- return &handle;
-}
-
-
-/* This gets called when the active profile changes */
-static void
-initialize_profile(const char *name, PurplePrefType type, gconstpointer val, gpointer null)
-{
- FinchSoundEvent *event;
- if (purple_prefs_exists(make_pref("")))
- return;
-
- purple_prefs_add_none(make_pref(""));
- purple_prefs_add_none(make_pref("/enabled"));
- purple_prefs_add_none(make_pref("/file"));
-
- for (event = sounds; event - sounds < PURPLE_NUM_SOUNDS; event++) {
- char pref[512];
- g_snprintf(pref, sizeof(pref), "/enabled/%s", event->pref);
- purple_prefs_add_bool(make_pref(pref), FALSE);
- g_snprintf(pref, sizeof(pref), "/file/%s", event->pref);
- purple_prefs_add_path(make_pref(pref), "");
- }
-
- purple_prefs_add_bool(make_pref("/conv_focus"), FALSE);
- purple_prefs_add_bool(make_pref("/mute"), FALSE);
- purple_prefs_add_path(make_pref("/command"), "");
- purple_prefs_add_string(make_pref("/method"), "automatic");
-}
-
-static void
-update_profiles(void)
-{
- GList *list = finch_sound_get_profiles();
- for (; list; list = g_list_delete_link(list, list)) {
- char pname[512];
-
- /* got_attention was added in libpurple 2.7.0 */
- g_snprintf(pname, sizeof(pname), FINCH_PREFS_ROOT "/sound/profiles/%s%s",
- (char *)list->data, "/enabled/got_attention");
- purple_prefs_add_bool(pname, FALSE);
- g_snprintf(pname, sizeof(pname), FINCH_PREFS_ROOT "/sound/profiles/%s%s",
- (char *)list->data, "/file/got_attention");
- purple_prefs_add_path(pname, "");
-
- g_free(list->data);
- }
-}
-
-static void
-finch_sound_init(void)
-{
- void *gnt_sound_handle = finch_sound_get_handle();
- void *blist_handle = purple_blist_get_handle();
- void *conv_handle = purple_conversations_get_handle();
-#ifdef USE_GSTREAMER
- GError *error = NULL;
-#endif
-
- purple_signal_connect(purple_connections_get_handle(), "signed-on",
- gnt_sound_handle, PURPLE_CALLBACK(account_signon_cb),
- NULL);
-
- purple_prefs_add_none(FINCH_PREFS_ROOT "/sound");
- purple_prefs_add_string(FINCH_PREFS_ROOT "/sound/actprofile", DEFAULT_PROFILE);
- purple_prefs_add_none(FINCH_PREFS_ROOT "/sound/profiles");
-
- purple_prefs_connect_callback(gnt_sound_handle, FINCH_PREFS_ROOT "/sound/actprofile", initialize_profile, NULL);
- purple_prefs_trigger_callback(FINCH_PREFS_ROOT "/sound/actprofile");
-
-
-#ifdef USE_GSTREAMER
- purple_debug_info("sound", "Initializing sound output drivers.\n");
-#if (GST_VERSION_MAJOR > 0 || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 10))
- gst_registry_fork_set_enabled(FALSE);
-#endif
- if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
- purple_notify_error(NULL, _("GStreamer Failure"),
- _("GStreamer failed to initialize."),
- error ? error->message : "", NULL);
- if (error) {
- g_error_free(error);
- error = NULL;
- }
- }
-#endif /* USE_GSTREAMER */
-
- purple_signal_connect(blist_handle, "buddy-signed-on",
- gnt_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
- GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE));
- purple_signal_connect(blist_handle, "buddy-signed-off",
- gnt_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
- GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE));
- purple_signal_connect(conv_handle, "received-im-msg",
- gnt_sound_handle, PURPLE_CALLBACK(im_msg_received_cb),
- GINT_TO_POINTER(PURPLE_SOUND_RECEIVE));
- purple_signal_connect(conv_handle, "sent-im-msg",
- gnt_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb),
- GINT_TO_POINTER(PURPLE_SOUND_SEND));
- purple_signal_connect(conv_handle, "chat-user-joined",
- gnt_sound_handle, PURPLE_CALLBACK(chat_user_join_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN));
- purple_signal_connect(conv_handle, "chat-user-left",
- gnt_sound_handle, PURPLE_CALLBACK(chat_user_left_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE));
- purple_signal_connect(conv_handle, "sent-chat-msg",
- gnt_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY));
- purple_signal_connect(conv_handle, "received-chat-msg",
- gnt_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
- purple_signal_connect(conv_handle, "got-attention",
- gnt_sound_handle, PURPLE_CALLBACK(got_attention_cb),
- GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION));
-
- update_profiles();
-}
-
-static void
-finch_sound_uninit(void)
-{
-#ifdef USE_GSTREAMER
- if (!gst_init_failed)
- gst_deinit();
-#endif
-
- purple_signals_disconnect_by_handle(finch_sound_get_handle());
-}
-
-#if defined(USE_GSTREAMER) && !defined(_WIN32)
-static gboolean
-bus_call (GstBus *bus, GstMessage *msg, gpointer data)
-{
- GstElement *play = data;
- GError *err = NULL;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_ERROR:
- gst_message_parse_error(msg, &err, NULL);
- purple_debug_error("gstreamer", "%s\n", err->message);
- g_error_free(err);
- /* fall-through and clean up */
- case GST_MESSAGE_EOS:
- gst_element_set_state(play, GST_STATE_NULL);
- gst_object_unref(GST_OBJECT(play));
- return FALSE;
- break;
- case GST_MESSAGE_WARNING:
- gst_message_parse_warning(msg, &err, NULL);
- purple_debug_warning("gstreamer", "%s\n", err->message);
- g_error_free(err);
- break;
- default:
- break;
- }
- return TRUE;
-}
-#endif
-
-static void
-finch_sound_play_file(const char *filename)
-{
- const char *method;
-#if defined(USE_GSTREAMER) && !defined(_WIN32)
- char *uri;
- GstElement *sink = NULL;
- GstElement *play = NULL;
- GstBus *bus = NULL;
-#endif
- if (purple_prefs_get_bool(make_pref("/mute")))
- return;
-
- method = purple_prefs_get_string(make_pref("/method"));
-
- if (purple_strequal(method, "nosound")) {
- return;
- } else if (purple_strequal(method, "beep")) {
- beep();
- return;
- }
-
- if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
- purple_debug_error("gntsound", "sound file (%s) does not exist.\n", filename);
- return;
- }
-
-#ifndef _WIN32
- if (purple_strequal(method, "custom")) {
- const char *sound_cmd;
- char *command;
- char *esc_filename;
- GError *error = NULL;
-
- sound_cmd = purple_prefs_get_path(make_pref("/command"));
-
- if (!sound_cmd || *sound_cmd == '\0') {
- purple_debug_error("gntsound",
- "'Command' sound method has been chosen, "
- "but no command has been set.");
- return;
- }
-
- esc_filename = g_shell_quote(filename);
-
- if (strstr(sound_cmd, "%s"))
- command = purple_strreplace(sound_cmd, "%s", esc_filename);
- else
- command = g_strdup_printf("%s %s", sound_cmd, esc_filename);
-
- if (!g_spawn_command_line_async(command, &error)) {
- purple_debug_error("gntsound", "sound command could not be launched: %s\n", error->message);
- g_error_free(error);
- }
-
- g_free(esc_filename);
- g_free(command);
- return;
- }
-#ifdef USE_GSTREAMER
- if (gst_init_failed) /* Perhaps do beep instead? */
- return;
- if (purple_strequal(method, "automatic")) {
- sink = gst_element_factory_make("autoaudiosink", "sink");
- if (!sink) {
- purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
- return;
- }
- } else if (purple_strequal(method, "esd")) {
- sink = gst_element_factory_make("esdsink", "sink");
- if (!sink) {
- purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
- return;
- }
- } else if (purple_strequal(method, "alsa")) {
- sink = gst_element_factory_make("alsasink", "sink");
- if (!sink) {
- purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
- return;
- }
- } else {
- purple_debug_error("sound", "Unknown sound method '%s'\n", method);
- return;
- }
-
- play = gst_element_factory_make("playbin", "play");
-
- if (play == NULL) {
- return;
- }
-
- uri = g_strdup_printf("file://%s", filename);
-
- g_object_set(G_OBJECT(play), "uri", uri,
- "audio-sink", sink, NULL);
-
- bus = gst_pipeline_get_bus(GST_PIPELINE(play));
- gst_bus_add_watch(bus, bus_call, play);
-
- gst_element_set_state(play, GST_STATE_PLAYING);
-
- gst_object_unref(bus);
- g_free(uri);
-
-#else /* USE_GSTREAMER */
- beep();
- return;
-#endif /* USE_GSTREAMER */
-#else /* _WIN32 */
- purple_debug_info("sound", "Playing %s\n", filename);
-
- {
- wchar_t *wc_filename = g_utf8_to_utf16(filename,
- -1, NULL, NULL, NULL);
- if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME))
- purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
- g_free(wc_filename);
- }
-#endif /* _WIN32 */
-}
-
-static void
-finch_sound_play_event(PurpleSoundEventID event)
-{
- char *enable_pref;
- char *file_pref;
- if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
- return;
-
- if (event >= PURPLE_NUM_SOUNDS ||
- event >= G_N_ELEMENTS(sounds)) {
- purple_debug_error("sound", "got request for unknown sound: %d\n", event);
- return;
- }
-
- enable_pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s",
- finch_sound_get_active_profile(),
- sounds[event].pref);
- file_pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s", finch_sound_get_active_profile(), sounds[event].pref);
-
- /* check NULL for sounds that don't have an option, ie buddy pounce */
- if (purple_prefs_get_bool(enable_pref)) {
- char *filename = g_strdup(purple_prefs_get_path(file_pref));
- if (!filename || *filename == '\0') {
- g_free(filename);
- filename = g_build_filename(PURPLE_DATADIR,
- "sounds", "purple", sounds[event].def, NULL);
- }
-
- purple_sound_play_file(filename, NULL);
- g_free(filename);
- }
-
- g_free(enable_pref);
- g_free(file_pref);
-}
-
-GList *
-finch_sound_get_profiles()
-{
- GList *list = NULL, *iter;
- iter = purple_prefs_get_children_names(FINCH_PREFS_ROOT "/sound/profiles");
- while (iter) {
- list = g_list_append(list, g_strdup(strrchr(iter->data, '/') + 1));
- g_free(iter->data);
- iter = g_list_delete_link(iter, iter);
- }
- return list;
-}
-
-/* This will also create it if it doesn't exist */
-void
-finch_sound_set_active_profile(const char *name)
-{
- purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile", name);
-}
-
-static gboolean
-finch_sound_profile_exists(const char *name)
-{
- gchar * tmp;
- gboolean ret = purple_prefs_exists(tmp = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s", name));
- g_free(tmp);
- return ret;
-}
-
-static void
-save_cb(GntWidget *button, gpointer win)
-{
- GList * itr;
-
- purple_prefs_set_string(make_pref("/method"), gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->method)));
- purple_prefs_set_path(make_pref("/command"), gnt_entry_get_text(GNT_ENTRY(pref_dialog->command)));
- purple_prefs_set_bool(make_pref("/conv_focus"), gnt_check_box_get_checked(GNT_CHECK_BOX(pref_dialog->conv_focus)));
- purple_prefs_set_int("/purple/sound/while_status", GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->while_status))));
-
- for (itr = gnt_tree_get_rows(GNT_TREE(pref_dialog->events)); itr; itr = itr->next) {
- FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(itr->data)];
- char * filepref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s", finch_sound_get_active_profile(), event->pref);
- char * boolpref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s", finch_sound_get_active_profile(), event->pref);
- purple_prefs_set_bool(boolpref, gnt_tree_get_choice(GNT_TREE(pref_dialog->events), itr->data));
- purple_prefs_set_path(filepref, event->file ? event->file : "");
- g_free(filepref);
- g_free(boolpref);
- }
- gnt_widget_destroy(GNT_WIDGET(win));
-}
-
-static void
-file_cb(GntFileSel *w, const char *path, const char *file, gpointer data)
-{
- FinchSoundEvent *event = data;
-
- g_free(event->file);
- event->file = g_strdup(path);
-
- gnt_tree_change_text(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(event->id), 1, file);
- gnt_tree_set_choice(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(event->id), TRUE);
-
- gnt_widget_destroy(GNT_WIDGET(w));
-}
-
-static void
-test_cb(GntWidget *button, gpointer null)
-{
- PurpleSoundEventID id = GPOINTER_TO_INT(gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events)));
- FinchSoundEvent * event = &sounds[id];
- char *enabled, *file, *tmpfile;
- gboolean temp_value;
-
- enabled = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s",
- finch_sound_get_active_profile(), event->pref);
- file = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s",
- finch_sound_get_active_profile(), event->pref);
-
- temp_value = purple_prefs_get_bool(enabled);
- tmpfile = g_strdup(purple_prefs_get_path(file));
-
- purple_prefs_set_path(file, event->file);
- if (!temp_value) purple_prefs_set_bool(enabled, TRUE);
-
- purple_sound_play_event(id, NULL);
-
- if (!temp_value) purple_prefs_set_bool(enabled, FALSE);
- purple_prefs_set_path(file, tmpfile);
-
- g_free(enabled);
- g_free(file);
- g_free(tmpfile);
-}
-
-static void
-reset_cb(GntWidget *button, gpointer null)
-{
- /* Don't dereference this pointer ! */
- gpointer key = gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events));
-
- FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(key)];
- g_free(event->file);
- event->file = NULL;
- gnt_tree_change_text(GNT_TREE(pref_dialog->events), key, 1, _("(default)"));
-}
-
-
-static void
-choose_cb(GntWidget *button, gpointer null)
-{
- GntWidget *w = gnt_file_sel_new();
- GntFileSel *sel = GNT_FILE_SEL(w);
- PurpleSoundEventID id = GPOINTER_TO_INT(gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events)));
- FinchSoundEvent * event = &sounds[id];
- char *path = NULL;
-
- gnt_box_set_title(GNT_BOX(w), _("Select Sound File..."));
- gnt_file_sel_set_current_location(sel,
- (event && event->file) ? (path = g_path_get_dirname(event->file))
- : purple_home_dir());
-
- g_signal_connect(G_OBJECT(sel), "cancelled", G_CALLBACK(gnt_widget_destroy), NULL);
- g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(file_cb), event);
- g_signal_connect_swapped(G_OBJECT(sel), "destroy", G_CALLBACK(g_nullify_pointer), &pref_dialog->selector);
-
- /* If there's an already open file-selector, close that one. */
- if (pref_dialog->selector)
- gnt_widget_destroy(pref_dialog->selector);
-
- pref_dialog->selector = w;
-
- gnt_widget_show(w);
- g_free(path);
-}
-
-static void
-release_pref_dialog(GntBindable *data, gpointer null)
-{
- GList * itr;
- for (itr = gnt_tree_get_rows(GNT_TREE(pref_dialog->events)); itr; itr = itr->next) {
- PurpleSoundEventID id = GPOINTER_TO_INT(itr->data);
- FinchSoundEvent * e = &sounds[id];
- g_free(e->file);
- e->file = NULL;
- }
- if (pref_dialog->selector)
- gnt_widget_destroy(pref_dialog->selector);
- g_free(pref_dialog->original_profile);
- g_free(pref_dialog);
- pref_dialog = NULL;
-}
-
-static void
-load_pref_window(const char * profile)
-{
- gint i;
-
- finch_sound_set_active_profile(profile);
-
- gnt_combo_box_set_selected(GNT_COMBO_BOX(pref_dialog->method), (gchar *)purple_prefs_get_string(make_pref("/method")));
-
- gnt_entry_set_text(GNT_ENTRY(pref_dialog->command), purple_prefs_get_path(make_pref("/command")));
-
- gnt_check_box_set_checked(GNT_CHECK_BOX(pref_dialog->conv_focus), purple_prefs_get_bool(make_pref("/conv_focus")));
-
- gnt_combo_box_set_selected(GNT_COMBO_BOX(pref_dialog->while_status), GINT_TO_POINTER(purple_prefs_get_int("/purple" "/sound/while_status")));
-
- for (i = 0; i < PURPLE_NUM_SOUNDS; i++) {
- FinchSoundEvent * event = &sounds[i];
- gchar *boolpref;
- gchar *filepref, *basename = NULL;
- const char * profile = finch_sound_get_active_profile();
-
- filepref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s", profile, event->pref);
-
- g_free(event->file);
- event->file = g_strdup(purple_prefs_get_path(filepref));
-
- g_free(filepref);
- if (event->label == NULL) {
- continue;
- }
-
- boolpref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s", profile, event->pref);
-
- gnt_tree_change_text(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(i), 0, event->label);
- gnt_tree_change_text(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(i), 1,
- event->file[0] ? (basename = g_path_get_basename(event->file)) : _("(default)"));
- g_free(basename);
-
- gnt_tree_set_choice(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(i), purple_prefs_get_bool(boolpref));
-
- g_free(boolpref);
- }
-
- gnt_tree_set_selected(GNT_TREE(pref_dialog->profiles), (gchar *)finch_sound_get_active_profile());
-
- gnt_widget_draw(pref_dialog->window);
-}
-
-static void
-reload_pref_window(const char *profile)
-{
- if (purple_strequal(profile, finch_sound_get_active_profile()))
- return;
- load_pref_window(profile);
-}
-
-static void
-prof_del_cb(GntWidget *button, gpointer null)
-{
- const char * profile = gnt_entry_get_text(GNT_ENTRY(pref_dialog->new_profile));
- gchar * pref;
-
- if (purple_strequal(profile, DEFAULT_PROFILE))
- return;
-
- pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s", profile);
- purple_prefs_remove(pref);
- g_free(pref);
-
- if (purple_strequal(pref_dialog->original_profile, profile)) {
- g_free(pref_dialog->original_profile);
- pref_dialog->original_profile = g_strdup(DEFAULT_PROFILE);
- }
-
- if(purple_strequal(profile, finch_sound_get_active_profile()))
- reload_pref_window(DEFAULT_PROFILE);
-
- gnt_tree_remove(GNT_TREE(pref_dialog->profiles), (gchar *) profile);
-}
-
-static void
-prof_add_cb(GntButton *button, GntEntry * entry)
-{
- const char * profile = gnt_entry_get_text(entry);
- GntTreeRow * row;
- if (!finch_sound_profile_exists(profile)) {
- gpointer key = g_strdup(profile);
- row = gnt_tree_create_row(GNT_TREE(pref_dialog->profiles), profile);
- gnt_tree_add_row_after(GNT_TREE(pref_dialog->profiles), key,
- row,
- NULL, NULL);
- gnt_entry_set_text(entry, "");
- gnt_tree_set_selected(GNT_TREE(pref_dialog->profiles), key);
- finch_sound_set_active_profile(key);
- } else
- reload_pref_window(profile);
-}
-
-static void
-prof_load_cb(GntTree *tree, gpointer oldkey, gpointer newkey, gpointer null)
-{
- reload_pref_window(newkey);
-}
-
-static void
-cancel_cb(GntButton *button, gpointer win)
-{
- finch_sound_set_active_profile(pref_dialog->original_profile);
- gnt_widget_destroy(GNT_WIDGET(win));
-}
-
-void
-finch_sounds_show_all(void)
-{
- GntWidget *box, *tmpbox, *splitbox, *cmbox;
- GntWidget *entry;
- GntWidget *chkbox;
- GntWidget *button;
- GntWidget *label;
- GntWidget *tree;
- GntWidget *win;
-
- gint i;
- GList *itr, *list;
-
- if (pref_dialog) {
- gnt_window_present(pref_dialog->window);
- return;
- }
-
- pref_dialog = g_new0(SoundPrefDialog, 1);
-
- pref_dialog->original_profile = g_strdup(finch_sound_get_active_profile());
-
- pref_dialog->window = win = gnt_window_box_new(FALSE, TRUE);
- gnt_box_set_pad(GNT_BOX(win), 0);
- gnt_box_set_toplevel(GNT_BOX(win), TRUE);
- gnt_box_set_title(GNT_BOX(win), _("Sound Preferences"));
- gnt_box_set_fill(GNT_BOX(win), TRUE);
- gnt_box_set_alignment(GNT_BOX(win), GNT_ALIGN_MID);
-
- /* Profiles */
- splitbox = gnt_hbox_new(FALSE);
- gnt_box_set_pad(GNT_BOX(splitbox), 0);
- gnt_box_set_alignment(GNT_BOX(splitbox), GNT_ALIGN_TOP);
-
- box = gnt_vbox_new(FALSE);
- gnt_box_set_pad(GNT_BOX(box), 0);
- gnt_box_add_widget(GNT_BOX(box), gnt_label_new_with_format(_("Profiles"), GNT_TEXT_FLAG_BOLD));
- pref_dialog->profiles = tree = gnt_tree_new();
- gnt_tree_set_hash_fns(GNT_TREE(tree), g_str_hash, g_str_equal, g_free);
- gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)g_ascii_strcasecmp);
- g_signal_connect(G_OBJECT(tree), "selection-changed", G_CALLBACK(prof_load_cb), NULL);
-
- itr = list = finch_sound_get_profiles();
- for (; itr; itr = itr->next) {
- /* Do not free itr->data. It's the stored as a key for the tree, and will
- * be freed when the tree is destroyed. */
- gnt_tree_add_row_after(GNT_TREE(tree), itr->data,
- gnt_tree_create_row(GNT_TREE(tree), itr->data), NULL, NULL);
- }
- g_list_free(list);
-
- gnt_box_add_widget(GNT_BOX(box), tree);
-
- pref_dialog->new_profile = entry = gnt_entry_new("");
- gnt_box_add_widget(GNT_BOX(box), entry);
-
- tmpbox = gnt_hbox_new(FALSE);
- button = gnt_button_new("Add");
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(prof_add_cb), entry);
- gnt_box_add_widget(GNT_BOX(tmpbox), button);
- button = gnt_button_new("Delete");
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(prof_del_cb), NULL);
- gnt_box_add_widget(GNT_BOX(tmpbox), button);
- gnt_box_add_widget(GNT_BOX(box), tmpbox);
- gnt_box_add_widget(GNT_BOX(splitbox), box);
-
- gnt_box_add_widget(GNT_BOX(splitbox), gnt_vline_new());
-
- /* Sound method */
-
- box = gnt_vbox_new(FALSE);
- gnt_box_set_pad(GNT_BOX(box), 0);
-
- pref_dialog->method = cmbox = gnt_combo_box_new();
- gnt_tree_set_hash_fns(GNT_TREE(gnt_combo_box_get_dropdown(GNT_COMBO_BOX(cmbox))),
- g_str_hash, g_str_equal, NULL);
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "automatic", _("Automatic"));
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "alsa", "ALSA");
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "esd", "ESD");
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "beep", _("Console Beep"));
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "custom", _("Command"));
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "nosound", _("No Sound"));
-
- label = gnt_label_new_with_format(_("Sound Method"), GNT_TEXT_FLAG_BOLD);
- gnt_box_add_widget(GNT_BOX(box), label);
- tmpbox = gnt_hbox_new(TRUE);
- gnt_box_set_fill(GNT_BOX(tmpbox), FALSE);
- gnt_box_set_pad(GNT_BOX(tmpbox), 0);
- gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new(_("Method: ")));
- gnt_box_add_widget(GNT_BOX(tmpbox), cmbox);
- gnt_box_add_widget(GNT_BOX(box), tmpbox);
-
- tmpbox = gnt_hbox_new(TRUE);
- gnt_box_set_pad(GNT_BOX(tmpbox), 0);
- gnt_box_set_fill(GNT_BOX(tmpbox), FALSE);
- gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new(_("Sound Command\n(%s for filename)")));
- pref_dialog->command = entry = gnt_entry_new("");
- gnt_box_add_widget(GNT_BOX(tmpbox), entry);
- gnt_box_add_widget(GNT_BOX(box), tmpbox);
-
- gnt_box_add_widget(GNT_BOX(box), gnt_line_new(FALSE));
-
- /* Sound options */
- gnt_box_add_widget(GNT_BOX(box), gnt_label_new_with_format(_("Sound Options"), GNT_TEXT_FLAG_BOLD));
- pref_dialog->conv_focus = chkbox = gnt_check_box_new(_("Sounds when conversation has focus"));
- gnt_box_add_widget(GNT_BOX(box), chkbox);
-
- tmpbox = gnt_hbox_new(TRUE);
- gnt_box_set_pad(GNT_BOX(tmpbox), 0);
- gnt_box_set_fill(GNT_BOX(tmpbox), FALSE);
- gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new("Enable Sounds:"));
- pref_dialog->while_status = cmbox = gnt_combo_box_new();
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), GINT_TO_POINTER(3), _("Always"));
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), GINT_TO_POINTER(1), _("Only when available"));
- gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), GINT_TO_POINTER(2), _("Only when not available"));
- gnt_box_add_widget(GNT_BOX(tmpbox), cmbox);
- gnt_box_add_widget(GNT_BOX(box), tmpbox);
-
- gnt_box_add_widget(GNT_BOX(splitbox), box);
-
- gnt_box_add_widget(GNT_BOX(win), splitbox);
-
- gnt_box_add_widget(GNT_BOX(win), gnt_hline_new());
-
- /* Sound events */
- gnt_box_add_widget(GNT_BOX(win), gnt_label_new_with_format(_("Sound Events"), GNT_TEXT_FLAG_BOLD));
- pref_dialog->events = tree = gnt_tree_new_with_columns(2);
- gnt_tree_set_column_titles(GNT_TREE(tree), _("Event"), _("File"));
- gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
-
- for (i = 0; i < PURPLE_NUM_SOUNDS; i++) {
- FinchSoundEvent * event = &sounds[i];
-
- if (event->label == NULL) {
- continue;
- }
-
- gnt_tree_add_choice(GNT_TREE(tree), GINT_TO_POINTER(i),
- gnt_tree_create_row(GNT_TREE(tree), event->label, event->def),
- NULL, NULL);
- }
-
- gnt_tree_adjust_columns(GNT_TREE(tree));
- gnt_box_add_widget(GNT_BOX(win), tree);
-
- box = gnt_hbox_new(FALSE);
- button = gnt_button_new(_("Test"));
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(test_cb), NULL);
- gnt_box_add_widget(GNT_BOX(box), button);
- button = gnt_button_new(_("Reset"));
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(reset_cb), NULL);
- gnt_box_add_widget(GNT_BOX(box), button);
- button = gnt_button_new(_("Choose..."));
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(choose_cb), NULL);
- gnt_box_add_widget(GNT_BOX(box), button);
- gnt_box_add_widget(GNT_BOX(win), box);
-
- gnt_box_add_widget(GNT_BOX(win), gnt_line_new(FALSE));
-
- /* Add new stuff before this */
- box = gnt_hbox_new(FALSE);
- gnt_box_set_fill(GNT_BOX(box), TRUE);
- button = gnt_button_new(_("Save"));
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_cb), win);
- gnt_box_add_widget(GNT_BOX(box), button);
- button = gnt_button_new(_("Cancel"));
- g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cancel_cb), win);
- gnt_box_add_widget(GNT_BOX(box), button);
- gnt_box_add_widget(GNT_BOX(win), box);
-
- g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(release_pref_dialog), NULL);
-
- load_pref_window(finch_sound_get_active_profile());
-
- gnt_widget_show(win);
-}
-
-gboolean finch_sound_is_enabled(void)
-{
- const char *pref = make_pref("/method");
- const char *method = purple_prefs_get_string(pref);
-
- if (!method)
- return FALSE;
- if (purple_strequal(method, "nosound"))
- return FALSE;
-
- return TRUE;
-}
-
-static PurpleSoundUiOps sound_ui_ops =
-{
- finch_sound_init,
- finch_sound_uninit,
- finch_sound_play_file,
- finch_sound_play_event,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PurpleSoundUiOps *
-finch_sound_get_ui_ops(void)
-{
- return &sound_ui_ops;
-}
-
--- a/finch/gntsound.h Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * finch
- *
- * Finch is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
-# error "only <finch.h> may be included directly"
-#endif
-
-#ifndef FINCH_SOUND_H
-#define FINCH_SOUND_H
-
-/**
- * SECTION:gntsound
- * @section_id: finch-gntsound
- * @short_description: <filename>gntsound.h</filename>
- * @title: Sound API
- */
-
-#include <purple.h>
-
-/**********************************************************************/
-/* GNT Sound API */
-/**********************************************************************/
-
-/**
- * finch_sound_get_active_profile:
- *
- * Get the name of the active sound profile.
- *
- * Returns: The name of the profile
- */
-const char *finch_sound_get_active_profile(void);
-
-/**
- * finch_sound_set_active_profile:
- * @name: The name of the profile
- *
- * Set the active profile. If the profile doesn't exist, nothing is changed.
- */
-void finch_sound_set_active_profile(const char *name);
-
-/**
- * finch_sound_get_profiles:
- *
- * Get a list of available sound profiles.
- *
- * Returns: (transfer container) (element-type utf8): A list of strings
- * denoting sound profile names. Caller must free the list
- * (but not the data).
- */
-GList *finch_sound_get_profiles(void);
-
-/**
- * finch_sound_is_enabled:
- *
- * Determine whether any sound will be played or not.
- *
- * Returns: Returns FALSE if preference is set to 'No sound', or if volume is
- * set to zero.
- */
-gboolean finch_sound_is_enabled(void);
-
-/**
- * finch_sound_get_ui_ops:
- *
- * Gets GNT sound UI ops.
- *
- * Returns: The UI operations structure.
- */
-PurpleSoundUiOps *finch_sound_get_ui_ops(void);
-
-/**
- * finch_sounds_show_all:
- *
- * Show the sound settings dialog.
- */
-void finch_sounds_show_all(void);
-
-#endif /* FINCH_SOUND_H */
-
--- a/finch/gntui.c Thu Aug 13 21:10:22 2020 -0500
+++ b/finch/gntui.c Thu Aug 13 22:03:41 2020 -0500
@@ -45,7 +45,6 @@
#include "gntrequest.h"
#include "gntroomlist.h"
#include "gntstatus.h"
-#include "gntsound.h"
void finch_ui_init()
{
@@ -71,9 +70,6 @@
finch_blist_init();
purple_blist_set_ui(FINCH_TYPE_BUDDY_LIST);
- /* Initialize sound */
- purple_sound_set_ui_ops(finch_sound_get_ui_ops());
-
/* Now the conversations */
finch_conversation_init();
purple_conversations_set_ui_ops(finch_conv_get_ui_ops());
@@ -110,7 +106,6 @@
gnt_register_action(_("File Transfers"), finch_xfer_dialog_show);
gnt_register_action(_("Plugins"), finch_plugins_show_all);
gnt_register_action(_("Room List"), finch_roomlist_show_all);
- gnt_register_action(_("Sounds"), finch_sounds_show_all);
gnt_register_action(_("Preferences"), finch_prefs_show_all);
gnt_register_action(_("Keyring settings"), finch_prefs_show_keyring);
gnt_register_action(_("Statuses"), finch_savedstatus_show_all);
--- a/finch/meson.build Thu Aug 13 21:10:22 2020 -0500
+++ b/finch/meson.build Thu Aug 13 22:03:41 2020 -0500
@@ -114,7 +114,6 @@
'gntprefs.c',
'gntrequest.c',
'gntroomlist.c',
- 'gntsound.c',
'gntstatus.c',
'gntui.c',
'gntxfer.c',
@@ -138,7 +137,6 @@
'gntprefs.h',
'gntrequest.h',
'gntroomlist.h',
- 'gntsound.h',
'gntstatus.h',
'gntui.h',
'gntxfer.h',
--- a/libpurple/core.c Thu Aug 13 21:10:22 2020 -0500
+++ b/libpurple/core.c Thu Aug 13 22:03:41 2020 -0500
@@ -44,8 +44,6 @@
#include "smiley-custom.h"
#include "smiley-parser.h"
#include "smiley-theme.h"
-#include "sound.h"
-#include "sound-theme-loader.h"
#include "status.h"
#include "stun.h"
#include "theme-manager.h"
@@ -180,7 +178,6 @@
purple_network_init();
purple_pounces_init();
purple_proxy_init();
- purple_sound_init();
purple_stun_init();
purple_xfers_init();
purple_idle_init();
@@ -236,7 +233,6 @@
purple_statuses_uninit();
purple_accounts_uninit();
purple_keyring_uninit(); /* after accounts */
- purple_sound_uninit();
purple_theme_manager_uninit();
purple_xfers_uninit();
purple_proxy_uninit();
--- a/libpurple/meson.build Thu Aug 13 21:10:22 2020 -0500
+++ b/libpurple/meson.build Thu Aug 13 22:03:41 2020 -0500
@@ -68,9 +68,6 @@
'smiley.c',
'status.c',
'stun.c',
- 'sound.c',
- 'sound-theme.c',
- 'sound-theme-loader.c',
'theme.c',
'theme-loader.c',
'theme-manager.c',
@@ -149,9 +146,6 @@
'smiley.h',
'status.h',
'stun.h',
- 'sound.h',
- 'sound-theme.h',
- 'sound-theme-loader.h',
'tests.h',
'theme.h',
'theme-loader.h',
@@ -216,7 +210,6 @@
'purpleimconversation.h',
'roomlist.h',
'status.h',
- 'sound.h',
'xfer.h',
'xmlnode.h'
]
--- a/libpurple/plugins/signals-test.c Thu Aug 13 21:10:22 2020 -0500
+++ b/libpurple/plugins/signals-test.c Thu Aug 13 22:03:41 2020 -0500
@@ -544,20 +544,6 @@
}
/**************************************************************************
- * Sound signal callbacks
- **************************************************************************/
-static int
-sound_playing_event_cb(PurpleSoundEventID event, PurpleAccount *account) {
- if (account != NULL)
- purple_debug_misc("signals test", "sound playing event: %d for account: %s\n",
- event, purple_account_get_username(account));
- else
- purple_debug_misc("signals test", "sound playing event: %d\n", event);
-
- return 0;
-}
-
-/**************************************************************************
* Notify signals callbacks
**************************************************************************/
static void
@@ -674,7 +660,6 @@
void *conn_handle = purple_connections_get_handle();
void *conv_handle = purple_conversations_get_handle();
void *accounts_handle = purple_accounts_get_handle();
- void *sound_handle = purple_sounds_get_handle();
void *notify_handle = purple_notify_get_handle();
void *jabber_handle = purple_protocols_find("prpl-jabber");
@@ -790,10 +775,6 @@
purple_signal_connect(core_handle, "uri-handler",
plugin, PURPLE_CALLBACK(uri_handler), NULL);
- /* Sound signals */
- purple_signal_connect(sound_handle, "playing-sound-event", plugin,
- PURPLE_CALLBACK(sound_playing_event_cb), NULL);
-
/* Notify signals */
purple_signal_connect(notify_handle, "displaying-email-notification",
plugin, PURPLE_CALLBACK(notify_email_cb), NULL);
--- a/libpurple/prefs.c Thu Aug 13 21:10:22 2020 -0500
+++ b/libpurple/prefs.c Thu Aug 13 22:03:41 2020 -0500
@@ -1669,6 +1669,9 @@
purple_prefs_remove("/purple/logging/log_idle_state");
purple_prefs_remove("/purple/logging/log_away_state");
purple_prefs_remove("/purple/logging/log_own_states");
+ purple_prefs_remove("/purple/sound/while_away");
+ purple_prefs_remove("/purple/sound/while_status");
+ purple_prefs_remove("/purple/sound");
purple_prefs_remove("/purple/status/scores/hidden");
purple_prefs_remove("/plugins/core/autorecon/hide_connected_error");
purple_prefs_remove("/plugins/core/autorecon/hide_connecting_error");
@@ -1676,14 +1679,6 @@
purple_prefs_remove("/plugins/core/autorecon/restore_state");
purple_prefs_remove("/plugins/core/autorecon");
purple_prefs_remove("/plugins/lopl");
-
- /* Convert old sounds while_away pref to new 3-way pref. */
- if (purple_prefs_exists("/purple/sound/while_away") &&
- purple_prefs_get_bool("/purple/sound/while_away"))
- {
- purple_prefs_set_int("/purple/sound/while_status", 3);
- }
- purple_prefs_remove("/purple/sound/while_away");
}
void *
--- a/libpurple/sound-theme-loader.c Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * SoundThemeLoader for libpurple
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "internal.h"
-#include "sound-theme-loader.h"
-#include "sound-theme.h"
-#include "util.h"
-#include "xmlnode.h"
-#include "debug.h"
-
-/**
- * PurpleSoundThemeLoader:
- *
- * A purple sound theme loader. extends PurpleThemeLoader (theme-loader.h)
- * This is a class designed to build sound themes
- */
-struct _PurpleSoundThemeLoader
-{
- PurpleThemeLoader parent;
-};
-
-/*****************************************************************************
- * Sound Theme Builder
- *****************************************************************************/
-
-static PurpleTheme *
-purple_sound_loader_build(const gchar *theme_dir)
-{
- PurpleXmlNode *root_node = NULL, *sub_node;
- gchar *dir, *filename_full, *data = NULL;
- PurpleSoundTheme *theme = NULL;
- const gchar *name;
-
- /* Find the theme file */
- g_return_val_if_fail(theme_dir != NULL, NULL);
- dir = g_build_filename(theme_dir, "purple", "sound", NULL);
- filename_full = g_build_filename(dir, "theme.xml", NULL);
-
- if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
- root_node = purple_xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader");
-
- g_free(filename_full);
- if (root_node == NULL) {
- g_free(dir);
- return NULL;
- }
-
- name = purple_xmlnode_get_attrib(root_node, "name");
-
- if (name && purple_strequal(purple_xmlnode_get_attrib(root_node, "type"), "sound")) {
- /* Parse the tree */
- sub_node = purple_xmlnode_get_child(root_node, "description");
- data = purple_xmlnode_get_data(sub_node);
-
- if (purple_xmlnode_get_attrib(root_node, "name") != NULL) {
- theme = g_object_new(PURPLE_TYPE_SOUND_THEME,
- "type", "sound",
- "name", name,
- "author", purple_xmlnode_get_attrib(root_node, "author"),
- "image", purple_xmlnode_get_attrib(root_node, "image"),
- "directory", dir,
- "description", data, NULL);
-
- sub_node = purple_xmlnode_get_child(root_node, "event");
-
- while (sub_node) {
- purple_sound_theme_set_file(theme,
- purple_xmlnode_get_attrib(sub_node, "name"),
- purple_xmlnode_get_attrib(sub_node, "file"));
- sub_node = purple_xmlnode_get_next_twin(sub_node);
- }
- }
- } else purple_debug_warning("sound-theme-loader", "Missing attribute or problem with the root element\n");
-
- purple_xmlnode_free(root_node);
- g_free(data);
- g_free(dir);
- return PURPLE_THEME(theme);
-}
-
-/******************************************************************************
- * GObject Stuff
- *****************************************************************************/
-
-static void
-purple_sound_theme_loader_class_init(PurpleSoundThemeLoaderClass *klass)
-{
- PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
-
- loader_klass->purple_theme_loader_build = purple_sound_loader_build;
-}
-
-GType
-purple_sound_theme_loader_get_type(void)
-{
- static GType type = 0;
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(PurpleSoundThemeLoaderClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)purple_sound_theme_loader_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(PurpleSoundThemeLoader),
- 0, /* n_preallocs */
- NULL, /* instance_init */
- NULL, /* value table */
- };
- type = g_type_register_static(PURPLE_TYPE_THEME_LOADER,
- "PurpleSoundThemeLoader", &info, 0);
- }
- return type;
-}
--- a/libpurple/sound-theme-loader.h Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_SOUND_THEME_LOADER_H
-#define PURPLE_SOUND_THEME_LOADER_H
-/**
- * SECTION:sound-theme-loader
- * @section_id: libpurple-sound-theme-loader
- * @short_description: <filename>sound-theme-loader.h</filename>
- * @title: Sound Theme Loader Class
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include "theme-loader.h"
-
-#define PURPLE_TYPE_SOUND_THEME_LOADER purple_sound_theme_loader_get_type()
-
-/**************************************************************************/
-/* Purple Theme-Loader API */
-/**************************************************************************/
-G_BEGIN_DECLS
-
-/**
- * purple_sound_theme_loader_get_type:
- *
- * Returns: The #GType for sound theme loader.
- */
-G_DECLARE_FINAL_TYPE(PurpleSoundThemeLoader, purple_sound_theme_loader, PURPLE,
- SOUND_THEME_LOADER, PurpleThemeLoader)
-
-G_END_DECLS
-#endif /* PURPLE_SOUND_THEME_LOADER_H */
--- a/libpurple/sound-theme.c Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Sound Themes for libpurple
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "internal.h"
-#include "sound-theme.h"
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-
-/**
- * PurpleSoundTheme:
- *
- * A purple sound theme.
- * This is an object for Purple to represent a sound theme.
- */
-struct _PurpleSoundTheme
-{
- /*< private >*/
- PurpleTheme parent;
-};
-
-typedef struct {
- /* used to store filenames of diffrent sounds */
- GHashTable *sound_files;
-} PurpleSoundThemePrivate;
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-
-G_DEFINE_TYPE_WITH_PRIVATE(PurpleSoundTheme, purple_sound_theme,
- PURPLE_TYPE_THEME);
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-
-/******************************************************************************
- * GObject Stuff
- *****************************************************************************/
-
-static void
-purple_sound_theme_init(PurpleSoundTheme *theme)
-{
- PurpleSoundThemePrivate *priv;
-
- priv = purple_sound_theme_get_instance_private(theme);
-
- priv->sound_files = g_hash_table_new_full(g_str_hash,
- g_str_equal, g_free, g_free);
-}
-
-static void
-purple_sound_theme_finalize(GObject *obj)
-{
- PurpleSoundThemePrivate *priv;
-
- priv = purple_sound_theme_get_instance_private(PURPLE_SOUND_THEME(obj));
-
- g_hash_table_destroy(priv->sound_files);
-
- G_OBJECT_CLASS(purple_sound_theme_parent_class)->finalize(obj);
-}
-
-static void
-purple_sound_theme_class_init(PurpleSoundThemeClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-
- obj_class->finalize = purple_sound_theme_finalize;
-}
-
-/*****************************************************************************
- * Public API functions
- *****************************************************************************/
-
-const gchar *
-purple_sound_theme_get_file(PurpleSoundTheme *theme,
- const gchar *event)
-{
- PurpleSoundThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL);
-
- priv = purple_sound_theme_get_instance_private(theme);
-
- return g_hash_table_lookup(priv->sound_files, event);
-}
-
-gchar *
-purple_sound_theme_get_file_full(PurpleSoundTheme *theme,
- const gchar *event)
-{
- const gchar *filename;
-
- g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL);
-
- filename = purple_sound_theme_get_file(theme, event);
-
- g_return_val_if_fail(filename, NULL);
-
- return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL);
-}
-
-void
-purple_sound_theme_set_file(PurpleSoundTheme *theme,
- const gchar *event,
- const gchar *filename)
-{
- PurpleSoundThemePrivate *priv;
- g_return_if_fail(PURPLE_IS_SOUND_THEME(theme));
-
- priv = purple_sound_theme_get_instance_private(theme);
-
- if (filename != NULL)
- g_hash_table_replace(priv->sound_files,
- g_strdup(event), g_strdup(filename));
- else
- g_hash_table_remove(priv->sound_files, event);
-}
--- a/libpurple/sound-theme.h Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_SOUND_THEME_H
-#define PURPLE_SOUND_THEME_H
-/**
- * SECTION:sound-theme
- * @section_id: libpurple-sound-theme
- * @short_description: <filename>sound-theme.h</filename>
- * @title: Sound Theme Class
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include "theme.h"
-#include "sound.h"
-
-#define PURPLE_TYPE_SOUND_THEME purple_sound_theme_get_type()
-
-/**************************************************************************/
-/* Purple Sound Theme API */
-/**************************************************************************/
-G_BEGIN_DECLS
-
-/**
- * purple_sound_theme_get_type:
- *
- * Returns: The #GType for a sound theme.
- */
-G_DECLARE_FINAL_TYPE(PurpleSoundTheme, purple_sound_theme, PURPLE, SOUND_THEME,
- PurpleTheme)
-
-/**
- * purple_sound_theme_get_file:
- * @theme: The theme.
- * @event: The purple sound event to look up.
- *
- * Returns a copy of the filename for the sound event.
- *
- * Returns: The filename of the sound event.
- */
-const gchar *purple_sound_theme_get_file(PurpleSoundTheme *theme,
- const gchar *event);
-
-/**
- * purple_sound_theme_get_file_full:
- * @theme: The theme.
- * @event: The purple sound event to look up
- *
- * Returns a copy of the directory and filename for the sound event
- *
- * Returns: The directory + '/' + filename of the sound event. This is
- * a newly allocated string that should be freed with g_free.
- */
-gchar *purple_sound_theme_get_file_full(PurpleSoundTheme *theme,
- const gchar *event);
-
-/**
- * purple_sound_theme_set_file:
- * @theme: The theme.
- * @event: the purple sound event to look up
- * @filename: the name of the file to be used for the event
- *
- * Sets the filename for a given sound event
- */
-void purple_sound_theme_set_file(PurpleSoundTheme *theme,
- const gchar *event,
- const gchar *filename);
-
-G_END_DECLS
-
-#endif /* PURPLE_SOUND_THEME_H */
--- a/libpurple/sound.c Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- *
- */
-#include "internal.h"
-
-#include "buddylist.h"
-#include "prefs.h"
-#include "sound.h"
-#include "sound-theme-loader.h"
-#include "theme-manager.h"
-
-static PurpleSoundUiOps *sound_ui_ops = NULL;
-static gint64 last_played[PURPLE_NUM_SOUNDS];
-
-static gboolean
-purple_sound_play_required(PurpleAccount *account)
-{
- gint pref_status = purple_prefs_get_int("/purple/sound/while_status");
-
- if (pref_status == PURPLE_SOUND_STATUS_ALWAYS)
- {
- /* Play sounds: Always */
- return TRUE;
- }
-
- if (account != NULL)
- {
- PurpleStatus *status = purple_account_get_active_status(account);
-
- if (purple_status_is_online(status))
- {
- gboolean available = purple_status_is_available(status);
- return (( available && pref_status == PURPLE_SOUND_STATUS_AVAILABLE) ||
- (!available && pref_status == PURPLE_SOUND_STATUS_AWAY));
- }
- }
-
- /* We get here a couple of ways. Either the request has been OK'ed
- * by purple_sound_play_event() and we're here because the UI has
- * called purple_sound_play_file(), or we're here for something
- * not related to an account (like testing a sound). */
- return TRUE;
-}
-
-void
-purple_sound_play_file(const char *filename, PurpleAccount *account)
-{
- if (!purple_sound_play_required(account))
- return;
-
- if(sound_ui_ops && sound_ui_ops->play_file)
- sound_ui_ops->play_file(filename);
-}
-
-void
-purple_sound_play_event(PurpleSoundEventID event, PurpleAccount *account)
-{
- if (!purple_sound_play_required(account))
- return;
-
- g_return_if_fail(event < PURPLE_NUM_SOUNDS);
-
- if (g_get_monotonic_time() - last_played[event] < 2 * G_USEC_PER_SEC)
- return;
- last_played[event] = g_get_monotonic_time();
-
- if(sound_ui_ops && sound_ui_ops->play_event) {
- int plugin_return;
-
- plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1(
- purple_sounds_get_handle(), "playing-sound-event",
- event, account));
-
- if (plugin_return)
- return;
- else
- sound_ui_ops->play_event(event);
- }
-}
-
-static PurpleSoundUiOps *
-purple_sound_ui_ops_copy(PurpleSoundUiOps *ops)
-{
- PurpleSoundUiOps *ops_new;
-
- g_return_val_if_fail(ops != NULL, NULL);
-
- ops_new = g_new(PurpleSoundUiOps, 1);
- *ops_new = *ops;
-
- return ops_new;
-}
-
-GType
-purple_sound_ui_ops_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- type = g_boxed_type_register_static("PurpleSoundUiOps",
- (GBoxedCopyFunc)purple_sound_ui_ops_copy,
- (GBoxedFreeFunc)g_free);
- }
-
- return type;
-}
-
-void
-purple_sound_set_ui_ops(PurpleSoundUiOps *ops)
-{
- if(sound_ui_ops && sound_ui_ops->uninit)
- sound_ui_ops->uninit();
-
- sound_ui_ops = ops;
-
- if(sound_ui_ops && sound_ui_ops->init)
- sound_ui_ops->init();
-}
-
-PurpleSoundUiOps *
-purple_sound_get_ui_ops(void)
-{
- return sound_ui_ops;
-}
-
-void
-purple_sound_init()
-{
- void *handle = purple_sounds_get_handle();
-
- /**********************************************************************
- * Register signals
- **********************************************************************/
-
- purple_signal_register(handle, "playing-sound-event",
- purple_marshal_BOOLEAN__INT_POINTER,
- G_TYPE_BOOLEAN, 2, G_TYPE_INT, PURPLE_TYPE_ACCOUNT);
-
- purple_prefs_add_none("/purple/sound");
- purple_prefs_add_int("/purple/sound/while_status", PURPLE_SOUND_STATUS_AVAILABLE);
- memset(last_played, 0, sizeof(last_played));
-
- purple_theme_manager_register_type(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL));
-}
-
-void
-purple_sound_uninit()
-{
- if(sound_ui_ops && sound_ui_ops->uninit)
- sound_ui_ops->uninit();
-
- purple_signals_unregister_by_instance(purple_sounds_get_handle());
-}
-
-void *
-purple_sounds_get_handle()
-{
- static int handle;
-
- return &handle;
-}
--- a/libpurple/sound.h Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_SOUND_H
-#define PURPLE_SOUND_H
-/**
- * SECTION:sound
- * @section_id: libpurple-sound
- * @short_description: Sound subsystem definition.
- * @title: Sound API
- * @see_also: <link linkend="chapter-signals-sound">Sound signals</link>
- */
-
-#include "account.h"
-
-#define PURPLE_TYPE_SOUND_UI_OPS (purple_sound_ui_ops_get_type())
-
-/**************************************************************************/
-/* Data Structures */
-/**************************************************************************/
-typedef struct _PurpleSoundUiOps PurpleSoundUiOps;
-
-/**
- * PurpleSoundStatus:
- * @PURPLE_SOUND_STATUS_AVAILABLE: Only play sound when Status is Available.
- * @PURPLE_SOUND_STATUS_AWAY: Only play sound when Status is Not Available.
- * @PURPLE_SOUND_STATUS_ALWAYS: Always play sound.
- *
- * A preference option on when to play sounds depending on the current status
- */
-typedef enum {
- PURPLE_SOUND_STATUS_AVAILABLE = 1,
- PURPLE_SOUND_STATUS_AWAY,
- PURPLE_SOUND_STATUS_ALWAYS,
-} PurpleSoundStatus;
-
-/**
- * PurpleSoundEventID:
- * @PURPLE_SOUND_BUDDY_ARRIVE: Buddy signs on.
- * @PURPLE_SOUND_BUDDY_LEAVE: Buddy signs off.
- * @PURPLE_SOUND_RECEIVE: Receive an IM.
- * @PURPLE_SOUND_FIRST_RECEIVE: Receive an IM that starts a conv.
- * @PURPLE_SOUND_SEND: Send an IM.
- * @PURPLE_SOUND_CHAT_JOIN: Someone joins a chat.
- * @PURPLE_SOUND_CHAT_LEAVE: Someone leaves a chat.
- * @PURPLE_SOUND_CHAT_YOU_SAY: You say something in a chat.
- * @PURPLE_SOUND_CHAT_SAY: Someone else says somthing in a chat.
- * @PURPLE_SOUND_POUNCE_DEFAULT: Default sound for a buddy pounce.
- * @PURPLE_SOUND_CHAT_NICK: Someone says your name in a chat.
- * @PURPLE_SOUND_GOT_ATTENTION: Got an attention.
- * @PURPLE_NUM_SOUNDS: Total number of sounds.
- *
- * A type of sound.
- */
-typedef enum
-{
- PURPLE_SOUND_BUDDY_ARRIVE = 0,
- PURPLE_SOUND_BUDDY_LEAVE,
- PURPLE_SOUND_RECEIVE,
- PURPLE_SOUND_FIRST_RECEIVE,
- PURPLE_SOUND_SEND,
- PURPLE_SOUND_CHAT_JOIN,
- PURPLE_SOUND_CHAT_LEAVE,
- PURPLE_SOUND_CHAT_YOU_SAY,
- PURPLE_SOUND_CHAT_SAY,
- PURPLE_SOUND_POUNCE_DEFAULT,
- PURPLE_SOUND_CHAT_NICK,
- PURPLE_SOUND_GOT_ATTENTION,
- PURPLE_NUM_SOUNDS
-
-} PurpleSoundEventID;
-
-/**
- * PurpleSoundUiOps:
- * @init: Called when the UI should initialize sound
- * @uninit: Called when the UI should teardown sound
- * @play_file: Called when a file should be played.
- * <sbr/>@filename: The filename to play
- * @play_event: Called when a sound event should be played.
- * <sbr/>@event: The #@PurpleSoundEventID to play
- *
- * Operations used by the core to request that particular sound files, or the
- * sound associated with a particular event, should be played.
- */
-struct _PurpleSoundUiOps
-{
- void (*init)(void);
- void (*uninit)(void);
- void (*play_file)(const char *filename);
- void (*play_event)(PurpleSoundEventID event);
-
- /*< private >*/
- void (*_purple_reserved1)(void);
- void (*_purple_reserved2)(void);
- void (*_purple_reserved3)(void);
- void (*_purple_reserved4)(void);
-};
-
-G_BEGIN_DECLS
-
-/**************************************************************************/
-/* Sound API */
-/**************************************************************************/
-
-/**
- * purple_sound_ui_ops_get_type:
- *
- * Returns: The #GType for the #PurpleSoundUiOps boxed structure.
- */
-GType purple_sound_ui_ops_get_type(void);
-
-/**
- * purple_sound_play_file:
- * @filename: The file to play.
- * @account: (nullable): The account that this sound is associated with, or
- * NULL if the sound is not associated with any specific
- * account. This is needed for the "sounds while away?"
- * preference to work correctly.
- *
- * Plays the specified sound file.
- */
-void purple_sound_play_file(const char *filename, PurpleAccount *account);
-
-/**
- * purple_sound_play_event:
- * @event: The event.
- * @account: (nullable): The account that this sound is associated with, or
- * NULL if the sound is not associated with any specific
- * account. This is needed for the "sounds while away?"
- * preference to work correctly.
- *
- * Plays the sound associated with the specified event.
- */
-void purple_sound_play_event(PurpleSoundEventID event, PurpleAccount *account);
-
-/**
- * purple_sound_set_ui_ops:
- * @ops: The UI sound operations structure.
- *
- * Sets the UI sound operations
- */
-void purple_sound_set_ui_ops(PurpleSoundUiOps *ops);
-
-/**
- * purple_sound_get_ui_ops:
- *
- * Gets the UI sound operations
- *
- * Returns: The UI sound operations structure.
- */
-PurpleSoundUiOps *purple_sound_get_ui_ops(void);
-
-/**
- * purple_sound_init:
- *
- * Initializes the sound subsystem
- */
-void purple_sound_init(void);
-
-/**
- * purple_sound_uninit:
- *
- * Shuts down the sound subsystem
- */
-void purple_sound_uninit(void);
-
-/**
- * purple_sounds_get_handle:
- *
- * Returns the sound subsystem handle.
- *
- * Returns: The sound subsystem handle.
- */
-void *purple_sounds_get_handle(void);
-
-G_END_DECLS
-
-#endif /* PURPLE_SOUND_H */
--- a/meson.build Thu Aug 13 21:10:22 2020 -0500
+++ b/meson.build Thu Aug 13 22:03:41 2020 -0500
@@ -771,7 +771,6 @@
toplevel_inc = include_directories('.')
subdir('libpurple')
-subdir('share/sounds')
subdir('finch')
subdir('pidgin')
subdir('doc')
--- a/pidgin/gtkconv.c Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/gtkconv.c Thu Aug 13 22:03:41 2020 -0500
@@ -1128,28 +1128,6 @@
}
static void
-menu_sounds_cb(GtkAction *action, gpointer data)
-{
- PidginConvWindow *win = data;
- PurpleConversation *conv;
- PidginConversation *gtkconv;
- PurpleBlistNode *node;
-
- conv = pidgin_conv_window_get_active_conversation(win);
-
- if (!conv)
- return;
-
- gtkconv = PIDGIN_CONVERSATION(conv);
-
- gtkconv->make_sound =
- gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
- node = get_conversation_blist_node(conv);
- if (node)
- purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound);
-}
-
-static void
chat_do_im(PidginConversation *gtkconv, const char *who)
{
PurpleConversation *conv = gtkconv->active_conv;
@@ -2604,7 +2582,6 @@
/* Toggle items */
static const GtkToggleActionEntry menu_toggle_entries[] = {
{ "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, G_CALLBACK(menu_logging_cb), FALSE },
- { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, G_CALLBACK(menu_sounds_cb), FALSE },
{ "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, G_CALLBACK(menu_toolbar_cb), FALSE },
};
@@ -2647,37 +2624,12 @@
"</menu>"
"<menu action='OptionsMenu'>"
"<menuitem action='EnableLogging'/>"
- "<menuitem action='EnableSounds'/>"
"<separator/>"
"<menuitem action='ShowFormattingToolbars'/>"
"</menu>"
"</menubar>"
"</ui>";
-static void
-sound_method_pref_changed_cb(const char *name, PurplePrefType type,
- gconstpointer value, gpointer data)
-{
- PidginConvWindow *win = data;
- const char *method = value;
-
- if (purple_strequal(method, "none"))
- {
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu->sounds),
- FALSE);
- gtk_action_set_sensitive(win->menu->sounds, FALSE);
- }
- else
- {
- PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
-
- if (gtkconv != NULL)
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu->sounds),
- gtkconv->make_sound);
- gtk_action_set_sensitive(win->menu->sounds, TRUE);
- }
-}
-
/* Returns TRUE if some items were added to the menu, FALSE otherwise */
static gboolean
populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolean all)
@@ -3103,19 +3055,6 @@
win->menu->logging =
gtk_ui_manager_get_action(win->menu->ui,
"/Conversation/OptionsMenu/EnableLogging");
- win->menu->sounds =
- gtk_ui_manager_get_action(win->menu->ui,
- "/Conversation/OptionsMenu/EnableSounds");
- method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
- if (purple_strequal(method, "none"))
- {
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu->sounds),
- FALSE);
- gtk_action_set_sensitive(win->menu->sounds, FALSE);
- }
- purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method",
- sound_method_pref_changed_cb, win);
-
win->menu->show_formatting_toolbar =
gtk_ui_manager_get_action(win->menu->ui,
"/Conversation/OptionsMenu/ShowFormattingToolbars");
@@ -4397,9 +4336,6 @@
gtk_widget_show(pane);
convnode = get_conversation_blist_node(conv);
- if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound"))
- gtkconv->make_sound = TRUE;
-
if (convnode != NULL && purple_blist_node_has_setting(convnode, "enable-logging")) {
gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging");
purple_conversation_set_logging(conv, logging);
@@ -7667,7 +7603,6 @@
PidginConvWindow *win;
PurpleConversation *conv;
PidginConversation *gtkconv;
- const char *sound_method;
win = user_data;
gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, page_num);
@@ -7691,11 +7626,6 @@
pidgin_conv_switch_active_conversation(conv);
- sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
- if (!purple_strequal(sound_method, "none"))
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu->sounds),
- gtkconv->make_sound);
-
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu->show_formatting_toolbar),
purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"));
--- a/pidgin/gtkconv.h Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/gtkconv.h Thu Aug 13 22:03:41 2020 -0500
@@ -101,8 +101,6 @@
PidginConvWindow *win;
- gboolean make_sound;
-
GtkWidget *tab_cont;
GtkWidget *tabby;
GtkWidget *menu_tabby;
--- a/pidgin/gtkconvwin.h Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/gtkconvwin.h Thu Aug 13 22:03:41 2020 -0500
@@ -71,7 +71,6 @@
GtkAction *insert_image;
GtkAction *logging;
- GtkAction *sounds;
GtkAction *show_formatting_toolbar;
GtkWidget *send_to;
--- a/pidgin/gtkpounce.c Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/gtkpounce.c Thu Aug 13 22:03:41 2020 -0500
@@ -91,11 +91,6 @@
GtkWidget *exec_cmd;
GtkWidget *exec_cmd_entry;
GtkWidget *exec_cmd_browse;
- GtkWidget *play_sound;
- GtkWidget *play_sound_entry;
- GtkWidget *play_sound_browse;
- GtkWidget *play_sound_test;
- GtkWidget *play_sound_reset;
GtkWidget *save_pounce;
@@ -157,32 +152,6 @@
}
static void
-pounce_test_sound(GtkWidget *w, GtkWidget *entry)
-{
- const char *filename;
- gboolean temp_mute;
-
- temp_mute = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute");
-
- if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
-
- filename = gtk_entry_get_text(GTK_ENTRY(entry));
-
- if (filename != NULL && *filename != '\0' && !purple_strequal(filename, _("(default)")))
- purple_sound_play_file(filename, NULL);
- else
- purple_sound_play_event(PURPLE_SOUND_POUNCE_DEFAULT, NULL);
-
- if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", TRUE);
-}
-
-static void
-pounce_reset_sound(GtkWidget *w, GtkWidget *entry)
-{
- gtk_entry_set_text(GTK_ENTRY(entry), _("(default)"));
-}
-
-static void
add_pounce_to_treeview(GtkListStore *model, PurplePounce *pounce)
{
GtkTreeIter iter;
@@ -247,7 +216,7 @@
save_pounce_cb(GtkWidget *w, PidginPounceDialog *dialog)
{
const char *name;
- const char *command, *sound, *reason;
+ const char *command, *reason;
char *message;
PurplePounceEvent events = PURPLE_POUNCE_NONE;
PurplePounceOption options = PURPLE_POUNCE_OPTION_NONE;
@@ -299,7 +268,6 @@
/* Data fields */
message = talkatu_markup_get_html(dialog->send_msg_buffer, NULL);
command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry));
- sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry));
reason = gtk_entry_get_text(GTK_ENTRY(dialog->popup_entry));
if (*reason == '\0') reason = NULL;
@@ -308,7 +276,6 @@
message = NULL;
}
if (*command == '\0') command = NULL;
- if (*sound == '\0' || purple_strequal(sound, _("(default)"))) sound = NULL;
/* If the pounce has already been triggered, let's pretend it is a new one */
if (dialog->pounce != NULL
@@ -338,15 +305,11 @@
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg)));
purple_pounce_action_set_enabled(dialog->pounce, "execute-command",
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd)));
- purple_pounce_action_set_enabled(dialog->pounce, "play-sound",
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound)));
purple_pounce_action_set_attribute(dialog->pounce, "send-message",
"message", message);
purple_pounce_action_set_attribute(dialog->pounce, "execute-command",
"command", command);
- purple_pounce_action_set_attribute(dialog->pounce, "play-sound",
- "filename", sound);
purple_pounce_action_set_attribute(dialog->pounce, "popup-notify",
"reason", reason);
@@ -359,8 +322,6 @@
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg)));
purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/execute-command",
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd)));
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/play-sound",
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound)));
purple_pounce_set_save(dialog->pounce,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce)));
@@ -702,8 +663,6 @@
= gtk_check_button_new_with_mnemonic(_("Send a _message"));
dialog->exec_cmd
= gtk_check_button_new_with_mnemonic(_("E_xecute a command"));
- dialog->play_sound
- = gtk_check_button_new_with_mnemonic(_("P_lay a sound"));
editor = talkatu_editor_new();
dialog->send_msg_entry = talkatu_editor_get_input(TALKATU_EDITOR(editor));
@@ -712,21 +671,11 @@
dialog->exec_cmd_entry = gtk_entry_new();
dialog->popup_entry = gtk_entry_new();
dialog->exec_cmd_browse = gtk_button_new_with_mnemonic(_("Brows_e..."));
- dialog->play_sound_entry = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), _("(default)"));
- gtk_editable_set_editable(GTK_EDITABLE(dialog->play_sound_entry), FALSE);
- dialog->play_sound_browse = gtk_button_new_with_mnemonic(_("Br_owse..."));
- dialog->play_sound_test = gtk_button_new_with_mnemonic(_("Pre_view"));
- dialog->play_sound_reset = gtk_button_new_with_mnemonic(_("Reset"));
gtk_widget_set_sensitive(editor, FALSE);
gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE);
gtk_widget_set_sensitive(dialog->popup_entry, FALSE);
gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE);
- gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE);
- gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE);
- gtk_widget_set_sensitive(dialog->play_sound_test, FALSE);
- gtk_widget_set_sensitive(dialog->play_sound_reset, FALSE);
g_object_unref(sg);
@@ -737,11 +686,6 @@
gtk_size_group_add_widget(sg, dialog->exec_cmd);
gtk_size_group_add_widget(sg, dialog->exec_cmd_entry);
gtk_size_group_add_widget(sg, dialog->exec_cmd_browse);
- gtk_size_group_add_widget(sg, dialog->play_sound);
- gtk_size_group_add_widget(sg, dialog->play_sound_entry);
- gtk_size_group_add_widget(sg, dialog->play_sound_browse);
- gtk_size_group_add_widget(sg, dialog->play_sound_test);
- gtk_size_group_add_widget(sg, dialog->play_sound_reset);
g_object_unref(sg);
sg = NULL;
@@ -755,14 +699,6 @@
gtk_widget_set_valign(dialog->exec_cmd_entry, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand(dialog->exec_cmd_browse, TRUE);
gtk_widget_set_valign(dialog->exec_cmd_browse, GTK_ALIGN_CENTER);
- gtk_widget_set_valign(dialog->play_sound, GTK_ALIGN_CENTER);
- gtk_widget_set_valign(dialog->play_sound_entry, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand(dialog->play_sound_browse, TRUE);
- gtk_widget_set_valign(dialog->play_sound_browse, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand(dialog->play_sound_test, TRUE);
- gtk_widget_set_valign(dialog->play_sound_test, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand(dialog->play_sound_reset, TRUE);
- gtk_widget_set_valign(dialog->play_sound_reset, GTK_ALIGN_CENTER);
gtk_grid_attach(GTK_GRID(grid), dialog->open_win, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid), dialog->popup, 0, 1, 1, 1);
@@ -772,11 +708,6 @@
gtk_grid_attach(GTK_GRID(grid), dialog->exec_cmd, 0, 4, 1, 1);
gtk_grid_attach(GTK_GRID(grid), dialog->exec_cmd_entry, 1, 4, 1, 1);
gtk_grid_attach(GTK_GRID(grid), dialog->exec_cmd_browse, 2, 4, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), dialog->play_sound, 0, 5, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), dialog->play_sound_entry, 1, 5, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), dialog->play_sound_browse,2, 5, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), dialog->play_sound_test, 3, 5, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), dialog->play_sound_reset, 4, 5, 1, 1);
gtk_grid_set_row_spacing(GTK_GRID(grid), 3);
@@ -788,11 +719,6 @@
gtk_widget_show(dialog->exec_cmd);
gtk_widget_show(dialog->exec_cmd_entry);
gtk_widget_show(dialog->exec_cmd_browse);
- gtk_widget_show(dialog->play_sound);
- gtk_widget_show(dialog->play_sound_entry);
- gtk_widget_show(dialog->play_sound_browse);
- gtk_widget_show(dialog->play_sound_test);
- gtk_widget_show(dialog->play_sound_reset);
g_signal_connect(G_OBJECT(dialog->message_recv), "clicked",
G_CALLBACK(message_recv_toggle),
@@ -816,29 +742,6 @@
G_CALLBACK(filesel),
dialog->exec_cmd_entry);
- g_object_bind_property(dialog->play_sound, "active",
- dialog->play_sound_entry, "sensitive",
- G_BINDING_DEFAULT);
- g_object_bind_property(dialog->play_sound, "active",
- dialog->play_sound_browse, "sensitive",
- G_BINDING_DEFAULT);
- g_object_bind_property(dialog->play_sound, "active",
- dialog->play_sound_test, "sensitive",
- G_BINDING_DEFAULT);
- g_object_bind_property(dialog->play_sound, "active",
- dialog->play_sound_reset, "sensitive",
- G_BINDING_DEFAULT);
-
- g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked",
- G_CALLBACK(filesel),
- dialog->play_sound_entry);
- g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked",
- G_CALLBACK(pounce_test_sound),
- dialog->play_sound_entry);
- g_signal_connect(G_OBJECT(dialog->play_sound_reset), "clicked",
- G_CALLBACK(pounce_reset_sound),
- dialog->play_sound_entry);
-
g_signal_connect_swapped(G_OBJECT(dialog->send_msg_entry), "format-cleared",
G_CALLBACK(reset_send_msg_entry), dialog);
g_signal_connect_swapped(G_OBJECT(dialog->account_menu), "changed",
@@ -948,8 +851,6 @@
purple_pounce_action_is_enabled(cur_pounce, "send-message"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd),
purple_pounce_action_is_enabled(cur_pounce, "execute-command"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound),
- purple_pounce_action_is_enabled(cur_pounce, "play-sound"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->save_pounce),
purple_pounce_get_save(cur_pounce));
@@ -974,14 +875,6 @@
{
gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value);
}
-
- if ((value = purple_pounce_action_get_attribute(cur_pounce,
- "play-sound",
- "filename")) != NULL)
- {
- gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry),
- (*value != '\0') ? value : _("(default)"));
- }
}
else
{
@@ -1040,8 +933,6 @@
purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/send-message"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd),
purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/execute-command"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound),
- purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/play-sound"));
}
gtk_widget_show(vbox2);
@@ -1527,19 +1418,6 @@
}
}
}
-
- if (purple_pounce_action_is_enabled(pounce, "play-sound"))
- {
- const char *sound;
-
- sound = purple_pounce_action_get_attribute(pounce,
- "play-sound", "filename");
-
- if (sound != NULL)
- purple_sound_play_file(sound, account);
- else
- purple_sound_play_event(PURPLE_SOUND_POUNCE_DEFAULT, account);
- }
}
static void
@@ -1555,7 +1433,6 @@
purple_pounce_action_register(pounce, "popup-notify");
purple_pounce_action_register(pounce, "send-message");
purple_pounce_action_register(pounce, "execute-command");
- purple_pounce_action_register(pounce, "play-sound");
update_pounces();
}
@@ -1583,8 +1460,6 @@
FALSE);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/execute-command",
FALSE);
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/play-sound",
- FALSE);
purple_prefs_add_none(PIDGIN_PREFS_ROOT "/pounces/dialog");
purple_prefs_add_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width", 520);
purple_prefs_add_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height", 321);
--- a/pidgin/gtkprefs.c Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/gtkprefs.c Thu Aug 13 22:03:41 2020 -0500
@@ -40,7 +40,6 @@
#include "gtkprefs.h"
#include "gtksavedstatuses.h"
#include "gtksmiley-theme.h"
-#include "gtksound.h"
#include "gtkstatus-icon-theme.h"
#include "gtkutils.h"
#include "pidgincore.h"
@@ -191,22 +190,6 @@
GtkWidget *apply;
} keyring;
- /* Sounds page */
- struct {
- PidginPrefCombo method;
- GtkWidget *method_vbox;
- GtkWidget *command;
- GtkWidget *command_hbox;
- GtkWidget *mute;
- GtkWidget *conv_focus;
- PidginPrefCombo while_status;
- struct {
- GtkWidget *view;
- GtkListStore *store;
- } event;
- GtkWidget *entry;
- } sound;
-
/* Away page */
struct {
PidginPrefCombo idle_reporting;
@@ -224,7 +207,6 @@
SoupSession *session;
GtkWidget *blist;
GtkWidget *status;
- GtkWidget *sound;
GtkWidget *smiley;
} theme;
@@ -256,17 +238,11 @@
static PidginPrefsWindow *prefs = NULL;
/* Themes page */
-static GtkWidget *prefs_sound_themes_combo_box;
static GtkWidget *prefs_blist_themes_combo_box;
static GtkWidget *prefs_status_themes_combo_box;
static GtkWidget *prefs_smiley_themes_combo_box;
-/* Sound theme specific */
-static int sound_row_sel = 0;
-static gboolean prefs_sound_themes_loading;
-
/* These exist outside the lifetime of the prefs dialog */
-static GtkListStore *prefs_sound_themes;
static GtkListStore *prefs_blist_themes;
static GtkListStore *prefs_status_icon_themes;
static GtkListStore *prefs_smiley_themes;
@@ -865,7 +841,7 @@
static void
delete_prefs(GtkWidget *asdf, void *gdsa)
{
- /* Close any "select sound" request dialogs */
+ /* Close any request dialogs */
purple_request_close_with_handle(prefs);
purple_notify_close_with_handle(prefs);
@@ -876,10 +852,6 @@
purple_prefs_disconnect_by_handle(prefs);
/* NULL-ify globals */
- sound_row_sel = 0;
- prefs_sound_themes_loading = FALSE;
-
- prefs_sound_themes_combo_box = NULL;
prefs_blist_themes_combo_box = NULL;
prefs_status_themes_combo_box = NULL;
prefs_smiley_themes_combo_box = NULL;
@@ -934,47 +906,6 @@
}
}
-/* Rebuild the markup for the sound theme selection for "(Custom)" themes */
-static void
-pref_sound_generate_markup(void)
-{
- gboolean print_custom, customized;
- const gchar *author, *description, *current_theme;
- gchar *name, *markup;
- PurpleSoundTheme *theme;
- GtkTreeIter iter;
-
- customized = pidgin_sound_is_customized();
- current_theme = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme");
-
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(prefs_sound_themes), &iter)) {
- do {
- gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &iter, 2, &name, -1);
-
- print_custom = customized && name && purple_strequal(current_theme, name);
-
- if (!name || *name == '\0') {
- g_free(name);
- name = g_strdup(_("Default"));
- author = _("Penguin Pimps");
- description = _("The default Pidgin sound theme");
- } else {
- theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(name, "sound"));
- author = purple_theme_get_author(PURPLE_THEME(theme));
- description = purple_theme_get_description(PURPLE_THEME(theme));
- }
-
- markup = get_theme_markup(name, print_custom, author, description);
-
- gtk_list_store_set(prefs_sound_themes, &iter, 1, markup, -1);
-
- g_free(name);
- g_free(markup);
-
- } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(prefs_sound_themes), &iter));
- }
-}
-
/* adds the themes to the theme list from the manager so they can be displayed in prefs */
static void
prefs_themes_sort(PurpleTheme *theme)
@@ -984,22 +915,7 @@
gchar *image_full = NULL, *markup;
const gchar *name, *author, *description;
- if (PURPLE_IS_SOUND_THEME(theme)){
-
- image_full = purple_theme_get_image_full(theme);
- if (image_full != NULL){
- pixbuf = pidgin_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE);
- g_free(image_full);
- } else
- pixbuf = NULL;
-
- gtk_list_store_append(prefs_sound_themes, &iter);
- gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1);
-
- if (pixbuf != NULL)
- g_object_unref(G_OBJECT(pixbuf));
-
- } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){
+ if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){
GtkListStore *store;
if (PIDGIN_IS_BLIST_THEME(theme))
@@ -1061,7 +977,6 @@
gchar *tmp;
GtkTreeIter iter;
- prefs_sound_themes_loading = TRUE;
/* refresh the list of themes in the manager */
purple_theme_manager_refresh();
@@ -1070,11 +985,6 @@
pixbuf = pidgin_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE);
g_free(tmp);
- /* sound themes */
- gtk_list_store_clear(prefs_sound_themes);
- gtk_list_store_append(prefs_sound_themes, &iter);
- gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, "", -1);
-
/* blist themes */
gtk_list_store_clear(prefs_blist_themes);
gtk_list_store_append(prefs_blist_themes, &iter);
@@ -1097,23 +1007,18 @@
gtk_list_store_clear(prefs_smiley_themes);
purple_theme_manager_for_each_theme(prefs_themes_sort);
- pref_sound_generate_markup();
smileys_refresh_theme_list();
/* set active */
- prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"));
prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"));
prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme"));
prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"));
- prefs_sound_themes_loading = FALSE;
}
/* init all the theme variables so that the themes can be sorted later and used by pref pages */
static void
prefs_themes_init(void)
{
- prefs_sound_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
-
prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
@@ -1473,39 +1378,6 @@
g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), (gpointer) type);
}
-/* sets the current sound theme */
-static void
-prefs_set_sound_theme_cb(GtkComboBox *combo_box, gpointer user_data)
-{
- PidginPrefsWindow *win = PIDGIN_PREFS_WINDOW(user_data);
- gint i;
- gchar *pref;
- gchar *new_theme;
- GtkTreeIter new_iter;
-
- if(gtk_combo_box_get_active_iter(combo_box, &new_iter) && !prefs_sound_themes_loading) {
-
- gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &new_iter, 2, &new_theme, -1);
-
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/sound/theme", new_theme);
-
- /* New theme removes all customization */
- for(i = 0; i < PURPLE_NUM_SOUNDS; i++){
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
- pidgin_sound_get_event_option(i));
- purple_prefs_set_path(pref, "");
- g_free(pref);
- }
-
- /* gets rid of the "(Custom)" from the last selection */
- pref_sound_generate_markup();
-
- gtk_entry_set_text(GTK_ENTRY(win->sound.entry), _("(default)"));
-
- g_free(new_theme);
- }
-}
-
/* sets the current smiley theme */
static void
prefs_set_smiley_theme_cb(GtkComboBox *combo_box, gpointer user_data)
@@ -1616,11 +1488,6 @@
"icon");
prefs_status_themes_combo_box = win->theme.status;
- /* Sound Themes */
- prefs_build_theme_combo_box(win->theme.sound, prefs_sound_themes,
- PIDGIN_PREFS_ROOT "/sound/theme", "sound");
- prefs_sound_themes_combo_box = win->theme.sound;
-
/* Smiley Themes */
prefs_build_theme_combo_box(win->theme.smiley, prefs_smiley_themes,
PIDGIN_PREFS_ROOT "/smileys/theme",
@@ -2310,294 +2177,6 @@
/*** keyring page - end *************************************************/
-static gboolean
-sound_method_filter(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
-{
- gboolean any = FALSE;
- gboolean gstreamer = FALSE;
- gboolean win32 = FALSE;
-
- gtk_tree_model_get(model, iter, 2, &any, 3, &gstreamer, 4, &win32, -1);
-
- if (any) {
- return TRUE;
- }
-
- if (gstreamer) {
-#ifdef USE_GSTREAMER
-#ifdef _WIN32
- return win32;
-#else
- return !win32;
-#endif
-#else
- return FALSE;
-#endif
- }
-
-#ifdef _WIN32
- return win32;
-#else
- return !win32;
-#endif
-}
-
-static gint
-sound_cmd_yeah(GtkEntry *entry, gpointer d)
-{
- purple_prefs_set_path(PIDGIN_PREFS_ROOT "/sound/command",
- gtk_entry_get_text(GTK_ENTRY(entry)));
- return TRUE;
-}
-
-static void
-sound_changed1_cb(const char *name, PurplePrefType type,
- gconstpointer value, gpointer data)
-{
- GtkWidget *hbox = data;
- const char *method = value;
-
- gtk_widget_set_sensitive(hbox, purple_strequal(method, "custom"));
-}
-
-static void
-sound_changed2_cb(const char *name, PurplePrefType type,
- gconstpointer value, gpointer data)
-{
- GtkWidget *vbox = data;
- const char *method = value;
-
- gtk_widget_set_sensitive(vbox, !purple_strequal(method, "none"));
-}
-
-
-static void
-event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data)
-{
- GtkTreeModel *model = (GtkTreeModel *)data;
- GtkTreeIter iter;
- GtkTreePath *path = gtk_tree_path_new_from_string(pth);
- char *pref;
-
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
- 2, &pref,
- -1);
-
- purple_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell));
- g_free(pref);
-
- gtk_list_store_set(GTK_LIST_STORE (model), &iter,
- 0, !gtk_cell_renderer_toggle_get_active(cell),
- -1);
-
- gtk_tree_path_free(path);
-}
-
-static void
-test_sound(GtkWidget *button, gpointer i_am_NULL)
-{
- char *pref;
- gboolean temp_enabled;
- gboolean temp_mute;
-
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s",
- pidgin_sound_get_event_option(sound_row_sel));
-
- temp_enabled = purple_prefs_get_bool(pref);
- temp_mute = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute");
-
- if (!temp_enabled) purple_prefs_set_bool(pref, TRUE);
- if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
-
- purple_sound_play_event(sound_row_sel, NULL);
-
- if (!temp_enabled) purple_prefs_set_bool(pref, FALSE);
- if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", TRUE);
-
- g_free(pref);
-}
-
-/*
- * Resets a sound file back to default.
- */
-static void
-reset_sound(GtkWidget *button, gpointer data)
-{
- PidginPrefsWindow *win = PIDGIN_PREFS_WINDOW(data);
- gchar *pref;
-
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
- pidgin_sound_get_event_option(sound_row_sel));
- purple_prefs_set_path(pref, "");
- g_free(pref);
-
- gtk_entry_set_text(GTK_ENTRY(win->sound.entry), _("(default)"));
-
- pref_sound_generate_markup();
-}
-
-static void
-sound_chosen_cb(void *user_data, const char *filename)
-{
- gchar *pref;
- int sound;
-
- sound = GPOINTER_TO_INT(user_data);
-
- /* Set it -- and forget it */
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
- pidgin_sound_get_event_option(sound));
- purple_prefs_set_path(pref, filename);
- g_free(pref);
-
- /*
- * If the sound we just changed is still the currently selected
- * sound, then update the box showing the file name.
- */
- if (sound == sound_row_sel)
- gtk_entry_set_text(GTK_ENTRY(prefs->sound.entry), filename);
-
- pref_sound_generate_markup();
-}
-
-static void
-select_sound(GtkWidget *button, gpointer being_NULL_is_fun)
-{
- gchar *pref;
- const char *filename;
-
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
- pidgin_sound_get_event_option(sound_row_sel));
- filename = purple_prefs_get_path(pref);
- g_free(pref);
-
- if (*filename == '\0')
- filename = NULL;
-
- purple_request_file(prefs, _("Sound Selection"), filename, FALSE,
- G_CALLBACK(sound_chosen_cb), NULL, NULL,
- GINT_TO_POINTER(sound_row_sel));
-}
-
-static void
-prefs_sound_sel(GtkTreeSelection *sel, gpointer data)
-{
- PidginPrefsWindow *win = PIDGIN_PREFS_WINDOW(data);
- GtkTreeModel *model;
- GtkTreeIter iter;
- GValue val;
- const char *file;
- char *pref;
-
- if (! gtk_tree_selection_get_selected (sel, &model, &iter))
- return;
-
- val.g_type = 0;
- gtk_tree_model_get_value (model, &iter, 3, &val);
- sound_row_sel = g_value_get_uint(&val);
-
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
- pidgin_sound_get_event_option(sound_row_sel));
- file = purple_prefs_get_path(pref);
- g_free(pref);
- if (win->sound.entry) {
- gtk_entry_set_text(GTK_ENTRY(win->sound.entry),
- (file && *file != '\0') ? file
- : _("(default)"));
- }
- g_value_unset (&val);
-
- pref_sound_generate_markup();
-}
-
-static void
-bind_sound_page(PidginPrefsWindow *win)
-{
- GtkTreeModel *model;
- GtkTreeSelection *sel;
- GtkTreePath *path;
- int j;
- const char *file;
- char *pref;
- const char *cmd;
-
- win->sound.method.type = PURPLE_PREF_STRING;
- win->sound.method.key = PIDGIN_PREFS_ROOT "/sound/method";
- pidgin_prefs_bind_dropdown(&win->sound.method);
- model = gtk_combo_box_get_model(GTK_COMBO_BOX(win->sound.method.combo));
- gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model), sound_method_filter, NULL, NULL);
- gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(model));
-
- gtk_widget_set_sensitive(
- win->sound.method_vbox,
- !purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT
- "/sound/method"),
- "none"));
- purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/method",
- sound_changed2_cb,
- win->sound.method_vbox);
-
- gtk_widget_set_sensitive(
- win->sound.command_hbox,
- purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT
- "/sound/method"),
- "custom"));
- purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/method",
- sound_changed1_cb,
- win->sound.command_hbox);
-
- cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command");
- if (cmd) {
- gtk_entry_set_text(GTK_ENTRY(win->sound.command), cmd);
- }
-
- pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/sound/mute",
- win->sound.mute);
-
- pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/sound/conv_focus",
- win->sound.conv_focus);
-
- win->sound.while_status.type = PURPLE_PREF_INT;
- win->sound.while_status.key = "/purple/sound/while_status";
- pidgin_prefs_bind_dropdown(&win->sound.while_status);
-
- /* SOUND SELECTION */
- for (j=0; j < PURPLE_NUM_SOUNDS; j++) {
- char *pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s",
- pidgin_sound_get_event_option(j));
- const char *label = pidgin_sound_get_event_label(j);
- GtkTreeIter iter;
-
- if (label == NULL) {
- g_free(pref);
- continue;
- }
-
- gtk_list_store_append(win->sound.event.store, &iter);
- gtk_list_store_set(win->sound.event.store, &iter,
- 0, purple_prefs_get_bool(pref),
- 1, _(label),
- 2, pref,
- 3, j,
- -1);
- g_free(pref);
- }
-
- sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(win->sound.event.view));
- path = gtk_tree_path_new_first();
- gtk_tree_selection_select_path(sel, path);
- gtk_tree_path_free(path);
-
- pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
- pidgin_sound_get_event_option(0));
- file = purple_prefs_get_path(pref);
- g_free(pref);
- gtk_entry_set_text(GTK_ENTRY(win->sound.entry),
- (file && *file != '\0') ? file : _("(default)"));
-}
-
-
static void
set_idle_away(PurpleSavedStatus *status)
{
@@ -3230,7 +2809,6 @@
bind_network_page(win);
bind_proxy_page(win);
bind_keyring_page(win);
- bind_sound_page(win);
bind_away_page(win);
bind_theme_page(win);
#ifdef USE_VV
@@ -3430,34 +3008,6 @@
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, keyring.vbox);
- /* Sounds page */
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.method.combo);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.method_vbox);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.command);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.command_hbox);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.mute);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.conv_focus);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.while_status.combo);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.event.view);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.event.store);
- gtk_widget_class_bind_template_child(widget_class, PidginPrefsWindow,
- sound.entry);
- gtk_widget_class_bind_template_callback(widget_class, sound_cmd_yeah);
- gtk_widget_class_bind_template_callback(widget_class, prefs_sound_sel);
- gtk_widget_class_bind_template_callback(widget_class, event_toggled);
- gtk_widget_class_bind_template_callback(widget_class, select_sound);
- gtk_widget_class_bind_template_callback(widget_class, test_sound);
- gtk_widget_class_bind_template_callback(widget_class, reset_sound);
-
/* Away page */
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow,
@@ -3486,16 +3036,12 @@
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, theme.status);
gtk_widget_class_bind_template_child(
- widget_class, PidginPrefsWindow, theme.sound);
- gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, theme.smiley);
gtk_widget_class_bind_template_callback(widget_class,
prefs_set_blist_theme_cb);
gtk_widget_class_bind_template_callback(widget_class,
prefs_set_status_icon_theme_cb);
gtk_widget_class_bind_template_callback(widget_class,
- prefs_set_sound_theme_cb);
- gtk_widget_class_bind_template_callback(widget_class,
prefs_set_smiley_theme_cb);
}
@@ -3653,6 +3199,40 @@
purple_prefs_remove(PIDGIN_PREFS_ROOT "/logging/individual_logs");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/signon");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/silent_signon");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/command");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/conv_focus");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/login");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/logout");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/send_im");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/got_attention");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/im_recv");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/join_chat");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/left_chat");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/login");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/logout");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/nick_said");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/pounce_default");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/send_im");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/sent_attention");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/method");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/mute");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/theme");
+ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound");
/* Convert old queuing prefs to hide_new 3-way pref. */
if (purple_prefs_exists("/plugins/gtk/docklet/queue_messages") &&
--- a/pidgin/gtksound.c Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,684 +0,0 @@
-/* pidgin
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- *
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <sys/types.h>
-#ifndef _WIN32
-# include <sys/wait.h>
-#endif
-
-#include <glib/gi18n-lib.h>
-
-#ifdef _WIN32
-#include <windows.h>
-#include <mmsystem.h>
-#endif
-
-#ifdef USE_GSTREAMER
-# include <gst/gst.h>
-#endif /* USE_GSTREAMER */
-
-#include <purple.h>
-
-#include "gtkconv.h"
-#include "gtksound.h"
-#include "pidgincore.h"
-
-struct pidgin_sound_event {
- char *label;
- char *pref;
- char *def;
-};
-
-static guint mute_login_sounds_timeout = 0;
-static gboolean mute_login_sounds = FALSE;
-
-#ifdef USE_GSTREAMER
-static gboolean gst_init_failed;
-#endif /* USE_GSTREAMER */
-
-static const struct pidgin_sound_event sounds[PURPLE_NUM_SOUNDS] = {
- {N_("Buddy logs in"), "login", "login.wav"},
- {N_("Buddy logs out"), "logout", "logout.wav"},
- {N_("Message received"), "im_recv", "receive.wav"},
- {N_("Message received begins conversation"), "first_im_recv", "receive.wav"},
- {N_("Message sent"), "send_im", "send.wav"},
- {N_("Person enters chat"), "join_chat", "login.wav"},
- {N_("Person leaves chat"), "left_chat", "logout.wav"},
- {N_("You talk in chat"), "send_chat_msg", "send.wav"},
- {N_("Others talk in chat"), "chat_msg_recv", "receive.wav"},
- /* this isn't a terminator, it's the buddy pounce default sound event ;-) */
- {NULL, "pounce_default", "alert.wav"},
- {N_("Someone says your username in chat"), "nick_said", "alert.wav"},
- {N_("Attention received"), "got_attention", "alert.wav"}
-};
-
-static gboolean
-unmute_login_sounds_cb(gpointer data)
-{
- mute_login_sounds = FALSE;
- mute_login_sounds_timeout = 0;
- return FALSE;
-}
-
-static gboolean
-chat_nick_matches_name(PurpleChatConversation *chat, const char *aname)
-{
- char *nick = NULL;
- char *name = NULL;
- gboolean ret = FALSE;
-
- if (chat==NULL)
- return ret;
-
- nick = g_strdup(purple_normalize(purple_conversation_get_account(
- PURPLE_CONVERSATION(chat)), purple_chat_conversation_get_nick(chat)));
- name = g_strdup(purple_normalize(purple_conversation_get_account(
- PURPLE_CONVERSATION(chat)), aname));
-
- if (g_utf8_collate(nick, name) == 0)
- ret = TRUE;
-
- g_free(nick);
- g_free(name);
-
- return ret;
-}
-
-/*
- * play a sound event for a conversation, honoring make_sound flag
- * of conversation and checking for focus if conv_focus pref is set
- */
-static void
-play_conv_event(PurpleConversation *conv, PurpleSoundEventID event)
-{
- g_return_if_fail(event < PURPLE_NUM_SOUNDS);
-
- /* If we should not play the sound for some reason, then exit early */
- if (conv != NULL && PIDGIN_IS_PIDGIN_CONVERSATION(conv))
- {
- PidginConversation *gtkconv;
- gboolean has_focus;
-
- gtkconv = PIDGIN_CONVERSATION(conv);
- has_focus = purple_conversation_has_focus(conv);
-
- if (!gtkconv->make_sound ||
- (has_focus && !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus")))
- {
- return;
- }
- }
-
- purple_sound_play_event(event, conv ? purple_conversation_get_account(conv) : NULL);
-}
-
-static void
-buddy_state_cb(PurpleBuddy *buddy, PurpleSoundEventID event)
-{
- purple_sound_play_event(event, purple_buddy_get_account(buddy));
-}
-
-static void
-im_msg_received_cb(PurpleAccount *account, char *sender,
- char *message, PurpleConversation *conv,
- PurpleMessageFlags flags, PurpleSoundEventID event)
-{
- if (flags & PURPLE_MESSAGE_DELAYED || flags & PURPLE_MESSAGE_NOTIFY)
- return;
-
- if (conv==NULL)
- purple_sound_play_event(PURPLE_SOUND_FIRST_RECEIVE, account);
- else
- play_conv_event(conv, event);
-}
-
-static void
-im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg,
- PurpleSoundEventID event)
-{
- PurpleConversation *conv = PURPLE_CONVERSATION(
- purple_conversations_find_im_with_account(
- purple_message_get_recipient(msg), account));
- play_conv_event(conv, event);
-}
-
-static void
-chat_user_join_cb(PurpleChatConversation *chat, const char *name,
- PurpleChatUserFlags flags, gboolean new_arrival,
- PurpleSoundEventID event)
-{
- if (new_arrival && !chat_nick_matches_name(chat, name))
- play_conv_event(PURPLE_CONVERSATION(chat), event);
-}
-
-static void
-chat_user_left_cb(PurpleChatConversation *chat, const char *name,
- const char *reason, PurpleSoundEventID event)
-{
- if (!chat_nick_matches_name(chat, name))
- play_conv_event(PURPLE_CONVERSATION(chat), event);
-}
-
-static void
-chat_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg, int id,
- PurpleSoundEventID event)
-{
- PurpleConnection *conn = purple_account_get_connection(account);
- PurpleConversation *conv = NULL;
-
- if (conn!=NULL)
- conv = PURPLE_CONVERSATION(purple_conversations_find_chat(conn,id));
-
- play_conv_event(conv, event);
-}
-
-static void
-chat_msg_received_cb(PurpleAccount *account, char *sender,
- char *message, PurpleChatConversation *chat,
- PurpleMessageFlags flags, PurpleSoundEventID event)
-{
- PurpleConversation *conv = PURPLE_CONVERSATION(chat);
- if (flags & PURPLE_MESSAGE_DELAYED || flags & PURPLE_MESSAGE_NOTIFY)
- return;
-
- g_return_if_fail(conv != NULL);
-
- if (purple_chat_conversation_is_ignored_user(chat, sender))
- return;
-
- if (chat_nick_matches_name(chat, sender))
- return;
-
- if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_chat_conversation_get_nick(chat)))
- /* This isn't quite right; if you have the PURPLE_SOUND_CHAT_NICK event disabled
- * and the PURPLE_SOUND_CHAT_SAY event enabled, you won't get a sound at all */
- play_conv_event(conv, PURPLE_SOUND_CHAT_NICK);
- else
- play_conv_event(conv, event);
-}
-
-static void
-got_attention_cb(PurpleAccount *account, const char *who,
- PurpleConversation *conv, guint type, PurpleSoundEventID event)
-{
- play_conv_event(conv, event);
-}
-
-/*
- * We mute sounds for the 10 seconds after you log in so that
- * you don't get flooded with sounds when the blist shows all
- * your buddies logging in.
- */
-static void
-account_signon_cb(PurpleConnection *gc, gpointer data)
-{
- if (mute_login_sounds_timeout != 0)
- g_source_remove(mute_login_sounds_timeout);
- mute_login_sounds = TRUE;
- mute_login_sounds_timeout = g_timeout_add_seconds(10, unmute_login_sounds_cb, NULL);
-}
-
-const char *
-pidgin_sound_get_event_option(PurpleSoundEventID event)
-{
- if(event >= PURPLE_NUM_SOUNDS)
- return 0;
-
- return sounds[event].pref;
-}
-
-const char *
-pidgin_sound_get_event_label(PurpleSoundEventID event)
-{
- if(event >= PURPLE_NUM_SOUNDS)
- return NULL;
-
- return sounds[event].label;
-}
-
-void *
-pidgin_sound_get_handle()
-{
- static int handle;
-
- return &handle;
-}
-
-static void
-pidgin_sound_init(void)
-{
- void *gtk_sound_handle = pidgin_sound_get_handle();
- void *blist_handle = purple_blist_get_handle();
- void *conv_handle = purple_conversations_get_handle();
-#ifdef USE_GSTREAMER
- GError *error = NULL;
-#endif
-
- purple_signal_connect(purple_connections_get_handle(), "signed-on",
- gtk_sound_handle, PURPLE_CALLBACK(account_signon_cb),
- NULL);
-
- purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound");
- purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/enabled");
- purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/file");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/login", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/login", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/logout", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/logout", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/im_recv", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_im", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_im", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/join_chat", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/left_chat", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", "");
- purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/theme", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", "");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE);
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
- purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/command", "");
- purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/method", "automatic");
-
-#ifdef USE_GSTREAMER
- purple_debug_info("sound", "Initializing sound output drivers.\n");
- gst_registry_fork_set_enabled(FALSE);
- if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
- purple_notify_error(NULL, _("GStreamer Failure"),
- _("GStreamer failed to initialize."),
- error ? error->message : "", NULL);
- if (error) {
- g_error_free(error);
- error = NULL;
- }
- }
-#endif /* USE_GSTREAMER */
-
- purple_signal_connect(blist_handle, "buddy-signed-on",
- gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
- GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE));
- purple_signal_connect(blist_handle, "buddy-signed-off",
- gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
- GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE));
- purple_signal_connect(conv_handle, "received-im-msg",
- gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb),
- GINT_TO_POINTER(PURPLE_SOUND_RECEIVE));
- purple_signal_connect(conv_handle, "sent-im-msg",
- gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb),
- GINT_TO_POINTER(PURPLE_SOUND_SEND));
- purple_signal_connect(conv_handle, "chat-user-joined",
- gtk_sound_handle, PURPLE_CALLBACK(chat_user_join_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN));
- purple_signal_connect(conv_handle, "chat-user-left",
- gtk_sound_handle, PURPLE_CALLBACK(chat_user_left_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE));
- purple_signal_connect(conv_handle, "sent-chat-msg",
- gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY));
- purple_signal_connect(conv_handle, "received-chat-msg",
- gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
- GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
- purple_signal_connect(conv_handle, "got-attention", gtk_sound_handle,
- PURPLE_CALLBACK(got_attention_cb),
- GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION));
- /* for the time being, don't handle sent-attention here, since playing a
- sound would result induplicate sounds. And fixing that would require changing the
- conversation signal for msg-recv */
-}
-
-static void
-pidgin_sound_uninit(void)
-{
-#ifdef USE_GSTREAMER
- if (!gst_init_failed)
- gst_deinit();
-#endif
-
- purple_signals_disconnect_by_handle(pidgin_sound_get_handle());
-}
-
-#ifdef USE_GSTREAMER
-static gboolean
-bus_call (GstBus *bus,
- GstMessage *msg,
- gpointer data)
-{
- GstElement *play = data;
- GError *err = NULL;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_ERROR:
- gst_message_parse_error(msg, &err, NULL);
- purple_debug_error("gstreamer", "%s\n", err->message);
- g_error_free(err);
- /* fall-through and clean up */
- case GST_MESSAGE_EOS:
- gst_element_set_state(play, GST_STATE_NULL);
- gst_object_unref(GST_OBJECT(play));
- return FALSE;
- break;
- case GST_MESSAGE_WARNING:
- gst_message_parse_warning(msg, &err, NULL);
- purple_debug_warning("gstreamer", "%s\n", err->message);
- g_error_free(err);
- break;
- default:
- break;
- }
- return TRUE;
-}
-#endif
-
-#ifndef _WIN32
-static gboolean
-expire_old_child(gpointer data)
-{
- pid_t pid = GPOINTER_TO_INT(data);
-
- if (waitpid(pid, NULL, WNOHANG | WUNTRACED) < 0) {
- if (errno == ECHILD)
- return FALSE;
- else
- purple_debug_warning("gtksound", "Child is ill, pid: %d (%s)\n", pid, strerror(errno));
- }
-
- if (kill(pid, SIGKILL) < 0)
- purple_debug_error("gtksound", "Killing process %d failed (%s)\n", pid, strerror(errno));
-
- return FALSE;
-}
-#endif
-
-#ifdef _WIN32
-static void
-pidgin_sound_play_file_win32(const char *filename)
-{
- wchar_t *wc_filename = g_utf8_to_utf16(filename,
- -1, NULL, NULL, NULL);
- if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME))
- purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
- g_free(wc_filename);
-}
-#endif /* _WIN32 */
-
-static void
-pidgin_sound_play_file(const char *filename)
-{
- const char *method;
-#ifdef USE_GSTREAMER
- char *uri;
- GstElement *sink = NULL;
- GstElement *play = NULL;
- GstBus *bus = NULL;
-#endif
-
- if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute"))
- return;
-
- method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
-
- if (purple_strequal(method, "none")) {
- return;
- } else if (purple_strequal(method, "beep")) {
- gdk_display_beep(gdk_display_get_default());
- return;
- }
-#ifdef _WIN32
- else if (purple_strequal(method, "playsoundw")) {
- pidgin_sound_play_file_win32(filename);
- return;
- }
-#endif /* _WIN32 */
-
- if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
- purple_debug_error("gtksound", "sound file (%s) does not exist.\n", filename);
- return;
- }
-
-#ifndef _WIN32
- if (purple_strequal(method, "custom")) {
- const char *sound_cmd;
- char *command;
- char *esc_filename;
- char **argv = NULL;
- GError *error = NULL;
- GPid pid;
-
- sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command");
-
- if (!sound_cmd || *sound_cmd == '\0') {
- purple_debug_error("gtksound",
- "'Command' sound method has been chosen, "
- "but no command has been set.\n");
- return;
- }
-
- esc_filename = g_shell_quote(filename);
-
- if(strstr(sound_cmd, "%s"))
- command = purple_strreplace(sound_cmd, "%s", esc_filename);
- else
- command = g_strdup_printf("%s %s", sound_cmd, esc_filename);
-
- if (!g_shell_parse_argv(command, NULL, &argv, &error)) {
- purple_debug_error("gtksound", "error parsing command %s (%s)\n",
- command, error->message);
- g_error_free(error);
- g_free(esc_filename);
- g_free(command);
- return;
- }
-
- if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- NULL, NULL, &pid, &error)) {
- purple_debug_error("gtksound", "sound command could not be launched: %s\n",
- error->message);
- g_error_free(error);
- } else {
- g_timeout_add_seconds(15, expire_old_child, GINT_TO_POINTER(pid));
- }
-
- g_strfreev(argv);
- g_free(esc_filename);
- g_free(command);
- return;
- }
-#endif /* _WIN32 */
-
-#ifdef USE_GSTREAMER
- if (gst_init_failed) /* Perhaps do gdk_beep instead? */
- return;
-#ifdef _WIN32
- if (purple_strequal(method, "automatic")) {
- sink = gst_element_factory_make("directsoundsink", "sink");
- if (sink == NULL)
- sink = gst_element_factory_make("waveformsink", "sink");
- if (sink == NULL)
- sink = gst_element_factory_make("autoaudiosink", "sink");
- } else if (purple_strequal(method, "directsound")) {
- sink = gst_element_factory_make("directsoundsink", "sink");
- } else if (purple_strequal(method, "waveform")) {
- sink = gst_element_factory_make("waveformsink", "sink");
- }
-#else
- if (purple_strequal(method, "automatic")) {
- sink = gst_element_factory_make("autoaudiosink", "sink");
- } else if (purple_strequal(method, "esd")) {
- sink = gst_element_factory_make("esdsink", "sink");
- } else if (purple_strequal(method, "alsa")) {
- sink = gst_element_factory_make("alsasink", "sink");
- }
-#endif
- else {
- purple_debug_error("sound", "Unknown sound method '%s'\n", method);
- return;
- }
-
- if (!purple_strequal(method, "automatic") && !sink) {
- purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
- return;
- }
-
- play = gst_element_factory_make("playbin", "play");
-
- if (play == NULL) {
- return;
- }
-
-#ifdef _WIN32
- uri = g_strdup_printf("file:///%s", filename);
- g_strdelimit(uri, "\\", '/');
-#else
- uri = g_strdup_printf("file://%s", filename);
-#endif
-
- g_object_set(G_OBJECT(play), "uri", uri,
- "audio-sink", sink, NULL);
-
- bus = gst_pipeline_get_bus(GST_PIPELINE(play));
- gst_bus_add_watch(bus, bus_call, play);
-
- gst_element_set_state(play, GST_STATE_PLAYING);
-
- gst_object_unref(bus);
- g_free(uri);
-
-#else /* #ifdef USE_GSTREAMER */
-
-#ifndef _WIN32
- gdk_display_beep(gdk_display_get_default());
-#else /* _WIN32 */
- pidgin_sound_play_file_win32(filename);
-#endif /* _WIN32 */
-
-#endif /* USE_GSTREAMER */
-}
-
-static void
-pidgin_sound_play_event(PurpleSoundEventID event)
-{
- char *enable_pref;
- char *file_pref;
- const char *theme_name;
- PurpleSoundTheme *theme;
-
- if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
- return;
-
- if (event >= PURPLE_NUM_SOUNDS) {
- purple_debug_error("sound", "got request for unknown sound: %d\n", event);
- return;
- }
-
- enable_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s",
- sounds[event].pref);
- file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref);
-
- /* check NULL for sounds that don't have an option, ie buddy pounce */
- if (purple_prefs_get_bool(enable_pref)) {
- char *filename = g_strdup(purple_prefs_get_path(file_pref));
- theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme");
-
- if (theme_name && *theme_name && (!filename || !*filename)) {
- /* Use theme */
- g_free(filename);
-
- theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(theme_name, "sound"));
- filename = purple_sound_theme_get_file_full(theme, sounds[event].pref);
-
- if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)){ /* Use Default sound in this case */
- purple_debug_error("sound", "The file: (%s) %s\n from theme: %s, was not found or wasn't readable\n",
- sounds[event].pref, filename, theme_name);
- g_free(filename);
- filename = NULL;
- }
- }
-
- if (!filename || *filename == '\0') { /* Use Default sounds */
- g_free(filename);
-
- filename = g_build_filename(PURPLE_DATADIR,
- "sounds", "purple", sounds[event].def, NULL);
- }
-
- purple_sound_play_file(filename, NULL);
-
- g_free(filename);
- }
-
- g_free(enable_pref);
- g_free(file_pref);
-}
-
-gboolean
-pidgin_sound_is_customized(void)
-{
- gint i;
- gchar *path;
- const char *file;
-
- for (i = 0; i < PURPLE_NUM_SOUNDS; i++) {
- path = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[i].pref);
- file = purple_prefs_get_path(path);
- g_free(path);
-
- if (file && file[0] != '\0')
- return TRUE;
- }
-
- return FALSE;
-
-}
-
-static PurpleSoundUiOps sound_ui_ops =
-{
- pidgin_sound_init,
- pidgin_sound_uninit,
- pidgin_sound_play_file,
- pidgin_sound_play_event,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PurpleSoundUiOps *
-pidgin_sound_get_ui_ops(void)
-{
- return &sound_ui_ops;
-}
--- a/pidgin/gtksound.h Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/* pidgin
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef _PIDGINSOUND_H_
-#define _PIDGINSOUND_H_
-/**
- * SECTION:gtksound
- * @section_id: pidgin-gtksound
- * @short_description: <filename>gtksound.h</filename>
- * @title: Sound API
- */
-
-#include <purple.h>
-
-G_BEGIN_DECLS
-
-/**************************************************************************/
-/* GTK+ Sound API */
-/**************************************************************************/
-
-/**
- * pidgin_sound_get_event_option:
- * @event: The event.
- *
- * Get the prefs option for an event.
- *
- * Returns: The option.
- */
-const char *pidgin_sound_get_event_option(PurpleSoundEventID event);
-
-/**
- * pidgin_sound_get_event_label:
- * @event: The event.
- *
- * Get the label for an event.
- *
- * Returns: The label.
- */
-const char *pidgin_sound_get_event_label(PurpleSoundEventID event);
-
-/**
- * pidgin_sound_get_ui_ops:
- *
- * Gets GTK+ sound UI ops.
- *
- * Returns: The UI operations structure.
- */
-PurpleSoundUiOps *pidgin_sound_get_ui_ops(void);
-
-/**
- * pidgin_sound_get_handle:
- *
- * Get the handle for the GTK+ sound system.
- *
- * Returns: The handle to the sound system
- */
-void *pidgin_sound_get_handle(void);
-
-/**
- * pidgin_sound_is_customized:
- *
- * Returns true Pidgin is using customized sounds
- *
- * Returns: TRUE if non default sounds are used.
- */
-gboolean pidgin_sound_is_customized(void);
-
-G_END_DECLS
-
-#endif /* _PIDGINSOUND_H_ */
--- a/pidgin/libpidgin.c Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/libpidgin.c Thu Aug 13 22:03:41 2020 -0500
@@ -50,7 +50,6 @@
#include "gtkroomlist.h"
#include "gtksavedstatuses.h"
#include "gtksmiley-theme.h"
-#include "gtksound.h"
#include "gtkutils.h"
#include "gtkwhiteboard.h"
#include "pidgincore.h"
@@ -219,7 +218,6 @@
purple_blist_set_ui(PIDGIN_TYPE_BUDDY_LIST);
purple_notify_set_ui_ops(pidgin_notify_get_ui_ops());
purple_request_set_ui_ops(pidgin_request_get_ui_ops());
- purple_sound_set_ui_ops(pidgin_sound_get_ui_ops());
purple_connections_set_ui_ops(pidgin_connections_get_ui_ops());
purple_whiteboard_set_ui_ops(pidgin_whiteboard_get_ui_ops());
purple_idle_set_ui_ops(pidgin_idle_get_ui_ops());
--- a/pidgin/meson.build Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/meson.build Thu Aug 13 22:03:41 2020 -0500
@@ -24,7 +24,6 @@
'gtkscrollbook.c',
'gtksmiley-manager.c',
'gtksmiley-theme.c',
- 'gtksound.c',
'gtkstatus-icon-theme.c',
'gtkstatusbox.c',
'gtkstyle.c',
@@ -83,7 +82,6 @@
'gtkscrollbook.h',
'gtksmiley-manager.h',
'gtksmiley-theme.h',
- 'gtksound.h',
'gtkstatus-icon-theme.h',
'gtkstatusbox.h',
'gtkstyle.h',
--- a/pidgin/pidginactiongroup.c Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/pidginactiongroup.c Thu Aug 13 22:03:41 2020 -0500
@@ -384,18 +384,6 @@
* Preference Callbacks
*****************************************************************************/
static void
-pidgin_action_group_mute_sounds_callback(const gchar *name,
- PurplePrefType type,
- gconstpointer value,
- gpointer data)
-{
- PidginActionGroup *group = PIDGIN_ACTION_GROUP(data);
-
- pidgin_action_group_bool_pref_handler(group, PIDGIN_ACTION_MUTE_SOUNDS,
- (gboolean)GPOINTER_TO_INT(value));
-}
-
-static void
pidgin_action_group_show_buddy_icons_callback(const gchar *name,
PurplePrefType type,
gconstpointer value,
@@ -555,14 +543,6 @@
}
static void
-pidgin_action_group_mute_sounds(GSimpleAction *action, GVariant *value,
- gpointer data)
-{
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute",
- g_variant_get_boolean(value));
-}
-
-static void
pidgin_action_group_new_message(GSimpleAction *simple, GVariant *parameter,
gpointer data)
{
@@ -717,10 +697,6 @@
.name = PIDGIN_ACTION_JOIN_CHAT,
.activate = pidgin_action_group_join_chat,
}, {
- .name = PIDGIN_ACTION_MUTE_SOUNDS,
- .state = "false",
- .change_state = pidgin_action_group_mute_sounds,
- }, {
.name = PIDGIN_ACTION_NEW_MESSAGE,
.activate = pidgin_action_group_new_message,
}, {
@@ -781,9 +757,6 @@
/* now add some handlers for preference changes and set actions to the
* correct value.
*/
- pidgin_action_group_setup_bool(group, PIDGIN_ACTION_MUTE_SOUNDS,
- PIDGIN_PREFS_ROOT "/sound/mute",
- pidgin_action_group_mute_sounds_callback);
pidgin_action_group_setup_bool(group, PIDGIN_ACTION_SHOW_BUDDY_ICONS,
PIDGIN_PREFS_ROOT "/blist/show_buddy_icons",
pidgin_action_group_show_buddy_icons_callback);
--- a/pidgin/pidginactiongroup.h Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/pidginactiongroup.h Thu Aug 13 22:03:41 2020 -0500
@@ -119,13 +119,6 @@
#define PIDGIN_ACTION_JOIN_CHAT ("join-chat")
/**
- * PIDGIN_ACTION_MUTE_SOUNDS:
- *
- * A constant that represents the mute-sounds action.
- */
-#define PIDGIN_ACTION_MUTE_SOUNDS ("mute-sounds")
-
-/**
* PIDGIN_ACTION_NEW_MESSAGE:
*
* A constant that represents the new-message action.
--- a/pidgin/plugins/mailchk.c Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/plugins/mailchk.c Thu Aug 13 22:03:41 2020 -0500
@@ -73,9 +73,6 @@
gtk_widget_show(mail);
}
- if (count & NEW_MAIL)
- purple_sound_play_event(PURPLE_SOUND_POUNCE_DEFAULT, NULL);
-
if (count & UNREAD_MAIL)
gtk_label_set_text(GTK_LABEL(mail), "You have new mail!");
else if (count & ANY_MAIL)
--- a/pidgin/resources/BuddyList/menu.ui Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/resources/BuddyList/menu.ui Thu Aug 13 22:03:41 2020 -0500
@@ -283,21 +283,6 @@
<property name="use_underline">True</property>
</object>
</child>
- <child>
- <object class="GtkSeparatorMenuItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkCheckMenuItem" id="mute_sounds">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">blist.mute-sounds</property>
- <property name="label" translatable="yes">Mute _Sounds</property>
- <property name="use_underline">True</property>
- </object>
- </child>
</object>
</child>
</object>
--- a/pidgin/resources/Prefs/prefs.ui Thu Aug 13 21:10:22 2020 -0500
+++ b/pidgin/resources/Prefs/prefs.ui Thu Aug 13 22:03:41 2020 -0500
@@ -280,115 +280,6 @@
</row>
</data>
</object>
- <object class="GtkListStore" id="sound.event.store">
- <columns>
- <!-- column-name active -->
- <column type="gboolean"/>
- <!-- column-name text -->
- <column type="gchararray"/>
- <!-- column-name pref -->
- <column type="gchararray"/>
- <!-- column-name id -->
- <column type="guint"/>
- </columns>
- </object>
- <object class="GtkListStore" id="sound.method.store_raw">
- <columns>
- <!-- column-name text -->
- <column type="gchararray"/>
- <!-- column-name value -->
- <column type="gchararray"/>
- <!-- column-name any -->
- <column type="gboolean"/>
- <!-- column-name gstreamer -->
- <column type="gboolean"/>
- <!-- column-name win32 -->
- <column type="gboolean"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Automatic</col>
- <col id="1">automatic</col>
- <col id="2">True</col>
- <col id="3">False</col>
- <col id="4">False</col>
- </row>
- <row>
- <col id="0" translatable="yes">DirectSound</col>
- <col id="1">directsound</col>
- <col id="2">False</col>
- <col id="3">True</col>
- <col id="4">True</col>
- </row>
- <row>
- <col id="0" translatable="yes">ESD</col>
- <col id="1">esd</col>
- <col id="2">False</col>
- <col id="3">True</col>
- <col id="4">False</col>
- </row>
- <row>
- <col id="0" translatable="yes">ALSA</col>
- <col id="1">alsa</col>
- <col id="2">False</col>
- <col id="3">True</col>
- <col id="4">False</col>
- </row>
- <row>
- <col id="0" translatable="yes">PlaySound</col>
- <col id="1">playsoundw</col>
- <col id="2">False</col>
- <col id="3">False</col>
- <col id="4">True</col>
- </row>
- <row>
- <col id="0" translatable="yes">Console beep</col>
- <col id="1">beep</col>
- <col id="2">False</col>
- <col id="3">False</col>
- <col id="4">False</col>
- </row>
- <row>
- <col id="0" translatable="yes">Command</col>
- <col id="1">custom</col>
- <col id="2">False</col>
- <col id="3">False</col>
- <col id="4">False</col>
- </row>
- <row>
- <col id="0" translatable="yes">No sounds</col>
- <col id="1">none</col>
- <col id="2">True</col>
- <col id="3">False</col>
- <col id="4">False</col>
- </row>
- </data>
- </object>
- <object class="GtkTreeModelFilter" id="sound.method.store">
- <property name="child_model">sound.method.store_raw</property>
- </object>
- <object class="GtkListStore" id="sound.while_status.store">
- <columns>
- <!-- column-name text -->
- <column type="gchararray"/>
- <!-- column-name value -->
- <column type="gint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Only when available</col>
- <col id="1">1</col>
- </row>
- <row>
- <col id="0" translatable="yes">Only when not available</col>
- <col id="1">2</col>
- </row>
- <row>
- <col id="0" translatable="yes">Always</col>
- <col id="1">3</col>
- </row>
- </data>
- </object>
<template class="PidginPrefsWindow" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Preferences</property>
@@ -2204,389 +2095,6 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="sound.page">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">12</property>
- <property name="orientation">vertical</property>
- <property name="spacing">18</property>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Method:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="sound.method.combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">sound.method.store</property>
- <property name="id_column">1</property>
- <child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="sound.method_vbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkBox" id="sound.command_hbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sound c_ommand:
-(%s for filename)</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">sound.command</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="sound.command">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <signal name="changed" handler="sound_cmd_yeah" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="sound.mute">
- <property name="label" translatable="yes">M_ute sounds</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="sound.conv_focus">
- <property name="label" translatable="yes">Sounds when conversation has _focus</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Enable sounds:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="sound.while_status.combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">sound.while_status.store</property>
- <child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_bottom">6</property>
- <property name="label" translatable="yes">Sound Options</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkScrolledWindow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="shadow_type">in</property>
- <property name="min_content_height">100</property>
- <child>
- <object class="GtkTreeView" id="sound.event.view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">sound.event.store</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection">
- <signal name="changed" handler="prefs_sound_sel" object="PidginPrefsWindow" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn">
- <property name="title" translatable="yes">Play</property>
- <child>
- <object class="GtkCellRendererToggle">
- <signal name="toggled" handler="event_toggled" object="sound.event.store" swapped="no"/>
- </object>
- <attributes>
- <attribute name="active">0</attribute>
- </attributes>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn">
- <property name="title" translatable="yes">Event</property>
- <child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkEntry" id="sound.entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton">
- <property name="label" translatable="yes">_Browse...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="select_sound" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton">
- <property name="label" translatable="yes">Pre_view</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="test_sound" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton">
- <property name="label" translatable="yes">_Reset</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="reset_sound" object="PidginPrefsWindow" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_bottom">6</property>
- <property name="label" translatable="yes">Sound Events</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">sound</property>
- <property name="title" translatable="yes">Sounds</property>
- <property name="position">6</property>
- </packing>
- </child>
- <child>
<object class="GtkBox" id="away.page">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -2914,7 +2422,7 @@
<packing>
<property name="name">away</property>
<property name="title" translatable="yes">Status / Idle</property>
- <property name="position">7</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -3069,60 +2577,6 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sound Theme:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="theme.sound">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <signal name="changed" handler="prefs_set_sound_theme_cb" object="PidginPrefsWindow" swapped="no"/>
- <child>
- <object class="GtkCellRendererPixbuf">
- <property name="width">32</property>
- <property name="height">32</property>
- </object>
- <attributes>
- <attribute name="pixbuf">0</attribute>
- </attributes>
- </child>
- <child>
- <object class="GtkCellRendererText">
- <property name="ellipsize">end</property>
- </object>
- <attributes>
- <attribute name="markup">1</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -3168,7 +2622,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
@@ -3197,7 +2651,7 @@
<packing>
<property name="name">theme</property>
<property name="title" translatable="yes">Themes</property>
- <property name="position">8</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
@@ -3241,18 +2695,10 @@
<widget name="label11"/>
</widgets>
</object>
- <object class="GtkSizeGroup" id="sound.sg">
- <widgets>
- <widget name="label15"/>
- <widget name="label16"/>
- <widget name="label17"/>
- </widgets>
- </object>
<object class="GtkSizeGroup" id="theme.combo_sg">
<widgets>
<widget name="theme.blist"/>
<widget name="theme.status"/>
- <widget name="theme.sound"/>
<widget name="theme.smiley"/>
</widgets>
</object>
@@ -3260,7 +2706,6 @@
<widgets>
<widget name="label19"/>
<widget name="label20"/>
- <widget name="label21"/>
<widget name="label18"/>
</widgets>
</object>
Binary file share/sounds/alert.wav has changed
Binary file share/sounds/login.wav has changed
Binary file share/sounds/logout.wav has changed
--- a/share/sounds/meson.build Thu Aug 13 21:10:22 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-sounds_DATA = [
- 'alert.wav',
- 'login.wav',
- 'logout.wav',
- 'receive.wav',
- 'send.wav'
-]
-
-install_data(sources : sounds_DATA,
- install_dir : get_option('datadir') + '/sounds/purple')
Binary file share/sounds/receive.wav has changed
Binary file share/sounds/send.wav has changed