Fix incorrect object used when getting the selected export path

This commit is contained in:
Zachary Hall 2023-07-17 12:55:13 -07:00
parent a6025d69f0
commit 18bc56e510
3 changed files with 20 additions and 5 deletions

View file

@ -14,6 +14,18 @@ modules:
- type: git - type: git
url: https://codeberg.org/soundtouch/soundtouch.git url: https://codeberg.org/soundtouch/soundtouch.git
tag: 2.3.2 tag: 2.3.2
- name: libportal
buildsystem: meson
config-opts:
- -Dvapi=false
- -Ddocs=false
- -Dtests=false
- -Dintrospection=false
- -Dbackends=[]
sources:
- type: archive
url: https://github.com/flatpak/libportal/releases/download/0.6/libportal-0.6.tar.xz
sha256: 88a12c3ba71bc31acff7238c280de697d609cebc50830c3766776ec35abc6566
- name: player - name: player
buildsystem: meson buildsystem: meson
builddir: true builddir: true

View file

@ -72,7 +72,7 @@ void FileBrowser::Open() {
#ifdef PORTALS #ifdef PORTALS
open = true; open = true;
if (save) { if (save) {
xdp_portal_save_file(portal, NULL, title.c_str(), "", pwd.c_str(), "", variant, NULL, NULL, XDP_SAVE_FILE_FLAG_NONE, NULL, &FileBrowser::FileBrowserSaveCallback, this); xdp_portal_save_file(portal, NULL, title.c_str(), NULL, pwd.c_str(), NULL, variant, NULL, NULL, XDP_SAVE_FILE_FLAG_NONE, NULL, &FileBrowser::FileBrowserSaveCallback, this);
} else { } else {
xdp_portal_open_file(portal, NULL, title.c_str(), variant, NULL, NULL, XDP_OPEN_FILE_FLAG_NONE, NULL, &FileBrowser::FileBrowserOpenCallback, this); xdp_portal_open_file(portal, NULL, title.c_str(), variant, NULL, NULL, XDP_OPEN_FILE_FLAG_NONE, NULL, &FileBrowser::FileBrowserOpenCallback, this);
} }
@ -106,7 +106,7 @@ void FileBrowser::FileBrowserOpenCallback(GObject *src, GAsyncResult *res, gpoin
str = str.substr(string("file://").length()); str = str.substr(string("file://").length());
} }
self->open = false; self->open = false;
self->selected = path(str); self->selected.emplace(path(str));
} }
void FileBrowser::FileBrowserSaveCallback(GObject *src, GAsyncResult *res, gpointer data) { void FileBrowser::FileBrowserSaveCallback(GObject *src, GAsyncResult *res, gpointer data) {
@ -134,7 +134,7 @@ void FileBrowser::FileBrowserSaveCallback(GObject *src, GAsyncResult *res, gpoin
str = str.substr(string("file://").length()); str = str.substr(string("file://").length());
} }
self->open = false; self->open = false;
self->selected = path(str); self->selected.emplace(path(str));
} }
#endif #endif

View file

@ -187,10 +187,12 @@ bool Theme::ShowEditor(bool* open, Theme* &theme) {
path filename = selected_path.filename(); path filename = selected_path.filename();
copy_file(selected_path, theme->themeDir / filename); copy_file(selected_path, theme->themeDir / filename);
theme->availableThemes.insert(filename); theme->availableThemes.insert(filename);
importDialog.ClearSelected();
} }
if (exportDialog.HasSelected()) { if (exportDialog.HasSelected()) {
path selected_path = importDialog.GetSelected(); path selected_path = exportDialog.GetSelected();
theme->Save(selected_path); theme->Save(selected_path);
exportDialog.ClearSelected();
} }
if (loadOpen) { if (loadOpen) {
ImGui::OpenPopup("Load..."); ImGui::OpenPopup("Load...");
@ -298,6 +300,7 @@ void Theme::Apply(float hue) {
} }
} }
void Theme::Save(string path) { void Theme::Save(string path) {
printf("Saving theme to %s...\n", path.c_str());
{ {
Json::Value config; Json::Value config;
std::ofstream stream; std::ofstream stream;
@ -344,7 +347,7 @@ void Theme::Save(string path) {
updateAvailableThemes(); updateAvailableThemes();
} }
void Theme::Save(path path) { void Theme::Save(path path) {
Save(path.string()); Save((string)path.string());
} }
void Theme::updateAvailableThemes() { void Theme::updateAvailableThemes() {
themeDir = path(prefPath) / path("themes"); themeDir = path(prefPath) / path("themes");