1
/* cdrdao - write audio CD-Rs in disc-at-once mode
3
* Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
#include "AddFileDialog.h"
31
#include "guiUpdate.h"
35
#include "AudioCDProject.h"
38
AddFileDialog::AddFileDialog(AudioCDProject *project)
39
: Gtk::FileSelection("")
44
set_filename("*.wav");
45
show_fileop_buttons();
46
set_select_multiple(true);
47
set_transient_for(*project);
50
Gtk::Button* cancel = get_cancel_button();
51
cancel->set_label(Gtk::Stock::CLOSE.id);
52
cancel->set_use_stock(true);
54
Gtk::Button* ok = get_ok_button();
55
ok->set_label(Gtk::Stock::ADD.id);
56
ok->set_use_stock(true);
58
ok->signal_clicked().connect(SigC::slot(*this,&AddFileDialog::applyAction));
59
cancel->signal_clicked().connect(SigC::slot(*this,
60
&AddFileDialog::closeAction));
63
AddFileDialog::~AddFileDialog()
67
void AddFileDialog::mode(Mode m)
73
set_title(_("Append Track"));
76
set_title(_("Append File"));
79
set_title(_("Insert File"));
84
void AddFileDialog::start()
87
get_window()->raise();
92
set_filename("*.wav");
96
void AddFileDialog::stop()
104
void AddFileDialog::update(unsigned long level)
106
if (level & UPD_EDITABLE_STATE) {
107
if (project_->tocEdit()) {
108
get_ok_button()->set_sensitive(project_->tocEdit()->editable());
113
bool AddFileDialog::on_delete_event(GdkEventAny*)
119
void AddFileDialog::closeAction()
124
void AddFileDialog::applyAction()
126
if (!project_->tocEdit() ||
127
!project_->tocEdit()->editable()) {
131
Glib::ArrayHandle<std::string> sfiles = get_selections();
132
std::list<std::string> files;
134
for (Glib::ArrayHandle<std::string>::const_iterator i = sfiles.begin();
135
i != sfiles.end(); i++) {
137
const char *s = stripCwd((*i).c_str());
139
if (s && *s != 0 && s[strlen(s) - 1] != '/')
143
if (files.size() > 0) {
146
project_->appendTracks(files);
150
project_->appendFiles(files);
154
project_->insertFiles(files);
157
if (files.size() > 1)
161
set_filename("*.wav");