Mercurial > pidgin
changeset 19155:53ad073898d0
merge of '71460fdbdf27e2233f9157851787002b09ead2c6'
and '98ddd79cda6d7d93f0534fc4df38b302f850b47e'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 11 Jul 2007 18:41:02 +0000 |
parents | d201f6967183 (current diff) 01d574f529e0 (diff) |
children | f65c287e466e |
files | libpurple/prefs.c libpurple/prefs.h |
diffstat | 2 files changed, 219 insertions(+), 113 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntsound.c Wed Jul 11 18:39:21 2007 +0000 +++ b/finch/gntsound.c Wed Jul 11 18:41:02 2007 +0000 @@ -71,9 +71,10 @@ GntWidget *events; GntWidget *window; GntWidget *selector; + GntWidget *profiles; } SoundPrefDialog; -SoundPrefDialog *pref_dialog; +static SoundPrefDialog *pref_dialog; #define PLAY_SOUND_TIMEOUT 15000 @@ -98,6 +99,26 @@ {PURPLE_SOUND_CHAT_NICK, N_("Someone says your screen name in chat"), "nick_said", "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) { @@ -147,7 +168,7 @@ has_focus = purple_conversation_has_focus(conv); - if (has_focus && !purple_prefs_get_bool(FINCH_PREFS_ROOT "/sound/conv_focus")) + if (has_focus && !purple_prefs_get_bool(make_pref("/conv_focus"))) { return; } @@ -170,10 +191,9 @@ if (flags & PURPLE_MESSAGE_DELAYED) return; - if (conv==NULL){ + if (conv==NULL) { purple_sound_play_event(PURPLE_SOUND_FIRST_RECEIVE, account); - } - else{ + } else { play_conv_event(conv, event); } } @@ -253,28 +273,10 @@ if (mute_login_sounds_timeout != 0) g_source_remove(mute_login_sounds_timeout); mute_login_sounds = TRUE; - mute_login_sounds_timeout = purple_timeout_add(10000, unmute_login_sounds_cb, NULL); + mute_login_sounds_timeout = purple_timeout_add_seconds(10, unmute_login_sounds_cb, NULL); } -const char * -finch_sound_get_event_option(PurpleSoundEventID event) -{ - if(event >= PURPLE_NUM_SOUNDS) - return 0; - - return sounds[event].pref; -} - -const char * -finch_sound_get_event_label(PurpleSoundEventID event) -{ - if(event >= PURPLE_NUM_SOUNDS) - return NULL; - - return sounds[event].label; -} - -void * +static void * finch_sound_get_handle() { static int handle; @@ -282,6 +284,46 @@ return &handle; } + +/* This gets called when the active profile changes */ +static void +load_profile(const char *name, PurplePrefType type, gconstpointer val, gpointer null) +{ + 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")); + purple_prefs_add_bool(make_pref("/enabled/login"), TRUE); + purple_prefs_add_path(make_pref("/file/login"), ""); + purple_prefs_add_bool(make_pref("/enabled/logout"), TRUE); + purple_prefs_add_path(make_pref("/file/logout"), ""); + purple_prefs_add_bool(make_pref("/enabled/im_recv"), TRUE); + purple_prefs_add_path(make_pref("/file/im_recv"), ""); + purple_prefs_add_bool(make_pref("/enabled/first_im_recv"), FALSE); + purple_prefs_add_path(make_pref("/file/first_im_recv"), ""); + purple_prefs_add_bool(make_pref("/enabled/send_im"), TRUE); + purple_prefs_add_path(make_pref("/file/send_im"), ""); + purple_prefs_add_bool(make_pref("/enabled/join_chat"), FALSE); + purple_prefs_add_path(make_pref("/file/join_chat"), ""); + purple_prefs_add_bool(make_pref("/enabled/left_chat"), FALSE); + purple_prefs_add_path(make_pref("/file/left_chat"), ""); + purple_prefs_add_bool(make_pref("/enabled/send_chat_msg"), FALSE); + purple_prefs_add_path(make_pref("/file/send_chat_msg"), ""); + purple_prefs_add_bool(make_pref("/enabled/chat_msg_recv"), FALSE); + purple_prefs_add_path(make_pref("/file/chat_msg_recv"), ""); + purple_prefs_add_bool(make_pref("/enabled/nick_said"), FALSE); + purple_prefs_add_path(make_pref("/file/nick_said"), ""); + purple_prefs_add_bool(make_pref("/enabled/pounce_default"), TRUE); + purple_prefs_add_path(make_pref("/file/pounce_default"), ""); + purple_prefs_add_bool(make_pref("/conv_focus"), TRUE); + purple_prefs_add_bool(make_pref("/mute"), FALSE); + purple_prefs_add_path(make_pref("/command"), ""); + purple_prefs_add_string(make_pref("/method"), "automatic"); + purple_prefs_add_int(make_pref("/volume"), 50); +} + static void finch_sound_init(void) { @@ -297,36 +339,13 @@ NULL); purple_prefs_add_none(FINCH_PREFS_ROOT "/sound"); - purple_prefs_add_none(FINCH_PREFS_ROOT "/sound/enabled"); - purple_prefs_add_none(FINCH_PREFS_ROOT "/sound/file"); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/login", TRUE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/login", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/logout", TRUE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/logout", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/im_recv", TRUE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/im_recv", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/first_im_recv", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/first_im_recv", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/send_im", TRUE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/send_im", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/join_chat", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/join_chat", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/left_chat", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/left_chat", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/send_chat_msg", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/send_chat_msg", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/chat_msg_recv", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/chat_msg_recv", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/nick_said", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/nick_said", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/enabled/pounce_default", TRUE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/file/pounce_default", ""); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/conv_focus", TRUE); - purple_prefs_add_bool(FINCH_PREFS_ROOT "/sound/mute", FALSE); - purple_prefs_add_path(FINCH_PREFS_ROOT "/sound/command", ""); - purple_prefs_add_string(FINCH_PREFS_ROOT "/sound/method", "automatic"); - purple_prefs_add_int(FINCH_PREFS_ROOT "/sound/volume", 50); + purple_prefs_add_string(FINCH_PREFS_ROOT "/sound/actprofile", "default"); + purple_prefs_add_none(FINCH_PREFS_ROOT "/sound/profiles"); + purple_prefs_connect_callback(gnt_sound_handle,FINCH_PREFS_ROOT "/sound/actprofile",load_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_init_failed = !gst_init_check(NULL, NULL, &error))) { @@ -417,10 +436,10 @@ GstElement *play = NULL; GstBus *bus = NULL; #endif - if (purple_prefs_get_bool(FINCH_PREFS_ROOT "/sound/mute")) + if (purple_prefs_get_bool(make_pref("/mute"))) return; - method = purple_prefs_get_string(FINCH_PREFS_ROOT "/sound/method"); + method = purple_prefs_get_string(make_pref("/method")); if (!strcmp(method, "none")) { return; @@ -441,7 +460,7 @@ char *esc_filename; GError *error = NULL; - sound_cmd = purple_prefs_get_path(FINCH_PREFS_ROOT "/sound/command"); + sound_cmd = purple_prefs_get_path(make_pref("/command")); if (!sound_cmd || *sound_cmd == '\0') { purple_debug_error("gntsound", @@ -469,7 +488,7 @@ #ifdef USE_GSTREAMER if (gst_init_failed) /* Perhaps do beep instead? */ return; - volume = (float)(CLAMP(purple_prefs_get_int(FINCH_PREFS_ROOT "/sound/volume"),0,100)) / 50; + volume = (float)(CLAMP(purple_prefs_get_int(make_pref("/volume")),0,100)) / 50; if (!strcmp(method, "automatic")) { if (purple_running_gnome()) { sink = gst_element_factory_make("gconfaudiosink", "sink"); @@ -553,9 +572,10 @@ return; } - enable_pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/enabled/%s", + 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/file/%s", 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)) { @@ -574,21 +594,47 @@ g_free(file_pref); } +GList * +finch_sound_get_profiles() +{ + return purple_prefs_get_children_names(FINCH_PREFS_ROOT "/sound/profiles"); +} + +static gboolean +profile_exists(const char *name) +{ + GList *itr = NULL; + for(itr = finch_sound_get_profiles();itr;itr = itr->next){ + if(!strcmp(itr->data,name)) + return TRUE; + } + return FALSE; +} + +void +finch_sound_set_active_profile(const char *name) +{ + if(profile_exists(name)) { + purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile",name); + } +} + + static void save_cb(GntWidget *button, gpointer win) { GList * itr; - purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/method", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->method))); - purple_prefs_set_path(FINCH_PREFS_ROOT "/sound/command", gnt_entry_get_text(GNT_ENTRY(pref_dialog->command))); - purple_prefs_set_bool(FINCH_PREFS_ROOT "/sound/conv_focus",gnt_check_box_get_checked(GNT_CHECK_BOX(pref_dialog->conv_focus))); + 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)))); - purple_prefs_set_int(FINCH_PREFS_ROOT "/sound/volume",gnt_slider_get_value(GNT_SLIDER(pref_dialog->volume))); + purple_prefs_set_int(make_pref("/volume"),gnt_slider_get_value(GNT_SLIDER(pref_dialog->volume))); 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("%s/sound/file/%s",FINCH_PREFS_ROOT,event->pref); - char * boolpref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/enabled/%s",event->pref); + 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); @@ -618,7 +664,7 @@ char *pref; gboolean temp_value; - pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/enabled/%s", + pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s",finch_sound_get_active_profile(), event->pref); temp_value = purple_prefs_get_bool(pref); @@ -645,6 +691,22 @@ } static void +pref_load_cb(GntWidget *button, gpointer null) +{ + + const gchar * value = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->profiles)); + + purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile",value); + +} + +static void +pref_save_cb(GntWidget *button, gpointer null) +{ + /* XXX: */ +} + +static void choose_cb(GntWidget *button, gpointer null) { GntWidget *w = gnt_file_sel_new(); @@ -686,12 +748,41 @@ pref_dialog = NULL; } +static void +reload_pref_window(GntComboBox *box, gpointer oldkey, gpointer newkey, gpointer null) +{ + gint i; + purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile",(gchar *)newkey); + 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"))); + gnt_slider_set_value(GNT_SLIDER(pref_dialog->volume),CLAMP(purple_prefs_get_int(make_pref("/volume")),0,100)); + for(i = 0;i < PURPLE_NUM_SOUNDS;i++){ + FinchSoundEvent * event = &sounds[i]; + gchar *boolpref; + gchar *filepref; + const char * profile = finch_sound_get_active_profile(); + + filepref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s",profile,event->pref); + 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] ? g_path_get_basename(event->file) : "(default)"); + gnt_tree_set_choice(GNT_TREE(pref_dialog->events),GINT_TO_POINTER(i),purple_prefs_get_bool(boolpref)); + g_free(boolpref); + } +} + void finch_sounds_show_all(void) { - GntWidget *box; - GntWidget *cmbox; - GntWidget *slider; + GntWidget *box, *cmbox, *slider; GntWidget *entry; GntWidget *chkbox; GntWidget *button; @@ -699,14 +790,14 @@ GntWidget *tree; GntWidget *win; + GList *itr,*list; gint i; - if(pref_dialog){ + if(pref_dialog) { gnt_window_present(pref_dialog->window); return; } - pref_dialog = g_new0(SoundPrefDialog,1); pref_dialog->window = win = gnt_window_box_new(FALSE,TRUE); @@ -724,8 +815,8 @@ 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")); - gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),(gchar *)purple_prefs_get_string(FINCH_PREFS_ROOT "/sound/method")); + /* Sound method */ label = gnt_label_new_with_format(_("Sound Method"),GNT_TEXT_FLAG_BOLD); gnt_box_add_widget(GNT_BOX(win),label); box = gnt_hbox_new(TRUE); @@ -739,15 +830,15 @@ gnt_box_set_pad(GNT_BOX(box),0); gnt_box_set_fill(GNT_BOX(box),FALSE); gnt_box_add_widget(GNT_BOX(box),gnt_label_new(_("Sound Command\n(%s for filename)"))); - pref_dialog->command = entry = gnt_entry_new(purple_prefs_get_path(FINCH_PREFS_ROOT "/sound/command")); + pref_dialog->command = entry = gnt_entry_new(""); gnt_box_add_widget(GNT_BOX(box),entry); gnt_box_add_widget(GNT_BOX(win),box); gnt_box_add_widget(GNT_BOX(win), gnt_line_new(FALSE)); + /* Sound options */ gnt_box_add_widget(GNT_BOX(win),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_check_box_set_checked(GNT_CHECK_BOX(chkbox),purple_prefs_get_bool(FINCH_PREFS_ROOT "/sound/conv_focus")); gnt_box_add_widget(GNT_BOX(win),chkbox); box = gnt_hbox_new(TRUE); @@ -758,7 +849,6 @@ 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_combo_box_set_selected(GNT_COMBO_BOX(cmbox),GINT_TO_POINTER(purple_prefs_get_int("/purple" "/sound/while_status"))); gnt_box_add_widget(GNT_BOX(box),cmbox); gnt_box_add_widget(GNT_BOX(win),box); @@ -771,14 +861,14 @@ gnt_slider_set_step(GNT_SLIDER(slider),5); label = gnt_label_new(""); gnt_slider_reflect_label(GNT_SLIDER(slider),GNT_LABEL(label)); - gnt_slider_set_value(GNT_SLIDER(slider),CLAMP(purple_prefs_get_int(FINCH_PREFS_ROOT "/sound/volume"),0,100)); gnt_box_set_pad(GNT_BOX(box),1); gnt_box_add_widget(GNT_BOX(box),slider); gnt_box_add_widget(GNT_BOX(box),label); gnt_box_add_widget(GNT_BOX(win),box); - gnt_box_add_widget(GNT_BOX(win), gnt_line_new(FALSE)); + 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")); @@ -786,23 +876,14 @@ for(i = 0;i < PURPLE_NUM_SOUNDS;i++){ FinchSoundEvent * event = &sounds[i]; - gchar *boolpref; - gchar *filepref; - - boolpref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/enabled/%s", event->pref); - - filepref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/file/%s", event->pref); - event->file = g_strdup(purple_prefs_get_path(filepref)); + 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->file[0] ? g_path_get_basename(event->file) : "(default)"), + gnt_tree_create_row(GNT_TREE(tree),"",""), NULL, NULL); - gnt_tree_set_choice(GNT_TREE(tree),GINT_TO_POINTER(i),purple_prefs_get_bool(boolpref)); - g_free(boolpref); - g_free(filepref); } gnt_tree_adjust_columns(GNT_TREE(tree)); @@ -820,6 +901,29 @@ 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)); + + /* Sound profiles */ + gnt_box_add_widget(GNT_BOX(win),gnt_label_new_with_format(_("Profiles"),GNT_TEXT_FLAG_BOLD)); + box = gnt_hbox_new(FALSE); + pref_dialog->profiles = cmbox = gnt_combo_box_new(); + list = itr = finch_sound_get_profiles(); + for(;itr;itr = itr->next){ + gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),itr->data,itr->data); + } + g_signal_connect(G_OBJECT(cmbox),"selection-changed",G_CALLBACK(reload_pref_window),NULL); + g_list_free(list); + gnt_box_add_widget(GNT_BOX(box),cmbox); + button = gnt_button_new("Load"); + g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(pref_load_cb),NULL); + gnt_box_add_widget(GNT_BOX(box),button); + button = gnt_button_new("Save"); + g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(pref_save_cb),NULL); + gnt_box_add_widget(GNT_BOX(box),button); + gnt_box_add_widget(GNT_BOX(win),box); + + + /* Add new stuff before this */ box = gnt_hbox_new(FALSE); gnt_box_set_pad(GNT_BOX(box),0); gnt_box_set_fill(GNT_BOX(box),TRUE); @@ -833,6 +937,8 @@ g_signal_connect(G_OBJECT(win),"destroy",G_CALLBACK(release_pref_dialog),NULL); + reload_pref_window(NULL,NULL,(gchar *)finch_sound_get_active_profile(),NULL); + gnt_widget_show(win); } @@ -854,3 +960,4 @@ { return &sound_ui_ops; } +
--- a/finch/gntsound.h Wed Jul 11 18:39:21 2007 +0000 +++ b/finch/gntsound.h Wed Jul 11 18:41:02 2007 +0000 @@ -28,31 +28,37 @@ #include "sound.h" /**********************************************************************/ -/** @name GNT Sound API */ +/** @name GNT Sound API */ /**********************************************************************/ /*@{*/ /** -* Get the prefs option for an event. -* -* @param event The event. -* @return The option. -*/ -const char *finch_sound_get_event_option(PurpleSoundEventID event); + * Get the name of the active sound profile. + * + * @return The name of the profile + */ +const char *finch_sound_get_active_profile(void); /** -* Get the label for an event. -* -* @param event The event. -* @return The label. -*/ -const char *finch_sound_get_event_label(PurpleSoundEventID event); + * Set the active profile. If the profile doesn't exist, nothing is changed. + * + * @param name The name of the profile + */ +void finch_sound_set_active_profile(const char *name); /** -* Gets GNT sound UI ops. -* -* @return The UI operations structure. -*/ + * Get a list of available sound profiles. + * + * @return A list of strings denoting sound profile names. + * Caller must free the list (but not the data). + */ +GList *finch_sound_get_profiles(void); + +/** + * Gets GNT sound UI ops. + * + * @return The UI operations structure. + */ PurpleSoundUiOps *finch_sound_get_ui_ops(void); /** @@ -60,13 +66,6 @@ */ void finch_sounds_show_all(void); -/** -* Get the handle for the GNT sound system. -* -* @return The handle to the sound system -*/ -void *finch_sound_get_handle(void); - /*@}*/ #endif