unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* GNU G-Golf 0.8.0-rc6 available for testing
@ 2024-09-18  2:49 David Pirotte
  2024-09-18 22:39 ` David Pirotte
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Pirotte @ 2024-09-18  2:49 UTC (permalink / raw)
  To: guile-user, guile-devel

[-- Attachment #1: Type: text/plain, Size: 5446 bytes --]

Hello Guilers,

The sixth release candidate of the upcoming GNU G-Golf 0.8.0 release is
now available for testing:


* Tarball and a GPG detached signature [*]:

	http://ftp.gnu.org/gnu/g-golf/g-golf-0.8.0-rc6.tar.gz
	http://ftp.gnu.org/gnu/g-golf/g-golf-0.8.0-rc6.tar.gz.sig


* Install

Dependencies and complete installation instructions are given in the
distributed INSTALL file, or here:

	https://www.gnu.org/software/g-golf/install.html


* Noteworthy changes in 0.8.0-rc6

Here is a summary of the noteworthy changes in this release, also
available in NEWS file and on the G-Golf website.


** New interfaces

*** New (g-golf support color) module

A color management module has been added. Documented under the Support
Canyon -> Color Hollow section.

*** Adding derived class custom layout-manager support

Derived class now support a #:layout-manager define-class option.

*** nil

Users need a way to inform g-golf to not process some callback ffi 'out
argument(s) (which can't be by using #f, as this mught be a valid ffi
'out arg value). To solve this, g-golf now defines a global nil variable
(defined as 'nil). See the newly added layout manager demo for a
concrete example of such a need and usage.

** Examples

*** Gtk-4 - Layout Manager

The upstream gtk4-demo layout-manager (transition) example has been
ported to g-golf.

*** Adwaita Demo

The following Adwaita Demo pages have been added:

  AdwDemoPageButtons
  AdwDemoPageToasts
  AdwDemoPageBanners
  AdwDemoPageAbout

** Bug fixing

*** <vfunc>

<vfunc> instances must hold a reference to the <closure-callback>
instance (not the <callback> instance).

*** next-vfunc

Fixed to retreive the vfunc pointer offset from one of the
class-direct-supers, recursively if needed, then grab and unlesss NULL,
call the immediate direct super vfunc.

*** g-golf-vfunc-closure

Enhanced to accept and (use if passed) an optional argument,
vfunc-long-name, as vfunc callback instances must be cached against
their long name, i.e. gdk-paintable-get-flags, gdk-paintable-snapshot
... (not get-flags, snapshot ...).

*** g-callable-info-make-closure

When calling g-callable-info-create-closure (fixed to work with the new
libffi api), we also need to call (and return the result of)
g-callable-info-get-closure-native-address, as the native-ptr.

*** ffi 'out arg values

scm->gi-argument has been enhanced to properly ignore ffi 'out args for
which the value is nil.

scm->gi-argument has been fixed, when that applies, to properly set the
(dereferenced) foreign (ffi 'out arg) pointer to its value.

*** g-object-import-with-supers

For some still misterious reason, when automatically importing an object
dependency, such as, for example, importing GtkApplication will trigger
the import of (among many others ofc) the GtkLayoutManager, unless we
call g-base-info-ref upon the info, those info maybe gc'ed.

Although this should actually never happen, as g-golf doesn't unref any
GIObjectInfo instances (but it did 'misteriously' happen), to be on the
safe side of things, g-golf (core) now calls g-base-info-ref upon the
result of calling g-object-info-get-parent.

* You can help

1. Testing by installing from the tarball, or from the source if you
   prefer, on the distro of your choice.

2. By running the distributed examples.

Ultimately, one of the best way to test, and participate, is to select
G-Golf to develop the next application of your dream! Here is an
overview of the GNOME platform libraries [1], accessible using G-Golf.
In particular, libadwaita [2] provides a number of widgets that change
their layout based on the available space. This can be used to make
applications adapt their UI between desktop and mobile devices (as shown
in the G-Golf port of the "Adwaita demo").


* Contact

Consider joining us on irc [3], where you may ask for help or report a
problem [4].

However, if you prefer:

	G-Golf uses the guile-user@gnu.org mailing list
	Report bugs to bug-g-golf@gnu.org


Thanks!
David


[*] Use a .sig file to verify that the corresponding file (without the
    .sig suffix) is intact.  First, be sure to download both the .sig
    file and the corresponding tarball.  Then, run a command like this:

	gpg --verify g-golf-0.8.0-rc6.tar.gz

    If that command fails because you don't have the required public
    key, then run this command to import it:

	gpg --keyserver keys.gnupg.net --recv-keys A3057AD7

    and rerun the 'gpg --verify' command


[1] https://developer.gnome.org/documentation/introduction/overview/libraries.html
[2] https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/
[3] https://www.gnu.org/software/g-golf/contact.html
[4] When reporting a problem, or if you think you found a bug, it is
very important that you prepare a minimal reproducible example (MRE),
sometimes also referred to as a short self-contained correct example
(SSCCE)

	http://www.sscce.org/
	https://en.wikipedia.org/wiki/Minimal_reproducible_example

Also, on irc, we chat :), so please do not write code snipsets directly
in the channel, unless 2 or 3 lines of code, nor (long/huge) error
messages of course - for more then 2 or 3 lines of code, or error
messages, always use a tor-friendly paste service (avoid those that
track its visitors and require javascript, thanks!).

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-18  2:49 GNU G-Golf 0.8.0-rc6 available for testing David Pirotte
@ 2024-09-18 22:39 ` David Pirotte
  2024-09-18 23:21 ` Greg Troxel
  2024-09-19 10:51 ` pelzflorian (Florian Pelz)
  2 siblings, 0 replies; 10+ messages in thread
From: David Pirotte @ 2024-09-18 22:39 UTC (permalink / raw)
  To: guile-user, guile-devel

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Hello Guilers,

> The sixth release candidate of the upcoming GNU G-Golf 0.8.0 release
> is now available for testing:
> ...

It occurs to me that I forgot to add an examples/gtk-4/Makefile.am
(sub)target entry, so the tarball also distributes the newly added
demos/*.scm files.

Hopefully, i shall build and release 0.8.0-rc7 tonight.
Sorry for the inconvinience.

David

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-18  2:49 GNU G-Golf 0.8.0-rc6 available for testing David Pirotte
  2024-09-18 22:39 ` David Pirotte
@ 2024-09-18 23:21 ` Greg Troxel
  2024-09-19 23:00   ` David Pirotte
  2024-09-19 10:51 ` pelzflorian (Florian Pelz)
  2 siblings, 1 reply; 10+ messages in thread
From: Greg Troxel @ 2024-09-18 23:21 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user

David Pirotte <david@altosw.be> writes:

> 	http://ftp.gnu.org/gnu/g-golf/g-golf-0.8.0-rc6.tar.gz

This is an odd version scheme; I would suggest that you instead use
0.8.0rc7 next time.  Packaging systems have code to interpret versions,
and the - is irregular as it usually separates package names and
versions.  Bsaically, do it like everybody else please.

I'm building on NetBSD 10 amd64 with

=> Tool dependency glib2-tools-[0-9]*: found glib2-tools-2.80.4
=> Tool dependency mktools-[0-9]*: found mktools-20220614
=> Tool dependency gtexinfo>=6: found gtexinfo-7.1
=> Tool dependency pkgconf-[0-9]*: found pkgconf-2.3.0
=> Tool dependency ccache-[0-9]*: found ccache-4.10.2
=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
=> Tool dependency checkperms>=1.1: found checkperms-1.12
=> Full dependency glib2>=2.76.4nb1: found glib2-2.80.4
=> Full dependency gobject-introspection>=1.76.1nb1: found gobject-introspection-1.80.1nb3
=> Full dependency guile22>=2.2.7nb6: found guile22-2.2.7nb6

and this blows up:

  GEN      g-golf/support/color.go
Backtrace:
In system/base/compile.scm:
   155:11 19 (_ #<closed: file 7365885cd1c0>)
   235:18 18 (read-and-compile #<input: g-golf/support/color.scm 15> ?)
   183:32 17 (compile-fold (#<procedure compile-tree-il (x e opts)>) ?)
In ice-9/boot-9.scm:
   2312:4 16 (save-module-excursion #<procedure 736586304900 at lang?>)
In language/scheme/compile-tree-il.scm:
    31:15 15 (_)
In ice-9/psyntax.scm:
  1262:36 14 (expand-top-sequence ((define-module (g-golf # #) # ?)) ?)
  1209:24 13 (parse _ (("placeholder" placeholder)) ((top) #(# # ?)) ?)
   285:10 12 (parse _ (("placeholder" placeholder)) (()) _ c&e (# #) #)
In ice-9/eval.scm:
   293:34 11 (_ #<module (#{ g77}#) 7365885cf0a0>)
In ice-9/boot-9.scm:
   2874:4 10 (define-module* _ #:filename _ #:pure _ #:version _ # _ ?)
  2071:24  9 (call-with-deferred-observers #<procedure 73658a1e1000 ?>)
  2887:24  8 (_)
   222:29  7 (map1 (((ice-9 rdelim)) ((ice-9 match)) ((ice-9 #) ?) ?))
   222:29  6 (map1 (((ice-9 match)) ((ice-9 string-fun) #:select ?) ?))
   222:17  5 (map1 (((ice-9 string-fun) #:select ((# . #))) ((# ?)) ?))
  2813:10  4 (resolve-interface (ice-9 string-fun) #:select _ #:hide ?)
   260:13  3 (for-each #<procedure 73658631a140 at ice-9/boot-9.scm?> ?)
  2818:38  2 (_ _)
In unknown file:
           1 (scm-error misc-error #f "~A" ("no binding `string-re?") ?)
In ice-9/boot-9.scm:
   752:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
no binding `string-replace-substring' in module (ice-9 string-fun)
*** [g-golf/support/color.go] Error code 1

with guile 3.0.x, it goes much better, with fewer warnings, and the
build completes.  It would be fine for me personally if this were fixed
by adjusting the guile requirement to >= 3.0, but I don't know how much
that would bother others.  (It is unfortunate how there are backwards
compat issues that cause people to need old guile, or so it seems.)




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-18  2:49 GNU G-Golf 0.8.0-rc6 available for testing David Pirotte
  2024-09-18 22:39 ` David Pirotte
  2024-09-18 23:21 ` Greg Troxel
@ 2024-09-19 10:51 ` pelzflorian (Florian Pelz)
  2024-09-19 22:20   ` David Pirotte
  2 siblings, 1 reply; 10+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-09-19 10:51 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

Thank you David for this release!

G-Golf works great.  Now I can embed GTK programs within the Guix Home
configurations of my family’s media center mini PC, without writing C
(see attached file).  All system setup is in Guile.  Note that this is
not pure Guix, but on top of my Guix channel git repo, I have applied
Arnaud’s Sway patch [1].  Also I have a custom configuration of the
operating-system’s sudoers file [2].

All that is left is that I do not understand why
(gdk-display-get-default) returns #f in G-Golf but
gdk_display_get_default () in C returns 0x1c0e36c0.

Regards,
Florian

[1]
https://issues.guix.gnu.org/72714
[2]
 (sudoers-file
  (plain-file "sudoers"
              (string-append (plain-file-content %sudoers-specification)
                             (format #f "\
Cmnd_Alias SHUTDOWN_CMDS = \
/run/current-system/profile/sbin/halt, \
/run/current-system/profile/sbin/reboot, \
/run/privileged/bin/mount ~%\
user ALL = (ALL) NOPASSWD: SHUTDOWN_CMDS~%"))))


[-- Attachment #2: home-configuration.scm --]
[-- Type: text/plain, Size: 10294 bytes --]

;;; Copyright © 2023, 2024 Florian Pelz <pelzflorian@pelzflorian.de>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; 
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
;; 
;; Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
;; der GNU General Public License, wie von der Free Software Foundation,
;; Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
;; veröffentlichten Version, weiter verteilen und/oder modifizieren.
;; 
;; Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
;; OHNE JEDE GEWÄHR,; sogar ohne die implizite
;; Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
;; Siehe die GNU General Public License für weitere Einzelheiten.
;; 
;; Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
;; Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.

(use-modules (gnu home)
             (gnu home services)
             (gnu home services desktop)
             (gnu home services shells)
             (gnu home services sound)
             (gnu home services sway)
             (gnu packages)
             (gnu packages gtk)
             (gnu packages guile-xyz)
             (gnu services)
             (guix build-system glib-or-gtk)
             (guix gexp)
             (guix licenses)
             (guix packages)
             (guix transformations))

(home-environment
  (packages (specifications->packages (list "git")))
  (services
   (list (service home-bash-service-type)
         (service home-dbus-service-type) ;für VLC
         ;; (service home-pipewire-service-type)
         (service home-sway-service-type
           (sway-configuration
            (execs
             `(,(with-extensions
                 (list graphene gtk
                       ((options->transformation
                         '((with-commit . "guile-g-golf=v0.8.0-rc6")))
                        guile-g-golf))
                 #~(string-append
                    "guile "
                    #$(scheme-file "launcher.scm"
                       #~(begin
                           (eval-when (expand load eval)
                             (use-modules (oop goops))
                             (default-duplicate-binding-handler
                               '(merge-generics replace
                                 warn-override-core warn last))
                             (setenv "GI_TYPELIB_PATH"
                                     #$(file-append
                                        (directory-union
                                         "typelibs"
                                         (list gdk-pixbuf
                                               graphene gtk harfbuzz
                                               pango))
                                        "/lib/girepository-1.0"))
                             (use-modules (g-golf))
                             (g-irepository-require
                              "Gtk" #:version "4.0")
                             (for-each (lambda (name)
                                         (gi-import-by-name "Gtk" name))
                                       '("Application"
                                         "ApplicationWindow"
                                         "Builder"
                                         "CssProvider"
                                         )))
                           (use-modules (sxml simple))
                           (define ui
                             '(interface
                               (requires (@ (version 4.0) (lib gtk)))
                               (object
                                (@ (id window) (class GtkApplicationWindow))
                                (child
                                 (object
                                  (@ (class GtkGrid))
                                  (property (@ (name row-homogeneous)) 1)
                                  (property (@ (name column-homogeneous)) 1)
                                  (child
                                   (object
                                    (@ (id btn-kodi) (class GtkButton))
                                    (property (@ (name label)) Kodi)
                                    (layout
                                     (property (@ (name column)) 0)
                                     (property (@ (name row)) 0))))
                                  (child
                                   (object
                                    (@ (id btn-halt) (class GtkButton))
                                    (property (@ (name label)) Halt)
                                    (layout
                                     (property (@ (name column)) 0)
                                     (property (@ (name row)) 1))))
                                  (child
                                   (object
                                    (@ (id btn-reboot) (class GtkButton))
                                    (property (@ (name label)) Reboot)
                                    (layout
                                     (property (@ (name column)) 1)
                                     (property (@ (name row)) 1))))
                                  (child
                                   (object
                                    (@ (id btn-mount) (class GtkButton))
                                    (property (@ (name label)) Mounten)
                                    (layout
                                     (property (@ (name column)) 1)
                                     (property (@ (name row)) 0)))))))))
                           (define provider
                             (make <gtk-css-provider>))
                           (define (mount-all)
                             (gtk-css-provider-load-from-string provider "\
.reddable label {
  background-color: red;
}
")
                             (unless (= 0 (system "\
sudo /run/privileged/bin/mount \
/dev/disk/by-id/usb-WD_Elements_25A3_574343374B31544434313530-0:0-part1 \
/media/WDElements/"))
                               (gtk-style-context-add-provider-for-display
                                (pk(gdk-display-get-default))
                                provider
                                100)))
                           (define (activate app)
                             (let ((builder (make <gtk-builder>)))
                               (define (get str)
                                 (get-object builder str))
                               (add-from-string builder
                                                (with-output-to-string
                                                  (lambda ()
                                                    (sxml->xml ui)))
                                                -1)
                               (let ((window (get "window"))
                                     (btn-kodi (get "btn-kodi"))
                                     (btn-mount (get "btn-mount"))
                                     (btn-halt (get "btn-halt"))
                                     (btn-reboot (get "btn-reboot")))
                                 (connect btn-kodi 'clicked
                                          (lambda (b)
                                            (gtk-widget-hide window)
                                            (system
                                             (string-append "\
/var/guix/profiles/per-user/florian/current-guix/bin/guix \
shell --container --network --no-cwd flatpak \
--expose=/home/user/.local/share/flatpak/ \
--share=/home/user/you-kodi/.kodi=/home/user/.var/app/tv.kodi.Kodi/data \
--expose=/sys \
--preserve='^DBUS_.*' \
--share=/media/WDElements \
--expose=/dev/dri --expose=" "/run/user/1001";(getenv "XDG_RUNTIME_DIR")
"/bus=/var/run/dbus/system_bus_socket --expose=/dev/dri --expose=/dev/snd \
--preserve='^DISPLAY$' -- flatpak run -v tv.kodi.Kodi --audio-backend=alsa"))
                                            (present window)))
                                 (connect btn-mount 'clicked
                                          (lambda (b)
                                            (mount-all)))
                                 (connect btn-halt 'clicked
                                          (lambda (b)
                                            (system "\
sudo /run/current-system/profile/sbin/halt")))
                                 (connect btn-reboot 'clicked
                                          (lambda (b)
                                            (system "\
sudo /run/current-system/profile/sbin/reboot")))
                                 (add-window app window)
                                 (present window))))
                           (let ((app (make <gtk-application>
                                        #:application-id "my.launcher")))
                             (mount-all)
                             (connect app 'activate activate)
                             (let ((status (g-application-run app '())))
                               (exit status status)))))
                    " 2>&1 | tee /home/user/errors"))))))
         (simple-service 'gtk-config-service
                         home-xdg-configuration-files-service-type
                         `(("gtk-4.0/settings.ini" ,(mixed-text-file
                                                     "gtk-config"
                                                     "\
[Settings]
gtk-xft-dpi=500000
")))))))

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-19 10:51 ` pelzflorian (Florian Pelz)
@ 2024-09-19 22:20   ` David Pirotte
  2024-09-20 13:08     ` pelzflorian (Florian Pelz)
  0 siblings, 1 reply; 10+ messages in thread
From: David Pirotte @ 2024-09-19 22:20 UTC (permalink / raw)
  To: pelzflorian (Florian Pelz); +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

Hello Florian,

> G-Golf works great.

Excellent! Note that you'll need to update your configuration and
use/grab 0.8.0-rc7 - which fixes a 'missing some distributed files',
necessary to be able to run the newly added

	examples/gtk-4/layout-manager.scm
	[ a g-golf port of the upstream gtk4-demo layout manager
	[ (transition) example

>  Now I can embed GTK programs within the Guix Home
> configurations ...

I am glad that you (finally) can happily use the distro of your dream.
Your config example certainly should help other guixers willing to use
g-golf.

> All that is left is that I do not understand why
> (gdk-display-get-default) returns #f in G-Golf but
> gdk_display_get_default () in C returns 0x1c0e36c0.

You need to have initialized either Gtk or Adw, otherwise it returns #f
(as expected).

	scheme@(guile-user)> ,use (g-golf)
	scheme@(guile-user)> (gi-import-by-name "Gdk" "Display")
	$5 = #<<gobject-class> <gdk-display> 7fee0e488c30>

	scheme@(guile-user)> (gdk-display-get-default)
	$6 = #f

	scheme@(guile-user)> (gi-import-by-name "Gtk" "init")
	$7 = #<<function> 7fee075cb480>
	scheme@(guile-user)> (gtk-init)

	scheme@(guile-user)> (gdk-display-get-default)
	$8 = #<<gdk-wayland-display> 7fee0f054a10>

David

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-18 23:21 ` Greg Troxel
@ 2024-09-19 23:00   ` David Pirotte
  2024-09-20 22:46     ` David Pirotte
  0 siblings, 1 reply; 10+ messages in thread
From: David Pirotte @ 2024-09-19 23:00 UTC (permalink / raw)
  To: Greg Troxel; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 10160 bytes --]

Hello Greg,

> This is an odd version scheme; I would suggest that you instead use
> 0.8.0rc7 next time.

Fwiw, i follow the semantic versioning scheme [1], although starting
with 0.8.0-rc6 and 0.8.0-rc7, i decided to remove the dot in between rc
and the number, because that's what debian does (and that's fine with
me, unlike what you (or your distro) propose).

>   GEN      g-golf/support/color.go
> Backtrace:
> In system/base/compile.scm:
> ...
> ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
> no binding `string-replace-substring' in module (ice-9 string-fun)
> *** [g-golf/support/color.go] Error code 1

Hum, i was not aware it was not in 2.2. sorry about this - I'll think
about the best way to fix this, will let you know

> with guile 3.0.x, it goes much better, with fewer warnings

You should have zero warning, as i have zero warning when building in
debian [2] - but to get an 'immaculate clean' build, i also need to

	rm -rf ~/.cache/guile
	./configure [--prefix=/your/prefix] [--with-guile-site]
	make uninstall 			# if it was installed
	make

	[ otherwise, depending on what changes were made in the source
	[ tree and/or what is in your .cache/guile 'tree', it might
	[ prematurely recompile some modules.

If you still have some warnings running 'the above', let me know, I am
curious and maybe i can fix those as well.

Thanks,
David

[1]

	https://en.wikipedia.org/wiki/Software_versioning

[2]

	[ you do not need to 'git clean dxf', nor ./autogen.sh
	[ when compiling using a tarball extract tree ofc ...

	git clean -dxf
	rm -rf ~/.cache/guile/
	./autogen.sh
	./configure --prefix=/opt3 --with-guile-site
	make uninstall
	make
Making all in libg-golf
make[1]: Entering directory '/usr/alto/projects/gnu/g-golf/git/libg-golf'
  CC       libg_golf_la-gg-const.lo
  CC       libg_golf_la-gg-ffi.lo
  CC       libg_golf_la-gg-utils.lo
  CC       libg_golf_la-gg-glib.lo
  CC       libg_golf_la-gg-gobject.lo
  CC       libg_golf_la-gg-callback.lo
  CC       libg_golf_la-gg-test-suite.lo
  CC       libg_golf_la-g-golf.lo
  CCLD     libg-golf.la
make[1]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/libg-golf'
Making all in test-suite
make[1]: Entering directory '/usr/alto/projects/gnu/g-golf/git/test-suite'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/test-suite'
Making all in doc
make[1]: Entering directory '/usr/alto/projects/gnu/g-golf/git/doc'
Updating ./version.texi
  MAKEINFO g-golf.info
make[1]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/doc'
Making all in examples
make[1]: Entering directory '/usr/alto/projects/gnu/g-golf/git/examples'
Making all in gtk-4
make[2]: Entering directory '/usr/alto/projects/gnu/g-golf/git/examples/gtk-4'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/examples/gtk-4'
Making all in adw-1
make[2]: Entering directory '/usr/alto/projects/gnu/g-golf/git/examples/adw-1'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/examples/adw-1'
make[2]: Entering directory '/usr/alto/projects/gnu/g-golf/git/examples'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/examples'
make[1]: Leaving directory '/usr/alto/projects/gnu/g-golf/git/examples'
make[1]: Entering directory '/usr/alto/projects/gnu/g-golf/git'
  GEN      g-golf/support/libg-golf.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling "/opt3/bin/guild"
;;; compiled "/home/david/.cache/guile/ccache/3.0-LE-8-4.7/opt3/bin/guild.go"
wrote `g-golf/support/libg-golf.go'
  GEN      g-golf/support/const.go
wrote `g-golf/support/const.go'
  GEN      g-golf/support/float.go
wrote `g-golf/support/float.go'
  GEN      g-golf/support/module.go
wrote `g-golf/support/module.go'
  GEN      g-golf/support/goops.go
wrote `g-golf/support/goops.go'
  GEN      g-golf/support/g-export.go
wrote `g-golf/support/g-export.go'
  GEN      g-golf/support/utils.go
wrote `g-golf/support/utils.go'
  GEN      g-golf/support/push.go
wrote `g-golf/support/push.go'
  GEN      g-golf/support/keyword.go
wrote `g-golf/support/keyword.go'
  GEN      g-golf/support/enum.go
wrote `g-golf/support/enum.go'
  GEN      g-golf/support/flags.go
wrote `g-golf/support/flags.go'
  GEN      g-golf/support/struct.go
wrote `g-golf/support/struct.go'
  GEN      g-golf/support/union.go
wrote `g-golf/support/union.go'
  GEN      g-golf/support/bytevector.go
wrote `g-golf/support/bytevector.go'
  GEN      g-golf/support/ffi.go
wrote `g-golf/support/ffi.go'
  GEN      g-golf/support/sxml.go
wrote `g-golf/support/sxml.go'
  GEN      g-golf/support/color.go
wrote `g-golf/support/color.go'
  GEN      g-golf/support.go
wrote `g-golf/support.go'
  GEN      g-golf/init.go
wrote `g-golf/init.go'
  GEN      g-golf/glib/version-information.go
wrote `g-golf/glib/version-information.go'
  GEN      g-golf/glib/mem-alloc.go
wrote `g-golf/glib/mem-alloc.go'
  GEN      g-golf/glib/main-event-loop.go
wrote `g-golf/glib/main-event-loop.go'
  GEN      g-golf/glib/io-channels.go
wrote `g-golf/glib/io-channels.go'
  GEN      g-golf/glib/misc-util-funcs.go
wrote `g-golf/glib/misc-util-funcs.go'
  GEN      g-golf/glib/unix-utils.go
wrote `g-golf/glib/unix-utils.go'
  GEN      g-golf/glib/glist.go
wrote `g-golf/glib/glist.go'
  GEN      g-golf/glib/gslist.go
wrote `g-golf/glib/gslist.go'
  GEN      g-golf/glib/byte-arrays.go
wrote `g-golf/glib/byte-arrays.go'
  GEN      g-golf/glib/quarks.go
wrote `g-golf/glib/quarks.go'
  GEN      g-golf/glib/simple-xml-subset-parser.go
wrote `g-golf/glib/simple-xml-subset-parser.go'
  GEN      g-golf/glib.go
wrote `g-golf/glib.go'
  GEN      g-golf/gobject/type-info.go
wrote `g-golf/gobject/type-info.go'
  GEN      g-golf/gobject/gobject.go
wrote `g-golf/gobject/gobject.go'
  GEN      g-golf/gobject/enum-flags.go
wrote `g-golf/gobject/enum-flags.go'
  GEN      g-golf/gobject/boxed-types.go
wrote `g-golf/gobject/boxed-types.go'
  GEN      g-golf/gobject/generic-values.go
wrote `g-golf/gobject/generic-values.go'
  GEN      g-golf/gobject/params-vals.go
wrote `g-golf/gobject/params-vals.go'
  GEN      g-golf/gobject/param-spec.go
wrote `g-golf/gobject/param-spec.go'
  GEN      g-golf/gobject/closures.go
wrote `g-golf/gobject/closures.go'
  GEN      g-golf/gobject/signals.go
wrote `g-golf/gobject/signals.go'
  GEN      g-golf/gobject.go
wrote `g-golf/gobject.go'
  GEN      g-golf/gi/utils.go
wrote `g-golf/gi/utils.go'
  GEN      g-golf/gi/cache-gi.go
wrote `g-golf/gi/cache-gi.go'
  GEN      g-golf/gi/cache-others.go
wrote `g-golf/gi/cache-others.go'
  GEN      g-golf/gi/repository.go
wrote `g-golf/gi/repository.go'
  GEN      g-golf/gi/typelib.go
wrote `g-golf/gi/typelib.go'
  GEN      g-golf/gi/version.go
wrote `g-golf/gi/version.go'
  GEN      g-golf/gi/common-types.go
wrote `g-golf/gi/common-types.go'
  GEN      g-golf/gi/base-info.go
wrote `g-golf/gi/base-info.go'
  GEN      g-golf/gi/callable-info.go
wrote `g-golf/gi/callable-info.go'
  GEN      g-golf/gi/function-info.go
wrote `g-golf/gi/function-info.go'
  GEN      g-golf/gi/signal-info.go
wrote `g-golf/gi/signal-info.go'
  GEN      g-golf/gi/vfunc-info.go
wrote `g-golf/gi/vfunc-info.go'
  GEN      g-golf/gi/registered-type-info.go
wrote `g-golf/gi/registered-type-info.go'
  GEN      g-golf/gi/enum-info.go
wrote `g-golf/gi/enum-info.go'
  GEN      g-golf/gi/struct-info.go
wrote `g-golf/gi/struct-info.go'
  GEN      g-golf/gi/union-info.go
wrote `g-golf/gi/union-info.go'
  GEN      g-golf/gi/object-info.go
wrote `g-golf/gi/object-info.go'
  GEN      g-golf/gi/interface-info.go
wrote `g-golf/gi/interface-info.go'
  GEN      g-golf/gi/arg-info.go
wrote `g-golf/gi/arg-info.go'
  GEN      g-golf/gi/constant-info.go
wrote `g-golf/gi/constant-info.go'
  GEN      g-golf/gi/field-info.go
wrote `g-golf/gi/field-info.go'
  GEN      g-golf/gi/property-info.go
wrote `g-golf/gi/property-info.go'
  GEN      g-golf/gi/type-info.go
wrote `g-golf/gi/type-info.go'
  GEN      g-golf/gi/gir-ffi.go
wrote `g-golf/gi/gir-ffi.go'
  GEN      g-golf/gi.go
wrote `g-golf/gi.go'
  GEN      g-golf/gdk/events.go
wrote `g-golf/gdk/events.go'
  GEN      g-golf/gdk.go
wrote `g-golf/gdk.go'
  GEN      g-golf/hl-api/n-decl.go
wrote `g-golf/hl-api/n-decl.go'
  GEN      g-golf/hl-api/ccc.go
wrote `g-golf/hl-api/ccc.go'
  GEN      g-golf/hl-api/argument.go
wrote `g-golf/hl-api/argument.go'
  GEN      g-golf/hl-api/gtype.go
wrote `g-golf/hl-api/gtype.go'
  GEN      g-golf/hl-api/gparam.go
wrote `g-golf/hl-api/gparam.go'
  GEN      g-golf/hl-api/iface.go
wrote `g-golf/hl-api/iface.go'
  GEN      g-golf/hl-api/gobject.go
wrote `g-golf/hl-api/gobject.go'
  GEN      g-golf/hl-api/events.go
wrote `g-golf/hl-api/events.go'
  GEN      g-golf/hl-api/callable.go
wrote `g-golf/hl-api/callable.go'
  GEN      g-golf/hl-api/callback.go
wrote `g-golf/hl-api/callback.go'
  GEN      g-golf/hl-api/function.go
wrote `g-golf/hl-api/function.go'
  GEN      g-golf/hl-api/vfunc.go
wrote `g-golf/hl-api/vfunc.go'
  GEN      g-golf/hl-api/object.go
wrote `g-golf/hl-api/object.go'
  GEN      g-golf/hl-api/closure.go
wrote `g-golf/hl-api/closure.go'
  GEN      g-golf/hl-api/signal.go
wrote `g-golf/hl-api/signal.go'
  GEN      g-golf/hl-api/glib.go
wrote `g-golf/hl-api/glib.go'
  GEN      g-golf/hl-api/import.go
wrote `g-golf/hl-api/import.go'
  GEN      g-golf/hl-api/utils.go
wrote `g-golf/hl-api/utils.go'
  GEN      g-golf/hl-api.go
wrote `g-golf/hl-api.go'
  GEN      g-golf/override/override.go
wrote `g-golf/override/override.go'
  GEN      g-golf/override/gdk.go
wrote `g-golf/override/gdk.go'
  GEN      g-golf/override/gtk.go
wrote `g-golf/override/gtk.go'
  GEN      g-golf/override.go
wrote `g-golf/override.go'
  GEN      g-golf.go
wrote `g-golf.go'

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-19 22:20   ` David Pirotte
@ 2024-09-20 13:08     ` pelzflorian (Florian Pelz)
  2024-09-20 21:40       ` David Pirotte
  0 siblings, 1 reply; 10+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-09-20 13:08 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]

David Pirotte <david@altosw.be> writes:
> Excellent! Note that you'll need to update your configuration and
> use/grab 0.8.0-rc7 - which fixes a 'missing some distributed files',
> necessary to be able to run the newly added
>
> 	examples/gtk-4/layout-manager.scm
> 	[ a g-golf port of the upstream gtk4-demo layout manager
> 	[ (transition) example

I see, but since Guix builds G-Golf from git rather than a tarball,
examples/gtk-4/layout-manager.scm had worked already with rc6.

Tarballs contain bundled M4 files and other build-aux files.  Guix
rather uses its own packaged version of these, avoiding something like
the xz vulnerability’s code injection.  Still it is good that you fixed
the tarball.


>>  Now I can embed GTK programs within the Guix Home
>> configurations ...
>
> I am glad that you (finally) can happily use the distro of your dream.
> Your config example certainly should help other guixers willing to use
> g-golf.

:)


>> All that is left is that I do not understand why
>> (gdk-display-get-default) returns #f in G-Golf but
>> gdk_display_get_default () in C returns 0x1c0e36c0.
>
> You need to have initialized either Gtk or Adw, otherwise it returns #f
> (as expected).
>
> 	scheme@(guile-user)> ,use (g-golf)
> 	scheme@(guile-user)> (gi-import-by-name "Gdk" "Display")
> 	$5 = #<<gobject-class> <gdk-display> 7fee0e488c30>
>
> 	scheme@(guile-user)> (gdk-display-get-default)
> 	$6 = #f
>
> 	scheme@(guile-user)> (gi-import-by-name "Gtk" "init")
> 	$7 = #<<function> 7fee075cb480>
> 	scheme@(guile-user)> (gtk-init)
>
> 	scheme@(guile-user)> (gdk-display-get-default)
> 	$8 = #<<gdk-wayland-display> 7fee0f054a10>
>
> David

This helped.  When manually run, missing gtk-init import and use was the
issue; thank you!  Funny enough, when auto-started, gtk-init is run by
GtkApplication or perhaps by some library constructor, but I also had
forgotten to actually call add-css-class.  Still I added gtk-init, so I
can manually run my launcher as well.

In case others use it as reference, the fixed version is attached.

Regards,
Florian


[-- Attachment #2: home-configuration.scm --]
[-- Type: text/plain, Size: 10406 bytes --]

;;; Copyright © 2023, 2024 Florian Pelz <pelzflorian@pelzflorian.de>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; 
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
;; 
;; Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
;; der GNU General Public License, wie von der Free Software Foundation,
;; Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
;; veröffentlichten Version, weiter verteilen und/oder modifizieren.
;; 
;; Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
;; OHNE JEDE GEWÄHR,; sogar ohne die implizite
;; Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
;; Siehe die GNU General Public License für weitere Einzelheiten.
;; 
;; Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
;; Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.

(use-modules (gnu home)
             (gnu home services)
             (gnu home services desktop)
             (gnu home services shells)
             (gnu home services sound)
             (gnu home services sway)
             (gnu packages)
             (gnu packages gtk)
             (gnu packages guile-xyz)
             (gnu services)
             (guix build-system glib-or-gtk)
             (guix gexp)
             (guix licenses)
             (guix packages)
             (guix transformations))

(home-environment
  (packages (specifications->packages (list "git")))
  (services
   (list (service home-bash-service-type)
         (service home-dbus-service-type) ;für VLC
         ;; (service home-pipewire-service-type)
         (service home-sway-service-type
           (sway-configuration
            (execs
             `(,(with-extensions
                 (list graphene gtk
                       ((options->transformation
                         '((with-commit . "guile-g-golf=v0.8.0-rc6")))
                        guile-g-golf))
                 #~(string-append
                    "guile "
                    #$(scheme-file "launcher.scm"
                       #~(begin
                           (eval-when (expand load eval)
                             (use-modules (oop goops))
                             (default-duplicate-binding-handler
                               '(merge-generics replace
                                 warn-override-core warn last))
                             (setenv "GI_TYPELIB_PATH"
                                     #$(file-append
                                        (directory-union
                                         "typelibs"
                                         (list gdk-pixbuf
                                               graphene gtk harfbuzz
                                               pango))
                                        "/lib/girepository-1.0"))
                             (use-modules (g-golf))
                             (g-irepository-require
                              "Gtk" #:version "4.0")
                             (for-each (lambda (name)
                                         (gi-import-by-name "Gtk" name))
                                       '("Application"
                                         "ApplicationWindow"
                                         "Builder"
                                         "CssProvider"
                                         "init")))
                           (use-modules (sxml simple))
                           (gtk-init)
                           (define ui
                             '(interface
                               (requires (@ (version 4.0) (lib gtk)))
                               (object
                                (@ (id window) (class GtkApplicationWindow))
                                (child
                                 (object
                                  (@ (class GtkGrid))
                                  (property (@ (name row-homogeneous)) 1)
                                  (property (@ (name column-homogeneous)) 1)
                                  (child
                                   (object
                                    (@ (id btn-kodi) (class GtkButton))
                                    (property (@ (name label)) Kodi)
                                    (layout
                                     (property (@ (name column)) 0)
                                     (property (@ (name row)) 0))))
                                  (child
                                   (object
                                    (@ (id btn-halt) (class GtkButton))
                                    (property (@ (name label)) Halt)
                                    (layout
                                     (property (@ (name column)) 0)
                                     (property (@ (name row)) 1))))
                                  (child
                                   (object
                                    (@ (id btn-reboot) (class GtkButton))
                                    (property (@ (name label)) Reboot)
                                    (layout
                                     (property (@ (name column)) 1)
                                     (property (@ (name row)) 1))))
                                  (child
                                   (object
                                    (@ (id btn-mount) (class GtkButton))
                                    (property (@ (name label)) Mounten)
                                    (layout
                                     (property (@ (name column)) 1)
                                     (property (@ (name row)) 0)))))))))
                           (define provider
                             (make <gtk-css-provider>))
                           (define (mount-all)
                             (gtk-css-provider-load-from-string provider "\
.reddable label {
  background-color: red;
}
")
                             (unless (= 0 (system "\
sudo /run/privileged/bin/mount \
/dev/disk/by-id/usb-WD_Elements_25A3_574343374B31544434313530-0:0-part1 \
/media/WDElements/"))
                               (gtk-style-context-add-provider-for-display
                                (gdk-display-get-default)
                                provider
                                100)))
                           (define (activate app)
                             (let ((builder (make <gtk-builder>)))
                               (define (get str)
                                 (get-object builder str))
                               (add-from-string builder
                                                (with-output-to-string
                                                  (lambda ()
                                                    (sxml->xml ui)))
                                                -1)
                               (let ((window (get "window"))
                                     (btn-kodi (get "btn-kodi"))
                                     (btn-mount (get "btn-mount"))
                                     (btn-halt (get "btn-halt"))
                                     (btn-reboot (get "btn-reboot")))
                                 (connect btn-kodi 'clicked
                                          (lambda (b)
                                            (gtk-widget-hide window)
                                            (system
                                             (string-append "\
/var/guix/profiles/per-user/florian/current-guix/bin/guix \
shell --container --network --no-cwd flatpak \
--expose=/home/user/.local/share/flatpak/ \
--share=/home/user/you-kodi/.kodi=/home/user/.var/app/tv.kodi.Kodi/data \
--expose=/sys \
--preserve='^DBUS_.*' \
--share=/media/WDElements \
--expose=/dev/dri --expose=" "/run/user/1001";(getenv "XDG_RUNTIME_DIR")
"/bus=/var/run/dbus/system_bus_socket --expose=/dev/dri --expose=/dev/snd \
--preserve='^DISPLAY$' -- flatpak run -v tv.kodi.Kodi --audio-backend=alsa"))
                                            (present window)))
                                 (connect btn-mount 'clicked
                                          (lambda (b)
                                            (mount-all)))
                                 (add-css-class btn-mount "reddable")
                                 (connect btn-halt 'clicked
                                          (lambda (b)
                                            (system "\
sudo /run/current-system/profile/sbin/halt")))
                                 (connect btn-reboot 'clicked
                                          (lambda (b)
                                            (system "\
sudo /run/current-system/profile/sbin/reboot")))
                                 (add-window app window)
                                 (present window))))
                           (let ((app (make <gtk-application>
                                        #:application-id "my.launcher")))
                             (mount-all)
                             (connect app 'activate activate)
                             (let ((status (g-application-run app '())))
                               (exit status status)))))
                    " 2>&1 | tee /home/user/errors"))))))
         (simple-service 'gtk-config-service
                         home-xdg-configuration-files-service-type
                         `(("gtk-4.0/settings.ini" ,(mixed-text-file
                                                     "gtk-config"
                                                     "\
[Settings]
gtk-xft-dpi=500000
")))))))

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-20 13:08     ` pelzflorian (Florian Pelz)
@ 2024-09-20 21:40       ` David Pirotte
  2024-09-23  7:27         ` pelzflorian (Florian Pelz)
  0 siblings, 1 reply; 10+ messages in thread
From: David Pirotte @ 2024-09-20 21:40 UTC (permalink / raw)
  To: pelzflorian (Florian Pelz); +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 1037 bytes --]

Hi Florian,

> ...
> I see, but since Guix builds G-Golf from git rather than a tarball,
> examples/gtk-4/layout-manager.scm had worked already with rc6.
> ...

Ah right -

> ...
> Funny enough, when auto-started, gtk-init is run by GtkApplication

Yes, either GtkApplication or AdwApplication, as part of the default
startup signal handler:

	https://docs.gtk.org/gtk4/initialization.html
	https://docs.gtk.org/gtk4/func.init.html	
	https://docs.gtk.org/gtk4/class.Application.html
	https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Application.html

I recommend you (and g-golf users) to carefully read at least the
GObject tutorial and then the upstream doc entries of the objects,
properties, functions, methods and virtual methods you are using in
your own g-golf based app [1].

David

[1] and also look at (and study from) the distributed examples g-golf
provides, where that applies ... room for improvment(s) (constructive
critics welcome), sure, but they are quite good i should say.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-19 23:00   ` David Pirotte
@ 2024-09-20 22:46     ` David Pirotte
  0 siblings, 0 replies; 10+ messages in thread
From: David Pirotte @ 2024-09-20 22:46 UTC (permalink / raw)
  To: Greg Troxel; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

Hello Greg,

> > ...
> >   GEN      g-golf/support/color.go
> > Backtrace:
> > In system/base/compile.scm:
> > ...
> > ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
> > no binding `string-replace-substring' in module (ice-9 string-fun)
> > *** [g-golf/support/color.go] Error code 1  
> 
> Hum, i was not aware it was not in 2.2. sorry about this - I'll think
> about the best way to fix this, will let you know

I fixed this problem by snarfing a copy -  see
03f4fd6b27bb2cf68633d106bc2cec3652ad2734 - currently in the devel
branch, but it will be part the next release ofc

Can you 'locally grab and apply' this patch? I'd rather wait for some
other changes before to run the next release ...

David

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: GNU G-Golf 0.8.0-rc6 available for testing
  2024-09-20 21:40       ` David Pirotte
@ 2024-09-23  7:27         ` pelzflorian (Florian Pelz)
  0 siblings, 0 replies; 10+ messages in thread
From: pelzflorian (Florian Pelz) @ 2024-09-23  7:27 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

David Pirotte <david@altosw.be> writes:
> I recommend you (and g-golf users) to carefully read at least the
> GObject tutorial and then the upstream doc entries of the objects,
> properties, functions, methods and virtual methods you are using in
> your own g-golf based app [1].

You are giving good recommendations.  My sequence

1. (make <gtk-application>)
2. use (gdk-display-get-default)
3. start the gtk-application

was just plain wrong.  In my last e-mail, I misinterpreted and thought
it worked in some cases, but in reality it never did.

In my C version, I had used gdk_display_get_default in a signal
connected to and run after GtkApplication::startup, which would have
been the right way to go.

If others use it for reference, attached is the version that follows the
conventions of the GtkApplication docs.


> [1] and also look at (and study from) the distributed examples g-golf
> provides, where that applies ... room for improvment(s) (constructive
> critics welcome), sure, but they are quite good i should say.

Your examples are good.  My app’s

(gtk-style-context-add-provider-for-display
 (gdk-display-get-default)
 provider
 100)))

looks less styley than G-Golf examples/gtk-4/css-basics.scm’s

(add-provider (get-style-context widget) provider #xFFFFFFFF)

But anyway.

Regards,
Florian

[-- Attachment #2: home-configuration.scm --]
[-- Type: text/plain, Size: 10464 bytes --]

;;; Copyright © 2023, 2024 Florian Pelz <pelzflorian@pelzflorian.de>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; 
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
;; 
;; Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
;; der GNU General Public License, wie von der Free Software Foundation,
;; Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
;; veröffentlichten Version, weiter verteilen und/oder modifizieren.
;; 
;; Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
;; OHNE JEDE GEWÄHR,; sogar ohne die implizite
;; Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
;; Siehe die GNU General Public License für weitere Einzelheiten.
;; 
;; Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
;; Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.

(use-modules (gnu home)
             (gnu home services)
             (gnu home services desktop)
             (gnu home services shells)
             (gnu home services sound)
             (gnu home services sway)
             (gnu packages)
             (gnu packages gtk)
             (gnu packages guile-xyz)
             (gnu services)
             (guix build-system glib-or-gtk)
             (guix gexp)
             (guix licenses)
             (guix packages)
             (guix transformations))

(home-environment
  (packages (specifications->packages (list "git")))
  (services
   (list (service home-bash-service-type)
         (service home-dbus-service-type) ;für VLC
         ;; (service home-pipewire-service-type)
         (service home-sway-service-type
           (sway-configuration
            (execs
             `(,(with-extensions
                 (list graphene gtk
                       ((options->transformation
                         '((with-commit . "guile-g-golf=v0.8.0-rc6")))
                        guile-g-golf))
                 #~(string-append
                    "guile "
                    #$(scheme-file "launcher.scm"
                       #~(begin
                           (eval-when (expand load eval)
                             (use-modules (oop goops))
                             (default-duplicate-binding-handler
                               '(merge-generics replace
                                 warn-override-core warn last))
                             (setenv "GI_TYPELIB_PATH"
                                     #$(file-append
                                        (directory-union
                                         "typelibs"
                                         (list gdk-pixbuf
                                               graphene gtk harfbuzz
                                               pango))
                                        "/lib/girepository-1.0"))
                             (use-modules (g-golf))
                             (g-irepository-require
                              "Gtk" #:version "4.0")
                             (for-each (lambda (name)
                                         (gi-import-by-name "Gtk" name))
                                       '("Application"
                                         "ApplicationWindow"
                                         "Builder"
                                         "CssProvider")))
                           (use-modules (sxml simple))
                           (define ui
                             '(interface
                               (requires (@ (version 4.0) (lib gtk)))
                               (object
                                (@ (id window) (class GtkApplicationWindow))
                                (child
                                 (object
                                  (@ (class GtkGrid))
                                  (property (@ (name row-homogeneous)) 1)
                                  (property (@ (name column-homogeneous)) 1)
                                  (child
                                   (object
                                    (@ (id btn-kodi) (class GtkButton))
                                    (property (@ (name label)) Kodi)
                                    (layout
                                     (property (@ (name column)) 0)
                                     (property (@ (name row)) 0))))
                                  (child
                                   (object
                                    (@ (id btn-halt) (class GtkButton))
                                    (property (@ (name label)) Halt)
                                    (layout
                                     (property (@ (name column)) 0)
                                     (property (@ (name row)) 1))))
                                  (child
                                   (object
                                    (@ (id btn-reboot) (class GtkButton))
                                    (property (@ (name label)) Reboot)
                                    (layout
                                     (property (@ (name column)) 1)
                                     (property (@ (name row)) 1))))
                                  (child
                                   (object
                                    (@ (id btn-mount) (class GtkButton))
                                    (property (@ (name label)) Mounten)
                                    (layout
                                     (property (@ (name column)) 1)
                                     (property (@ (name row)) 0)))))))))
                           (define provider
                             (make <gtk-css-provider>))
                           (define (mount-all)
                             (gtk-css-provider-load-from-string provider "\
.reddable label {
  background-color: red;
}
")
                             (unless (= 0 (system "\
sudo /run/privileged/bin/mount \
/dev/disk/by-id/usb-WD_Elements_25A3_574343374B31544434313530-0:0-part1 \
/media/WDElements/"))
                               (gtk-style-context-add-provider-for-display
                                (gdk-display-get-default)
                                provider
                                100)))
                           (define (activate app)
                             (let ((builder (make <gtk-builder>)))
                               (define (get str)
                                 (get-object builder str))
                               (add-from-string builder
                                                (with-output-to-string
                                                  (lambda ()
                                                    (sxml->xml ui)))
                                                -1)
                               (let ((window (get "window"))
                                     (btn-kodi (get "btn-kodi"))
                                     (btn-mount (get "btn-mount"))
                                     (btn-halt (get "btn-halt"))
                                     (btn-reboot (get "btn-reboot")))
                                 (connect btn-kodi 'clicked
                                          (lambda (b)
                                            (gtk-widget-hide window)
                                            (system
                                             (string-append "\
/var/guix/profiles/per-user/florian/current-guix/bin/guix \
shell --container --network --no-cwd flatpak \
--expose=/home/helle/.local/share/flatpak/ \
--share=/home/helle/you-kodi/.kodi=/home/helle/.var/app/tv.kodi.Kodi/data \
--expose=/sys \
--preserve='^DBUS_.*' \
--share=/media/WDElements --share=/media/fritznas \
--expose=/dev/dri --expose=" "/run/user/1001";(getenv "XDG_RUNTIME_DIR")
"/bus=/var/run/dbus/system_bus_socket --expose=/dev/dri --expose=/dev/snd \
--preserve='^DISPLAY$' -- flatpak run -v tv.kodi.Kodi --audio-backend=alsa"))
                                            (present window)))
                                 (connect btn-mount 'clicked
                                          (lambda (b)
                                            (mount-all)))
                                 (add-css-class btn-mount "reddable")
                                 (connect btn-halt 'clicked
                                          (lambda (b)
                                            (system "\
sudo /run/current-system/profile/sbin/halt")))
                                 (connect btn-reboot 'clicked
                                          (lambda (b)
                                            (system "\
sudo /run/current-system/profile/sbin/reboot")))
                                 (add-window app window)
                                 (present window))))
                           (let ((app (make <gtk-application>
                                        #:application-id "my.launcher")))
                             (connect app 'startup
                                      (lambda (app)
                                        (mount-all)))
                             (connect app 'activate activate)
                             (let ((status (g-application-run app '())))
                               (exit status status)))))
                    " 2>&1 | tee /home/helle/errors"))))))
         (simple-service 'gtk-config-service
                         home-xdg-configuration-files-service-type
                         `(("gtk-4.0/settings.ini" ,(mixed-text-file
                                                     "gtk-config"
                                                     "\
[Settings]
gtk-xft-dpi=500000
")))))))

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-09-23  7:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18  2:49 GNU G-Golf 0.8.0-rc6 available for testing David Pirotte
2024-09-18 22:39 ` David Pirotte
2024-09-18 23:21 ` Greg Troxel
2024-09-19 23:00   ` David Pirotte
2024-09-20 22:46     ` David Pirotte
2024-09-19 10:51 ` pelzflorian (Florian Pelz)
2024-09-19 22:20   ` David Pirotte
2024-09-20 13:08     ` pelzflorian (Florian Pelz)
2024-09-20 21:40       ` David Pirotte
2024-09-23  7:27         ` pelzflorian (Florian Pelz)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).