Mercurial > pidgin.yaz
comparison finch/gntsound.c @ 19156:f65c287e466e
Update the way _get_children_names is used.
applied changes from afa84ce2e5e448ce3233a9effb3136e1e23fb969
through d7c71ed89067d861b85108f04ea056f23320d33d
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 11 Jul 2007 19:44:32 +0000 |
parents | 01d574f529e0 |
children | 3266c971527e |
comparison
equal
deleted
inserted
replaced
19155:53ad073898d0 | 19156:f65c287e466e |
---|---|
595 } | 595 } |
596 | 596 |
597 GList * | 597 GList * |
598 finch_sound_get_profiles() | 598 finch_sound_get_profiles() |
599 { | 599 { |
600 return purple_prefs_get_children_names(FINCH_PREFS_ROOT "/sound/profiles"); | 600 GList *list = NULL, *iter; |
601 iter = purple_prefs_get_children_names(FINCH_PREFS_ROOT "/sound/profiles"); | |
602 while (iter) { | |
603 list = g_list_append(list, g_strdup(strrchr(iter->data, '/') + 1)); | |
604 g_free(iter->data); | |
605 iter = g_list_delete_link(iter, iter); | |
606 } | |
607 return list; | |
601 } | 608 } |
602 | 609 |
603 static gboolean | 610 static gboolean |
604 profile_exists(const char *name) | 611 profile_exists(const char *name) |
605 { | 612 { |
606 GList *itr = NULL; | 613 char *str = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s", name); |
607 for(itr = finch_sound_get_profiles();itr;itr = itr->next){ | 614 gboolean ret = purple_prefs_exists(str); |
608 if(!strcmp(itr->data,name)) | 615 g_free(str); |
609 return TRUE; | 616 return ret; |
610 } | |
611 return FALSE; | |
612 } | 617 } |
613 | 618 |
614 void | 619 void |
615 finch_sound_set_active_profile(const char *name) | 620 finch_sound_set_active_profile(const char *name) |
616 { | 621 { |
906 /* Sound profiles */ | 911 /* Sound profiles */ |
907 gnt_box_add_widget(GNT_BOX(win),gnt_label_new_with_format(_("Profiles"),GNT_TEXT_FLAG_BOLD)); | 912 gnt_box_add_widget(GNT_BOX(win),gnt_label_new_with_format(_("Profiles"),GNT_TEXT_FLAG_BOLD)); |
908 box = gnt_hbox_new(FALSE); | 913 box = gnt_hbox_new(FALSE); |
909 pref_dialog->profiles = cmbox = gnt_combo_box_new(); | 914 pref_dialog->profiles = cmbox = gnt_combo_box_new(); |
910 list = itr = finch_sound_get_profiles(); | 915 list = itr = finch_sound_get_profiles(); |
916 gnt_tree_set_hash_fns(GNT_TREE(GNT_COMBO_BOX(cmbox)->dropdown), g_str_hash, g_str_equal, g_free); | |
911 for(;itr;itr = itr->next){ | 917 for(;itr;itr = itr->next){ |
912 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),itr->data,itr->data); | 918 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),itr->data,itr->data); |
913 } | 919 } |
914 g_signal_connect(G_OBJECT(cmbox),"selection-changed",G_CALLBACK(reload_pref_window),NULL); | 920 g_signal_connect(G_OBJECT(cmbox),"selection-changed",G_CALLBACK(reload_pref_window),NULL); |
915 g_list_free(list); | 921 g_list_free(list); |