From: Kaj-Michael Lang Date: Fri, 18 Apr 2008 09:32:44 +0000 (+0300) Subject: Add function to alter basedir for audio files. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2a077c9b732c6a6c60f932de2da9cf6471046f1;p=mapper Add function to alter basedir for audio files. --- diff --git a/src/audio-note.c b/src/audio-note.c index 8c94525..cf4a88b 100644 --- a/src/audio-note.c +++ b/src/audio-note.c @@ -198,16 +198,13 @@ gtk_box_pack_start(GTK_BOX(ui->vbox), ui->btn_stop, TRUE, TRUE, 0); ui->note_play=¬e_play; ui->note_record=¬e_record; +ui->basedir=NULL; /* XXX: Make this a configuration option */ #ifdef WITH_DEVICE_770 -ui->basedir=NOTES_BASEDIR_MMC1; -if (g_mkdir_with_parents(ui->basedir, 0775)==-1) { - MACRO_BANNER_SHOW_INFO(_window, _("Failed to create directory for sound files!")); - return TRUE; -} +audio_note_set_basedir(NOTES_BASEDIR_MMC1); #else -ui->basedir=g_get_home_dir(); +audio_note_setbasedir(g_get_home_dir()); #endif g_signal_connect(G_OBJECT(ui->btn_record), "clicked", G_CALLBACK(audio_note_record_cb), ui); @@ -217,6 +214,16 @@ g_signal_connect(G_OBJECT(ui->btn_stop), "clicked", G_CALLBACK(audio_note_stop_c return ui; } +void +audio_note_set_basedir(audio_note_ui *ui, const gchar *basedir) +{ +if (ui->basedir) + g_free(ui->basedir) +ui->basedir=g_strdup(basedir); +if (g_mkdir_with_parents(ui->basedir, 0775)==-1) { +} +} + static gboolean audio_note_bus_cb(GstBus *bus, GstMessage *msg, gpointer data) {