From: Kaj-Michael Lang Date: Wed, 9 Apr 2008 10:34:09 +0000 (+0300) Subject: Set basedir on init. Don't expand time display. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa444a4db092b3797f01847164935c8d5d70f9aa;p=mapper Set basedir on init. Don't expand time display. --- diff --git a/src/audio-note.c b/src/audio-note.c index 073642f..8c94525 100644 --- a/src/audio-note.c +++ b/src/audio-note.c @@ -108,17 +108,6 @@ audio_note_ui *ui=(audio_note_ui *)data; time_t t; struct tm *tmp; -/* XXX: Make this a configuration option */ -#ifdef WITH_DEVICE_770 -basedir=NOTES_BASEDIR_MMC1; -if (g_mkdir_with_parents(basedir, 0775)==-1) { - MACRO_BANNER_SHOW_INFO(_window, _("Failed to create directory for sound files!")); - return TRUE; -} -#else -basedir=g_get_home_dir(); -#endif - t=time(NULL); tmp=localtime(&t); if (tmp == NULL) { @@ -132,7 +121,7 @@ strftime(buffer, sizeof(buffer), "%Y-%m-%d-%H%M%S", tmp); if (ui->cfile) g_free(ui->cfile); -ui->cfile=g_strdup_printf("%s/an-%s.wav", basedir, buffer); +ui->cfile=g_strdup_printf("%s/an-%s.wav", ui->basedir, buffer); if (audio_note_record(ui->cfile)==TRUE) { audio_note_position_display(ui, TRUE); @@ -201,7 +190,8 @@ ui->btn_stop=gtk_button_new_from_stock(GTK_STOCK_MEDIA_STOP); gtk_widget_set_sensitive(ui->btn_play, FALSE); gtk_widget_set_sensitive(ui->btn_stop, FALSE); -gtk_box_pack_start(GTK_BOX(ui->vbox), ui->lbl_time, TRUE, TRUE, 0); +gtk_box_pack_start(GTK_BOX(ui->vbox), ui->lbl_time, TRUE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->vbox), ui->btn_record, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(ui->vbox), ui->btn_play, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(ui->vbox), ui->btn_stop, TRUE, TRUE, 0); @@ -209,6 +199,17 @@ gtk_box_pack_start(GTK_BOX(ui->vbox), ui->btn_stop, TRUE, TRUE, 0); ui->note_play=¬e_play; ui->note_record=¬e_record; +/* 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; +} +#else +ui->basedir=g_get_home_dir(); +#endif + g_signal_connect(G_OBJECT(ui->btn_record), "clicked", G_CALLBACK(audio_note_record_cb), ui); g_signal_connect(G_OBJECT(ui->btn_play), "clicked", G_CALLBACK(audio_note_play_cb), ui); g_signal_connect(G_OBJECT(ui->btn_stop), "clicked", G_CALLBACK(audio_note_stop_cb), ui); diff --git a/src/audio-note.h b/src/audio-note.h index 4f5cd85..3d086c3 100644 --- a/src/audio-note.h +++ b/src/audio-note.h @@ -45,6 +45,7 @@ struct _audio_note_ui { GtkWidget *btn_stop; gint pos_sid; gchar *cfile; + gchar *basedir; note_pipeline *note_play; note_pipeline *note_record; };