Add "Open Folder" button in Preferences > Theme section

This commit is contained in:
David Capello 2015-09-18 12:39:46 -03:00
parent 83fe139600
commit c37c790b47
2 changed files with 17 additions and 3 deletions

View File

@ -144,6 +144,7 @@
<hbox>
<button id="select_theme" text="&amp;Select" width="60" />
<boxfiller />
<button id="open_theme_folder" text="Open &amp;Folder" width="100" />
</hbox>
</vbox>

View File

@ -156,6 +156,7 @@ public:
// Theme buttons
selectTheme()->Click.connect(Bind<void>(&OptionsWindow::onSelectTheme, this));
openThemeFolder()->Click.connect(Bind<void>(&OptionsWindow::onOpenThemeFolder, this));
onChangeGridScope();
sectionListbox()->selectIndex(m_curSection);
@ -333,9 +334,7 @@ private:
if (themeList()->getItemsCount() > 0)
return;
ResourceFinder rf;
rf.includeDataDir("skins");
std::string path = rf.defaultFilename();
std::string path = themeFolder();
for (auto& fn : base::list_files(path)) {
if (!base::is_directory(base::join_path(path, fn)))
continue;
@ -365,6 +364,20 @@ private:
}
}
void onOpenThemeFolder() {
ui::Alert::show(PACKAGE
"<<%s"
"||&OK", themeFolder().c_str());
launcher::open_folder(themeFolder());
}
static std::string themeFolder() {
ResourceFinder rf;
rf.includeDataDir("skins");
return rf.defaultFilename();
}
Preferences& m_preferences;
DocumentPreferences& m_globPref;
DocumentPreferences& m_docPref;