0

I have to create one-file (.exe) program. In this program user can choose directory from his computer.

I create program in order of http://www.tarnyko.net/en/?q=node/31 and it run well.

But when I invoke FileChoser (click on button) I got this error

GLib-GIO-ERROR No GSettings schemas are installed on the system

Response of Tarnyko to this issue is in coment on webpage - this is known "bug" with static compiling.

How can I work around this?

On the one hand I have to have one-file.exe. On the other hand I realy do not want create "sophisticated" FileChooser on my own... is there any option to deal with this?

My ideas: 1 - Call native File chooser of OS (windows) 2 - Create file chooser on my own - if it is not "much hard" in gtk

I do not know how to do either of this.

Sorry for duplicating - probably succes solution is in answer form "ebassi" here GLib-GIO-ERROR**: No GSettings schemas are installed on the system (not tested yet)

Community
  • 1
  • 1
  • [This is what google could do for you](https://www.google.it/search?q=GLib-GIO-ERROR+No+GSettings+schemas+are+installed+on+the+system&oq=GLib-GIO-ERROR+No+GSettings+schemas+are+installed+on+the+system&aqs=chrome..69i57j0l5.415j0j7&sourceid=chrome&es_sm=122&ie=UTF-8) – LPs May 16 '16 at 15:44
  • Statically compiling GTK+ is explicitly not supported, so any "bugs" that you see are the result of using an unsupported configuration. That being said, recompile your static GLib to have GSettings not look for schemas on the filesystem or something. I'm not sure if this is even possible... You may also need to recompile GTK+ to embed its schema as part of the .a file. – andlabs May 16 '16 at 21:13
  • @andlabs, Would you mind providing a source for it being explicitly unsupported? Not because I think you're wrong, but I was curious about the rationale. – Blake May 16 '16 at 22:48
  • Static linking is not explicitly unsupported, but it's not tested for regressions because nobody really uses it on Linux (where the development of GTK happens) and it's usually the wrong choice. GTK and its dependencies use loadable modules and ancillary files like setting schemas and pixbuf loaders; those cannot be statically linked into the binary. Instead, spend some time, and use an installer. – ebassi May 16 '16 at 23:36

2 Answers2

1

Settings schemas (which are used in GTK in more places than just the file selector widget) cannot be statically linked into a binary: they have to be installed in a well known location (controllable via the $XDG_DATA_DIRS environment variable) and they have to be compiled into a cache.

GTK's dependencies like Pango and GDK-Pixbuf also use ancillary files and loadable modules that are not strictly compatible (unless you're willing to spend time on it) with static linking.

The usual recommendation for only providing a single executable for your application is to have a self-extracting installer that contains all the installed files necessary to running a GTK application, and avoid static linking.

ebassi
  • 8,648
  • 27
  • 29
0

I don't think it's possible to create just one .exe file (without any other files) with GTK+. Maybe only when you recode the GTK and it's dependencies - which is not an easy task to do.

The best solution I found is to put all schemas (and also icons for your GTK+ app) in the same location where your .exe file is placed:

EXE_LOCATION\program.exe

// For icons:
EXE_LOCATION\share\icons\hicolor...

// For schemas
EXE_LOCATION\share\glib-2.0\schemas

Then you deliver these files together with your .exe file and with all needed .dll files.

About the native file chooser in GTK+: It also needs the schemas - at least on Windows OS.

PaweX3
  • 65
  • 1
  • 7