Re: Nim GTK3 editor



On Sun, 2016-07-10 at 18:12 +0300, LRN wrote:
If you're using GSettings schema, it should come with a set of default
values for settings, which would prevent the situation where settings are
uninitialized.

Have done some basic investigations:

proc nimEdAppActivateOrOpen(win: NimEdAppWindow) =
  let priv: NimEdAppWindowPrivate = nimEdAppWindowGetInstancePrivate(win)
  let notebook: Notebook = newNotebook()
  show(notebook)
  attach(priv.grid, notebook, 0, 1, 1, 1)
  let scheme: cstring  = getString(priv.settings, StyleSchemeSettingsID)
  if scheme == nil:
    echo "getString(priv.settings, StyleSchemeSettingsID) == nil"
  if scheme != nil:
    let manager = styleSchemeManagerGetDefault()
    if manager == nil:
      echo "styleSchemeManagerGetDefault() == nil"
    let style = getScheme(manager, scheme)
    if style == nil:
      echo "getScheme(manager, scheme) == nil"
    if style != nil:
      let st: gtksource.Style = gtksource.getStyle(style, "text")
      if st == nil:
        echo "gtksource.getStyle(style, \"text\") == nil"
      if st != nil:
        var fg, bg: cstring
        objectGet(st, "foreground", addr fg, nil)
        objectGet(st, "background", addr bg, nil)
        setTTColor(fg, bg)
        free(fg)
        free(bg)
  win.setDefaultSize(600, 400)
  present(win)

output after "rm /home/stefan/.config/dconf/user" as long as user has not selected a custom style scheme is

gtksource.getStyle(style, "text") == nil

so the problem is

https://developer.gnome.org/gtksourceview/stable/GtkSourceStyleScheme.html#gtk-source-style-scheme-get-style

which can indeed return NULL. But I can not say that I really
understand it currently. There should be always a valid style for
string "text". Will see if restarting the computer will make a
difference.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]