pidgin  2.13.0
About: Pidgin is a chat program (multi-protocol instant messaging client) which lets you log in to accounts on multiple chat networks simultaneously (old name "gaim").
  Fossies Dox: pidgin-2.13.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

gntsound.c File Reference
#include "finch.h"
#include <internal.h>
#include "debug.h"
#include "notify.h"
#include "prefs.h"
#include "sound.h"
#include "util.h"
#include "gntconv.h"
#include "gntbox.h"
#include "gntwindow.h"
#include "gntcombobox.h"
#include "gntlabel.h"
#include "gntsound.h"
#include "gntwidget.h"
#include "gntentry.h"
#include "gntcheckbox.h"
#include "gntline.h"
#include "gntslider.h"
#include "gnttree.h"
#include "gntfilesel.h"
Include dependency graph for gntsound.c:

Go to the source code of this file.

Data Structures

struct  FinchSoundEvent
 
struct  SoundPrefDialog
 

Macros

#define DEFAULT_PROFILE   "default"
 
#define PLAY_SOUND_TIMEOUT   15000
 

Functions

const char * finch_sound_get_active_profile ()
 
static gchar * make_pref (const char *name)
 
static gboolean unmute_login_sounds_cb (gpointer data)
 
static gboolean chat_nick_matches_name (PurpleConversation *conv, const char *aname)
 
static void play_conv_event (PurpleConversation *conv, PurpleSoundEventID event)
 
static void buddy_state_cb (PurpleBuddy *buddy, PurpleSoundEventID event)
 
static void im_msg_received_cb (PurpleAccount *account, char *sender, char *message, PurpleConversation *conv, PurpleMessageFlags flags, PurpleSoundEventID event)
 
static void im_msg_sent_cb (PurpleAccount *account, const char *receiver, const char *message, PurpleSoundEventID event)
 
static void chat_buddy_join_cb (PurpleConversation *conv, const char *name, PurpleConvChatBuddyFlags flags, gboolean new_arrival, PurpleSoundEventID event)
 
static void chat_buddy_left_cb (PurpleConversation *conv, const char *name, const char *reason, PurpleSoundEventID event)
 
static void chat_msg_sent_cb (PurpleAccount *account, const char *message, int id, PurpleSoundEventID event)
 
static void chat_msg_received_cb (PurpleAccount *account, char *sender, char *message, PurpleConversation *conv, PurpleMessageFlags flags, PurpleSoundEventID event)
 
static void got_attention_cb (PurpleAccount *account, const char *who, PurpleConversation *conv, guint type, PurpleSoundEventID event)
 
static void account_signon_cb (PurpleConnection *gc, gpointer data)
 
static void * finch_sound_get_handle (void)
 
static void initialize_profile (const char *name, PurplePrefType type, gconstpointer val, gpointer null)
 
static void update_profiles (void)
 
static void finch_sound_init (void)
 
static void finch_sound_uninit (void)
 
static void finch_sound_play_file (const char *filename)
 
static void finch_sound_play_event (PurpleSoundEventID event)
 
GList * finch_sound_get_profiles ()
 
void finch_sound_set_active_profile (const char *name)
 
static gboolean finch_sound_profile_exists (const char *name)
 
static void save_cb (GntWidget *button, gpointer win)
 
static void file_cb (GntFileSel *w, const char *path, const char *file, gpointer data)
 
static void test_cb (GntWidget *button, gpointer null)
 
static void reset_cb (GntWidget *button, gpointer null)
 
static void choose_cb (GntWidget *button, gpointer null)
 
static void release_pref_dialog (GntBindable *data, gpointer null)
 
static void load_pref_window (const char *profile)
 
static void reload_pref_window (const char *profile)
 
static void prof_del_cb (GntWidget *button, gpointer null)
 
static void prof_add_cb (GntButton *button, GntEntry *entry)
 
static void prof_load_cb (GntTree *tree, gpointer oldkey, gpointer newkey, gpointer null)
 
static void cancel_cb (GntButton *button, gpointer win)
 
void finch_sounds_show_all (void)
 
gboolean finch_sound_is_enabled (void)
 
PurpleSoundUiOpsfinch_sound_get_ui_ops (void)
 

Variables

static SoundPrefDialogpref_dialog
 
static guint mute_login_sounds_timeout = 0
 
static gboolean mute_login_sounds = FALSE
 
static FinchSoundEvent sounds [PURPLE_NUM_SOUNDS]
 
static PurpleSoundUiOps sound_ui_ops
 

Detailed Description

GNT Sound API

Definition in file gntsound.c.

Macro Definition Documentation

◆ DEFAULT_PROFILE

#define DEFAULT_PROFILE   "default"

Definition at line 83 of file gntsound.c.

◆ PLAY_SOUND_TIMEOUT

#define PLAY_SOUND_TIMEOUT   15000

Definition at line 87 of file gntsound.c.

Function Documentation

◆ account_signon_cb()

static void account_signon_cb ( PurpleConnection gc,
gpointer  data 
)
static

◆ buddy_state_cb()

static void buddy_state_cb ( PurpleBuddy buddy,
PurpleSoundEventID  event 
)
static

Definition at line 193 of file gntsound.c.

References purple_buddy_get_account(), and purple_sound_play_event().

Referenced by finch_sound_init().

◆ cancel_cb()

static void cancel_cb ( GntButton button,
gpointer  win 
)
static

◆ chat_buddy_join_cb()

static void chat_buddy_join_cb ( PurpleConversation conv,
const char *  name,
PurpleConvChatBuddyFlags  flags,
gboolean  new_arrival,
PurpleSoundEventID  event 
)
static

Definition at line 223 of file gntsound.c.

References chat_nick_matches_name(), name, and play_conv_event().

Referenced by finch_sound_init().

◆ chat_buddy_left_cb()

static void chat_buddy_left_cb ( PurpleConversation conv,
const char *  name,
const char *  reason,
PurpleSoundEventID  event 
)
static

Definition at line 232 of file gntsound.c.

References chat_nick_matches_name(), name, and play_conv_event().

Referenced by finch_sound_init().

◆ chat_msg_received_cb()

◆ chat_msg_sent_cb()

static void chat_msg_sent_cb ( PurpleAccount account,
const char *  message,
int  id,
PurpleSoundEventID  event 
)
static

Definition at line 240 of file gntsound.c.

References account, NULL, play_conv_event(), purple_account_get_connection(), and purple_find_chat().

Referenced by finch_sound_init().

◆ chat_nick_matches_name()

static gboolean chat_nick_matches_name ( PurpleConversation conv,
const char *  aname 
)
static

◆ choose_cb()

◆ file_cb()

static void file_cb ( GntFileSel w,
const char *  path,
const char *  file,
gpointer  data 
)
static

◆ finch_sound_get_active_profile()

const char* finch_sound_get_active_profile ( void  )

Get the name of the active sound profile.

Returns
The name of the profile
Since
2.1.0

Definition at line 112 of file gntsound.c.

References FINCH_PREFS_ROOT, and purple_prefs_get_string().

Referenced by finch_sound_play_event(), finch_sounds_show_all(), load_pref_window(), make_pref(), prof_del_cb(), reload_pref_window(), save_cb(), and test_cb().

◆ finch_sound_get_handle()

static void* finch_sound_get_handle ( void  )
static

Definition at line 300 of file gntsound.c.

References handle.

Referenced by finch_sound_init(), and finch_sound_uninit().

◆ finch_sound_get_profiles()

GList* finch_sound_get_profiles ( void  )

Get a list of available sound profiles.

Returns
A list of strings denoting sound profile names. Caller must free the list (but not the data).
Since
2.1.0

Definition at line 631 of file gntsound.c.

References FINCH_PREFS_ROOT, NULL, purple_prefs_get_children_names(), and strrchr.

Referenced by finch_sounds_show_all(), and update_profiles().

◆ finch_sound_get_ui_ops()

PurpleSoundUiOps* finch_sound_get_ui_ops ( void  )

Gets GNT sound UI ops.

Returns
The UI operations structure.
Since
2.1.0

Definition at line 1122 of file gntsound.c.

References sound_ui_ops.

Referenced by gnt_ui_init().

◆ finch_sound_init()

◆ finch_sound_is_enabled()

gboolean finch_sound_is_enabled ( void  )

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.
Since
2.2.0

Definition at line 1094 of file gntsound.c.

References FALSE, make_pref(), pref, purple_prefs_get_int(), purple_prefs_get_string(), purple_strequal(), and TRUE.

Referenced by finch_create_conversation().

◆ finch_sound_play_event()

◆ finch_sound_play_file()

◆ finch_sound_profile_exists()

static gboolean finch_sound_profile_exists ( const char *  name)
static

Definition at line 651 of file gntsound.c.

References FINCH_PREFS_ROOT, name, and purple_prefs_exists().

Referenced by prof_add_cb().

◆ finch_sound_set_active_profile()

void finch_sound_set_active_profile ( const char *  name)

Set the active profile. If the profile doesn't exist, nothing is changed.

Parameters
nameThe name of the profile
Since
2.1.0

Definition at line 645 of file gntsound.c.

References FINCH_PREFS_ROOT, name, and purple_prefs_set_string().

Referenced by cancel_cb(), load_pref_window(), and prof_add_cb().

◆ finch_sound_uninit()

static void finch_sound_uninit ( void  )
static

Definition at line 426 of file gntsound.c.

References finch_sound_get_handle(), and purple_signals_disconnect_by_handle().

◆ finch_sounds_show_all()

void finch_sounds_show_all ( void  )

Show the sound settings dialog.

Since
2.1.0

Definition at line 903 of file gntsound.c.

References _(), cancel_cb(), choose_cb(), SoundPrefDialog::command, SoundPrefDialog::conv_focus, SoundPrefDialog::events, FALSE, finch_sound_get_active_profile(), finch_sound_get_profiles(), GNT_ALIGN_MID, GNT_ALIGN_TOP, GNT_BOX, gnt_box_add_widget(), gnt_box_set_alignment(), gnt_box_set_fill(), gnt_box_set_pad(), gnt_box_set_title(), gnt_box_set_toplevel(), gnt_button_new(), gnt_check_box_new(), GNT_COMBO_BOX, gnt_combo_box_add_data(), gnt_combo_box_new(), gnt_entry_new(), gnt_hbox_new, gnt_hline_new, GNT_LABEL, gnt_label_new(), gnt_label_new_with_format(), gnt_line_new(), GNT_SLIDER, gnt_slider_new(), gnt_slider_reflect_label(), gnt_slider_set_large_step(), gnt_slider_set_small_step(), gnt_slider_set_step(), GNT_TEXT_FLAG_BOLD, GNT_TREE, gnt_tree_add_choice(), gnt_tree_add_row_after(), gnt_tree_adjust_columns(), gnt_tree_create_row(), gnt_tree_new(), gnt_tree_new_with_columns(), gnt_tree_set_column_titles(), gnt_tree_set_compare_func(), gnt_tree_set_hash_fns(), gnt_tree_set_show_title(), gnt_vbox_new, gnt_vline_new, gnt_widget_show(), gnt_window_box_new(), gnt_window_present(), label, load_pref_window(), SoundPrefDialog::method, SoundPrefDialog::new_profile, NULL, SoundPrefDialog::original_profile, pref_dialog, prof_add_cb(), prof_del_cb(), prof_load_cb(), SoundPrefDialog::profiles, PURPLE_NUM_SOUNDS, release_pref_dialog(), reset_cb(), save_cb(), sounds, test_cb(), tree, TRUE, SoundPrefDialog::volume, SoundPrefDialog::while_status, and SoundPrefDialog::window.

Referenced by gnt_ui_init().

◆ got_attention_cb()

static void got_attention_cb ( PurpleAccount account,
const char *  who,
PurpleConversation conv,
guint  type,
PurpleSoundEventID  event 
)
static

Definition at line 278 of file gntsound.c.

References play_conv_event().

Referenced by finch_sound_init().

◆ im_msg_received_cb()

static void im_msg_received_cb ( PurpleAccount account,
char *  sender,
char *  message,
PurpleConversation conv,
PurpleMessageFlags  flags,
PurpleSoundEventID  event 
)
static

◆ im_msg_sent_cb()

static void im_msg_sent_cb ( PurpleAccount account,
const char *  receiver,
const char *  message,
PurpleSoundEventID  event 
)
static

◆ initialize_profile()

static void initialize_profile ( const char *  name,
PurplePrefType  type,
gconstpointer  val,
gpointer  null 
)
static

◆ load_pref_window()

◆ make_pref()

static gchar* make_pref ( const char *  name)
static

◆ play_conv_event()

◆ prof_add_cb()

◆ prof_del_cb()

◆ prof_load_cb()

static void prof_load_cb ( GntTree tree,
gpointer  oldkey,
gpointer  newkey,
gpointer  null 
)
static

Definition at line 890 of file gntsound.c.

References reload_pref_window().

Referenced by finch_sounds_show_all().

◆ release_pref_dialog()

static void release_pref_dialog ( GntBindable data,
gpointer  null 
)
static

◆ reload_pref_window()

static void reload_pref_window ( const char *  profile)
static

◆ reset_cb()

static void reset_cb ( GntWidget button,
gpointer  null 
)
static

◆ save_cb()

◆ test_cb()

◆ unmute_login_sounds_cb()

static gboolean unmute_login_sounds_cb ( gpointer  data)
static

Definition at line 132 of file gntsound.c.

References FALSE, mute_login_sounds, and mute_login_sounds_timeout.

Referenced by account_signon_cb().

◆ update_profiles()

static void update_profiles ( void  )
static

Variable Documentation

◆ mute_login_sounds

gboolean mute_login_sounds = FALSE
static

Definition at line 90 of file gntsound.c.

Referenced by account_signon_cb(), finch_sound_play_event(), and unmute_login_sounds_cb().

◆ mute_login_sounds_timeout

guint mute_login_sounds_timeout = 0
static

Definition at line 89 of file gntsound.c.

Referenced by account_signon_cb(), and unmute_login_sounds_cb().

◆ pref_dialog

◆ sound_ui_ops

PurpleSoundUiOps sound_ui_ops
static

◆ sounds

Initial value:
= {
{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}
}

Definition at line 96 of file gntsound.c.

Referenced by choose_cb(), finch_sound_play_event(), finch_sounds_show_all(), initialize_profile(), load_pref_window(), release_pref_dialog(), reset_cb(), save_cb(), and test_cb().

finch_sound_init
static void finch_sound_init(void)
Definition: gntsound.c:355
PURPLE_SOUND_BUDDY_ARRIVE
Definition: sound.h:43
N_
#define N_(String)
Definition: internal.h:59
PURPLE_SOUND_POUNCE_DEFAULT
Definition: sound.h:52
PURPLE_SOUND_CHAT_YOU_SAY
Definition: sound.h:50
PURPLE_SOUND_CHAT_JOIN
Definition: sound.h:48
PURPLE_SOUND_SEND
Definition: sound.h:47
finch_sound_play_file
static void finch_sound_play_file(const char *filename)
Definition: gntsound.c:467
finch_sound_uninit
static void finch_sound_uninit(void)
Definition: gntsound.c:426
PURPLE_SOUND_CHAT_NICK
Definition: sound.h:53
NULL
#define NULL
Definition: getopt1.c:52
PURPLE_SOUND_CHAT_SAY
Definition: sound.h:51
PURPLE_SOUND_RECEIVE
Definition: sound.h:45
PURPLE_SOUND_GOT_ATTENTION
Definition: sound.h:54
finch_sound_play_event
static void finch_sound_play_event(PurpleSoundEventID event)
Definition: gntsound.c:595
PURPLE_SOUND_BUDDY_LEAVE
Definition: sound.h:44
PURPLE_SOUND_FIRST_RECEIVE
Definition: sound.h:46
PURPLE_SOUND_CHAT_LEAVE
Definition: sound.h:49