openmedicus / gtk-sharp

DEPRECATED: Use https://github.com/GLibSharp/GtkSharp or https://github.com/GtkSharp/GtkSharp
Other
22 stars 6 forks source link

GSettings schemas #6

Open Hecatron opened 8 years ago

Hecatron commented 8 years ago

Hi, I've recently been experimenting with GtkSharp from NuGet, very good job btw I think the NuGet versions which are GTK3 are based on this source code fork I've been using Glade installed via MSYS2 to design forms then load them up in .Net under windows

but one thing I have noticed is that with the FileChooserButton while this works fine in the latest glade (3.19.0 run via msys) This seems to generate a "No GSettings schemas are installed on the system" when clicked from a .Net app (for info I've using Windows 10 / Visual Studio 2015)

From what I can gather glib is having problems finding the schema files which for MSYS2 are located under C:\msys64\mingw64\share\glib-2.0\schemas

I've tried copying the files into various sub-directories under the path of where the .Net app is located but without much luck (such as exedir\share\glib-2.0\schemas) I've also tried setting the XDG_DATA_DIR enviroment variable to the location (also doesn't work)

any ideas on what the search path might be, or how to get it to locate the schema files?

Hecatron commented 8 years ago

with a bit of vb code I was able to work out the search path

    Dim tmp1 As IntPtr = g_get_system_data_dirs()
    Dim tmplst = GLib.Marshaller.NullTermPtrToStringArray(tmp1, False)

    <DllImport("libglib-2.0-0.dll", CallingConvention:=CallingConvention.Cdecl)>
    Shared Function g_get_system_data_dirs() As IntPtr
    End Function
C:\ProgramData
C:\Users\Public\Documents\
<SourceCodeDir>\share\
<SourceCodeDir>\share\

It looks like it's picked up on the bin folder that Visual Studio generates so if the final exe ends up in SourceCodeDir\bin\Debug because it sees the bin folder it uses the parent of that and goes back up one from there which resolves to SourceCodeDir\share\

Now I just need to figure out how to add to that list

Hecatron commented 8 years ago

After digging through the GLib source code, there doesn't appear to be a way to set the path so the simplest solution I could find was to copy and paste

  1. C:\msys64\mingw64\share\glib-2.0\schemas -> C:\ProgramData\glib-2.0\schemas
  2. C:\msys64\mingw64\share\icons -> C:\ProgramData\icons
  3. C:\msys64\mingw64\share\themes -> C:\ProgramData\themes
mikkeljohnsen commented 8 years ago

I don't use GSettings myself on Windows. I wrap my config and on Windows it saves in the registry and on Mac it uses a homemade XML file. So I only use GSettings on Linux.