summaryrefslogtreecommitdiff
path: root/gtk2_ardour/theme_manager.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-05-30 12:19:09 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:46 -0400
commit6ec731c5faccb2295a1599b2453866c28d7af61e (patch)
tree51089d5eeae962523e346725c523968dc4c11747 /gtk2_ardour/theme_manager.cc
parentae314207b1b04ba231bd05c3e1bedf6cb9c30b3f (diff)
rework of color theme file management
Use program-name + version when saving user color files (and search for them) Preset XML-defined theme name, but use filename in config files (could be wrong).
Diffstat (limited to 'gtk2_ardour/theme_manager.cc')
-rw-r--r--gtk2_ardour/theme_manager.cc47
1 files changed, 38 insertions, 9 deletions
diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc
index e402bf1a3e..c99e8e886b 100644
--- a/gtk2_ardour/theme_manager.cc
+++ b/gtk2_ardour/theme_manager.cc
@@ -79,7 +79,7 @@ ThemeManager::ThemeManager()
, palette_window (0)
{
Gtk::HBox* hbox;
-
+
/* Now the alias list */
alias_list = TreeStore::create (alias_columns);
@@ -112,11 +112,33 @@ ThemeManager::ThemeManager()
set_homogeneous (false);
- vector<string> color_themes = ::get_color_themes ();
+ std::map<string,string> color_themes;
+
+ get_color_themes (color_themes);
if (color_themes.size() > 1) {
- Gtkmm2ext::set_popdown_strings (color_theme_dropdown, color_themes);
- color_theme_dropdown.set_active_text (UIConfiguration::instance().get_color_file());
+ theme_list = TreeStore::create (color_theme_columns);
+
+ TreeModel::iterator selected_iter = theme_list->children().end();
+
+ for (std::map<string,string>::iterator c = color_themes.begin(); c != color_themes.end(); ++c) {
+ TreeModel::Row row;
+
+ row = *(theme_list->append());
+ row[color_theme_columns.name] = c->first;
+ row[color_theme_columns.path] = c->second;
+
+ if (UIConfiguration::instance().get_color_file() == c->first) {
+ selected_iter = row;
+ }
+ }
+
+ color_theme_dropdown.set_model (theme_list);
+ color_theme_dropdown.pack_start (color_theme_columns.name);
+
+ if (selected_iter != theme_list->children().end()) {
+ color_theme_dropdown.set_active (selected_iter);
+ }
hbox = Gtk::manage (new Gtk::HBox());
Gtk::Alignment* align = Gtk::manage (new Gtk::Alignment);
@@ -126,6 +148,7 @@ ThemeManager::ThemeManager()
hbox->pack_start (color_theme_label, false, false);
hbox->pack_start (*align, true, true);
pack_start (*hbox, PACK_SHRINK);
+ hbox->show_all ();
}
pack_start (reset_button, PACK_SHRINK);
@@ -365,8 +388,16 @@ ThemeManager::on_icon_set_changed ()
void
ThemeManager::on_color_theme_changed ()
{
- string new_theme = color_theme_dropdown.get_active_text();
- UIConfiguration::instance().set_color_file (new_theme);
+ Gtk::TreeModel::iterator iter = color_theme_dropdown.get_active();
+
+ if (iter) {
+ Gtk::TreeModel::Row row = *iter;
+
+ if (row) {
+ string new_theme = row[color_theme_columns.path];
+ UIConfiguration::instance().set_color_file (new_theme);
+ }
+ }
}
void
@@ -423,9 +454,7 @@ ThemeManager::reset_canvas_colors()
string cfile;
string basename;
- basename = "my-";
- basename += UIConfiguration::instance().get_color_file();
- basename += UIConfiguration::color_file_suffix;
+ basename = UIConfiguration::instance().color_file_name (true, true, true);
if (find_file (ardour_config_search_path(), basename, cfile)) {
string backup = cfile + string (X_(".old"));