Git Product home page Git Product logo

Comments (3)

btzy avatar btzy commented on June 28, 2024

Just to be sure I'm understanding you correctly, you want to have a check at runtime to decide whether to open a Portal or GTK dialog?

from nativefiledialog-extended.

iTrooz avatar iTrooz commented on June 28, 2024

Yes. Sorry, re-reading myself, I realize that this was pretty badly written

The functions could be implemented on your side with something like this:
(pseudocode, I know your API isn't exactly like that)

nfdresult_t NFD::openFile(NFD::UniquePathU8 outPath) {
	result = NFD::Portal::openFile(outPath)
	if (result == NFD_ERROR) {
		return NFD::GTK::openFile(outPath)
	} else return result;
}

But It'd also be fine for me if NFD::Portal::openFile() and NFD::GTK::openFile() were simply exposed to us, and we had the responsibility to implement the fallback (right now we have to choose between them at compile time with NFD_PORTAL)

from nativefiledialog-extended.

btzy avatar btzy commented on June 28, 2024

Thanks for the clarification.

It's a nice feature to have, and I'd be happy to accept a PR for such a feature (as long as it is possible at build time to select just a single implementation).

There's a different but related question, about whether it should be a hard loader error if the loader cannot find libdbus or libgtk at runtime. Your current proposal will be a hard error at load time, which I'm not sure is ideal. Preventing a hard loader error is usually achieved using dlopen() (as mentioned in mlabbe/nativefiledialog#42 and mlabbe/nativefiledialog#102), but it can probably be done more nicely on Linux by importing the functions from shared libraries as weak symbols (with #pragma weak or some attribute). This will allow you to run your binary even if one of libdbus or libgtk is missing. I'm not too sure whether such a distribution exists in practice though.

from nativefiledialog-extended.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.