diff options
author | David Pirotte <david@altosw.be> | 2023-10-07 00:07:27 -0300 |
---|---|---|
committer | David Pirotte <david@altosw.be> | 2023-10-07 00:07:27 -0300 |
commit | 4e783116c0641ee4443b42cb16a09d9bac1c83ca (patch) | |
tree | 4f1897d26aa81c7e25b64475eb3bd5116255b56b | |
parent | e2ee88590d32b7b6418516581fdb9b82c383abee (diff) | |
parent | ab6e777e3db53be4259e35107467112f79ac71db (diff) |
Prepare 0.8.0-rc-1v0.8.0-rc-1
* Merge branch 'devel'.
33 files changed, 2264 insertions, 50 deletions
@@ -69,8 +69,8 @@ Adw-1 examples: G-Golf release are [[http://ftp.gnu.org/gnu/g-golf/][here]]. The latest tarballs are: - g-golf-0.8.0-alpha-6.tar.gz - g-golf-0.8.0-alpha-6.tar.gz.sig + g-golf-0.8.0-rc-1.tar.gz + g-golf-0.8.0-rc-1.tar.gz.sig [ GPG Key: A3057AD7 [ gpg --keyserver keys.gnupg.net --recv-keys A3057AD7 @@ -79,8 +79,8 @@ Assuming you have satisfied the dependencies, open a terminal and proceed with the following steps: cd <download-path> - tar zxf g-golf-0.8.0-alpha-6.tar.gz - cd g-golf-0.8.0-alpha-6 + tar zxf g-golf-0.8.0-rc-1.tar.gz + cd g-golf-0.8.0-rc-1 ./configure [--prefix=/your/prefix] [--with-guile-site=yes] make make install diff --git a/Makefile.am b/Makefile.am index 835c2e9..b834e04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,6 +29,7 @@ pkgconfig_DATA=meta/g-golf-1.0.pc SOURCES = \ g-golf/support/libg-golf.scm \ + g-golf/support/const.scm \ g-golf/support/float.scm \ g-golf/support/module.scm \ g-golf/support/goops.scm \ @@ -26,6 +26,35 @@ warranty. * Latest News +** October 2023 + +[[http://www.gnu.org/software/g-golf][GNU G-Golf]] version 0.8.0-rc-1 is released. + +This is the first release candidate of the upcoming 0.8.0 release, now +available for testing. + +*** Noteworthy changes in 0.8.0-rc-1 + +Here is a summary of the noteworthy changes in this release. See G-Golf +[[http://git.savannah.gnu.org/cgit/g-golf.git][git summary]] and [[http://git.savannah.gnu.org/cgit/g-golf.git/log/][git log]] for a complete list and description. + +**** New features + +Derived class +GObject properties + +Derived classes slot exposed as a gobject property now also support the +boolean, uint, float, double, flags, string, param and boxed types. + +**** Examples + +Adwaita Demo + +The 'Style Classes' page has been added to the demo. + + +* Older News + ** September 2023 [[http://www.gnu.org/software/g-golf][GNU G-Golf]] version 0.8.0-alpha-6 is released. @@ -94,8 +123,6 @@ signal-connect Now return the handler-id, needed to call disconnect. -* Older News - ** August 2023 [[http://www.gnu.org/software/g-golf][GNU G-Golf]] version 0.8.0-a.5 is released. @@ -81,9 +81,9 @@ points to its source code, in the G-Golf sources [[http://git.savannah.gnu.org/c ** Latest News -September 2023 +October 2023 -GNU G-Golf version 0.8.0-alpha-6 is released. +GNU G-Golf version 0.8.0-rc-1 released. Visit the NEWS file or see the [[http://git.savannah.gnu.org/cgit/g-golf.git/tree/NEWS][News]] page for the list of visible changes in this release, as well as older news. diff --git a/configure.ac b/configure.ac index f1d0ca5..d6ee148 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_PREREQ(2.69) AC_INIT( [g-golf], - [0.8.0-alpha-6], + [0.8.0-rc-1], [bug-g-golf@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/doc/cr-gobject-params-vals.texi b/doc/cr-gobject-params-vals.texi index 2fa361e..3e055e6 100644 --- a/doc/cr-gobject-params-vals.texi +++ b/doc/cr-gobject-params-vals.texi @@ -20,26 +20,34 @@ Parameters and Values — Standard Parameter and Value Types @item @ref{g-value-type-name} @item @ref{g-value-ref} @item @ref{g-value-set!} +@item @ref{g-param-spec-boolean} @item @ref{g-value-get-boolean} @item @ref{g-value-set-boolean} @item @ref{g-param-spec-int} @item @ref{g-value-get-int} @item @ref{g-value-set-int} +@item @ref{g-param-spec-uint} @item @ref{g-value-get-uint} @item @ref{g-value-set-uint} +@item @ref{g-param-spec-float} @item @ref{g-value-get-float} @item @ref{g-value-set-float} +@item @ref{g-param-spec-double} @item @ref{g-value-get-double} @item @ref{g-value-set-double} @item @ref{g-param-spec-enum} @item @ref{g-value-get-enum} @item @ref{g-value-set-enum} +@item @ref{g-param-spec-flags} @item @ref{g-value-get-flags} @item @ref{g-value-set-flags} +@item @ref{g-param-spec-string} @item @ref{g-value-get-string} @item @ref{g-value-set-string} +@item @ref{g-param-spec-param} @item @ref{g-value-get-param} @item @ref{g-value-set-param} +@item @ref{g-param-spec-boxed} @item @ref{g-value-get-boxed} @item @ref{g-value-set-boxed} @item @ref{g-value-get-pointer} @@ -147,6 +155,21 @@ otherwise it will most likely lead to a crash. @end deffn +@anchor{g-param-spec-boolean} +@deffn Procedure g-param-spec-boolean name nick blurb @ + default flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecBoolean} instance +specifying a @code{G_TYPE_BOOLEAN} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{default} the +default value and @var{flags} the flags - for the property specified. +@end deffn + + @anchor{g-value-get-boolean} @deffn Procedure g-value-get-boolean g-value @@ -173,7 +196,7 @@ Sets the content of @var{g-value} to @code{0} if @var{val} is Returns a pointer. -Creates and returns a pointer to a new @code{GParamSpecEnum} instance +Creates and returns a pointer to a new @code{GParamSpecInt} instance specifying a @code{G_TYPE_INT} property. The @var{name} is the canonical name of the property specified, @@ -201,6 +224,22 @@ Sets the content of @var{g-value} to @var{int}. @end deffn +@anchor{g-param-spec-uint} +@deffn Procedure g-param-spec-uint name nick blurb @ + minimum maximum default flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecUInt} instance +specifying a @code{G_TYPE_UINT} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{minimum} the +minimum value, @var{maximum} the maximum value, @var{default} the +default value and @var{flags} the flags - for the property specified. +@end deffn + + @anchor{g-value-get-uint} @deffn Procedure g-value-get-uint g-value @@ -219,6 +258,22 @@ Sets the content of @var{g-value} to @var{uint}. @end deffn +@anchor{g-param-spec-float} +@deffn Procedure g-param-spec-float name nick blurb @ + minimum maximum default flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecFloat} instance +specifying a @code{G_TYPE_FLOAT} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{minimum} the +minimum value, @var{maximum} the maximum value, @var{default} the +default value and @var{flags} the flags - for the property specified. +@end deffn + + @anchor{g-value-get-float} @deffn Procedure g-value-get-float g-value @@ -237,6 +292,22 @@ Sets the content of @var{g-value} to @var{float}. @end deffn +@anchor{g-param-spec-double} +@deffn Procedure g-param-spec-double name nick blurb @ + minimum maximum default flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecDouble} instance +specifying a @code{G_TYPE_DOUBLE} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{minimum} the +minimum value, @var{maximum} the maximum value, @var{default} the +default value and @var{flags} the flags - for the property specified. +@end deffn + + @anchor{g-value-get-double} @deffn Procedure g-value-get-double g-value @@ -294,6 +365,22 @@ info for @var{g-value}), otherwise an exception is raised. @end deffn +@anchor{g-param-spec-flags} +@deffn Procedure g-param-spec-flags name nick blurb type @ + default flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecFlags} instance +specifying a @code{G_TYPE_FLAGS} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{type} a +@code{<gi-flags>} instance, @var{default} the default value and +@var{flags} the flags - for the property specified. +@end deffn + + @anchor{g-value-get-flags} @deffn Procedure g-value-get-flags g-value @@ -317,6 +404,21 @@ being a valid member of the (registered) gi-flags type for @end deffn +@anchor{g-param-spec-string} +@deffn Procedure g-param-spec-string name nick blurb @ + default flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecString} instance +specifying a @code{G_TYPE_STRING} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{default} the +default value and @var{flags} the flags - for the property specified. +@end deffn + + @anchor{g-value-get-string} @deffn Procedure g-value-get-string g-value @@ -336,6 +438,22 @@ Sets the content of @var{g-value} to @var{str}. @end deffn +@anchor{g-param-spec-param} +@deffn Procedure g-param-spec-param name nick blurb @ + type flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecParam} instance +specifying a @code{G_TYPE_PARAM} property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{type} a +GType derived from @code{G_TYPE_PARAM} and @var{flags} the flags - for +the property specified. +@end deffn + + @anchor{g-value-get-param} @deffn Procedure g-value-get-param g-value @@ -356,6 +474,22 @@ Sets the content of @var{g-value} to @var{param}. @end deffn +@anchor{g-param-spec-boxed} +@deffn Procedure g-param-spec-boxed name nick blurb @ + type flags + +Returns a pointer. + +Creates and returns a pointer to a new @code{GParamSpecBoxed} instance +specifying a @code{G_TYPE_BOXED} derived property. + +The @var{name} is the canonical name of the property specified, +@var{nick} its nick name, @var{blurb} its description, @var{type} a +GType derived from @code{G_TYPE_BOXED} and @var{flags} the flags - for +the property specified. +@end deffn + + @anchor{g-value-get-boxed} @deffn Procedure g-value-get-boxed g-value diff --git a/examples/adw-1/adw1-demo-3.png b/examples/adw-1/adw1-demo-3.png Binary files differnew file mode 100644 index 0000000..ff2e289 --- /dev/null +++ b/examples/adw-1/adw1-demo-3.png diff --git a/examples/adw-1/adw1-demo-4.png b/examples/adw-1/adw1-demo-4.png Binary files differnew file mode 100644 index 0000000..f8bd939 --- /dev/null +++ b/examples/adw-1/adw1-demo-4.png diff --git a/examples/adw-1/adw1-demo/style-dark.css b/examples/adw-1/adw1-demo/css/style-dark.css index 4aebb20..4aebb20 100644 --- a/examples/adw-1/adw1-demo/style-dark.css +++ b/examples/adw-1/adw1-demo/css/style-dark.css diff --git a/examples/adw-1/adw1-demo/style.css b/examples/adw-1/adw1-demo/css/style.css index 6f4e5d0..6f4e5d0 100644 --- a/examples/adw-1/adw1-demo/style.css +++ b/examples/adw-1/adw1-demo/css/style.css diff --git a/examples/adw-1/adw1-demo/style-classes-demo-window.scm b/examples/adw-1/adw1-demo/style-classes-demo-window.scm new file mode 100644 index 0000000..f85a6ab --- /dev/null +++ b/examples/adw-1/adw1-demo/style-classes-demo-window.scm @@ -0,0 +1,137 @@ +;; -*- mode: scheme; coding: utf-8 -*- + +;;;; +;;;; Copyright (C) 2023 +;;;; Free Software Foundation, Inc. + +;;;; This file is part of GNU G-Golf + +;;;; GNU G-Golf is free software; you can redistribute it and/or modify +;;;; it under the terms of the GNU Lesser General Public License as +;;;; published by the Free Software Foundation; either version 3 of the +;;;; License, or (at your option) any later version. + +;;;; GNU G-Golf 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 +;;;; Lesser General Public License for more details. + +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with GNU G-Golf. If not, see +;;;; <https://www.gnu.org/licenses/lgpl.html>. +;;;; + +;;; Commentary: + +;;; Code: + + +(define-module (adw1-demo style-classes-demo-window) + #:use-module (oop goops) + #:use-module (g-golf) + + #:duplicates (merge-generics + replace + warn-override-core + warn + last) + + #:export (<adw-style-classes-demo-window>)) + + +(g-export !devel + !status-pages-window + !status-pages-action-row + !sidebar-window + !sidebar-action-row + !sidebar-split-view + !sidebar-list + !devel-switch-row) + + +(eval-when (expand load eval) + (g-irepository-require "Adw" #:version "1") + (for-each (lambda (name) + (gi-import-by-name "Adw" name)) + '("Window" + "NavigationSplitView" + "ActionRow" + "SwitchRow"))) + + +(define-class <adw-style-classes-demo-window> (<adw-window>) + ;; slots + (devel #:g-param '(boolean + #:default #f) + #:accessor !devel) + (progress-bar #:child-id "progress-bar" + #:accessor !progress-bar) + (status-pages-window #:child-id "status-pages-window" + #:accessor !status-pages-window) + (status-pages-action-row #:child-id "status-pages-action-row" + #:accessor !status-pages-action-row) + (sidebar-window #:child-id "sidebar-window" + #:accessor !sidebar-window) + (sidebar-action-row #:child-id "sidebar-action-row" + #:accessor !sidebar-action-row) + (sidebar-split-view #:child-id "sidebar-split-view" + #:accessor !sidebar-split-view) + (sidebar-list #:child-id "sidebar-list" + #:accessor !sidebar-list) + (devel-switch-row #:child-id "devel-switch-row" + #:accessor !devel-switch-row) + (progress-bar-switch-row #:child-id "progress-bar-switch-row" + #:accessor !progress-bar-switch-row) + ;; class options + #:template (string-append (dirname (current-filename)) + "/ui/style-classes-demo-window.ui") + #:child-ids '("progress-bar" + "status-pages-window" + "status-pages-action-row" + "sidebar-window" + "sidebar-action-row" + "sidebar-split-view" + "sidebar-list" + "devel-switch-row" + "progress-bar-switch-row")) + + +(define-method (initialize (self <adw-style-classes-demo-window>) initargs) + (next-method) + + (bind-property (!progress-bar self) + "visible" + (!progress-bar-switch-row self) + "active" + '(sync-create bidirectional)) + + (connect (!status-pages-action-row self) + 'activated + (lambda (r) + (present (!status-pages-window self)))) + + (connect (!sidebar-action-row self) + 'activated + (lambda (r) + (present (!sidebar-window self)))) + + (connect (!sidebar-list self) + 'row-activated + (lambda (list-box row) + (set-show-content (!sidebar-split-view self) #t))) + + (connect (!devel-switch-row self) + 'notify::active + (lambda (switch-row p-spec) + (notify-devel-switch-row-cb self switch-row)))) + +(define (notify-devel-switch-row-cb window switch-row) + (let ((devel (!active switch-row))) + (if devel + (begin + (add-css-class window "devel") + (add-css-class (!status-pages-window window) "devel")) + (begin + (remove-css-class window "devel") + (remove-css-class (!status-pages-window window) "devel"))) + (set! (!devel window) devel))) diff --git a/examples/adw-1/adw1-demo/style-classes.scm b/examples/adw-1/adw1-demo/style-classes.scm new file mode 100644 index 0000000..da33eb3 --- /dev/null +++ b/examples/adw-1/adw1-demo/style-classes.scm @@ -0,0 +1,78 @@ +;; -*- mode: scheme; coding: utf-8 -*- + +;;;; +;;;; Copyright (C) 2023 +;;;; Free Software Foundation, Inc. + +;;;; This file is part of GNU G-Golf + +;;;; GNU G-Golf is free software; you can redistribute it and/or modify +;;;; it under the terms of the GNU Lesser General Public License as +;;;; published by the Free Software Foundation; either version 3 of the +;;;; License, or (at your option) any later version. + +;;;; GNU G-Golf 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 +;;;; Lesser General Public License for more details. + +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with GNU G-Golf. If not, see +;;;; <https://www.gnu.org/licenses/lgpl.html>. +;;;; + +;;; Commentary: + +;;; Code: + + +(define-module (adw1-demo style-classes) + #:use-module (oop goops) + #:use-module (g-golf) + #:use-module (adw1-demo style-classes-demo-window) + + #:duplicates (merge-generics + replace + warn-override-core + warn + last) + + #:export (<adw-demo-page-style-classes>)) + + +#;(g-export ) + + +(eval-when (expand load eval) + (g-irepository-require "Gtk" #:version "4.0") + (for-each (lambda (name) + (gi-import-by-name "Gtk" name)) + '("Root" + "Button")) + (g-irepository-require "Adw" #:version "1") + (for-each (lambda (name) + (gi-import-by-name "Adw" name)) + '("Bin"))) + + +(define-class <adw-demo-page-style-classes> (<adw-bin>) + ;; slots + (style-classes-button #:child-id "style-classes-button" + #:accessor !style-classes-button) + ;; class options + #:template (string-append (dirname (current-filename)) + "/ui/style-classes.ui") + #:child-ids '("style-classes-button")) + + +(define-method (initialize (self <adw-demo-page-style-classes>) initargs) + (next-method) + + (connect (!style-classes-button self) + "clicked" + (lambda (b) + (let ((adw-style-classes-demo-window + (make <adw-style-classes-demo-window>))) + (set-transient-for adw-style-classes-demo-window + (get-root self)) + (present adw-style-classes-demo-window))))) diff --git a/examples/adw-1/adw1-demo/ui/style-classes-demo-window.scm b/examples/adw-1/adw1-demo/ui/style-classes-demo-window.scm new file mode 100644 index 0000000..ad225e4 --- /dev/null +++ b/examples/adw-1/adw1-demo/ui/style-classes-demo-window.scm @@ -0,0 +1,1114 @@ +;; -*- mode: sxml-ui; coding: utf-8 -*- + +;;;; +;;;; Copyright (C) 2023 +;;;; Free Software Foundation, Inc. + +;;;; This file is part of GNU G-Golf + +;;;; GNU G-Golf is free software; you can redistribute it and/or modify +;;;; it under the terms of the GNU Lesser General Public License as +;;;; published by the Free Software Foundation; either version 3 of the +;;;; License, or (at your option) any later version. + +;;;; GNU G-Golf 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 +;;;; Lesser General Public License for more details. + +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with GNU G-Golf. If not, see +;;;; <https://www.gnu.org/licenses/lgpl.html>. +;;;; + +;;; Commentary: + +;;; Code: + + +(use-modules (g-golf support sxml)) + + +(define %demo-menu + '(menu (@ (id "demo-menu")) + (section + (item + (attribute (@ (name "label") + (translatable "yes")) "Item 1") + (attribute (@ (name "action")) style.dummy)) + (item + (attribute (@ (name "label") + (translatable "yes")) "Item 2") + (attribute (@ (name "action")) style.dummy)) + (item + (attribute (@ (name "label") + (translatable "yes")) "Item 3") + (attribute (@ (name "action")) style.dummy))))) + + +(define %status-pages-sidebar + '(property (@ (name "sidebar")) + (object (@ (class "AdwStatusPage")) + (property (@ (name "icon-name")) org.gnome.Adwaita1.Demo-symbolic) + (property (@ (name "title") + (translatable "yes")) Compact) + (property (@ (name "description") + (translatable "yes")) "This status page has the \"compact\" style class.") + (property (@ (name "tooltip-text")) compact) + (style (class (@ (name "compact")))) + (property (@ (name "child")) + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Buttom) + (property (@ (name "halign")) center) + (style (class (@ (name "pill"))))))))) + +(define %status-pages-content + '(property (@ (name "content")) + (object (@ (class "AdwStatusPage")) + (property (@ (name "hexpand")) True) + (property (@ (name "icon-name")) org.gnome.Adwaita1.Demo-symbolic) + (property (@ (name "title") + (translatable "yes")) Regular) + (property (@ (name "description") + (translatable "yes")) "This is a regular status pag.") + (property (@ (name "child")) + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Buttom) + (property (@ (name "halign")) center) + (style (class (@ (name "pill"))))))))) + +(define %status-pages + `(object (@ (class "AdwWindow") + (id "status-pages-window")) + (property (@ (name "modal")) True) + (property (@ (name "transient-for")) AdwStyleClassesDemoWindow) + (property (@ (name "title") + (translatable "yes")) "Status Pages") + (property (@ (name "hide-on-close")) True) + (property (@ (name "default-width")) 640) + (property (@ (name "default-height")) 480) + (property (@ (name "width-request")) 360) + (property (@ (name "height-request")) 200) + (child + (object (@ (class "GtkShortcutController")) + (property (@ (name "scope")) managed) + (child + (object (@ (class "GtkShortcut")) + (property (@ (name "trigger")) Escape) + (property (@ (name "action")) "action(window.close)"))))) + (property (@ (name "content")) + (object (@ (class "AdwToolbarView")) + (property (@ (name "top-bar-style")) raised) + (child (@ (type "top")) + (object (@ (class "GtkHeaderBar")) + (child + (object (@ (class "GtkToggleButton") + (id "compact-toggle-button")) + (property (@ (name "icon-name")) view-sidebar-start) + (property (@ (name "active") + (bind-source "compact-split-view") + (bind-property "show-sidebar") + (bind-flags "sync-create|bidirectional"))))))) + (property (@ (name "content")) + (object (@ (class "AdwOverlaySplitView") + (id "compact-split-view")) + ,%status-pages-sidebar + ,%status-pages-content)))) + (child + (object (@ (class "AdwBreakpoint")) + (condition "max-width: 450sp") + (setter (@ (object "compact-split-view") + (property "collapsed")) True) + (setter (@ (object "compact-toggle-button") + (property "visible")) True))))) + +(define %sidebar-sidebar + '(property (@ (name "sidebar")) + (object (@ (class "AdwNavigationPage")) + ;; libadwaita-1-0:amd64 1.4~rc-1 complains if none, despite + ;; its AdwHeaderBar show-title property set to false ... + (property (@ (name "title")) "Bluefox") ;; fake title + (property (@ (name "child")) + (object (@ (class "AdwToolbarView")) + (child (@ (type "top")) + (object (@ (class "AdwHeaderBar")) + (property (@ (name "show-title")) False))) + (child + (object (@ (class "GtkScrolledWindow")) + (property (@ (name "hscrollbar-policy")) never) + (property (@ (name "child")) + (object (@ (class "GtkListBox") + (id "sidebar-list")) + (property (@ (name "tooltip-text")) navigation-sidebar) + (property (@ (name "selection-mode")) browse) + ;; signal - row-activated - sidebar-forward-cb - swapped + (style (class (@ (name "navigation-sidebar")))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Item 1") + (property (@ (name "ellipsize")) end) + (property (@ (name "xalign")) 0))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Item 2") + (property (@ (name "ellipsize")) end) + (property (@ (name "xalign")) 0))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Item 3") + (property (@ (name "ellipsize")) end) + (property (@ (name "xalign")) 0))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Item 4") + (property (@ (name "ellipsize")) end) + (property (@ (name "xalign")) 0))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Item 5") + (property (@ (name "ellipsize")) end) + (property (@ (name "xalign")) 0)))))))))))) + +(define %sidebar-content + '(property (@ (name "content")) + (object (@ (class "AdwNavigationPage")) + (property (@ (name "title") + (translatable "yes")) Sidebar) + (property (@ (name "tag")) content) + (property (@ (name "child")) + (object (@ (class "AdwToolbarView")) + (child (@ (type "top")) + (object (@ (class "AdwHeaderBar")))) + (child + (object (@ (class "AdwStatusPage")) + (property (@ (name "title") + (translatable "yes")) Sidebar) + (property (@ (name "description") + (translatable "yes")) "\"navigation-sidebar\" style class on GtkListBox or GtkListView.")))))))) + +(define %sidebar + `(object (@ (class "AdwWindow") + (id "sidebar-window")) + (property (@ (name "modal")) True) + (property (@ (name "transient-for")) AdwStyleClassesDemoWindow) + (property (@ (name "title") + (translatable "yes")) Sidebar) + (property (@ (name "hide-on-close")) True) + (property (@ (name "default-width")) 720) + (property (@ (name "default-height")) 480) + (property (@ (name "width-request")) 360) + (property (@ (name "height-request")) 240) + (child + (object (@ (class "GtkShortcutController")) + (property (@ (name "scope")) managed) + (child + (object (@ (class "GtkShortcut")) + (property (@ (name "trigger")) Escape) + (property (@ (name "action")) "action(window.close)"))))) + (property (@ (name "content")) + (object (@ (class "AdwNavigationSplitView") + (id "sidebar-split-view")) + (property (@ (name "min-sidebar-width")) 140) + (property (@ (name "max-sidebar-width")) 240) + ,%sidebar-sidebar + ,%sidebar-content)) + (child + (object (@ (class "AdwBreakpoint")) + (condition "max-width: 450sp") + (setter (@ (object "sidebar-split-view") + (property "collapsed")) True) + (setter (@ (object "sidebar-list") + (property "selection-mode")) none))))) + + +(define %progress-bar + '(object (@ (class "GtkProgressBar") + (id "progress-bar")) + (property (@ (name "valign")) start) + (property (@ (name "fraction")) 0.5) + (property (@ (name "tooltip-text")) osd) + (property (@ (name "visible")) False) + #;(binding (@ (name "visible")) + (lookup (@ (name "progress")) "AdwStyleClassesDemoWindow")) + (style (class (@ (name "osd")))))) + + +(define %button-box-1 + '(object (@ (class "GtkBox") + (id "button-box-1")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Regular) + (property (@ (name "can-shrink")) True))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Flat) + (property (@ (name "tooltip-text")) flat) + (property (@ (name "can-shrink")) True) + (style (class (@ (name "flat")))))))) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Suggested) + (property (@ (name "tooltip-text")) suggested-action) + (property (@ (name "can-shrink")) True) + (style (class (@ (name "suggested-action")))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Destructive) + (property (@ (name "tooltip-text")) destructive-action) + (property (@ (name "can-shrink")) True) + (style (class (@ (name "destructive-action")))))))))) + +(define %button-box-2 + '(object (@ (class "GtkBox") + (id "button-box-2")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Custom) + (property (@ (name "name")) custom-button-1) + (property (@ (name "can-shrink")) True))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Custom) + (property (@ (name "name")) custom-button-2) + (property (@ (name "can-shrink")) True))))) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Custom) + (property (@ (name "name")) custom-button-3) + (property (@ (name "tooltip-text")) opaque) + (property (@ (name "can-shrink")) True) + (style (class (@ (name "opaque")))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Custom) + (property (@ (name "name")) custom-button-4) + (property (@ (name "tooltip-text")) opaque) + (property (@ (name "can-shrink")) True) + (style (class (@ (name "opaque")))))))))) + +(define %button-box-3 + '(object (@ (class "GtkBox") + (id "button-box-3")) + (property (@ (name "spacing")) 6) + (property (@ (name "margin-top")) 12) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "halign")) center) + (property (@ (name "valign")) center) + (property (@ (name "hexpand")) True) + (property (@ (name "tooltip-text")) circular) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) "Pill Button") + (property (@ (name "halign")) center) + (property (@ (name "valign")) center) + (property (@ (name "tooltip-text")) pill) + (property (@ (name "icon-name")) list-add-symbolic) + (style (class (@ (name "circular")))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) A) + (property (@ (name "tooltip-text")) circular) + (style (class (@ (name "circular")))))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) "Pill Button") + (property (@ (name "halign")) center) + (property (@ (name "valign")) center) + (property (@ (name "hexpand")) True) + (property (@ (name "tooltip-text")) pill) + (property (@ (name "can-shrink")) True) + (style (class (@ (name "pill")))))) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "halign")) center) + (property (@ (name "valign")) center) + (property (@ (name "hexpand")) True) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) go-previous-symbolic) + (property (@ (name "tooltip-text")) osd) + (style (class (@ (name "osd")))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) go-next-symbolic) + (property (@ (name "tooltip-text")) osd) + (style (class (@ (name "osd")))))))))) + +(define %buttons + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) Buttoms) + (property (@ (name "description") + (translatable "yes")) "The \"flat\", \"suggested-action\" and \"destructive\" style classes action can be used together with \"pill\" or \"circular\". + +The \"opaque\" style class allows to create buttons with custom colors that look similar to \"suggested-action\".") + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "orientation")) vertical) + (child ,%button-box-1) + (child ,%button-box-2) + (child ,%button-box-3))))) + + +(define %entry-box-1 + '(object (@ (class "GtkBox") + (id "entry-box-1")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (property (@ (name "hexpand")) True) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Regular) + (property (@ (name "text") + (translatable "yes")) Regular) + (property (@ (name "secondary-icon-name")) edit-copy-symbolic))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Success) + (property (@ (name "text") + (translatable "yes")) Success) + (property (@ (name "tooltip-text")) success) + (property (@ (name "secondary-icon-name")) edit-copy-symbolic) + (style (class (@ (name "success")))))))) + +(define %entry-box-2 + '(object (@ (class "GtkBox") + (id "entry-box-2")) + (property (@ (name "spacing")) 6) + (property (@ (name "homogeneous")) True) + (property (@ (name "hexpand")) True) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Warning) + (property (@ (name "text") + (translatable "yes")) Warning) + (property (@ (name "tooltip-text")) warning) + (property (@ (name "secondary-icon-name")) edit-copy-symbolic) + (style (class (@ (name "warning")))))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Error) + (property (@ (name "text") + (translatable "yes")) Error) + (property (@ (name "tooltip-text")) error) + (property (@ (name "secondary-icon-name")) edit-copy-symbolic) + (style (class (@ (name "error")))))))) + +(define %entries + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) Entries) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "orientation")) vertical) + (child ,%entry-box-1) + (child ,%entry-box-2))))) + + +(define %linked-controls-box-1 + '(object (@ (class "GtkBox")) + (property (@ (name "tooltip-text")) linked) + (style (class (@ (name "linked")))) + (child + (object (@ (class "GtkToggleButton") + (id "toggle")) + (property (@ (name "icon-name")) view-grid-symbolic) + (property (@ (name "active")) True))) + (child + (object (@ (class "GtkToggleButton")) + (property (@ (name "icon-name")) view-list-symbolic) + (property (@ (name "group")) toggle))))) + +(define %linked-controls-box-2 + '(object (@ (class "GtkBox")) + (property (@ (name "tooltip-text")) linked) + (style (class (@ (name "linked")))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Entry) + (property (@ (name "hexpand")) True))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Entry) + (property (@ (name "hexpand")) True))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "label") + (translatable "yes")) Button) + (property (@ (name "can-shrink")) True))))) + +(define %linked-controls-box-3 + '(object (@ (class "GtkBox")) + (property (@ (name "orientation")) vertical) + (property (@ (name "tooltip-text")) linked) + (style (class (@ (name "linked")))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) edit-cut-symbolic))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) edit-copy-symbolic))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) edit-paste-symbolic))))) + +(define %linked-controls-box-4 + '(object (@ (class "GtkBox")) + (property (@ (name "orientation")) vertical) + (property (@ (name "hexpand")) True) + (property (@ (name "tooltip-text")) linked) + (style (class (@ (name "linked")))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Street))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) City))) + (child + (object (@ (class "GtkEntry")) + (property (@ (name "placeholder-text") + (translatable "yes")) Province))))) + +(define %linked-controls + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) "Linked Controls") + (property (@ (name "description") + (translatable "yes")) "The \"linked\" style on GtkBox and similar containers allows to visually join related button-like and entry-like widgets.") + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (child ,%linked-controls-box-1) + (child ,%linked-controls-box-2))) + (child + (object (@ (class "GtkBox")) + (property (@ (name "spacing")) 6) + (property (@ (name "margin-top")) 6) + (child ,%linked-controls-box-3) + (child ,%linked-controls-box-4))))) + + +(define %labels-box-1 + '(object (@ (class "GtkBox")) + (property (@ (name "orientation")) vertical) + (property (@ (name "spacing")) 12) + (property (@ (name "hexpand")) True) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Title 1") + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) title-1) + (style (class (@ (name "title-1")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Title 2") + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) title-2) + (style (class (@ (name "title-2")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Title 3") + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) title-3) + (style (class (@ (name "title-3")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Title 4") + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) title-4) + (style (class (@ (name "title-4")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Monospace) + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) monospace) + (style (class (@ (name "monospace")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Numeric (1234567890)") + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) numeric) + (style (class (@ (name "numeric")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Accent) + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) accent) + (style (class (@ (name "accent")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Success) + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) success) + (style (class (@ (name "success")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Warning) + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) warning) + (style (class (@ (name "warning")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Error) + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) error) + (style (class (@ (name "error")))))))) + +(define %labels-box-2 + '(object (@ (class "GtkBox")) + (property (@ (name "orientation")) vertical) + (property (@ (name "spacing")) 12) + (property (@ (name "hexpand")) True) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Heading) + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) heading) + (style (class (@ (name "heading")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "This is a paragraph of a body copy. You would use this style for most text in interfaces. It can also include <b>styling</b> or <a href=\"https://os.gnome.org/\"> links</a> .") + (property (@ (name "use-markup")) True) + (property (@ (name "xalign")) 0) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char) + (property (@ (name "max-width-chars")) 25) + (property (@ (name "tooltip-text")) body) + (style (class (@ (name "body")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Caption Heading") + (property (@ (name "xalign")) 0) + (property (@ (name "ellipsize")) end) + (property (@ (name "tooltip-text")) caption-heading) + (style (class (@ (name "caption-heading")))))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Caption body text, to be used for body copy on image captions and the like.") + (property (@ (name "xalign")) 0) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char) + (property (@ (name "max-width-chars")) 25) + (property (@ (name "tooltip-text")) caption) + (style (class (@ (name "caption")))))))) + +(define %labels + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) Labels) + (child + (object (@ (class "GtkBox") + (id "label-box")) + (property (@ (name "spacing")) 18) + (child ,%labels-box-1) + (child ,%labels-box-2))))) + + +(define %cards-and-boxed-lists-box + '(object (@ (class "GtkBox")) + (property (@ (name "homogeneous")) True) + (property (@ (name "height-request")) 100) + (property (@ (name "spacing")) 12) + (property (@ (name "margin-bottom")) 12) + (child + (object (@ (class "AdwBin")) + (property (@ (name "tooltip-text")) card) + (style (class (@ (name "card")))) + (property (@ (name "child")) + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Card) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char))))) + (child + (object (@ (class "AdwBin")) + (property (@ (name "tooltip-text")) "card, activatable") + (property (@ (name "focusable")) True) + (style (class (@ (name "card"))) + (class (@ (name "activatable")))) + (property (@ (name "child")) + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Card (activatable)") + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "tooltip-text")) card) + (style (class (@ (name "card")))) + (property (@ (name "child")) + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Card (button)") + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char))))))) + +(define %cards-and-boxed-lists-listbox + '(object (@ (class "GtkListBox")) + (property (@ (name "selection-mode")) none) + (property (@ (name "tooltip-text")) boxed-list) + (style (class (@ (name "boxed-list")))) + (child + (object (@ (class "AdwActionRow")) + (property (@ (name "title") + (translatable "yes")) Row))) + (child + (object (@ (class "AdwActionRow")) + (property (@ (name "title") + (translatable "yes")) "Row (activatable)") + (property (@ (name "activatable")) True))))) + +(define %cards-and-boxed-lists + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) "Cards and Boxed Lists") + (property (@ (name "description") + (translatable "yes")) "The \"boxed-list\" style class can be used with GtkListBox to create boxed lists. + +The \"card\" style class can be used to achieve the same style with GtkBox or similar containers, and with GtkButton. If used together with \"activatable\" style class, or on a GtkButton, the card will also have hover and press styles.") + (child ,%cards-and-boxed-lists-box) + (child ,%cards-and-boxed-lists-listbox))) + + +(define %app-icons-grid-column-1 + '((child + (object (@ (class "GtkImage")) + (property (@ (name "icon-name")) org.gnome.Boxes) + (property (@ (name "pixel-size")) 128) + (property (@ (name "valign")) end) + (property (@ (name "tooltip-text")) icon-dropshadow) + (style (class (@ (name "icon-dropshadow")))) + (layout (property (@ (name "column")) 0) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label")) 128) + (property (@ (name "xalign")) 0.5) + (layout (property (@ (name "column")) 0) + (property (@ (name "row")) 1)))))) + +(define %app-icons-grid-column-2 + '((child + (object (@ (class "GtkImage")) + (property (@ (name "icon-name")) org.gnome.Boxes) + (property (@ (name "pixel-size")) 64) + (property (@ (name "valign")) end) + (property (@ (name "tooltip-text")) icon-dropshadow) + (style (class (@ (name "icon-dropshadow")))) + (layout (property (@ (name "column")) 1) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label")) 64) + (property (@ (name "xalign")) 0.5) + (layout (property (@ (name "column")) 1) + (property (@ (name "row")) 1)))))) + +(define %app-icons-grid-column-3 + '((child + (object (@ (class "GtkImage")) + (property (@ (name "icon-name")) org.gnome.Boxes) + (property (@ (name "pixel-size")) 32) + (property (@ (name "valign")) end) + (property (@ (name "tooltip-text")) icon-dropshadow) + (style (class (@ (name "icon-dropshadow")))) + (layout (property (@ (name "column")) 2) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label")) 32) + (property (@ (name "xalign")) 0.5) + (layout (property (@ (name "column")) 2) + (property (@ (name "row")) 1)))))) + +(define %app-icons + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) "App Icons") + (property (@ (name "description") + (translatable "yes")) "The \"icon-dropshadow\" style class ensures legibility when displaying app icons. For 32x32 and smaller app icons, \"lowres-icon\" should be used instead.") + (child + (object (@ (class "GtkGrid")) + (property (@ (name "row-spacing")) 6) + (property (@ (name "column-spacing")) 12) + ,@%app-icons-grid-column-1 + ,@%app-icons-grid-column-2 + ,@%app-icons-grid-column-3)))) + + +(define %check-buttons-group-1 + '((child + (object (@ (class "GtkCheckButton")) + (property (@ (name "halign")) end) + (property (@ (name "valign")) end) + (property (@ (name "active")) True) + (layout (property (@ (name "column")) 0) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkCheckButton")) + (property (@ (name "halign")) start) + (property (@ (name "valign")) end) + (layout (property (@ (name "column")) 1) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Regular) + (property (@ (name "xalign")) 0.5) + (property (@ (name "margin-start")) 12) + (property (@ (name "margin-end")) 12) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char) + (layout (property (@ (name "column")) 0) + (property (@ (name "row")) 1) + (property (@ (name "column-span")) 2)))))) + +(define %check-buttons-group-2 + '((child + (object (@ (class "GtkCheckButton")) + (property (@ (name "halign")) end) + (property (@ (name "valign")) end) + (property (@ (name "active")) True) + (property (@ (name "tooltip-text")) selection-mode) + (style (class (@ (name "selection-mode")))) + (layout (property (@ (name "column")) 2) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkCheckButton")) + (property (@ (name "halign")) start) + (property (@ (name "valign")) end) + (property (@ (name "tooltip-text")) selection-mode) + (style (class (@ (name "selection-mode")))) + (layout (property (@ (name "column")) 3) + (property (@ (name "row")) 0)))) + (child + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) "Selection Mode") + (property (@ (name "xalign")) 0.5) + (property (@ (name "margin-start")) 12) + (property (@ (name "margin-end")) 12) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char) + (layout (property (@ (name "column")) 2) + (property (@ (name "row")) 1) + (property (@ (name "column-span")) 2)))))) + +(define %check-buttons + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) "Check Buttons") + (property (@ (name "description") + (translatable "yes")) "The \"selection-mode\" style class makes can be used with GtkCheckButton to make them large and round.") + (child + (object (@ (class "GtkGrid")) + (property (@ (name "row-spacing")) 6) + (property (@ (name "column-spacing")) 12) + (property (@ (name "halign")) start) + ,@%check-buttons-group-1 + ,@%check-buttons-group-2)))) + + +(define %toolbar-1 + '(object (@ (class "GtkFrame")) + (property (@ (name "margin-bottom")) 12) + (property (@ (name "child")) + (object (@ (class "GtkBox")) + (property (@ (name "tooltip-text")) toolbar) + (style (class (@ (name "toolbar")))) + (child + (object (@ (class "GtkMenuButton")) + (property (@ (name "label") + (translatable "yes")) Open) + (property (@ (name "menu-model")) demo-menu))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) tab-new-symbolic))) + (child + (object (@ (class "GtkSeparator")) + (property (@ (name "hexpand")) True) + (style (class (@ (name "spacer")))))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) edit-undo-symbolic))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) edit-redo-symbolic))) + (child + (object (@ (class "GtkSeparator")) + (style (class (@ (name "spacer")))))) + (child + (object (@ (class "GtkMenuButton")) + (property (@ (name "icon-name")) view-more-symbolic) + (property (@ (name "menu-model")) demo-menu))))))) + +(define %toolbar-2 + '(object (@ (class "GtkBox")) + (property (@ (name "tooltip-text")) "toolbar, osd") + (style (class (@ (name "toolbar"))) + (class (@ (name "osd")))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) media-skip-backward-symbolic))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) media-playback-pause-symbolic))) + (child + (object (@ (class "GtkButton")) + (property (@ (name "icon-name")) media-skip-forward-symbolic))) + (child + (object (@ (class "GtkScale")) + (property (@ (name "hexpand")) True) + (property (@ (name "adjustment")) + (object (@ (class "GtkAdjustment")) + (property (@ (name "lower")) 0) + (property (@ (name "upper")) 100) + (property (@ (name "value")) 50))))) + (child + (object (@ (class "GtkScaleButton")) + (property (@ (name "icons")) "audio-volume-muted\naudio-volume-high\naudio-volume-low\naudio-volume-medium"))))) + +(define %toolbars + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) Toolbars) + (property (@ (name "description") + (translatable "yes")) "The \"toolbar\" style class on GtkBox and similar containers gives the same padding, spacing and button appearance as GtkHeaderBar and GtkActionBar have. A toolbar can additionally have the \"osd\" style class, useful for floating media controls. + +The \"raised\" style class can be used to make a button inside a toolbar use default appearance instead.") + (child ,%toolbar-1) + (child ,%toolbar-2))) + + +(define %background-items + '((child + (object (@ (class "AdwBin")) + (property (@ (name "tooltip-text")) background) + (style (class (@ (name "background")))) + (property (@ (name "child")) + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Background) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char))))) + (child + (object (@ (class "AdwBin")) + (property (@ (name "tooltip-text")) view) + (style (class (@ (name "view")))) + (property (@ (name "child")) + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) View) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char))))) + (child + (object (@ (class "AdwBin")) + (property (@ (name "tooltip-text")) osd) + (style (class (@ (name "osd")))) + (property (@ (name "child")) + (object (@ (class "GtkLabel")) + (property (@ (name "label") + (translatable "yes")) Osd) + (property (@ (name "wrap")) True) + (property (@ (name "wrap-mode")) word-char))))))) + +(define %backgrounds + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) Backgrounds) + (property (@ (name "description") + (translatable "yes")) "These style classes can be applied to any widgets that need the specific background and text color.") + (child + (object (@ (class "GtkBox")) + (property (@ (name "homogeneous")) True)y + (property (@ (name "height-request")) 100) + ,@%background-items)))) + + +(define %misc-status-pages + '(object (@ (class "AdwActionRow") + (id "status-pages-action-row")) + (property (@ (name "title") + (translatable "yes")) "Status Pages") + (property (@ (name "activatable")) True) + #;(property (@ (name "action-name")) style.status-page) + (child + (object (@ (class "GtkImage")) + (property (@ (name "icon-name")) go-next-symbolic) + (style (class (@ (name "dim-label")))))))) + +(define %misc-sidebar + '(object (@ (class "AdwActionRow") + (id "sidebar-action-row")) + (property (@ (name "title") + (translatable "yes")) Sidebar) + (property (@ (name "activatable")) True) + #;(property (@ (name "action-name")) style.status-page) + (child + (object (@ (class "GtkImage")) + (property (@ (name "icon-name")) go-next-symbolic) + (style (class (@ (name "dim-label")))))))) + +(define %misc-devel-switch + '(object (@ (class "AdwSwitchRow") + (id "devel-switch-row")) + (property (@ (name "title") + (translatable "yes")) "Development Window") + (property (@ (name "subtitle") + (translatable "yes")) "\"devel\" style class on GtkWindow") + #;(property (@ (name "action-name")) style.devel))) + +(define %misc-progress-bar + '(object (@ (class "AdwSwitchRow") + (id "progress-bar-switch-row")) + (property (@ (name "title") + (translatable "yes")) "OSD Progress Bar") + (property (@ (name "subtitle") + (translatable "yes")) "\"osd\" style class on GtkProgressBar") + #;(property (@ (name "action-name")) style.progress))) + +(define %misc + `(object (@ (class "AdwPreferencesGroup")) + (property (@ (name "title") + (translatable "yes")) Misc) + (child ,%misc-status-pages) + (child ,%misc-sidebar) + (child ,%misc-devel-switch) + (child ,%misc-progress-bar))) + + +(define %style-classes-demo-window + `(interface + (requires (@ (version "4.0") (lib "gtk"))) + (requires (@ (version "1.0") (lib "libadwaita"))) + (template (@ (class "AdwStyleClassesDemoWindow") + (parent "AdwWindow")) + (property (@ (name "modal")) True) + (property (@ (name "default-width")) 800) + (property (@ (name "default-height")) 640) + (property (@ (name "width-request")) 360) + (property (@ (name "height-request")) 150) + (property (@ (name "title") + (translatable "yes")) "Style Classes") + (property (@ (name "content")) + (object (@ (class "AdwToolbarView")) + (child (@ (type "top")) + (object (@ (class "AdwHeaderBar")))) + (property (@ (name "content")) + (object (@ (class "GtkOverlay")) + (child (@ (type "overlay")) + ,%progress-bar) + (child + (object (@ (class "AdwPreferencesPage")) + (property (@ (name "width-request")) 360) + (property (@ (name "description") + (translatable "yes")) "Hover over widgets to see their exact style class names.") + (child ,%buttons) + (child ,%entries) + (child ,%linked-controls) + (child ,%labels) + (child ,%cards-and-boxed-lists) + (child ,%app-icons) + (child ,%check-buttons) + (child ,%toolbars) + (child ,%backgrounds) + (child ,%misc))))))) + (child + (object (@ (class "AdwBreakpoint")) + (condition "max-width: 500sp") + (setter (@ (object "button-box-1") + (property "orientation")) vertical) + (setter (@ (object "button-box-2") + (property "orientation")) vertical) + (setter (@ (object "entry-box-1") + (property "orientation")) vertical) + (setter (@ (object "entry-box-2") + (property "orientation")) vertical) + (setter (@ (object "label-box") + (property "orientation")) vertical) + (setter (@ (object "label-box") + (property "spacing")) 12)))) + ,%demo-menu + ,%status-pages + ,%sidebar)) + + +(define (make-ui) + (sxml->ui %style-classes-demo-window)) diff --git a/examples/adw-1/adw1-demo/ui/style-classes-demo-window.ui b/examples/adw-1/adw1-demo/ui/style-classes-demo-window.ui new file mode 100644 index 0000000..7c6d654 --- /dev/null +++ b/examples/adw-1/adw1-demo/ui/style-classes-demo-window.ui @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface><requires version="4.0" lib="gtk" /><requires version="1.0" lib="libadwaita" /><template class="AdwStyleClassesDemoWindow" parent="AdwWindow"><property name="modal">True</property><property name="default-width">800</property><property name="default-height">640</property><property name="width-request">360</property><property name="height-request">150</property><property name="title" translatable="yes">Style Classes</property><property name="content"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar" /></child><property name="content"><object class="GtkOverlay"><child type="overlay"><object class="GtkProgressBar" id="progress-bar"><property name="valign">start</property><property name="fraction">0.5</property><property name="tooltip-text">osd</property><property name="visible">False</property><style><class name="osd" /></style></object></child><child><object class="AdwPreferencesPage"><property name="width-request">360</property><property name="description" translatable="yes">Hover over widgets to see their exact style class names.</property><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Buttoms</property><property name="description" translatable="yes">The "flat", "suggested-action" and "destructive" style classes action can be used together with "pill" or "circular". + +The "opaque" style class allows to create buttons with custom colors that look similar to "suggested-action".</property><child><object class="GtkBox"><property name="spacing">6</property><property name="orientation">vertical</property><child><object class="GtkBox" id="button-box-1"><property name="spacing">6</property><property name="homogeneous">True</property><child><object class="GtkBox"><property name="spacing">6</property><property name="homogeneous">True</property><child><object class="GtkButton"><property name="label" translatable="yes">Regular</property><property name="can-shrink">True</property></object></child><child><object class="GtkButton"><property name="label" translatable="yes">Flat</property><property name="tooltip-text">flat</property><property name="can-shrink">True</property><style><class name="flat" /></style></object></child></object></child><child><object class="GtkBox"><property name="spacing">6</property><property name="homogeneous">True</property><child><object class="GtkButton"><property name="label" translatable="yes">Suggested</property><property name="tooltip-text">suggested-action</property><property name="can-shrink">True</property><style><class name="suggested-action" /></style></object></child><child><object class="GtkButton"><property name="label" translatable="yes">Destructive</property><property name="tooltip-text">destructive-action</property><property name="can-shrink">True</property><style><class name="destructive-action" /></style></object></child></object></child></object></child><child><object class="GtkBox" id="button-box-2"><property name="spacing">6</property><property name="homogeneous">True</property><child><object class="GtkBox"><property name="spacing">6</property><property name="homogeneous">True</property><child><object class="GtkButton"><property name="label" translatable="yes">Custom</property><property name="name">custom-button-1</property><property name="can-shrink">True</property></object></child><child><object class="GtkButton"><property name="label" translatable="yes">Custom</property><property name="name">custom-button-2</property><property name="can-shrink">True</property></object></child></object></child><child><object class="GtkBox"><property name="spacing">6</property><property name="homogeneous">True</property><child><object class="GtkButton"><property name="label" translatable="yes">Custom</property><property name="name">custom-button-3</property><property name="tooltip-text">opaque</property><property name="can-shrink">True</property><style><class name="opaque" /></style></object></child><child><object class="GtkButton"><property name="label" translatable="yes">Custom</property><property name="name">custom-button-4</property><property name="tooltip-text">opaque</property><property name="can-shrink">True</property><style><class name="opaque" /></style></object></child></object></child></object></child><child><object class="GtkBox" id="button-box-3"><property name="spacing">6</property><property name="margin-top">12</property><child><object class="GtkBox"><property name="spacing">6</property><property name="halign">center</property><property name="valign">center</property><property name="hexpand">True</property><property name="tooltip-text">circular</property><child><object class="GtkButton"><property name="label" translatable="yes">Pill Button</property><property name="halign">center</property><property name="valign">center</property><property name="tooltip-text">pill</property><property name="icon-name">list-add-symbolic</property><style><class name="circular" /></style></object></child><child><object class="GtkButton"><property name="label" translatable="yes">A</property><property name="tooltip-text">circular</property><style><class name="circular" /></style></object></child></object></child><child><object class="GtkButton"><property name="label" translatable="yes">Pill Button</property><property name="halign">center</property><property name="valign">center</property><property name="hexpand">True</property><property name="tooltip-text">pill</property><property name="can-shrink">True</property><style><class name="pill" /></style></object></child><child><object class="GtkBox"><property name="spacing">6</property><property name="halign">center</property><property name="valign">center</property><property name="hexpand">True</property><child><object class="GtkButton"><property name="icon-name">go-previous-symbolic</property><property name="tooltip-text">osd</property><style><class name="osd" /></style></object></child><child><object class="GtkButton"><property name="icon-name">go-next-symbolic</property><property name="tooltip-text">osd</property><style><class name="osd" /></style></object></child></object></child></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Entries</property><child><object class="GtkBox"><property name="spacing">6</property><property name="orientation">vertical</property><child><object class="GtkBox" id="entry-box-1"><property name="spacing">6</property><property name="homogeneous">True</property><property name="hexpand">True</property><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Regular</property><property name="text" translatable="yes">Regular</property><property name="secondary-icon-name">edit-copy-symbolic</property></object></child><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Success</property><property name="text" translatable="yes">Success</property><property name="tooltip-text">success</property><property name="secondary-icon-name">edit-copy-symbolic</property><style><class name="success" /></style></object></child></object></child><child><object class="GtkBox" id="entry-box-2"><property name="spacing">6</property><property name="homogeneous">True</property><property name="hexpand">True</property><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Warning</property><property name="text" translatable="yes">Warning</property><property name="tooltip-text">warning</property><property name="secondary-icon-name">edit-copy-symbolic</property><style><class name="warning" /></style></object></child><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Error</property><property name="text" translatable="yes">Error</property><property name="tooltip-text">error</property><property name="secondary-icon-name">edit-copy-symbolic</property><style><class name="error" /></style></object></child></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Linked Controls</property><property name="description" translatable="yes">The "linked" style on GtkBox and similar containers allows to visually join related button-like and entry-like widgets.</property><child><object class="GtkBox"><property name="spacing">6</property><child><object class="GtkBox"><property name="tooltip-text">linked</property><style><class name="linked" /></style><child><object class="GtkToggleButton" id="toggle"><property name="icon-name">view-grid-symbolic</property><property name="active">True</property></object></child><child><object class="GtkToggleButton"><property name="icon-name">view-list-symbolic</property><property name="group">toggle</property></object></child></object></child><child><object class="GtkBox"><property name="tooltip-text">linked</property><style><class name="linked" /></style><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Entry</property><property name="hexpand">True</property></object></child><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Entry</property><property name="hexpand">True</property></object></child><child><object class="GtkButton"><property name="label" translatable="yes">Button</property><property name="can-shrink">True</property></object></child></object></child></object></child><child><object class="GtkBox"><property name="spacing">6</property><property name="margin-top">6</property><child><object class="GtkBox"><property name="orientation">vertical</property><property name="tooltip-text">linked</property><style><class name="linked" /></style><child><object class="GtkButton"><property name="icon-name">edit-cut-symbolic</property></object></child><child><object class="GtkButton"><property name="icon-name">edit-copy-symbolic</property></object></child><child><object class="GtkButton"><property name="icon-name">edit-paste-symbolic</property></object></child></object></child><child><object class="GtkBox"><property name="orientation">vertical</property><property name="hexpand">True</property><property name="tooltip-text">linked</property><style><class name="linked" /></style><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Street</property></object></child><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">City</property></object></child><child><object class="GtkEntry"><property name="placeholder-text" translatable="yes">Province</property></object></child></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Labels</property><child><object class="GtkBox" id="label-box"><property name="spacing">18</property><child><object class="GtkBox"><property name="orientation">vertical</property><property name="spacing">12</property><property name="hexpand">True</property><child><object class="GtkLabel"><property name="label" translatable="yes">Title 1</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">title-1</property><style><class name="title-1" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Title 2</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">title-2</property><style><class name="title-2" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Title 3</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">title-3</property><style><class name="title-3" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Title 4</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">title-4</property><style><class name="title-4" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Monospace</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">monospace</property><style><class name="monospace" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Numeric (1234567890)</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">numeric</property><style><class name="numeric" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Accent</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">accent</property><style><class name="accent" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Success</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">success</property><style><class name="success" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Warning</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">warning</property><style><class name="warning" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Error</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">error</property><style><class name="error" /></style></object></child></object></child><child><object class="GtkBox"><property name="orientation">vertical</property><property name="spacing">12</property><property name="hexpand">True</property><child><object class="GtkLabel"><property name="label" translatable="yes">Heading</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">heading</property><style><class name="heading" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">This is a paragraph of a body copy. You would use this style for most text in interfaces. It can also include <b>styling</b> or <a href="https://os.gnome.org/"> links</a> .</property><property name="use-markup">True</property><property name="xalign">0</property><property name="wrap">True</property><property name="wrap-mode">word-char</property><property name="max-width-chars">25</property><property name="tooltip-text">body</property><style><class name="body" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Caption Heading</property><property name="xalign">0</property><property name="ellipsize">end</property><property name="tooltip-text">caption-heading</property><style><class name="caption-heading" /></style></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Caption body text, to be used for body copy on image captions and the like.</property><property name="xalign">0</property><property name="wrap">True</property><property name="wrap-mode">word-char</property><property name="max-width-chars">25</property><property name="tooltip-text">caption</property><style><class name="caption" /></style></object></child></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Cards and Boxed Lists</property><property name="description" translatable="yes">The "boxed-list" style class can be used with GtkListBox to create boxed lists. + +The "card" style class can be used to achieve the same style with GtkBox or similar containers, and with GtkButton. If used together with "activatable" style class, or on a GtkButton, the card will also have hover and press styles.</property><child><object class="GtkBox"><property name="homogeneous">True</property><property name="height-request">100</property><property name="spacing">12</property><property name="margin-bottom">12</property><child><object class="AdwBin"><property name="tooltip-text">card</property><style><class name="card" /></style><property name="child"><object class="GtkLabel"><property name="label" translatable="yes">Card</property><property name="wrap">True</property><property name="wrap-mode">word-char</property></object></property></object></child><child><object class="AdwBin"><property name="tooltip-text">card, activatable</property><property name="focusable">True</property><style><class name="card" /><class name="activatable" /></style><property name="child"><object class="GtkLabel"><property name="label" translatable="yes">Card (activatable)</property><property name="wrap">True</property><property name="wrap-mode">word-char</property></object></property></object></child><child><object class="GtkButton"><property name="tooltip-text">card</property><style><class name="card" /></style><property name="child"><object class="GtkLabel"><property name="label" translatable="yes">Card (button)</property><property name="wrap">True</property><property name="wrap-mode">word-char</property></object></property></object></child></object></child><child><object class="GtkListBox"><property name="selection-mode">none</property><property name="tooltip-text">boxed-list</property><style><class name="boxed-list" /></style><child><object class="AdwActionRow"><property name="title" translatable="yes">Row</property></object></child><child><object class="AdwActionRow"><property name="title" translatable="yes">Row (activatable)</property><property name="activatable">True</property></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">App Icons</property><property name="description" translatable="yes">The "icon-dropshadow" style class ensures legibility when displaying app icons. For 32x32 and smaller app icons, "lowres-icon" should be used instead.</property><child><object class="GtkGrid"><property name="row-spacing">6</property><property name="column-spacing">12</property><child><object class="GtkImage"><property name="icon-name">org.gnome.Boxes</property><property name="pixel-size">128</property><property name="valign">end</property><property name="tooltip-text">icon-dropshadow</property><style><class name="icon-dropshadow" /></style><layout><property name="column">0</property><property name="row">0</property></layout></object></child><child><object class="GtkLabel"><property name="label">128</property><property name="xalign">0.5</property><layout><property name="column">0</property><property name="row">1</property></layout></object></child><child><object class="GtkImage"><property name="icon-name">org.gnome.Boxes</property><property name="pixel-size">64</property><property name="valign">end</property><property name="tooltip-text">icon-dropshadow</property><style><class name="icon-dropshadow" /></style><layout><property name="column">1</property><property name="row">0</property></layout></object></child><child><object class="GtkLabel"><property name="label">64</property><property name="xalign">0.5</property><layout><property name="column">1</property><property name="row">1</property></layout></object></child><child><object class="GtkImage"><property name="icon-name">org.gnome.Boxes</property><property name="pixel-size">32</property><property name="valign">end</property><property name="tooltip-text">icon-dropshadow</property><style><class name="icon-dropshadow" /></style><layout><property name="column">2</property><property name="row">0</property></layout></object></child><child><object class="GtkLabel"><property name="label">32</property><property name="xalign">0.5</property><layout><property name="column">2</property><property name="row">1</property></layout></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Check Buttons</property><property name="description" translatable="yes">The "selection-mode" style class makes can be used with GtkCheckButton to make them large and round.</property><child><object class="GtkGrid"><property name="row-spacing">6</property><property name="column-spacing">12</property><property name="halign">start</property><child><object class="GtkCheckButton"><property name="halign">end</property><property name="valign">end</property><property name="active">True</property><layout><property name="column">0</property><property name="row">0</property></layout></object></child><child><object class="GtkCheckButton"><property name="halign">start</property><property name="valign">end</property><layout><property name="column">1</property><property name="row">0</property></layout></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Regular</property><property name="xalign">0.5</property><property name="margin-start">12</property><property name="margin-end">12</property><property name="wrap">True</property><property name="wrap-mode">word-char</property><layout><property name="column">0</property><property name="row">1</property><property name="column-span">2</property></layout></object></child><child><object class="GtkCheckButton"><property name="halign">end</property><property name="valign">end</property><property name="active">True</property><property name="tooltip-text">selection-mode</property><style><class name="selection-mode" /></style><layout><property name="column">2</property><property name="row">0</property></layout></object></child><child><object class="GtkCheckButton"><property name="halign">start</property><property name="valign">end</property><property name="tooltip-text">selection-mode</property><style><class name="selection-mode" /></style><layout><property name="column">3</property><property name="row">0</property></layout></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Selection Mode</property><property name="xalign">0.5</property><property name="margin-start">12</property><property name="margin-end">12</property><property name="wrap">True</property><property name="wrap-mode">word-char</property><layout><property name="column">2</property><property name="row">1</property><property name="column-span">2</property></layout></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Toolbars</property><property name="description" translatable="yes">The "toolbar" style class on GtkBox and similar containers gives the same padding, spacing and button appearance as GtkHeaderBar and GtkActionBar have. A toolbar can additionally have the "osd" style class, useful for floating media controls. + +The "raised" style class can be used to make a button inside a toolbar use default appearance instead.</property><child><object class="GtkFrame"><property name="margin-bottom">12</property><property name="child"><object class="GtkBox"><property name="tooltip-text">toolbar</property><style><class name="toolbar" /></style><child><object class="GtkMenuButton"><property name="label" translatable="yes">Open</property><property name="menu-model">demo-menu</property></object></child><child><object class="GtkButton"><property name="icon-name">tab-new-symbolic</property></object></child><child><object class="GtkSeparator"><property name="hexpand">True</property><style><class name="spacer" /></style></object></child><child><object class="GtkButton"><property name="icon-name">edit-undo-symbolic</property></object></child><child><object class="GtkButton"><property name="icon-name">edit-redo-symbolic</property></object></child><child><object class="GtkSeparator"><style><class name="spacer" /></style></object></child><child><object class="GtkMenuButton"><property name="icon-name">view-more-symbolic</property><property name="menu-model">demo-menu</property></object></child></object></property></object></child><child><object class="GtkBox"><property name="tooltip-text">toolbar, osd</property><style><class name="toolbar" /><class name="osd" /></style><child><object class="GtkButton"><property name="icon-name">media-skip-backward-symbolic</property></object></child><child><object class="GtkButton"><property name="icon-name">media-playback-pause-symbolic</property></object></child><child><object class="GtkButton"><property name="icon-name">media-skip-forward-symbolic</property></object></child><child><object class="GtkScale"><property name="hexpand">True</property><property name="adjustment"><object class="GtkAdjustment"><property name="lower">0</property><property name="upper">100</property><property name="value">50</property></object></property></object></child><child><object class="GtkScaleButton"><property name="icons">audio-volume-muted +audio-volume-high +audio-volume-low +audio-volume-medium</property></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Backgrounds</property><property name="description" translatable="yes">These style classes can be applied to any widgets that need the specific background and text color.</property><child><object class="GtkBox"><property name="homogeneous">True</property>y<property name="height-request">100</property><child><object class="AdwBin"><property name="tooltip-text">background</property><style><class name="background" /></style><property name="child"><object class="GtkLabel"><property name="label" translatable="yes">Background</property><property name="wrap">True</property><property name="wrap-mode">word-char</property></object></property></object></child><child><object class="AdwBin"><property name="tooltip-text">view</property><style><class name="view" /></style><property name="child"><object class="GtkLabel"><property name="label" translatable="yes">View</property><property name="wrap">True</property><property name="wrap-mode">word-char</property></object></property></object></child><child><object class="AdwBin"><property name="tooltip-text">osd</property><style><class name="osd" /></style><property name="child"><object class="GtkLabel"><property name="label" translatable="yes">Osd</property><property name="wrap">True</property><property name="wrap-mode">word-char</property></object></property></object></child></object></child></object></child><child><object class="AdwPreferencesGroup"><property name="title" translatable="yes">Misc</property><child><object class="AdwActionRow" id="status-pages-action-row"><property name="title" translatable="yes">Status Pages</property><property name="activatable">True</property><child><object class="GtkImage"><property name="icon-name">go-next-symbolic</property><style><class name="dim-label" /></style></object></child></object></child><child><object class="AdwActionRow" id="sidebar-action-row"><property name="title" translatable="yes">Sidebar</property><property name="activatable">True</property><child><object class="GtkImage"><property name="icon-name">go-next-symbolic</property><style><class name="dim-label" /></style></object></child></object></child><child><object class="AdwSwitchRow" id="devel-switch-row"><property name="title" translatable="yes">Development Window</property><property name="subtitle" translatable="yes">"devel" style class on GtkWindow</property></object></child><child><object class="AdwSwitchRow" id="progress-bar-switch-row"><property name="title" translatable="yes">OSD Progress Bar</property><property name="subtitle" translatable="yes">"osd" style class on GtkProgressBar</property></object></child></object></child></object></child></object></property></object></property><child><object class="AdwBreakpoint"><condition>max-width: 500sp</condition><setter object="button-box-1" property="orientation">vertical</setter><setter object="button-box-2" property="orientation">vertical</setter><setter object="entry-box-1" property="orientation">vertical</setter><setter object="entry-box-2" property="orientation">vertical</setter><setter object="label-box" property="orientation">vertical</setter><setter object="label-box" property="spacing">12</setter></object></child></template><menu id="demo-menu"><section><item><attribute name="label" translatable="yes">Item 1</attribute><attribute name="action">style.dummy</attribute></item><item><attribute name="label" translatable="yes">Item 2</attribute><attribute name="action">style.dummy</attribute></item><item><attribute name="label" translatable="yes">Item 3</attribute><attribute name="action">style.dummy</attribute></item></section></menu><object class="AdwWindow" id="status-pages-window"><property name="modal">True</property><property name="transient-for">AdwStyleClassesDemoWindow</property><property name="title" translatable="yes">Status Pages</property><property name="hide-on-close">True</property><property name="default-width">640</property><property name="default-height">480</property><property name="width-request">360</property><property name="height-request">200</property><child><object class="GtkShortcutController"><property name="scope">managed</property><child><object class="GtkShortcut"><property name="trigger">Escape</property><property name="action">action(window.close)</property></object></child></object></child><property name="content"><object class="AdwToolbarView"><property name="top-bar-style">raised</property><child type="top"><object class="GtkHeaderBar"><child><object class="GtkToggleButton" id="compact-toggle-button"><property name="icon-name">view-sidebar-start</property><property name="active" bind-source="compact-split-view" bind-property="show-sidebar" bind-flags="sync-create|bidirectional" /></object></child></object></child><property name="content"><object class="AdwOverlaySplitView" id="compact-split-view"><property name="sidebar"><object class="AdwStatusPage"><property name="icon-name">org.gnome.Adwaita1.Demo-symbolic</property><property name="title" translatable="yes">Compact</property><property name="description" translatable="yes">This status page has the "compact" style class.</property><property name="tooltip-text">compact</property><style><class name="compact" /></style><property name="child"><object class="GtkButton"><property name="label" translatable="yes">Buttom</property><property name="halign">center</property><style><class name="pill" /></style></object></property></object></property><property name="content"><object class="AdwStatusPage"><property name="hexpand">True</property><property name="icon-name">org.gnome.Adwaita1.Demo-symbolic</property><property name="title" translatable="yes">Regular</property><property name="description" translatable="yes">This is a regular status pag.</property><property name="child"><object class="GtkButton"><property name="label" translatable="yes">Buttom</property><property name="halign">center</property><style><class name="pill" /></style></object></property></object></property></object></property></object></property><child><object class="AdwBreakpoint"><condition>max-width: 450sp</condition><setter object="compact-split-view" property="collapsed">True</setter><setter object="compact-toggle-button" property="visible">True</setter></object></child></object><object class="AdwWindow" id="sidebar-window"><property name="modal">True</property><property name="transient-for">AdwStyleClassesDemoWindow</property><property name="title" translatable="yes">Sidebar</property><property name="hide-on-close">True</property><property name="default-width">720</property><property name="default-height">480</property><property name="width-request">360</property><property name="height-request">240</property><child><object class="GtkShortcutController"><property name="scope">managed</property><child><object class="GtkShortcut"><property name="trigger">Escape</property><property name="action">action(window.close)</property></object></child></object></child><property name="content"><object class="AdwNavigationSplitView" id="sidebar-split-view"><property name="min-sidebar-width">140</property><property name="max-sidebar-width">240</property><property name="sidebar"><object class="AdwNavigationPage"><property name="title">Bluefox</property><property name="child"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar"><property name="show-title">False</property></object></child><child><object class="GtkScrolledWindow"><property name="hscrollbar-policy">never</property><property name="child"><object class="GtkListBox" id="sidebar-list"><property name="tooltip-text">navigation-sidebar</property><property name="selection-mode">browse</property><style><class name="navigation-sidebar" /></style><child><object class="GtkLabel"><property name="label" translatable="yes">Item 1</property><property name="ellipsize">end</property><property name="xalign">0</property></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Item 2</property><property name="ellipsize">end</property><property name="xalign">0</property></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Item 3</property><property name="ellipsize">end</property><property name="xalign">0</property></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Item 4</property><property name="ellipsize">end</property><property name="xalign">0</property></object></child><child><object class="GtkLabel"><property name="label" translatable="yes">Item 5</property><property name="ellipsize">end</property><property name="xalign">0</property></object></child></object></property></object></child></object></property></object></property><property name="content"><object class="AdwNavigationPage"><property name="title" translatable="yes">Sidebar</property><property name="tag">content</property><property name="child"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar" /></child><child><object class="AdwStatusPage"><property name="title" translatable="yes">Sidebar</property><property name="description" translatable="yes">"navigation-sidebar" style class on GtkListBox or GtkListView.</property></object></child></object></property></object></property></object></property><child><object class="AdwBreakpoint"><condition>max-width: 450sp</condition><setter object="sidebar-split-view" property="collapsed">True</setter><setter object="sidebar-list" property="selection-mode">none</setter></object></child></object></interface> diff --git a/examples/adw-1/adw1-demo/ui/style-classes.scm b/examples/adw-1/adw1-demo/ui/style-classes.scm new file mode 100644 index 0000000..8e6f957 --- /dev/null +++ b/examples/adw-1/adw1-demo/ui/style-classes.scm @@ -0,0 +1,55 @@ +;; -*- mode: sxml-ui; coding: utf-8 -*- + +;;;; +;;;; Copyright (C) 2023 +;;;; Free Software Foundation, Inc. + +;;;; This file is part of GNU G-Golf + +;;;; GNU G-Golf is free software; you can redistribute it and/or modify +;;;; it under the terms of the GNU Lesser General Public License as +;;;; published by the Free Software Foundation; either version 3 of the +;;;; License, or (at your option) any later version. + +;;;; GNU G-Golf 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 +;;;; Lesser General Public License for more details. + +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with GNU G-Golf. If not, see +;;;; <https://www.gnu.org/licenses/lgpl.html>. +;;;; + +;;; Commentary: + +;;; Code: + + +(use-modules (g-golf support sxml)) + + +(define %style-classes + `(interface + (requires (@ (version "4.0") (lib "gtk"))) + (requires (@ (version "1.0") (lib "libadwaita"))) + (template (@ (class "AdwDemoPageStyleClasses") + (parent "AdwBin")) + (property (@ (name "child")) + (object (@ (class "AdwStatusPage")) + (property (@ (name "icon-name")) style-classes-symbolic) + (property (@ (name "title") + (translatable "yes")) "Style classes") + (property (@ (name "description") + (translatable "yes")) "Various widget styles available for use.") + (property (@ (name "child")) + (object (@ (class "GtkButton") + (id style-classes-button)) + (property (@ (name "label") + (translatable "yes")) "Run the Demo") + (property (@ (name "halign")) center) + (style (class (@ (name "pill"))))))))))) + + +(define (make-ui) + (sxml->ui %style-classes)) diff --git a/examples/adw-1/adw1-demo/ui/style-classes.ui b/examples/adw-1/adw1-demo/ui/style-classes.ui new file mode 100644 index 0000000..168b642 --- /dev/null +++ b/examples/adw-1/adw1-demo/ui/style-classes.ui @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface><requires version="4.0" lib="gtk" /><requires version="1.0" lib="libadwaita" /><template class="AdwDemoPageStyleClasses" parent="AdwBin"><property name="child"><object class="AdwStatusPage"><property name="icon-name">style-classes-symbolic</property><property name="title" translatable="yes">Style classes</property><property name="description" translatable="yes">Various widget styles available for use.</property><property name="child"><object class="GtkButton" id="style-classes-button"><property name="label" translatable="yes">Run the Demo</property><property name="halign">center</property><style><class name="pill" /></style></object></property></object></property></template></interface> diff --git a/examples/adw-1/adw1-demo/ui/sxml-ui.el b/examples/adw-1/adw1-demo/ui/sxml-ui.el index 45db97d..cb83b40 100644 --- a/examples/adw-1/adw1-demo/ui/sxml-ui.el +++ b/examples/adw-1/adw1-demo/ui/sxml-ui.el @@ -32,13 +32,14 @@ (defvar %template-ui-sxml-tags-indent-0 '(section - item)) + item + style + layout)) (defvar %template-ui-sxml-tags-indent-1 '(interface template object - style property child menu @@ -65,6 +66,10 @@ . font-lock-constant-face))) (font-lock-add-keywords 'sxml-ui-mode + '(("\\<\\(binding\\)\\>" + . font-lock-constant-face))) + +(font-lock-add-keywords 'sxml-ui-mode '(("\\<\\(section\\)\\>" . font-lock-doc-face))) @@ -73,10 +78,18 @@ . font-lock-warning-face))) (font-lock-add-keywords 'sxml-ui-mode + '(("\\<\\(property\\)\\>" + . font-lock-comment-face))) + +(font-lock-add-keywords 'sxml-ui-mode '(("\\<\\(attribute\\)\\>" . font-lock-comment-face))) (font-lock-add-keywords 'sxml-ui-mode + '(("\\<\\(lookup\\)\\>" + . font-lock-comment-face))) + +(font-lock-add-keywords 'sxml-ui-mode '(("\\<\\(interface\\|template\\)\\>" . font-lock-preprocessor-face))) @@ -89,12 +102,16 @@ . font-lock-preprocessor-face))) (font-lock-add-keywords 'sxml-ui-mode - '(("\\<\\(property\\)\\>" - . font-lock-comment-face))) + '(("\\<\\(child\\)\\>" + . font-lock-warning-face))) (font-lock-add-keywords 'sxml-ui-mode - '(("\\<\\(child\\|style\\)\\>" - . font-lock-warning-face))) + '(("\\<\\(style\\\|layout\\|condition\\)\\>" + . font-lock-doc-markup-face))) + +(font-lock-add-keywords 'sxml-ui-mode + '(("\\<\\(setter\\)\\>" + . font-lock-type-face))) (font-lock-add-keywords 'sxml-ui-mode '(("\\<\\(version\\|class\\|parent\\|name\\|translatable\\|id\\|bind-source\\|bind-property\\|bind-flags\\|type\\)\\>" diff --git a/examples/adw-1/adw1-demo/ui/window.scm b/examples/adw-1/adw1-demo/ui/window.scm index b224a1f..966751c 100644 --- a/examples/adw-1/adw1-demo/ui/window.scm +++ b/examples/adw-1/adw1-demo/ui/window.scm @@ -73,6 +73,13 @@ (property (@ (name "child")) (object (@ (class "AdwDemoPageNavigationView")))))) +(define %style-classes + '(object (@ (class "GtkStackPage")) + (property (@ (name "title") + (translatable "yes")) "Style Classes") + (property (@ (name "child")) + (object (@ (class "AdwDemoPageStyleClasses")))))) + (define %sidebar `(object (@ (class "AdwNavigationPage")) (property (@ (name "title") @@ -103,7 +110,8 @@ (property (@ (name "vhomogeneous")) False) ;; signal - notify::visible-child ... (child ,%welcome-page) - (child ,%navigation-view))))))) + (child ,%navigation-view) + (child ,%style-classes))))))) (define %window `(interface diff --git a/examples/adw-1/adw1-demo/ui/window.ui b/examples/adw-1/adw1-demo/ui/window.ui index 735cde8..b78a699 100644 --- a/examples/adw-1/adw1-demo/ui/window.ui +++ b/examples/adw-1/adw1-demo/ui/window.ui @@ -1,2 +1,2 @@ <?xml version="1.0" encoding="UTF-8"?> -<interface><requires version="4.0" lib="gtk" /><requires version="1.0" lib="libadwaita" /><menu id="primary-menu"><section><item><attribute name="label" translatable="yes">_Inspector</attribute><attribute name="action">app.inspector</attribute></item></section><section><item><attribute name="label" translatable="yes">_Preferences</attribute><attribute name="action">app.preferences</attribute></item><item><attribute name="label" translatable="yes">_About Adwaita Demo</attribute><attribute name="action">app.about</attribute></item></section></menu><template class="AdwDemoWindow" parent="AdwApplicationWindow"><property name="title" translatable="yes">Adwaita Demo</property><property name="default-width">800</property><property name="default-height">576</property><property name="width-request">360</property><property name="height-request">200</property><child><object class="AdwBreakpoint"><condition>max-width: 500sp</condition><setter object="split-view" property="collapsed">True</setter></object></child><property name="content"><object class="AdwToastOverlay" id="toast-overlay"><property name="child"><object class="AdwNavigationSplitView" id="split-view"><property name="min-sidebar-width">240</property><property name="sidebar"><object class="AdwNavigationPage"><property name="title" bind-source="AdwDemoWindow" bind-property="title" bind-flags="sync-create" /><property name="child"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar"><child type="start"><object class="GtkButton" id="color-scheme-button" /></child><child type="end"><object class="GtkMenuButton"><property name="tooltip-text" translatable="yes">Main Menu</property><property name="menu-model">primary-menu</property><property name="icon-name">open-menu-symbolic</property><property name="primary">True</property></object></child></object></child><property name="content"><object class="GtkStackSidebar"><property name="stack">stack</property></object></property></object></property></object></property><property name="content"><object class="AdwNavigationPage"><property name="title">Bluefox</property><property name="child"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar"><property name="show-title">False</property></object></child><property name="content"><object class="GtkStack" id="stack"><property name="vhomogeneous">False</property><child><object class="GtkStackPage"><property name="title" translatable="yes">Welcome</property><property name="child"><object class="AdwDemoPageWelcome" /></property></object></child><child><object class="GtkStackPage"><property name="title" translatable="yes">Navigation View</property><property name="child"><object class="AdwDemoPageNavigationView" /></property></object></child></object></property></object></property></object></property></object></property></object></property></template></interface> +<interface><requires version="4.0" lib="gtk" /><requires version="1.0" lib="libadwaita" /><menu id="primary-menu"><section><item><attribute name="label" translatable="yes">_Inspector</attribute><attribute name="action">app.inspector</attribute></item></section><section><item><attribute name="label" translatable="yes">_Preferences</attribute><attribute name="action">app.preferences</attribute></item><item><attribute name="label" translatable="yes">_About Adwaita Demo</attribute><attribute name="action">app.about</attribute></item></section></menu><template class="AdwDemoWindow" parent="AdwApplicationWindow"><property name="title" translatable="yes">Adwaita Demo</property><property name="default-width">800</property><property name="default-height">576</property><property name="width-request">360</property><property name="height-request">200</property><child><object class="AdwBreakpoint"><condition>max-width: 500sp</condition><setter object="split-view" property="collapsed">True</setter></object></child><property name="content"><object class="AdwToastOverlay" id="toast-overlay"><property name="child"><object class="AdwNavigationSplitView" id="split-view"><property name="min-sidebar-width">240</property><property name="sidebar"><object class="AdwNavigationPage"><property name="title" bind-source="AdwDemoWindow" bind-property="title" bind-flags="sync-create" /><property name="child"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar"><child type="start"><object class="GtkButton" id="color-scheme-button" /></child><child type="end"><object class="GtkMenuButton"><property name="tooltip-text" translatable="yes">Main Menu</property><property name="menu-model">primary-menu</property><property name="icon-name">open-menu-symbolic</property><property name="primary">True</property></object></child></object></child><property name="content"><object class="GtkStackSidebar"><property name="stack">stack</property></object></property></object></property></object></property><property name="content"><object class="AdwNavigationPage"><property name="title">Bluefox</property><property name="child"><object class="AdwToolbarView"><child type="top"><object class="AdwHeaderBar"><property name="show-title">False</property></object></child><property name="content"><object class="GtkStack" id="stack"><property name="vhomogeneous">False</property><child><object class="GtkStackPage"><property name="title" translatable="yes">Welcome</property><property name="child"><object class="AdwDemoPageWelcome" /></property></object></child><child><object class="GtkStackPage"><property name="title" translatable="yes">Navigation View</property><property name="child"><object class="AdwDemoPageNavigationView" /></property></object></child><child><object class="GtkStackPage"><property name="title" translatable="yes">Style Classes</property><property name="child"><object class="AdwDemoPageStyleClasses" /></property></object></child></object></property></object></property></object></property></object></property></object></property></template></interface> diff --git a/examples/adw-1/adw1-demo/window.scm b/examples/adw-1/adw1-demo/window.scm index 7d36a61..4a284d0 100644 --- a/examples/adw-1/adw1-demo/window.scm +++ b/examples/adw-1/adw1-demo/window.scm @@ -33,6 +33,7 @@ #:use-module (adw1-demo preferences) #:use-module (adw1-demo welcome) #:use-module (adw1-demo navigation-view) + #:use-module (adw1-demo style-classes) #:duplicates (merge-generics replace @@ -61,6 +62,8 @@ (gi-import-by-name "Gtk" name)) '("License" "Window" + "StyleContext" + "CssProvider" "ClosureExpression" "IconTheme" "Stack" @@ -148,11 +151,16 @@ (present about))) (define (show-window app) - (let* ((display (gdk-display-get-default)) + (let* ((cwd (dirname (current-filename))) + (display (gdk-display-get-default)) (manager (adw-style-manager-get-default)) - (icon-theme (gtk-icon-theme-get-for-display display))) - (add-search-path icon-theme (string-append (dirname (current-filename)) - "/icons")) + (icon-theme (gtk-icon-theme-get-for-display display)) + (css-path (string-append cwd "/css/style.css")) + (css-provider (let ((provider (make <gtk-css-provider>))) + (gtk-css-provider-load-from-path provider css-path) + provider))) + (add-search-path icon-theme (string-append cwd "/icons")) + (gtk-style-context-add-provider-for-display display css-provider 800) (let* ((window (make <adw-demo-window> #:application app)) (color-scheme-button (!color-scheme-button window)) @@ -182,11 +190,7 @@ (connect-after (!stack window) 'notify::visible-child - (lambda (s c) - ;; FIXME - ;; - the second arg - ;; g-closure-marshal-g-value-ref <- must be enhanced - ;; (dimfi s c (g-object-type-name c) + (lambda (stack p-spec) (notify-visible-child-cb window))) (present window)))) @@ -45,6 +45,7 @@ #:use-module (system foreign) #:use-module (srfi srfi-1) #:use-module (g-golf support libg-golf) + #:use-module (g-golf support const) #:use-module (g-golf support float) #:use-module (g-golf support module) #:use-module (g-golf support goops) @@ -149,6 +150,7 @@ (rnrs arithmetic bitwise) (system foreign) (srfi srfi-1) + (g-golf support const) (g-golf support float) (g-golf support module) (g-golf support goops) diff --git a/g-golf/gobject/params-vals.scm b/g-golf/gobject/params-vals.scm index 2777f0b..c637e27 100644 --- a/g-golf/gobject/params-vals.scm +++ b/g-golf/gobject/params-vals.scm @@ -32,13 +32,14 @@ #:use-module (system foreign) #:use-module (rnrs bytevectors) #:use-module (g-golf init) + #:use-module (g-golf support libg-golf) #:use-module (g-golf support g-export) + #:use-module (g-golf support const) #:use-module (g-golf support enum) #:use-module (g-golf support flags) #:use-module (g-golf support struct) #:use-module (g-golf support union) #:use-module (g-golf support utils) - #:use-module (g-golf support libg-golf) #:use-module (g-golf gi cache-gi) #:use-module (g-golf gi utils) #:use-module (g-golf gobject type-info) @@ -56,24 +57,34 @@ g-value-type-name g-value-ref g-value-set! + g-param-spec-boolean + g-value-get-boolean + g-value-set-boolean g-param-spec-int g-value-get-int g-value-set-int + g-param-spec-uint g-value-get-uint g-value-set-uint - g-value-get-boolean - g-value-set-boolean + g-param-spec-float g-value-get-float g-value-set-float + g-param-spec-double g-value-get-double g-value-set-double g-param-spec-enum g-value-get-enum + ;; g-value-set-enum is a method, see g-export below + g-param-spec-flags g-value-get-flags + ;; g-value-set-flags is a method, see g-export below + g-param-spec-string g-value-get-string g-value-set-string + g-param-spec-param g-value-get-param g-value-set-param + g-param-spec-boxed g-value-get-boxed g-value-set-boxed g-value-get-pointer @@ -138,10 +149,10 @@ (case type-tag ((boolean) (g-value-get-boolean g-value)) - ((uint) - (g-value-get-uint g-value)) ((int) (g-value-get-int g-value)) + ((uint) + (g-value-get-uint g-value)) ((float) (g-value-get-float g-value)) ((double) @@ -171,10 +182,10 @@ (case type-tag ((boolean) (g-value-set-boolean g-value value)) - ((uint) - (g-value-set-uint g-value value)) ((int) (g-value-set-int g-value value)) + ((uint) + (g-value-set-uint g-value value)) ((float) (g-value-set-float g-value value)) ((double) @@ -202,6 +213,19 @@ ;;; GObject Low level API ;;; +(define (g-param-spec-boolean name nick blurb default flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_boolean (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + (if default 1 0) + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-boolean g-value) (if (= (g_value_get_boolean g-value) 0) #f #t)) @@ -212,8 +236,8 @@ (define (g-param-spec-int name nick blurb minimum maximum default flags) (let* ((nick (or nick name)) (blurb (or blurb nick)) - (minimum (or minimum -2147483648)) ;; FIXME import G_MININT - (maximum (or maximum 2147483647)) ;; FIXME import G_MAXINT + (minimum (or minimum INT-MIN)) + (maximum (or maximum INT-MAX)) (default (or default 0)) (flags (or flags '(readable writable))) (g-param-flags @@ -233,18 +257,72 @@ (define (g-value-set-int g-value int) (g_value_set_int g-value int)) +(define (g-param-spec-uint name nick blurb minimum maximum default flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (minimum (or minimum 0)) + (maximum (or maximum UINT-MAX)) + (default (or default 0)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_uint (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + minimum + maximum + default + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-uint g-value) (g_value_get_uint g-value)) (define (g-value-set-uint g-value uint) (g_value_set_uint g-value uint)) +(define (g-param-spec-float name nick blurb minimum maximum default flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (minimum (or minimum FLT-MIN)) + (maximum (or maximum FLT-MAX)) + (default (or default 0)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_float (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + minimum + maximum + default + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-float g-value) (g_value_get_float g-value)) (define (g-value-set-float g-value float) (g_value_set_float g-value float)) +(define (g-param-spec-double name nick blurb minimum maximum default flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (minimum (or minimum DBL-MIN)) + (maximum (or maximum DBL-MAX)) + (default (or default 0)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_double (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + minimum + maximum + default + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-double g-value) (g_value_get_double g-value)) @@ -294,6 +372,24 @@ (g_value_set_enum g-value val) (error "No such " (!name gi-enum) " key: " sym)))) +(define (g-param-spec-flags name nick blurb type default flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (g-type (!g-type type)) + (default (if default + (flags->integer type default) + 0)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_flags (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + g-type + default + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-gi-flags g-value) (let* ((g-name (g-value-type-name g-value)) (name (g-name->name g-name))) @@ -313,6 +409,19 @@ (g_value_set_flags g-value val) (error "No such " (!name gi-flags) " key: " flags)))) +(define (g-param-spec-string name nick blurb default flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_string (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + (scm->gi default 'string) + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-string g-value) (let ((pointer (g_value_get_string g-value))) (if (null-pointer? pointer) @@ -325,6 +434,19 @@ (string->pointer str) %null-pointer))) +(define (g-param-spec-param name nick blurb type flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_param (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + type + (flags->integer g-param-flags flags)) + 'pointer))) + (define (g-value-get-param g-value) (let ((pointer (g_value_get_param g-value))) (if (null-pointer? pointer) @@ -336,6 +458,19 @@ (g_value_set_param g-value param) (g_value_set_param g-value %null-pointer))) +(define (g-param-spec-boxed name nick blurb type flags) + (let* ((nick (or nick name)) + (blurb (or blurb nick)) + (flags (or flags '(readable writable))) + (g-param-flags + (@ (g-golf gobject param-spec) %g-param-flags))) + (gi->scm (g_param_spec_boxed (string->pointer name) + (string->pointer nick) + (string->pointer blurb) + type + (flags->integer g-param-flags flags)) + 'pointer))) + (define %gdk-event-class (@ (g-golf gdk events) gdk-event-class)) @@ -354,7 +489,7 @@ value)) ((or (!is-opaque? gi-boxed) (!is-semi-opaque? gi-boxed)) - value) + (gi->scm value 'pointer)) (else (parse-c-struct value (!scm-types gi-boxed)))) @@ -371,7 +506,7 @@ (value (if gi-boxed (if (or (!is-opaque? gi-boxed) (!is-semi-opaque? gi-boxed)) - boxed + (scm->gi boxed 'pointer) (make-c-struct (!scm-types gi-boxed) boxed)) (case name ((g-value) boxed) @@ -425,6 +560,16 @@ ;;; GObject Bindings ;;; +(define g_param_spec_boolean + (pointer->procedure '* + (dynamic-func "g_param_spec_boolean" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + int ;; default-value + unsigned-int))) ;; flags + (define g_value_get_boolean (pointer->procedure int (dynamic-func "g_value_get_boolean" @@ -463,6 +608,18 @@ (list '* int))) +(define g_param_spec_uint + (pointer->procedure '* + (dynamic-func "g_param_spec_uint" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + unsigned-int ;; minimum + unsigned-int ;; maximum + unsigned-int ;; default-value + unsigned-int))) ;; flags + (define g_value_get_uint (pointer->procedure unsigned-int (dynamic-func "g_value_get_uint" @@ -476,6 +633,18 @@ (list '* unsigned-int))) +(define g_param_spec_float + (pointer->procedure '* + (dynamic-func "g_param_spec_float" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + float ;; minimum + float ;; maximum + float ;; default-value + unsigned-int))) ;; flags + (define g_value_get_float (pointer->procedure float (dynamic-func "g_value_get_float" @@ -489,6 +658,18 @@ (list '* float))) +(define g_param_spec_double + (pointer->procedure '* + (dynamic-func "g_param_spec_double" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + double ;; minimum + double ;; maximum + double ;; default-value + unsigned-int))) ;; flags + (define g_value_get_double (pointer->procedure double (dynamic-func "g_value_get_double" @@ -509,7 +690,7 @@ (list '* ;; name '* ;; nick '* ;; blurb - size_t ;; g-type + size_t ;; enum-type int ;; default-value unsigned-int))) ;; flags @@ -526,6 +707,17 @@ (list '* int))) +(define g_param_spec_flags + (pointer->procedure '* + (dynamic-func "g_param_spec_flags" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + size_t ;; flags-type + int ;; default-value + unsigned-int))) ;; flags + (define g_value_get_flags (pointer->procedure unsigned-int (dynamic-func "g_value_get_flags" @@ -539,6 +731,16 @@ (list '* unsigned-int))) +(define g_param_spec_string + (pointer->procedure '* + (dynamic-func "g_param_spec_string" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + '* ;; default-value + unsigned-int))) ;; flags + (define g_value_get_string (pointer->procedure '* (dynamic-func "g_value_get_string" @@ -552,6 +754,16 @@ (list '* '*))) +(define g_param_spec_param + (pointer->procedure '* + (dynamic-func "g_param_spec_param" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + size_t ;; param-type + unsigned-int))) ;; flags + (define g_value_get_param (pointer->procedure '* (dynamic-func "g_value_get_param" @@ -565,6 +777,16 @@ (list '* '*))) +(define g_param_spec_boxed + (pointer->procedure '* + (dynamic-func "g_param_spec_boxed" + %libgobject) + (list '* ;; name + '* ;; nick + '* ;; blurb + size_t ;; boxed-type + unsigned-int))) ;; flags + (define g_value_get_boxed (pointer->procedure '* (dynamic-func "g_value_get_boxed" diff --git a/g-golf/hl-api/gobject.scm b/g-golf/hl-api/gobject.scm index bee6b6c..7c66b88 100644 --- a/g-golf/hl-api/gobject.scm +++ b/g-golf/hl-api/gobject.scm @@ -70,7 +70,7 @@ gi-add-method-gf)) -#;(g-export ) +(g-export disconnect) ;;; @@ -83,7 +83,7 @@ ;; revealed that unless connect is promoted as a gf in this module ;; (which is defined and imported before signal, and of course before ;; any user import(s)), then an 'overrides core binding' warning is -;; displayed, followed by a "module-lookup"connect exception. +;; displayed, followed by a "module-lookup" connect exception. (define %connect (module-ref the-root-module 'connect)) @@ -92,6 +92,22 @@ "The core Guile implementation of the connect(2) POSIX call" (apply %connect args)) +;; Same as above, in order to avoid the following warning [1], the +;; disconnect gf must be added and exported from this module. This is +;; because this module, which does not use (g-golf hl-api signal), is +;; where imported typelib 'components' are being defined and exported. + +;; So, just to make sure 'everyone' understands, unless we define and +;; export the disconnect gf from this module, what would happen, when a +;; typelib defines a method for which the short method name is +;; disconnect, is the user inevitably sees this warning [1] - as this +;; situation ends up, with two disconnect gf that are not merged. + +;; [1] WARNING: (g-golf): `disconnect' imported from both (g-golf hl-api +;; gobject) and (g-golf hl-api signal). + +(define-generic disconnect) + ;;; ;;; <gobject-class> diff --git a/g-golf/hl-api/gparam.scm b/g-golf/hl-api/gparam.scm index e4417b3..c1a34b7 100644 --- a/g-golf/hl-api/gparam.scm +++ b/g-golf/hl-api/gparam.scm @@ -42,8 +42,16 @@ #:export (g-param-construct + g-param-construct-boolean g-param-construct-int + g-param-construct-uint + g-param-construct-float + g-param-construct-double g-param-construct-enum + g-param-construct-flags + g-param-construct-string + g-param-construct-param + g-param-construct-boxed g-param-construct-object)) @@ -58,10 +66,26 @@ (match p-spec ((param-type . param-desc) (case param-type + ((boolean) + (g-param-construct-boolean name param-desc)) ((int) (g-param-construct-int name param-desc)) + ((uint) + (g-param-construct-uint name param-desc)) + ((float) + (g-param-construct-float name param-desc)) + ((double) + (g-param-construct-double name param-desc)) ((enum) (g-param-construct-enum name param-desc)) + ((flags) + (g-param-construct-flags name param-desc)) + ((string) + (g-param-construct-string name param-desc)) + ((param) + (g-param-construct-param name param-desc)) + ((boxed) + (g-param-construct-boxed name param-desc)) ((object) (g-param-construct-object name param-desc)) (else @@ -69,6 +93,16 @@ "Unimplemented g-param-construct type: ~S" (list param-type) #f))))))) +(define (g-param-construct-boolean name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (default (get-keyword #:default param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-boolean (symbol->string name) + nick + blurb + default + flags))) (define (g-param-construct-int name param-desc) (let ((nick (get-keyword #:nick param-desc #f)) @@ -85,6 +119,51 @@ default flags))) +(define (g-param-construct-uint name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (minimum (get-keyword #:minimum param-desc #f)) + (maximum (get-keyword #:maximum param-desc #f)) + (default (get-keyword #:default param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-uint (symbol->string name) + nick + blurb + minimum + maximum + default + flags))) + +(define (g-param-construct-float name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (minimum (get-keyword #:minimum param-desc #f)) + (maximum (get-keyword #:maximum param-desc #f)) + (default (get-keyword #:default param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-float (symbol->string name) + nick + blurb + minimum + maximum + default + flags))) + +(define (g-param-construct-double name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (minimum (get-keyword #:minimum param-desc #f)) + (maximum (get-keyword #:maximum param-desc #f)) + (default (get-keyword #:default param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-double (symbol->string name) + nick + blurb + minimum + maximum + default + flags))) + (define (g-param-construct-enum name param-desc) (let ((nick (get-keyword #:nick param-desc #f)) (blurb (get-keyword #:blurb param-desc #f)) @@ -98,6 +177,52 @@ default flags))) +(define (g-param-construct-flags name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (type (get-keyword #:type param-desc #f)) + (default (get-keyword #:default param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-flags (symbol->string name) + nick + blurb + type + default + flags))) + +(define (g-param-construct-string name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (default (get-keyword #:default param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-string (symbol->string name) + nick + blurb + default + flags))) + +(define (g-param-construct-param name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (type (get-keyword #:type param-desc (symbol->g-type 'param))) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-param (symbol->string name) + nick + blurb + type + flags))) + +(define (g-param-construct-boxed name param-desc) + (let ((nick (get-keyword #:nick param-desc #f)) + (blurb (get-keyword #:blurb param-desc #f)) + (type (get-keyword #:type param-desc #f)) + (flags (get-keyword #:flags param-desc #f))) + (g-param-spec-boxed (symbol->string name) + nick + blurb + type + flags))) + (define (g-param-construct-object name param-desc) (let ((nick (get-keyword #:nick param-desc #f)) (blurb (get-keyword #:blurb param-desc #f)) diff --git a/g-golf/support.scm b/g-golf/support.scm index a3d8201..a421ade 100644 --- a/g-golf/support.scm +++ b/g-golf/support.scm @@ -36,7 +36,7 @@ (define-module (g-golf support) #:use-module (oop goops) - #:use-module (g-golf support libg-golf) + #:use-module (g-golf support const) #:use-module (g-golf support float) #:use-module (g-golf support module) #:use-module (g-golf support goops) @@ -61,7 +61,7 @@ (eval-when (expand load eval) (re-export-public-interface (oop goops) - (g-golf support libg-golf) + (g-golf support const) (g-golf support float) (g-golf support module) (g-golf support goops) diff --git a/g-golf/support/const.scm b/g-golf/support/const.scm new file mode 100644 index 0000000..2804bbf --- /dev/null +++ b/g-golf/support/const.scm @@ -0,0 +1,47 @@ +;; -*- mode: scheme; coding: utf-8 -*- + +;;;; +;;;; Copyright (C) 2023 +;;;; Free Software Foundation, Inc. + +;;;; This file is part of GNU G-Golf + +;;;; GNU G-Golf is free software; you can redistribute it and/or modify +;;;; it under the terms of the GNU Lesser General Public License as +;;;; published by the Free Software Foundation; either version 3 of the +;;;; License, or (at your option) any later version. + +;;;; GNU G-Golf 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 +;;;; Lesser General Public License for more details. + +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with GNU G-Golf. If not, see +;;;; <https://www.gnu.org/licenses/lgpl.html>. +;;;; + +;;; Commentary: + +;;; Code: + + +(define-module (g-golf support const) + #:use-module (g-golf support libg-golf) + + #:export (INT-MIN + INT-MAX + UINT-MAX + FLT-MIN + FLT-MAX + DBL-MIN + DBL-MAX)) + + +(define INT-MIN (gg_int_min)) +(define INT-MAX (gg_int_max)) +(define UINT-MAX (gg_uint_max)) +(define FLT-MIN (gg_flt_min)) +(define FLT-MAX (gg_flt_max)) +(define DBL-MIN (gg_dbl_min)) +(define DBL-MAX (gg_dbl_max)) diff --git a/g-golf/support/libg-golf.scm b/g-golf/support/libg-golf.scm index 9985472..1a67123 100644 --- a/g-golf/support/libg-golf.scm +++ b/g-golf/support/libg-golf.scm @@ -39,6 +39,15 @@ ;; Misc. pointer_address_size + ;; Constants + gg_int_min + gg_int_max + gg_uint_max + gg_flt_min + gg_flt_max + gg_dbl_min + gg_dbl_max + ;; Floats float_to_int @@ -91,6 +100,53 @@ ;;; +;;; Constants +;;; + +(define gg_int_min + (pointer->procedure int + (dynamic-func "gg_int_min" + %libg-golf) + (list))) + +(define gg_int_max + (pointer->procedure int + (dynamic-func "gg_int_max" + %libg-golf) + (list))) + +(define gg_uint_max + (pointer->procedure unsigned-int + (dynamic-func "gg_uint_max" + %libg-golf) + (list))) + +(define gg_flt_min + (pointer->procedure float + (dynamic-func "gg_flt_min" + %libg-golf) + (list))) + +(define gg_flt_max + (pointer->procedure float + (dynamic-func "gg_flt_max" + %libg-golf) + (list))) + +(define gg_dbl_min + (pointer->procedure double + (dynamic-func "gg_dbl_min" + %libg-golf) + (list))) + +(define gg_dbl_max + (pointer->procedure double + (dynamic-func "gg_dbl_max" + %libg-golf) + (list))) + + +;;; ;;; FFI ;;; diff --git a/libg-golf/Makefile.am b/libg-golf/Makefile.am index 14e19a4..7f783cd 100644 --- a/libg-golf/Makefile.am +++ b/libg-golf/Makefile.am @@ -1,6 +1,6 @@ #### -#### Copyright (C) 2016 - 2022 +#### Copyright (C) 2016 - 2023 #### Free Software Foundation, Inc. #### This file is part of GNU G-Golf. @@ -27,6 +27,7 @@ lib_LTLIBRARIES = \ libg-golf.la libg_golf_la_sources = \ + gg-const.c \ gg-ffi.c \ gg-utils.c \ gg-glib.c \ @@ -36,6 +37,7 @@ libg_golf_la_sources = \ g-golf.c libg_golf_la_headers = \ + gg-const.h \ gg-ffi.h \ gg-utils.h \ gg-glib.h \ diff --git a/libg-golf/g-golf.c b/libg-golf/g-golf.c index 8ae571b..8269d17 100644 --- a/libg-golf/g-golf.c +++ b/libg-golf/g-golf.c @@ -35,6 +35,8 @@ /* #include <gtk/gtk.h> */ #include <girepository.h> +#include "gg-const.h" +#include "gg-ffi.h" #include "gg-utils.h" #include "gg-glib.h" #include "gg-gobject.h" diff --git a/libg-golf/gg-const.c b/libg-golf/gg-const.c new file mode 100644 index 0000000..13297a9 --- /dev/null +++ b/libg-golf/gg-const.c @@ -0,0 +1,90 @@ +/* -*- mode: C; coding: utf-8 -*- + +#### +#### Copyright (C) 2023 +#### Free Software Foundation, Inc. + +#### This file is part of GNU G-Golf. + +#### GNU G-Golf 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. + +#### GNU G-Golf 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 GNU G-Golf. If not, see +#### <https://www.gnu.org/licenses/gpl.html>. +#### + +*/ + + +#include <limits.h> +#include <float.h> + + +/* + * int +*/ + +int +gg_int_min () +{ + return INT_MIN; +} + +int +gg_int_max () +{ + return INT_MAX; +} + + +/* + * unsigned int +*/ + +unsigned int +gg_uint_max () +{ + return UINT_MAX; +} + + +/* + * float +*/ + +float +gg_flt_min () +{ + return FLT_MIN; +} + +float +gg_flt_max () +{ + return FLT_MAX; +} + + +/* + * double +*/ + +double +gg_dbl_min () +{ + return DBL_MIN; +} + +double +gg_dbl_max () +{ + return DBL_MAX; +} diff --git a/libg-golf/gg-const.h b/libg-golf/gg-const.h new file mode 100644 index 0000000..b25b9af --- /dev/null +++ b/libg-golf/gg-const.h @@ -0,0 +1,68 @@ +/* -*- mode: C; coding: utf-8 -*- + +#### +#### Copyright (C) 2023 +#### Free Software Foundation, Inc. + +#### This file is part of GNU G-Golf. + +#### GNU G-Golf 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. + +#### GNU G-Golf 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 GNU G-Golf. If not, see +#### <https://www.gnu.org/licenses/gpl.html>. +#### + +*/ + +#include <limits.h> +#include <float.h> + + +/* + * int +*/ + +int +gg_int_min (); + +int +gg_int_max (); + + +/* + * unsigned int +*/ + +unsigned int +gg_uint_max (); + + +/* + * float +*/ + +float +gg_flt_min (); + +float +gg_flt_max (); + + +/* + * double +*/ + +double +gg_dbl_min (); + +double +gg_dbl_max (); diff --git a/libg-golf/gg-utils.c b/libg-golf/gg-utils.c index 78013bb..1dbea54 100644 --- a/libg-golf/gg-utils.c +++ b/libg-golf/gg-utils.c @@ -1,7 +1,7 @@ /* -*- mode: C; coding: utf-8 -*- #### -#### Copyright (C) 2021 +#### Copyright (C) 2021 - 2023 #### Free Software Foundation, Inc. #### This file is part of GNU G-Golf. @@ -36,7 +36,6 @@ /* * misc. - * */ size_t @@ -50,7 +49,6 @@ pointer_address_size () /* * floats - * */ int diff --git a/libg-golf/gg-utils.h b/libg-golf/gg-utils.h index 326d72d..6692ae7 100644 --- a/libg-golf/gg-utils.h +++ b/libg-golf/gg-utils.h @@ -1,7 +1,7 @@ /* -*- mode: C; coding: utf-8 -*- #### -#### Copyright (C) 2021 +#### Copyright (C) 2021 - 2023 #### Free Software Foundation, Inc. #### This file is part of GNU G-Golf. @@ -36,7 +36,6 @@ /* * misc. - * */ size_t @@ -45,7 +44,6 @@ pointer_address_size (); /* * floats - * */ int |