summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-06-10 14:22:59 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-06-10 14:39:28 -0400
commit839a0063f218cca5d54b5dece05649d134be4e41 (patch)
tree2cc969480322cc9542f52f6e3235a5d1597ca2cb
parentd59d26b89a875d226e8d7405d75c17c331fc6a0a (diff)
add ::get_icon_sets() to utils
-rw-r--r--gtk2_ardour/utils.cc40
-rw-r--r--gtk2_ardour/utils.h1
2 files changed, 39 insertions, 2 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 3919a756cb..8ded1a2f81 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -654,6 +654,42 @@ get_xpm (std::string name)
return xpm_map[name];
}
+vector<string>
+get_icon_sets ()
+{
+ Searchpath spath(ARDOUR::ardour_data_search_path());
+ spath.add_subdirectory_to_paths ("icons");
+ vector<string> r;
+
+ r.push_back (_("default"));
+
+ for (vector<string>::iterator s = spath.begin(); s != spath.end(); ++s) {
+
+ vector<string> entries;
+
+ get_files_in_directory (*s, entries);
+
+ for (vector<string>::iterator e = entries.begin(); e != entries.end(); ++e) {
+
+ string d = *e;
+
+ /* ignore dotfiles, . and .. */
+
+ if (d.empty() || d[0] == '.') {
+ continue;
+ }
+
+ Glib::ustring path = Glib::build_filename (*s, *e);
+
+ if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
+ r.push_back (Glib::filename_to_utf8 (*e));
+ }
+ }
+ }
+
+ return r;
+}
+
std::string
get_icon_path (const char* cname, string icon_set)
{
@@ -663,7 +699,7 @@ get_icon_path (const char* cname, string icon_set)
Searchpath spath(ARDOUR::ardour_data_search_path());
- if (!icon_set.empty() && icon_set != "default") {
+ if (!icon_set.empty() && icon_set != _("default")) {
string subdir = Glib::build_filename ("icons", icon_set);
spath.add_subdirectory_to_paths (subdir);
@@ -672,7 +708,7 @@ get_icon_path (const char* cname, string icon_set)
if (data_file_path.empty()) {
- if (!icon_set.empty() && icon_set != "default") {
+ if (!icon_set.empty() && icon_set != _("default")) {
warning << string_compose (_("icon \"%1\" not found for icon set \"%2\", fallback to default"), cname, icon_set) << endmsg;
}
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index a59f55eec1..63b6ef08ae 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -76,6 +76,7 @@ bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev);
bool emulate_key_event (Gtk::Widget*, unsigned int);
Glib::RefPtr<Gdk::Pixbuf> get_xpm (std::string);
+std::vector<std::string> get_icon_sets ();
std::string get_icon_path (const char*, std::string icon_set = std::string());
Glib::RefPtr<Gdk::Pixbuf> get_icon (const char*, std::string icon_set = std::string());
static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map;