comparison finch/gntsound.c @ 19139:2d0925800d72

Made the display of files for sound events cleaner
author Eric Polino <aluink@pidgin.im>
date Fri, 06 Jul 2007 23:28:24 +0000
parents 51772173a916
children fb880d1adb40
comparison
equal deleted inserted replaced
19138:dd115c8f0880 19139:2d0925800d72
598 static void 598 static void
599 file_cb(GntWidget *w, gpointer data) 599 file_cb(GntWidget *w, gpointer data)
600 { 600 {
601 GntFileSel *sel = GNT_FILE_SEL(data); 601 GntFileSel *sel = GNT_FILE_SEL(data);
602 const char * file = gnt_file_sel_get_selected_file(sel); 602 const char * file = gnt_file_sel_get_selected_file(sel);
603 FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events)))]; 603 gpointer key = gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events));
604 FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(key)];
604 605
605 g_free(event->file); 606 g_free(event->file);
606 event->file = g_strdup(file); 607 event->file = g_strdup(file);
608
609 gnt_tree_change_text(GNT_TREE(pref_dialog->events),key,1,g_path_get_basename(file));
607 610
608 gnt_widget_destroy(GNT_WIDGET(data)); 611 gnt_widget_destroy(GNT_WIDGET(data));
609 } 612 }
610 613
611 static void 614 static void
637 gpointer key = gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events)); 640 gpointer key = gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events));
638 641
639 FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(key)]; 642 FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(key)];
640 g_free(event->file); 643 g_free(event->file);
641 event->file = NULL; 644 event->file = NULL;
642 gnt_tree_change_text(GNT_TREE(pref_dialog->events),key,1,""); 645 gnt_tree_change_text(GNT_TREE(pref_dialog->events),key,1,"(default)");
643 } 646 }
644 647
645 static void 648 static void
646 choose_cb(GntWidget *button, gpointer null) 649 choose_cb(GntWidget *button, gpointer null)
647 { 650 {
780 if(event->label == NULL){ 783 if(event->label == NULL){
781 continue; 784 continue;
782 } 785 }
783 786
784 gnt_tree_add_choice(GNT_TREE(tree), GINT_TO_POINTER(i), 787 gnt_tree_add_choice(GNT_TREE(tree), GINT_TO_POINTER(i),
785 gnt_tree_create_row(GNT_TREE(tree),event->label,event->file[0] ? g_path_get_basename(event->file) : ""), 788 gnt_tree_create_row(GNT_TREE(tree),event->label,event->file[0] ? g_path_get_basename(event->file) : "(default)"),
786 NULL, NULL); 789 NULL, NULL);
787 gnt_tree_set_choice(GNT_TREE(tree),GINT_TO_POINTER(i),purple_prefs_get_bool(boolpref)); 790 gnt_tree_set_choice(GNT_TREE(tree),GINT_TO_POINTER(i),purple_prefs_get_bool(boolpref));
788 g_free(boolpref); 791 g_free(boolpref);
789 g_free(filepref); 792 g_free(filepref);
790 } 793 }