projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Auditioned to Export Report Dialog.
[ardour.git]
/
gtk2_ardour
/
search_path_option.cc
diff --git
a/gtk2_ardour/search_path_option.cc
b/gtk2_ardour/search_path_option.cc
index be01b9b1aa6893f7977cfcce967bf6c331dba38d..9aea6178120fe71aaa6bffe2e8655bfbf56d8066 100644
(file)
--- a/
gtk2_ardour/search_path_option.cc
+++ b/
gtk2_ardour/search_path_option.cc
@@
-17,12
+17,17
@@
*/
#include "pbd/strsplit.h"
*/
#include "pbd/strsplit.h"
+#include "pbd/compose.h"
+#include "pbd/shortpath.h"
+
#include "search_path_option.h"
#include "search_path_option.h"
+#include "i18n.h"
using namespace std;
using namespace Gtk;
SearchPathOption::SearchPathOption (const string& pathname, const string& label,
using namespace std;
using namespace Gtk;
SearchPathOption::SearchPathOption (const string& pathname, const string& label,
+ const string& default_path,
sigc::slot<std::string> get, sigc::slot<bool, std::string> set)
: Option (pathname, label)
, _get (get)
sigc::slot<std::string> get, sigc::slot<bool, std::string> set)
: Option (pathname, label)
, _get (get)
@@
-35,22
+40,24
@@
SearchPathOption::SearchPathOption (const string& pathname, const string& label,
hbox->set_border_width (12);
hbox->set_spacing (6);
hbox->set_border_width (12);
hbox->set_spacing (6);
- hbox->pack_end (add_chooser,
false, fals
e);
- hbox->pack_end (*manage (new Label (
"Click to add a new location"
)), false, false);
+ hbox->pack_end (add_chooser,
true, tru
e);
+ hbox->pack_end (*manage (new Label (
_("Click to add a new location")
)), false, false);
hbox->show_all ();
hbox->show_all ();
-
+
vbox.pack_start (path_box);
vbox.pack_end (*hbox);
session_label.set_use_markup (true);
vbox.pack_start (path_box);
vbox.pack_end (*hbox);
session_label.set_use_markup (true);
- session_label.set_markup (string_compose ("<i>%1
</i>", _("the session folder"
)));
+ session_label.set_markup (string_compose ("<i>%1
(%2)</i>", _("the session folder"), short_path (default_path, 32
)));
session_label.set_alignment (0.0, 0.5);
session_label.show ();
session_label.set_alignment (0.0, 0.5);
session_label.show ();
+
+ path_box.pack_start (session_label);
}
SearchPathOption::~SearchPathOption()
{
}
SearchPathOption::~SearchPathOption()
{
-
+
}
}
@@
-59,20
+66,21
@@
SearchPathOption::path_chosen ()
{
string path = add_chooser.get_filename ();
add_path (path);
{
string path = add_chooser.get_filename ();
add_path (path);
+ changed ();
}
void
SearchPathOption::add_to_page (OptionEditorPage* p)
{
int const n = p->table.property_n_rows();
}
void
SearchPathOption::add_to_page (OptionEditorPage* p)
{
int const n = p->table.property_n_rows();
- p->table.resize (n +
2
, 3);
+ p->table.resize (n +
1
, 3);
Label* label = manage (new Label);
Label* label = manage (new Label);
- label->set_alignment (0.0, 0.
5
);
- label->set_
markup (string_compose ("<b>%1</b>
", _name));
+ label->set_alignment (0.0, 0.
0
);
+ label->set_
text (string_compose ("%1
", _name));
- p->table.attach (*label,
0, 1
, n, n + 1, FILL | EXPAND);
- p->table.attach (vbox,
0, 3, n + 1, n + 2
, FILL | EXPAND);
+ p->table.attach (*label,
1, 2
, n, n + 1, FILL | EXPAND);
+ p->table.attach (vbox,
2, 3, n, n + 1
, FILL | EXPAND);
}
void
}
void
@@
-95,8
+103,8
@@
SearchPathOption::set_state_from_config ()
clear ();
path_box.pack_start (session_label);
clear ();
path_box.pack_start (session_label);
- split (str, dirs,
':'
);
-
+ split (str, dirs,
G_SEARCHPATH_SEPARATOR
);
+
for (vector<string>::iterator d = dirs.begin(); d != dirs.end(); ++d) {
add_path (*d);
}
for (vector<string>::iterator d = dirs.begin(); d != dirs.end(); ++d) {
add_path (*d);
}
@@
-106,17
+114,11
@@
void
SearchPathOption::changed ()
{
string str;
SearchPathOption::changed ()
{
string str;
-
- for (list<PathEntry*>::iterator p = paths.begin(); p != paths.end(); ++p) {
- if (p == paths.begin()) {
- /* skip first entry, its always "the session"
- */
- continue;
- }
+ for (list<PathEntry*>::iterator p = paths.begin(); p != paths.end(); ++p) {
if (!str.empty()) {
if (!str.empty()) {
- str +=
':'
;
+ str +=
G_SEARCHPATH_SEPARATOR
;
}
str += (*p)->entry.get_text ();
}
}
str += (*p)->entry.get_text ();
}
@@
-130,11
+132,16
@@
SearchPathOption::add_path (const string& path, bool removable)
PathEntry* pe = new PathEntry (path, removable);
paths.push_back (pe);
path_box.pack_start (pe->box, false, false);
PathEntry* pe = new PathEntry (path, removable);
paths.push_back (pe);
path_box.pack_start (pe->box, false, false);
+ pe->remove_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &SearchPathOption::remove_path), pe));
}
void
}
void
-SearchPathOption::remove_path (
const string& path
)
+SearchPathOption::remove_path (
PathEntry* pe
)
{
{
+ path_box.remove (pe->box);
+ paths.remove (pe);
+ delete pe;
+ changed ();
}
SearchPathOption::PathEntry::PathEntry (const std::string& path, bool removable)
}
SearchPathOption::PathEntry::PathEntry (const std::string& path, bool removable)
@@
-146,7
+153,7
@@
SearchPathOption::PathEntry::PathEntry (const std::string& path, bool removable)
box.set_spacing (6);
box.set_homogeneous (false);
box.pack_start (entry, true, true);
box.set_spacing (6);
box.set_homogeneous (false);
box.pack_start (entry, true, true);
-
+
if (removable) {
box.pack_start (remove_button, false, false);
remove_button.show ();
if (removable) {
box.pack_start (remove_button, false, false);
remove_button.show ();