From f4e1907f43240e236a9f33eb702770b44e03ffd7 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Mon, 7 Aug 2023 17:22:27 +0200 Subject: [PATCH 001/461] GNOME 45 (#475) --- Workbench.doap | 1 + meson.build | 2 +- re.sonny.Workbench.Devel.json | 7 ++++--- re.sonny.Workbench.json | 7 ++++--- src/Previewer/previewer.vala | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Workbench.doap b/Workbench.doap index 949542d8c..7225f73b6 100644 --- a/Workbench.doap +++ b/Workbench.doap @@ -13,6 +13,7 @@ JavaScript Vala + C GTK 4 Libadwaita diff --git a/meson.build b/meson.build index 7c0930cec..89af49974 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('Workbench', ['vala', 'c'], - version: '44.2', + version: '45.0', meson_version: '>= 0.59.0', license: 'GPL-3.0-only' ) diff --git a/re.sonny.Workbench.Devel.json b/re.sonny.Workbench.Devel.json index 5d9231391..7dbcf3375 100644 --- a/re.sonny.Workbench.Devel.json +++ b/re.sonny.Workbench.Devel.json @@ -1,7 +1,7 @@ { "id": "re.sonny.Workbench.Devel", "runtime": "org.gnome.Sdk", - "runtime-version": "44", + "runtime-version": "master", "sdk": "org.gnome.Sdk", "sdk-extensions": [ "org.freedesktop.Sdk.Extension.vala", @@ -193,7 +193,7 @@ { "type": "git", "url": "https://github.com/JCWasmx86/GTKCssLanguageServer", - "commit": "638bf6e8836d9c2aed6d4c5d17dbf00311155145" + "commit": "6fa2252d55c4c11a866b6ea91c1a8ad52d7d3a01" } ], "modules": [ @@ -224,8 +224,9 @@ } ], "post-install": [ + "cp -a /usr/share/gtk-doc/html/. /app/share/doc/", + "rm -r /app/share/doc/appstream", "cp -a /usr/share/doc/. /app/share/doc/", - "cp -a /usr/share/gtk-doc/html/. /app/share/doc", "cp -a /usr/lib/sdk/vala/bin/. /app/bin/", "cp -a /usr/lib/sdk/vala/lib/. /app/lib/", "cp -a /usr/lib/sdk/vala/share/. /app/share/" diff --git a/re.sonny.Workbench.json b/re.sonny.Workbench.json index 9edfdd863..8efef90d9 100644 --- a/re.sonny.Workbench.json +++ b/re.sonny.Workbench.json @@ -1,7 +1,7 @@ { "id": "re.sonny.Workbench", "runtime": "org.gnome.Sdk", - "runtime-version": "44", + "runtime-version": "master", "sdk": "org.gnome.Sdk", "sdk-extensions": [ "org.freedesktop.Sdk.Extension.vala", @@ -193,7 +193,7 @@ { "type": "git", "url": "https://github.com/JCWasmx86/GTKCssLanguageServer", - "commit": "638bf6e8836d9c2aed6d4c5d17dbf00311155145" + "commit": "6fa2252d55c4c11a866b6ea91c1a8ad52d7d3a01" } ], "modules": [ @@ -224,8 +224,9 @@ } ], "post-install": [ + "cp -a /usr/share/gtk-doc/html/. /app/share/doc/", + "rm -r /app/share/doc/appstream", "cp -a /usr/share/doc/. /app/share/doc/", - "cp -a /usr/share/gtk-doc/html/. /app/share/doc", "cp -a /usr/lib/sdk/vala/bin/. /app/bin/", "cp -a /usr/lib/sdk/vala/lib/. /app/lib/", "cp -a /usr/lib/sdk/vala/share/. /app/share/" diff --git a/src/Previewer/previewer.vala b/src/Previewer/previewer.vala index 6e54adf3c..e227f6fb8 100644 --- a/src/Previewer/previewer.vala +++ b/src/Previewer/previewer.vala @@ -118,7 +118,7 @@ namespace Workbench { var end = section.get_end_location(); this.css_parser_error(error.message, (int)start.lines, (int)start.line_chars, (int)end.lines, (int)end.line_chars); }); - this.css.load_from_data (content.data); + this.css.load_from_data (content); Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), this.css , Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } From 5fe420aebdc4b703f99a49e84d589cc891024532 Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Sun, 30 Jul 2023 08:37:37 -0500 Subject: [PATCH 002/461] library: add switch row (#448) --- src/Library/demos/Boxed Lists/main.blp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Library/demos/Boxed Lists/main.blp b/src/Library/demos/Boxed Lists/main.blp index 474bb44e7..1066f543d 100644 --- a/src/Library/demos/Boxed Lists/main.blp +++ b/src/Library/demos/Boxed Lists/main.blp @@ -38,9 +38,14 @@ Adw.StatusPage { title: _("A row can be an entry"); } + Adw.SwitchRow { + title: _("Switch Row"); + subtitle: _("Simple on/off control"); + } + Adw.ComboRow { title: _("Choose an item"); - subtitle: _("ComboRow can have a drop down list"); + subtitle: _("List of options from a drop down"); model: StringList list { strings ["this", "is", "a", "string", "list"] }; From 585a15345c87732a26402702efebb8fdc3f41d53 Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Mon, 7 Aug 2023 06:52:37 -0500 Subject: [PATCH 003/461] library: Add spin row to boxed list entry (#461) --- src/Library/demos/Boxed Lists/main.blp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Library/demos/Boxed Lists/main.blp b/src/Library/demos/Boxed Lists/main.blp index 1066f543d..febddf01e 100644 --- a/src/Library/demos/Boxed Lists/main.blp +++ b/src/Library/demos/Boxed Lists/main.blp @@ -43,6 +43,18 @@ Adw.StatusPage { subtitle: _("Simple on/off control"); } + Adw.SpinRow { + title: _("Spin Row"); + subtitle: _("Increment or decrement a value"); + climb-rate: 0.2; + adjustment: Adjustment { + lower: 0; + upper: 100; + step-increment: 1; + value: 50; + }; + } + Adw.ComboRow { title: _("Choose an item"); subtitle: _("List of options from a drop down"); From 711d70ddfdbc0a9a4b39fb9fb8d2ad921ff7ce46 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Mon, 7 Aug 2023 20:14:10 +0200 Subject: [PATCH 004/461] Update dependencies --- re.sonny.Workbench.Devel.json | 21 ++++++++++++--------- re.sonny.Workbench.json | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/re.sonny.Workbench.Devel.json b/re.sonny.Workbench.Devel.json index 7dbcf3375..1c0f5248d 100644 --- a/re.sonny.Workbench.Devel.json +++ b/re.sonny.Workbench.Devel.json @@ -120,8 +120,8 @@ "sources": [ { "type": "archive", - "url": "https://download.gnome.org/sources/libshumate/1.0/libshumate-1.0.3.tar.xz", - "sha256": "77a192f0dfec082b8de20b1939f3adf03eed41114d49fdaae2bbb2729ceb015a" + "url": "https://download.gnome.org/sources/libshumate/1.0/libshumate-1.0.5.tar.xz", + "sha256": "a8cfd8df9177ee44b04733b017af13c9e93f98765cdc89b750a48edaf701956c" } ] }, @@ -131,16 +131,18 @@ "build-commands": ["chmod +x rome", "cp rome /app/bin/rome"], "sources": [ { - "type": "archive", + "type": "file", + "dest-filename": "rome", "only-arches": ["aarch64"], - "url": "https://registry.npmjs.org/@rometools/cli-linux-arm64/-/cli-linux-arm64-12.1.1.tgz", - "sha512": "8ca25e4fa488d5df5b90094c398977750b73bd38bdf1db0903310cf754955cb9793a78e4e7967d406f5fd44e276d2efa2cae1e65a34c70aaacec5da14b255e75" + "url": "https://github.com/rome/tools/releases/download/cli%2Fv12.1.3-nightly.4c8cf32/rome-linux-arm64", + "sha512": "1eb832e8042cdd690d46487be2d7c67eb068684cd4f95831dc42ead68bef582d991fd19c87273133175235c6411fb5cb4e67cefec77b71b6354fea4d8a270c58" }, { - "type": "archive", + "type": "file", + "dest-filename": "rome", "only-arches": ["x86_64"], - "url": "https://registry.npmjs.org/@rometools/cli-linux-x64/-/cli-linux-x64-12.1.1.tgz", - "sha512": "0ac2e3658b4b41d2a831cae85d72949997721507e0565ec2f282080dc24dce61d929d57046123533e9caff4be9885b558c2b7a8fe0b0da00d89284128a14edd3" + "url": "https://github.com/rome/tools/releases/download/cli%2Fv12.1.3-nightly.4c8cf32/rome-linux-x64", + "sha512": "6ee701d85cca7655e39f9a0b414e1f75cb423beb4032af5ccebe9510a3cd1266b136c805b3a4b32062a7df4c18c37909580cf42ca7687fe454258295ee25b5fb" } ] }, @@ -157,7 +159,7 @@ { "type": "git", "url": "https://gitlab.gnome.org/Teams/Design/icon-development-kit-www.git", - "commit": "f2ecae16b8303d196577ebbbcb320d7a28ee0c69" + "commit": "3ac8811ad9de28006ce1d9e3ea9c4eaca2422c5d" } ], "modules": [ @@ -224,6 +226,7 @@ } ], "post-install": [ + "rm -rf /app/share/doc/appstream", "cp -a /usr/share/gtk-doc/html/. /app/share/doc/", "rm -r /app/share/doc/appstream", "cp -a /usr/share/doc/. /app/share/doc/", diff --git a/re.sonny.Workbench.json b/re.sonny.Workbench.json index 8efef90d9..05f5f67ed 100644 --- a/re.sonny.Workbench.json +++ b/re.sonny.Workbench.json @@ -120,8 +120,8 @@ "sources": [ { "type": "archive", - "url": "https://download.gnome.org/sources/libshumate/1.0/libshumate-1.0.3.tar.xz", - "sha256": "77a192f0dfec082b8de20b1939f3adf03eed41114d49fdaae2bbb2729ceb015a" + "url": "https://download.gnome.org/sources/libshumate/1.0/libshumate-1.0.5.tar.xz", + "sha256": "a8cfd8df9177ee44b04733b017af13c9e93f98765cdc89b750a48edaf701956c" } ] }, @@ -131,16 +131,18 @@ "build-commands": ["chmod +x rome", "cp rome /app/bin/rome"], "sources": [ { - "type": "archive", + "type": "file", + "dest-filename": "rome", "only-arches": ["aarch64"], - "url": "https://registry.npmjs.org/@rometools/cli-linux-arm64/-/cli-linux-arm64-12.1.1.tgz", - "sha512": "8ca25e4fa488d5df5b90094c398977750b73bd38bdf1db0903310cf754955cb9793a78e4e7967d406f5fd44e276d2efa2cae1e65a34c70aaacec5da14b255e75" + "url": "https://github.com/rome/tools/releases/download/cli%2Fv12.1.3-nightly.4c8cf32/rome-linux-arm64", + "sha512": "1eb832e8042cdd690d46487be2d7c67eb068684cd4f95831dc42ead68bef582d991fd19c87273133175235c6411fb5cb4e67cefec77b71b6354fea4d8a270c58" }, { - "type": "archive", + "type": "file", + "dest-filename": "rome", "only-arches": ["x86_64"], - "url": "https://registry.npmjs.org/@rometools/cli-linux-x64/-/cli-linux-x64-12.1.1.tgz", - "sha512": "0ac2e3658b4b41d2a831cae85d72949997721507e0565ec2f282080dc24dce61d929d57046123533e9caff4be9885b558c2b7a8fe0b0da00d89284128a14edd3" + "url": "https://github.com/rome/tools/releases/download/cli%2Fv12.1.3-nightly.4c8cf32/rome-linux-x64", + "sha512": "6ee701d85cca7655e39f9a0b414e1f75cb423beb4032af5ccebe9510a3cd1266b136c805b3a4b32062a7df4c18c37909580cf42ca7687fe454258295ee25b5fb" } ] }, @@ -224,6 +226,7 @@ } ], "post-install": [ + "rm -rf /app/share/doc/appstream", "cp -a /usr/share/gtk-doc/html/. /app/share/doc/", "rm -r /app/share/doc/appstream", "cp -a /usr/share/doc/. /app/share/doc/", From f89137758da981be0953cc33a50566579cc7c174 Mon Sep 17 00:00:00 2001 From: Sriyansh Shivam <96797205+SoNiC-HeRE@users.noreply.github.com> Date: Tue, 8 Aug 2023 00:35:12 +0530 Subject: [PATCH 005/461] library: Adds columnview entry (#437) * Add columnview * test * Update * Clean Up and implement colview * Refactoring and applied suggested changes * Applied changes * Progress * Updated * Update * Update * Reverse * Applied Suggested Changes * Minor Change --- src/Library/demos/Column View/main.blp | 44 ++++++++++ src/Library/demos/Column View/main.js | 105 ++++++++++++++++++++++++ src/Library/demos/Column View/main.json | 7 ++ 3 files changed, 156 insertions(+) create mode 100644 src/Library/demos/Column View/main.blp create mode 100644 src/Library/demos/Column View/main.js create mode 100644 src/Library/demos/Column View/main.json diff --git a/src/Library/demos/Column View/main.blp b/src/Library/demos/Column View/main.blp new file mode 100644 index 000000000..b6ed143cc --- /dev/null +++ b/src/Library/demos/Column View/main.blp @@ -0,0 +1,44 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + title: _("Column View"); + description: _("Presents a large dynamic list of items using multiple columns with headers"); + valign: start; + + Adw.Clamp { + maximum-size: 240; + + Box { + orientation: vertical; + spacing: 12; + + LinkButton { + label: _("Documentation"); + uri: "https://docs.gtk.org/gtk4/class.ColumnView.html"; + } + + Frame { + ColumnView column_view { + show-column-separators: true; + show-row-separators: true; + + ColumnViewColumn col1 { + title: _("Name"); + factory: SignalListItemFactory{}; + } + + ColumnViewColumn col2 { + title: _("Size"); + factory: SignalListItemFactory {}; + } + + ColumnViewColumn col3 { + title: _("Date"); + factory: SignalListItemFactory {}; + } + } + } + } + } +} diff --git a/src/Library/demos/Column View/main.js b/src/Library/demos/Column View/main.js new file mode 100644 index 000000000..32f3d9ebf --- /dev/null +++ b/src/Library/demos/Column View/main.js @@ -0,0 +1,105 @@ +import Gtk from "gi://Gtk"; +import Gio from "gi://Gio"; +import GObject from "gi://GObject"; + +const column_view = workbench.builder.get_object("column_view"); +const col1 = workbench.builder.get_object("col1"); +const col2 = workbench.builder.get_object("col2"); +const col3 = workbench.builder.get_object("col3"); + +//Model +const dir = Gio.File.new_for_path(pkg.pkgdatadir).resolve_relative_path( + "Library/demos", +); + +const data_model = new Gtk.DirectoryList({ + file: dir, + attributes: "standard::*,time::modified", +}); + +const sort_model = new Gtk.SortListModel({ + model: data_model, + sorter: column_view.sorter, +}); + +column_view.model = new Gtk.SingleSelection({ + model: sort_model, +}); + +col1.sorter = new Gtk.StringSorter({ + expression: new Gtk.ClosureExpression( + GObject.TYPE_STRING, + (fileInfo) => fileInfo.get_display_name(), + null, + ), +}); + +col2.sorter = new Gtk.NumericSorter({ + expression: new Gtk.ClosureExpression( + GObject.TYPE_INT, + (fileInfo) => fileInfo.get_size(), + null, + ), +}); + +col3.sorter = new Gtk.NumericSorter({ + expression: new Gtk.ClosureExpression( + GObject.TYPE_INT64, + (fileInfo) => fileInfo.get_modification_date_time().to_unix(), + null, + ), +}); + +//View +//Column 1 +const factory_col1 = col1.factory; +factory_col1.connect("setup", (factory, list_item) => { + const label = new Gtk.Label({ + margin_start: 12, + margin_end: 12, + }); + list_item.set_child(label); +}); +factory_col1.connect("bind", (factory, list_item) => { + const label_widget = list_item.get_child(); + const model_item = list_item.get_item(); + label_widget.label = model_item.get_display_name(); +}); + +//Column 2 +const factory_col2 = col2.factory; +factory_col2.connect("setup", (factory, list_item) => { + const label = new Gtk.Label({ + margin_start: 12, + margin_end: 12, + }); + list_item.set_child(label); +}); +factory_col2.connect("bind", (factory, list_item) => { + const label_widget = list_item.get_child(); + const model_item = list_item.get_item(); + const size = model_item.get_size(); + if (Math.floor(size / 1_000_000_000) > 0) + label_widget.label = `${(size / 1_000_000_000).toFixed(1)} GB`; + else if (Math.floor(size / 1_000_000) > 0) + label_widget.label = `${(size / 1_000_000).toFixed(1)} MB`; + else if (Math.floor(size / 1000) > 0) + label_widget.label = `${(size / 1000).toFixed(1)} kB`; + else label_widget.label = `${size / 1000} bytes`; +}); + +//Column 3 +const factory_col3 = col3.factory; +factory_col3.connect("setup", (factory, list_item) => { + const label = new Gtk.Label({ + margin_start: 12, + margin_end: 12, + }); + list_item.set_child(label); +}); +factory_col3.connect("bind", (factory, list_item) => { + const label_widget = list_item.get_child(); + const model_item = list_item.get_item(); + const date = model_item.get_modification_date_time(); + label_widget.label = date.format("%F"); +}); diff --git a/src/Library/demos/Column View/main.json b/src/Library/demos/Column View/main.json new file mode 100644 index 000000000..1c0c72913 --- /dev/null +++ b/src/Library/demos/Column View/main.json @@ -0,0 +1,7 @@ +{ + "name": "Column View", + "category": "layout", + "description": "Presents a large dynamic list of items using multiple columns with headers", + "panels": ["ui", "preview"], + "autorun": true +} From 2831d4d0605fe5f73a0ad5d6587a61cad8da4e16 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Tue, 8 Aug 2023 00:51:10 +0200 Subject: [PATCH 006/461] Fix build when appstream folder is absent --- re.sonny.Workbench.Devel.json | 2 +- re.sonny.Workbench.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/re.sonny.Workbench.Devel.json b/re.sonny.Workbench.Devel.json index 1c0f5248d..216d59d93 100644 --- a/re.sonny.Workbench.Devel.json +++ b/re.sonny.Workbench.Devel.json @@ -228,7 +228,7 @@ "post-install": [ "rm -rf /app/share/doc/appstream", "cp -a /usr/share/gtk-doc/html/. /app/share/doc/", - "rm -r /app/share/doc/appstream", + "rm -rf /app/share/doc/appstream", "cp -a /usr/share/doc/. /app/share/doc/", "cp -a /usr/lib/sdk/vala/bin/. /app/bin/", "cp -a /usr/lib/sdk/vala/lib/. /app/lib/", diff --git a/re.sonny.Workbench.json b/re.sonny.Workbench.json index 05f5f67ed..9f6fcb5be 100644 --- a/re.sonny.Workbench.json +++ b/re.sonny.Workbench.json @@ -228,7 +228,7 @@ "post-install": [ "rm -rf /app/share/doc/appstream", "cp -a /usr/share/gtk-doc/html/. /app/share/doc/", - "rm -r /app/share/doc/appstream", + "rm -rf /app/share/doc/appstream", "cp -a /usr/share/doc/. /app/share/doc/", "cp -a /usr/lib/sdk/vala/bin/. /app/bin/", "cp -a /usr/lib/sdk/vala/lib/. /app/lib/", From 90b03fd8fabe5ecd1cd74f788d363d895407082d Mon Sep 17 00:00:00 2001 From: AkshayWarrier <58233418+AkshayWarrier@users.noreply.github.com> Date: Wed, 9 Aug 2023 05:14:52 +0530 Subject: [PATCH 007/461] library: Add Menu entry (#445) * library: Add Menu entry * Menu: Minor change from review Co-authored-by: Andy Holmes <1265208+andyholmes@users.noreply.github.com> * Set default text color to green This should be visible in any color scheme. --------- Co-authored-by: Andy Holmes <1265208+andyholmes@users.noreply.github.com> Co-authored-by: Andy Holmes --- src/Library/demos/Menu/main.blp | 159 +++++++++++++++++++++++++++++++ src/Library/demos/Menu/main.js | 57 +++++++++++ src/Library/demos/Menu/main.json | 7 ++ 3 files changed, 223 insertions(+) create mode 100644 src/Library/demos/Menu/main.blp create mode 100644 src/Library/demos/Menu/main.js create mode 100644 src/Library/demos/Menu/main.json diff --git a/src/Library/demos/Menu/main.blp b/src/Library/demos/Menu/main.blp new file mode 100644 index 000000000..b88dcfc9b --- /dev/null +++ b/src/Library/demos/Menu/main.blp @@ -0,0 +1,159 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage demo { + title: _("Menu"); + description: _("Display structured menus with items, sections and submenus"); + + Box { + halign: center; + orientation: vertical; + + Box { + orientation: vertical; + spacing: 42; + + Adw.PreferencesGroup { + title: _("Primary and Secondary Menus"); + description: _("Used with controls such as menu buttons"); + + MenuButton { + halign: center; + label: _("Menu Button"); + menu-model: demo_menu; + } + } + + Adw.PreferencesGroup { + title: _("Context Menus"); + description: _("Menus that popup on right-clicking a widget"); + + Adw.Clamp { + maximum-size: 500; + + Frame { + Label label { + margin-top: 6; + margin-bottom: 6; + margin-start: 6; + margin-end: 6; + wrap: true; + wrap-mode: char; + selectable: true; + label: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vel elit scelerisque mauris pellentesque pulvinar. Molestie nunc non blandit massa enim nec dui nunc."; + extra-menu: context_menu; + } + } + } + } + + Box { + halign: center; + + LinkButton { + label: "GJS Guide"; + uri: "https://gjs.guide/guides/gio/actions-and-menus.html#gmenu"; + } + + LinkButton { + label: "Human Interface Guidelines"; + uri: "https://developer.gnome.org/hig/patterns/controls/menus.html"; + } + } + } + } +} + +menu demo_menu { + item { + label: _("New File"); + } + + section { + item { + label: _("New Terminal"); + } + + item { + label: _("New Build Terminal"); + } + + item { + label: _("New Runtime Terminal"); + } + } + + section { + label: _("Settings"); + + submenu { + label: _("Appearance"); + + item { + label: _("System Default"); + } + + item { + label: _("Force Light Mode"); + } + + item { + label: _("Force Dark Mode"); + } + } + + submenu { + label: _("Accessibility"); + + item { + label: _("High Contrast"); + } + + section { + label: _("Text Direction"); + + item { + label: _("Left-to-Right"); + } + + item { + label: _("Right-to-Left"); + } + } + } + } +} + +menu context_menu { + item { + label: _("Italics"); + action: "text.italic"; + } + + item { + label: _("Bold"); + action: "text.bold"; + } + + submenu { + label: _("Font Color"); + + item { + label: _("Green"); + action: "text.color"; + target: "green"; + } + + item { + label: _("Blue"); + action: "text.color"; + target: "blue"; + } + + item { + label: _("Red"); + action: "text.color"; + target: "red"; + } + } +} diff --git a/src/Library/demos/Menu/main.js b/src/Library/demos/Menu/main.js new file mode 100644 index 000000000..f83a66219 --- /dev/null +++ b/src/Library/demos/Menu/main.js @@ -0,0 +1,57 @@ +import GLib from "gi://GLib"; +import Gio from "gi://Gio"; +import Pango from "gi://Pango"; + +const label = workbench.builder.get_object("label"); + +const text_group = new Gio.SimpleActionGroup(); +label.insert_action_group("text", text_group); + +const text_state = { italic: false, bold: false, foreground: "green" }; + +const italic_action = new Gio.SimpleAction({ + name: "italic", + state: GLib.Variant.new_boolean(false), +}); + +italic_action.connect("notify::state", (action) => { + if (action.state.unpack()) text_state["italic"] = true; + else text_state["italic"] = false; + label.attributes = stateToAttr(text_state); +}); +text_group.add_action(italic_action); + +const bold_action = new Gio.SimpleAction({ + name: "bold", + state: GLib.Variant.new_boolean(false), +}); + +bold_action.connect("notify::state", (action) => { + if (action.state.unpack()) text_state["bold"] = true; + else text_state["bold"] = false; + label.attributes = stateToAttr(text_state); +}); +text_group.add_action(bold_action); + +const color_action = new Gio.SimpleAction({ + name: "color", + state: GLib.Variant.new_string("green"), + parameter_type: new GLib.VariantType("s"), +}); + +color_action.connect("notify::state", (action) => { + text_state["foreground"] = action.state.unpack(); + label.attributes = stateToAttr(text_state); +}); + +text_group.add_action(color_action); + +// Helper function to create a PangoAttrList from text_state +function stateToAttr(state) { + const attrs = []; + if (state["bold"]) attrs.push("0 -1 weight bold"); + if (state["italic"]) attrs.push("0 -1 style italic"); + attrs.push(`0 -1 foreground ${state["foreground"]}`); + const attr_string = attrs.join(", "); + return Pango.attr_list_from_string(attr_string); +} diff --git a/src/Library/demos/Menu/main.json b/src/Library/demos/Menu/main.json new file mode 100644 index 000000000..d53ac9845 --- /dev/null +++ b/src/Library/demos/Menu/main.json @@ -0,0 +1,7 @@ +{ + "name": "Menu", + "category": "controls", + "description": "Display structured menus with items, sections and submenus", + "panels": ["ui", "preview"], + "autorun": true +} From 4d3570fc57726381ff11bd9025b12429caa136e1 Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Tue, 8 Aug 2023 13:28:01 -0700 Subject: [PATCH 008/461] build: fix warnings from meson Use `meson.project_source_root()` where necessary. --- src/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/meson.build b/src/meson.build index 9e5fab5d9..b03269005 100644 --- a/src/meson.build +++ b/src/meson.build @@ -6,7 +6,7 @@ bin_conf.set('prefix', prefix) bin_conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir'))) bin_conf.set('datadir', datadir) bin_conf.set('pkgdatadir', pkgdatadir) -bin_conf.set('sourcedir', meson.source_root()) +bin_conf.set('sourcedir', meson.project_source_root()) blueprint_compiler = find_program( '/app/bin/blueprint-compiler', @@ -56,7 +56,7 @@ gresource = custom_target('gjspack', gjspack, '--appid=' + app_id, '--prefix', '/re/sonny/Workbench', - '--project-root', meson.source_root(), + '--project-root', meson.project_source_root(), '--resource-root', meson.project_source_root() / 'src', '--blueprint-compiler', blueprint_compiler, '--no-executable', From 495513a8416e226b758f71e76054703cef00cdce Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Tue, 8 Aug 2023 13:29:07 -0700 Subject: [PATCH 009/461] fix: add unimplemented method to `Workbench.CompletionRequest` The getter was missing for `Workbench.CompletionRequest:cancellable`. --- src/libworkbench/workbench-completion-request.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libworkbench/workbench-completion-request.c b/src/libworkbench/workbench-completion-request.c index 68029e463..7ed6fa0ea 100644 --- a/src/libworkbench/workbench-completion-request.c +++ b/src/libworkbench/workbench-completion-request.c @@ -295,6 +295,21 @@ workbench_completion_request_init (WorkbenchCompletionRequest *self) self->items = g_ptr_array_new_with_free_func (g_object_unref); } +/** + * workbench_completion_request_get_cancellable: (get-property cancellable) + * + * Get the cancellable for the request. + * + * Returns: (transfer none) (nullable): a `GCancellable` + */ +GCancellable * +workbench_completion_request_get_cancellable (WorkbenchCompletionRequest *request) +{ + g_return_val_if_fail (WORKBENCH_IS_COMPLETION_REQUEST (request), NULL); + + return request->cancellable; +} + /** * workbench_completion_request_get_context: (get-property context) * From 32eb95d20f61839e4b2134f49d1e490781ee710b Mon Sep 17 00:00:00 2001 From: Sriyansh Shivam <96797205+SoNiC-HeRE@users.noreply.github.com> Date: Thu, 10 Aug 2023 02:24:39 +0530 Subject: [PATCH 010/461] library: Adds file/uri launcher entry (#403) * Adds launcher entry * Updated code * Clean Up * Applied changes * Updated demo * Suggested Changes * New property --- src/Library/demos/Launcher/main.blp | 98 ++++++++++++++++++++++++ src/Library/demos/Launcher/main.js | 84 ++++++++++++++++++++ src/Library/demos/Launcher/main.json | 7 ++ src/Library/demos/Launcher/workbench.txt | 1 + 4 files changed, 190 insertions(+) create mode 100644 src/Library/demos/Launcher/main.blp create mode 100644 src/Library/demos/Launcher/main.js create mode 100644 src/Library/demos/Launcher/main.json create mode 100644 src/Library/demos/Launcher/workbench.txt diff --git a/src/Library/demos/Launcher/main.blp b/src/Library/demos/Launcher/main.blp new file mode 100644 index 000000000..f569b0ee3 --- /dev/null +++ b/src/Library/demos/Launcher/main.blp @@ -0,0 +1,98 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + title: _("Launcher"); + description: _("Collect the arguments that are needed to open a File or URI"); + + Adw.Clamp { + maximum-size: 640; + Box { + orientation: vertical; + spacing: 24; + + Gtk.StackSwitcher { + stack: stack; + halign: center; + } + + Gtk.Stack stack { + transition-type: crossfade; + vexpand: true; + + Gtk.StackPage { + name: "file_launcher"; + title: _("File Launcher"); + child: + Box { + orientation: vertical; + halign: center; + spacing: 24; + Box { + halign: center; + spacing: 18; + orientation: horizontal; + + Button launch_file { + label: _("Launch"); + styles ["suggested-action", "pill"] + } + Button file_location { + label: _("View"); + styles ["suggested-action", "pill"] + } + } + + Button change_file { + label: _("Select File"); + child: Box { + halign: center; + orientation: vertical; + Label { + label: _("Select File"); + styles ["title-4"] + } + Label file_name { + label: _("workbench.txt"); + styles ["dim-label", "body"] + } + }; + } + LinkButton { + label: _("API Reference"); + uri : "https://docs.gtk.org/gtk4/class.FileLauncher.html"; + } + }; + } + + Gtk.StackPage { + name: "uri_launcher"; + title: _("URI Launcher"); + child: + Box { + orientation: vertical; + halign: center; + spacing: 24; + Box { + halign: center; + Button uri_launch { + label: _("Launch"); + sensitive: false; + styles ["suggested-action", "pill"] + } + } + + Entry uri_details { + placeholder-text: _("Enter Uri"); + } + + LinkButton { + label: _("API Reference"); + uri : "https://docs.gtk.org/gtk4/class.UriLauncher.html"; + } + }; + } + } + } + } +} diff --git a/src/Library/demos/Launcher/main.js b/src/Library/demos/Launcher/main.js new file mode 100644 index 000000000..a08b4fa0e --- /dev/null +++ b/src/Library/demos/Launcher/main.js @@ -0,0 +1,84 @@ +import Gtk from "gi://Gtk"; +import Gdk from "gi://Gdk"; +import Gio from "gi://Gio"; +import GLib from "gi://GLib"; + +const launch_file = workbench.builder.get_object("launch_file"); +const file_name = workbench.builder.get_object("file_name"); +const file_location = workbench.builder.get_object("file_location"); +const change_file = workbench.builder.get_object("change_file"); +const uri_launch = workbench.builder.get_object("uri_launch"); +const uri_details = workbench.builder.get_object("uri_details"); +const change_uri = workbench.builder.get_object("change_uri"); + +Gio._promisify(Gtk.FileLauncher.prototype, "launch", "launch_finish"); +Gio._promisify( + Gtk.FileLauncher.prototype, + "open_containing_folder", + "open_containing_folder_finish", +); +Gio._promisify(Gtk.FileDialog.prototype, "open", "open_finish"); +Gio._promisify(Gtk.UriLauncher.prototype, "launch", "launch_finish"); + +const file_launcher = new Gtk.FileLauncher(); +const uri_launcher = new Gtk.UriLauncher(); +const file = Gio.File.new_for_path(pkg.pkgdatadir).resolve_relative_path( + "Library/demos/Launcher/workbench.txt", +); +file_launcher.set_file(file); +file_launcher.always_ask = true; + +//File Launcher +launch_file.connect("clicked", () => { + file_launcher.launch(workbench.window, null).catch(logError); +}); + +file_launcher.connect("notify::file", () => { + const file_info = file_launcher.get_file(); + const details = file_info.query_info( + "standard::*", + Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + null, + ); + file_name.label = details.get_name(); +}); + +file_location.connect("clicked", () => { + file_launcher.open_containing_folder(workbench.window, null).catch(logError); +}); + +change_file.connect("clicked", () => { + let new_file = null; + + const dialog_for_file = new Gtk.FileDialog({ + title: _("Select File"), + modal: true, + }); + dialog_for_file + .open(workbench.window, null) + .then((result) => { + new_file = result; + }) + .catch((err) => { + console.debug(err.message); + }) + .finally(() => { + file_launcher.set_file(new_file); + }); +}); + +// URI Launcher +uri_launch.connect("clicked", () => { + uri_launcher.launch(workbench.window, null).catch(logError); +}); +uri_details.connect("changed", () => { + const text = uri_details.get_text(); + + uri_launcher.set_uri(text); + + try { + uri_launch.sensitive = GLib.Uri.is_valid(text, GLib.UriFlags.NONE); + } catch { + uri_launch.sensitive = false; + } +}); diff --git a/src/Library/demos/Launcher/main.json b/src/Library/demos/Launcher/main.json new file mode 100644 index 000000000..cb557c0f4 --- /dev/null +++ b/src/Library/demos/Launcher/main.json @@ -0,0 +1,7 @@ +{ + "name": "Launcher", + "category": "controls", + "description": "Collect the arguments that are needed to open a File or URI", + "panels": ["code", "preview"], + "autorun": true +} diff --git a/src/Library/demos/Launcher/workbench.txt b/src/Library/demos/Launcher/workbench.txt new file mode 100644 index 000000000..c048c7d68 --- /dev/null +++ b/src/Library/demos/Launcher/workbench.txt @@ -0,0 +1 @@ +Hello 👋 from Workbench From ea51f37f0f1e11c855d118ea148e3fe77a784328 Mon Sep 17 00:00:00 2001 From: Alex <47825679+SpikedPaladin@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:30:05 +0300 Subject: [PATCH 011/461] library: Add vala demo for Text View (#476) * library: Add vala demo for Text View * Fix for code review * Fix for code review #2 --- src/Library/demos/Text View/main.vala | 57 +++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/Library/demos/Text View/main.vala diff --git a/src/Library/demos/Text View/main.vala b/src/Library/demos/Text View/main.vala new file mode 100644 index 000000000..0929c7f09 --- /dev/null +++ b/src/Library/demos/Text View/main.vala @@ -0,0 +1,57 @@ +#!/usr/bin/env -S vala workbench.vala --pkg gtk4 --pkg libadwaita-1 + +void main () { + var textview = (Gtk.TextView) workbench.builder.get_object("textview"); + var select = (Gtk.Button) workbench.builder.get_object("select"); + var copy = (Gtk.Button) workbench.builder.get_object("copy"); + var cut = (Gtk.Button) workbench.builder.get_object("cut"); + var clear = (Gtk.Button) workbench.builder.get_object("clear"); + var paste = (Gtk.Button) workbench.builder.get_object("paste"); + + Gdk.Display display = Gdk.Display.get_default(); + Gdk.Clipboard clipboard = display.get_clipboard(); + Gtk.TextBuffer buffer = textview.buffer; + + buffer.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vel elit scelerisque mauris pellentesque pulvinar. Molestie nunc non blandit massa enim nec dui nunc. Turpis in eu mi bibendum neque egestas congue quisque. Sed velit dignissim sodales ut. Massa tempor nec feugiat nisl pretium fusce id velit. Vitae congue eu consequat ac felis donec et. Ultrices sagittis orci a scelerisque purus semper eget duis at. Habitant morbi tristique senectus et netus et malesuada fames ac. Vitae aliquet nec ullamcorper sit amet risus nullam. Tortor at auctor urna nunc. Eget velit aliquet sagittis id consectetur purus. Libero id faucibus nisl tincidunt eget. Nunc consequat interdum varius sit amet mattis. Enim facilisis gravida neque convallis. Dolor sit amet consectetur adipiscing elit ut aliquam purus. Venenatis tellus in metus vulputate eu scelerisque.Sit amet luctus venenatis lectus magna fringilla urna. Eget nunc lobortis mattis aliquam. Urna duis convallis convallis tellus id interdum velit. Fames ac turpis egestas maecenas. Venenatis lectus magna fringilla urna porttitor rhoncus dolor. Egestas erat imperdiet sed euismod nisi porta lorem mollis aliquam. Eget est lorem ipsum dolor sit amet consectetur. Eget nunc lobortis mattis aliquam faucibus purus in. Iaculis nunc sed augue lacus viverra vitae. Euismod elementum nisi quis eleifend. Et pharetra pharetra massa massa ultricies mi quis. Volutpat odio facilisis mauris sit. Enim ut tellus elementum sagittis vitae et. Volutpat sed cras ornare arcu dui vivamus arcu felis. Arcu vitae elementum curabitur vitae nunc sed. Porttitor rhoncus dolor purus non enim. Scelerisque fermentum dui faucibus in ornare quam viverra. Amet purus gravida quis blandit turpis cursus. Faucibus pulvinar elementum integer enim. Aenean et tortor at risus viverra adipiscing at in.Vitae ultricies leo integer malesuada nunc vel. Quis lectus nulla at volutpat diam ut. Donec ac odio tempor orci dapibus ultrices. Justo eget magna fermentum iaculis eu non diam. Mauris cursus mattis molestie a iaculis at erat pellentesque. Phasellus faucibus scelerisque eleifend donec pretium. Blandit volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque. Habitant morbi tristique senectus et netus. Nunc faucibus a pellentesque sit amet porttitor eget dolor. Nulla malesuada pellentesque elit eget. Tortor vitae purus faucibus ornare suspendisse sed nisi lacus sed. Sollicitudin ac orci phasellus egestas tellus. In hendrerit gravida rutrum quisque non tellus orci ac. Suspendisse ultrices gravida dictum fusce ut placerat. Varius morbi enim nunc faucibus. Tellus elementum sagittis vitae et leo duis ut diam. Velit dignissim sodales ut eu sem integer. Sapien eget mi proin sed libero enim. Odio euismod lacinia at quis risus. Tellus at urna condimentum mattis pellentesque id."; + + copy.clicked.connect(() => { + if (buffer.get_has_selection()) { + buffer.copy_clipboard(clipboard); + message("Text copied to clipboard"); + } else { + message("No text selected to copy"); + } + }); + paste.clicked.connect(() => { + buffer.paste_clipboard(clipboard, null, true); + message("Text pasted"); + }); + cut.clicked.connect(() => { + if (buffer.get_has_selection()) { + buffer.cut_clipboard(clipboard, true); + message("Text cut to clipboard"); + } else { + message("No text selected to cut"); + } + }); + select.clicked.connect(() => { + Gtk.TextIter start, end; + + buffer.get_start_iter(out start); + buffer.get_end_iter(out end); + + buffer.select_range(start, end); + }); + clear.clicked.connect(() => { + Gtk.TextIter start, end; + + buffer.get_start_iter(out start); + buffer.get_end_iter(out end); + + buffer.@delete(ref start, ref end); + }); + + textview.copy_clipboard.connect(() => message("Text copied to clipboard")); + textview.cut_clipboard.connect(() => message("Text cut to clipboard")); + textview.paste_clipboard.connect(() => message("Text pasted")); +} From a6bd074a92a3051e4c2498f18fdd877084897e91 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Wed, 9 Aug 2023 23:36:55 +0200 Subject: [PATCH 012/461] library: Some improvements to the Launcher demo --- src/Library/demos/Launcher/main.blp | 103 +++++++++++++-------------- src/Library/demos/Launcher/main.js | 64 +++++++---------- src/Library/demos/Launcher/main.json | 4 +- 3 files changed, 80 insertions(+), 91 deletions(-) diff --git a/src/Library/demos/Launcher/main.blp b/src/Library/demos/Launcher/main.blp index f569b0ee3..c80c28577 100644 --- a/src/Library/demos/Launcher/main.blp +++ b/src/Library/demos/Launcher/main.blp @@ -3,7 +3,7 @@ using Adw 1; Adw.StatusPage { title: _("Launcher"); - description: _("Collect the arguments that are needed to open a File or URI"); + description: _("Open a File or URI"); Adw.Clamp { maximum-size: 640; @@ -23,73 +23,72 @@ Adw.StatusPage { Gtk.StackPage { name: "file_launcher"; title: _("File Launcher"); - child: + child: Box { + orientation: vertical; + halign: center; + spacing: 24; Box { - orientation: vertical; halign: center; - spacing: 24; - Box { - halign: center; - spacing: 18; - orientation: horizontal; + spacing: 6; + orientation: horizontal; + homogeneous: true; - Button launch_file { - label: _("Launch"); - styles ["suggested-action", "pill"] - } - Button file_location { - label: _("View"); - styles ["suggested-action", "pill"] - } + Button launch_file { + label: _("Launch"); + styles ["suggested-action", "pill"] } - - Button change_file { - label: _("Select File"); - child: Box { - halign: center; - orientation: vertical; - Label { - label: _("Select File"); - styles ["title-4"] - } - Label file_name { - label: _("workbench.txt"); - styles ["dim-label", "body"] - } - }; - } - LinkButton { - label: _("API Reference"); - uri : "https://docs.gtk.org/gtk4/class.FileLauncher.html"; + Button file_location { + label: _("View in Files"); + styles ["suggested-action", "pill"] } + } + + Button change_file { + label: _("Select File"); + child: Box { + halign: center; + orientation: vertical; + Label { + label: _("Select File"); + styles ["title-4"] + } + Label file_name { + label: _("workbench.txt"); + styles ["dim-label", "body"] + } + }; + } + LinkButton { + label: _("API Reference"); + uri : "https://docs.gtk.org/gtk4/class.FileLauncher.html"; + } }; } Gtk.StackPage { name: "uri_launcher"; title: _("URI Launcher"); - child: + child: Box { + orientation: vertical; + halign: center; + spacing: 24; Box { - orientation: vertical; halign: center; - spacing: 24; - Box { - halign: center; - Button uri_launch { - label: _("Launch"); - sensitive: false; - styles ["suggested-action", "pill"] - } + Button uri_launch { + label: _("Launch"); + styles ["suggested-action", "pill"] } + } - Entry uri_details { - placeholder-text: _("Enter Uri"); - } + Entry uri_details { + placeholder-text: _("Enter URL"); + text: "https://gnome.org"; + } - LinkButton { - label: _("API Reference"); - uri : "https://docs.gtk.org/gtk4/class.UriLauncher.html"; - } + LinkButton { + label: _("API Reference"); + uri : "https://docs.gtk.org/gtk4/class.UriLauncher.html"; + } }; } } diff --git a/src/Library/demos/Launcher/main.js b/src/Library/demos/Launcher/main.js index a08b4fa0e..eca15160b 100644 --- a/src/Library/demos/Launcher/main.js +++ b/src/Library/demos/Launcher/main.js @@ -3,14 +3,6 @@ import Gdk from "gi://Gdk"; import Gio from "gi://Gio"; import GLib from "gi://GLib"; -const launch_file = workbench.builder.get_object("launch_file"); -const file_name = workbench.builder.get_object("file_name"); -const file_location = workbench.builder.get_object("file_location"); -const change_file = workbench.builder.get_object("change_file"); -const uri_launch = workbench.builder.get_object("uri_launch"); -const uri_details = workbench.builder.get_object("uri_details"); -const change_uri = workbench.builder.get_object("change_uri"); - Gio._promisify(Gtk.FileLauncher.prototype, "launch", "launch_finish"); Gio._promisify( Gtk.FileLauncher.prototype, @@ -20,27 +12,32 @@ Gio._promisify( Gio._promisify(Gtk.FileDialog.prototype, "open", "open_finish"); Gio._promisify(Gtk.UriLauncher.prototype, "launch", "launch_finish"); -const file_launcher = new Gtk.FileLauncher(); -const uri_launcher = new Gtk.UriLauncher(); -const file = Gio.File.new_for_path(pkg.pkgdatadir).resolve_relative_path( - "Library/demos/Launcher/workbench.txt", -); -file_launcher.set_file(file); -file_launcher.always_ask = true; +const launch_file = workbench.builder.get_object("launch_file"); +const file_name = workbench.builder.get_object("file_name"); +const file_location = workbench.builder.get_object("file_location"); +const change_file = workbench.builder.get_object("change_file"); +const uri_launch = workbench.builder.get_object("uri_launch"); +const uri_details = workbench.builder.get_object("uri_details"); //File Launcher + +const file = Gio.File.new_for_uri(workbench.resolve("workbench.txt")); +const file_launcher = new Gtk.FileLauncher({ + always_ask: true, + file, +}); + launch_file.connect("clicked", () => { file_launcher.launch(workbench.window, null).catch(logError); }); file_launcher.connect("notify::file", () => { - const file_info = file_launcher.get_file(); - const details = file_info.query_info( - "standard::*", - Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + const details = file_launcher.file.query_info( + "standard::display-name", + Gio.FileQueryInfoFlags.NONE, null, ); - file_name.label = details.get_name(); + file_name.label = details.get_display_name(); }); file_location.connect("clicked", () => { @@ -48,31 +45,23 @@ file_location.connect("clicked", () => { }); change_file.connect("clicked", () => { - let new_file = null; - - const dialog_for_file = new Gtk.FileDialog({ - title: _("Select File"), - modal: true, - }); - dialog_for_file + new Gtk.FileDialog() .open(workbench.window, null) - .then((result) => { - new_file = result; - }) - .catch((err) => { - console.debug(err.message); + .then((file) => { + file_launcher.file = file; }) - .finally(() => { - file_launcher.set_file(new_file); - }); + .catch(logError); }); // URI Launcher + uri_launch.connect("clicked", () => { - uri_launcher.launch(workbench.window, null).catch(logError); + new Gtk.UriLauncher({ uri: uri_details.text }) + .launch(workbench.window, null) + .catch(logError); }); uri_details.connect("changed", () => { - const text = uri_details.get_text(); + const text = uri_details.text; uri_launcher.set_uri(text); @@ -82,3 +71,4 @@ uri_details.connect("changed", () => { uri_launch.sensitive = false; } }); + diff --git a/src/Library/demos/Launcher/main.json b/src/Library/demos/Launcher/main.json index cb557c0f4..2c876ca43 100644 --- a/src/Library/demos/Launcher/main.json +++ b/src/Library/demos/Launcher/main.json @@ -1,7 +1,7 @@ { "name": "Launcher", - "category": "controls", - "description": "Collect the arguments that are needed to open a File or URI", + "category": "platform", + "description": "Open a File or URI", "panels": ["code", "preview"], "autorun": true } From d48e919ff5c09f4b1f11439969bde662fe45c374 Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Wed, 9 Aug 2023 16:49:09 -0700 Subject: [PATCH 013/461] build: bump vte to 0.72.2 --- re.sonny.Workbench.Devel.json | 4 ++-- re.sonny.Workbench.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/re.sonny.Workbench.Devel.json b/re.sonny.Workbench.Devel.json index 216d59d93..1a62ee113 100644 --- a/re.sonny.Workbench.Devel.json +++ b/re.sonny.Workbench.Devel.json @@ -84,8 +84,8 @@ "sources": [ { "type": "archive", - "url": "https://download.gnome.org/sources/vte/0.72/vte-0.72.1.tar.xz", - "sha256": "0554f9f88d56ce2d78398fcc7f69bc00e53bbbc5f694e0ae1dcaf5286f89d7e4" + "url": "https://download.gnome.org/sources/vte/0.72/vte-0.72.2.tar.xz", + "sha256": "f7966fd185a6981f53964162b71cfef7e606495155d6f5827b72aa0dd6741c9e" } ] }, diff --git a/re.sonny.Workbench.json b/re.sonny.Workbench.json index 9f6fcb5be..b03701fa7 100644 --- a/re.sonny.Workbench.json +++ b/re.sonny.Workbench.json @@ -84,8 +84,8 @@ "sources": [ { "type": "archive", - "url": "https://download.gnome.org/sources/vte/0.72/vte-0.72.1.tar.xz", - "sha256": "0554f9f88d56ce2d78398fcc7f69bc00e53bbbc5f694e0ae1dcaf5286f89d7e4" + "url": "https://download.gnome.org/sources/vte/0.72/vte-0.72.2.tar.xz", + "sha256": "f7966fd185a6981f53964162b71cfef7e606495155d6f5827b72aa0dd6741c9e" } ] }, From dc62d212ad510078bbc83abaecee12ac842ca559 Mon Sep 17 00:00:00 2001 From: AkshayWarrier <58233418+AkshayWarrier@users.noreply.github.com> Date: Fri, 11 Aug 2023 14:36:55 +0530 Subject: [PATCH 014/461] library: Add Navigation Split View entry (#479) * library: Add Navigation Split View entry * Navigation Split View: Replicate Adw Demo * Navigation Split View: Changes from code review * Navigation Split View: Update main.json --- .../demos/Navigation Split View/main.blp | 66 +++++++++++++++++++ .../demos/Navigation Split View/main.json | 6 ++ 2 files changed, 72 insertions(+) create mode 100644 src/Library/demos/Navigation Split View/main.blp create mode 100644 src/Library/demos/Navigation Split View/main.json diff --git a/src/Library/demos/Navigation Split View/main.blp b/src/Library/demos/Navigation Split View/main.blp new file mode 100644 index 000000000..3c307ffd9 --- /dev/null +++ b/src/Library/demos/Navigation Split View/main.blp @@ -0,0 +1,66 @@ +using Gtk 4.0; +using Adw 1; + +Adw.Window { + width-request: 360; + height-request: 200; + default-width: 640; + default-height: 480; + + Adw.Breakpoint { + condition ("max-width: 400sp") + setters { + split_view.collapsed: true; + button.visible: true; + } + } + + content: Adw.NavigationSplitView split_view { + sidebar: Adw.NavigationPage { + title: "Sidebar"; + tag: "sidebar"; + child: Adw.ToolbarView { + + [top] + Adw.HeaderBar { + show-title: false; + } + + content: Adw.StatusPage { + title: _("Sidebar"); + + Button button { + visible: false; + halign: center; + can-shrink: true; + label: _("Open Content"); + action-name: "navigation.push"; + action-target: "'content'"; + styles ["pill"] + } + }; + }; + }; + + content: Adw.NavigationPage { + title: "Content"; + tag: "content"; + child: Adw.ToolbarView { + + [top] + Adw.HeaderBar { + show-title: false; + } + + content: Adw.StatusPage { + title: _("Content"); + + LinkButton { + label: "API Reference"; + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.NavigationSplitView.html"; + } + }; + }; + }; + }; +} diff --git a/src/Library/demos/Navigation Split View/main.json b/src/Library/demos/Navigation Split View/main.json new file mode 100644 index 000000000..30555a9a0 --- /dev/null +++ b/src/Library/demos/Navigation Split View/main.json @@ -0,0 +1,6 @@ +{ + "category": "navigation", + "description": "A widget presenting sidebar and content side by side or as a navigation view.", + "panels": ["ui", "preview"], + "autorun": true +} From 9b725a62315c2feb63941e745a33729c20c29b1e Mon Sep 17 00:00:00 2001 From: AkshayWarrier Date: Wed, 19 Jul 2023 10:26:20 +0530 Subject: [PATCH 015/461] library: Add Scrolled Window entry --- src/Library/demos/Scrolled Window/main.blp | 76 +++++++++++++++++ src/Library/demos/Scrolled Window/main.js | 91 +++++++++++++++++++++ src/Library/demos/Scrolled Window/main.json | 10 +++ 3 files changed, 177 insertions(+) create mode 100644 src/Library/demos/Scrolled Window/main.blp create mode 100644 src/Library/demos/Scrolled Window/main.js create mode 100644 src/Library/demos/Scrolled Window/main.json diff --git a/src/Library/demos/Scrolled Window/main.blp b/src/Library/demos/Scrolled Window/main.blp new file mode 100644 index 000000000..f25b6ee7e --- /dev/null +++ b/src/Library/demos/Scrolled Window/main.blp @@ -0,0 +1,76 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + title: _("Scrolled Window"); + description: _("A container that makes its child scrollable"); + + Adw.Clamp { + Box{ + hexpand: true; + vexpand: true; + spacing: 12; + orientation: vertical; + + Box{ + halign: center; + spacing: 18; + + Label { + label: _("Orientation"); + } + + Box { + margin-start: 6; + homogeneous: true; + halign: center; + styles ["linked"] + + ToggleButton toggle_orientation { + label: _("Horizontal"); + active: true; + } + ToggleButton { + label: _("Vertical"); + group: toggle_orientation; + } + } + + Label { + label: _("Go To"); + } + + Box{ + + Button button_start { + label: _("Start"); + } + + Button button_end { + label: _("End"); + } + styles ["linked"] + } + } + + + + ScrolledWindow scrolled_window { + margin-bottom: 24; + margin-top: 24; + has-frame: true; + propagate-natural-height: true; + max-content-height: 300; + + Box container { + homogeneous: true; + } + } + + LinkButton { + label: "Documentation"; + uri: "https://docs.gtk.org/gtk4/class.ScrolledWindow.html"; + } + } + } +} diff --git a/src/Library/demos/Scrolled Window/main.js b/src/Library/demos/Scrolled Window/main.js new file mode 100644 index 000000000..69cc52a3d --- /dev/null +++ b/src/Library/demos/Scrolled Window/main.js @@ -0,0 +1,91 @@ +import Gtk from "gi://Gtk"; +import Adw from "gi://Adw"; + +const scrolled_window = workbench.builder.get_object("scrolled_window"); +const container = workbench.builder.get_object("container"); +const toggle_orientation = workbench.builder.get_object("toggle_orientation"); +const button_start = workbench.builder.get_object("button_start"); +const button_end = workbench.builder.get_object("button_end"); + +const scrollbars = [ + scrolled_window.get_hscrollbar(), + scrolled_window.get_vscrollbar(), +]; +let orientation = 0; +toggle_orientation.connect("toggled", () => { + if (toggle_orientation.active) { + container.orientation = Gtk.Orientation.HORIZONTAL; + orientation = 0; + } else { + container.orientation = Gtk.Orientation.VERTICAL; + orientation = 1; + } +}); + +const num_items = 20; +for (let i = 0; i < num_items; i++) { + populateContainer(container, `Item ${i + 1}`); +} + +scrolled_window.connect("edge-reached", () => { + console.log("Edge Reached"); +}); + +button_start.connect("clicked", () => { + disableButtons(); + const scrollbar = scrollbars[orientation]; + const anim = createScrollbarAnim(scrollbar, 0); + anim.play(); +}); + +button_end.connect("clicked", () => { + disableButtons(); + const scrollbar = scrollbars[orientation]; + const anim = createScrollbarAnim(scrollbar, 1); + anim.play(); +}); + +function populateContainer(container, label) { + const item = new Adw.Bin({ + margin_top: 6, + margin_bottom: 6, + margin_start: 6, + margin_end: 6, + child: new Gtk.Label({ + label: label, + width_request: 100, + height_request: 100, + }), + css_classes: ["card"], + }); + container.append(item); +} + +function disableButtons() { + button_end.sensitive = false; + button_start.sensitive = false; +} + +function enableButtons() { + button_end.sensitive = true; + button_start.sensitive = true; +} + +function createScrollbarAnim(scrollbar, direction) { + // direction = 0 -> Animates to Start + // direction = 1 -> Animates to End + const adjustment = scrollbar.adjustment; + const target = Adw.PropertyAnimationTarget.new(adjustment, "value"); + const animation = new Adw.TimedAnimation({ + widget: scrollbar, + value_from: adjustment.value, + value_to: direction ? adjustment.upper : 0, + duration: 3000, + easing: Adw.Easing["LINEAR"], + target: target, + }); + animation.connect("done", () => { + enableButtons(); + }); + return animation; +} diff --git a/src/Library/demos/Scrolled Window/main.json b/src/Library/demos/Scrolled Window/main.json new file mode 100644 index 000000000..c422c2ec0 --- /dev/null +++ b/src/Library/demos/Scrolled Window/main.json @@ -0,0 +1,10 @@ +{ + "name": "Scrolled Window", + "category": "layout", + "description": "A container that makes its child scrollable", + "panels": [ + "ui", + "preview" + ], + "autorun": true +} From e90d3d2b23d5b67319b476f2c691d96bf8414dde Mon Sep 17 00:00:00 2001 From: AkshayWarrier Date: Thu, 20 Jul 2023 02:49:08 +0530 Subject: [PATCH 016/461] Scrolled Window: Minor change --- src/Library/demos/Scrolled Window/main.blp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Library/demos/Scrolled Window/main.blp b/src/Library/demos/Scrolled Window/main.blp index f25b6ee7e..57f16b258 100644 --- a/src/Library/demos/Scrolled Window/main.blp +++ b/src/Library/demos/Scrolled Window/main.blp @@ -68,7 +68,7 @@ Adw.StatusPage { } LinkButton { - label: "Documentation"; + label: "API Reference"; uri: "https://docs.gtk.org/gtk4/class.ScrolledWindow.html"; } } From 75c07263e85318ee9aa8561c33f56bb3b11603fc Mon Sep 17 00:00:00 2001 From: AkshayWarrier Date: Mon, 7 Aug 2023 22:20:17 +0530 Subject: [PATCH 017/461] Scrolled Window: Enable/disable start and end buttons properly --- src/Library/demos/Scrolled Window/main.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Library/demos/Scrolled Window/main.js b/src/Library/demos/Scrolled Window/main.js index 69cc52a3d..ff265869e 100644 --- a/src/Library/demos/Scrolled Window/main.js +++ b/src/Library/demos/Scrolled Window/main.js @@ -7,6 +7,8 @@ const toggle_orientation = workbench.builder.get_object("toggle_orientation"); const button_start = workbench.builder.get_object("button_start"); const button_end = workbench.builder.get_object("button_end"); +button_start.sensitive = false; + const scrollbars = [ scrolled_window.get_hscrollbar(), scrolled_window.get_vscrollbar(), @@ -28,6 +30,11 @@ for (let i = 0; i < num_items; i++) { } scrolled_window.connect("edge-reached", () => { + const scrollbar = scrollbars[orientation]; + const adj = scrollbar.adjustment; + // Enable end button if scrollbar is at the start + button_end.sensitive = adj.value === adj.lower; + button_start.sensitive = !button_end.sensitive; console.log("Edge Reached"); }); @@ -62,13 +69,8 @@ function populateContainer(container, label) { } function disableButtons() { - button_end.sensitive = false; button_start.sensitive = false; -} - -function enableButtons() { - button_end.sensitive = true; - button_start.sensitive = true; + button_end.sensitive = false; } function createScrollbarAnim(scrollbar, direction) { @@ -79,13 +81,10 @@ function createScrollbarAnim(scrollbar, direction) { const animation = new Adw.TimedAnimation({ widget: scrollbar, value_from: adjustment.value, - value_to: direction ? adjustment.upper : 0, - duration: 3000, + value_to: direction ? adjustment.upper - adjustment.page_size : 0, + duration: 1000, easing: Adw.Easing["LINEAR"], target: target, }); - animation.connect("done", () => { - enableButtons(); - }); return animation; } From 0d1a0bb2f4493840bf397820315fd640b465c4d7 Mon Sep 17 00:00:00 2001 From: AkshayWarrier Date: Thu, 10 Aug 2023 13:53:07 +0530 Subject: [PATCH 018/461] Scrolled Window: Better behaviour --- src/Library/demos/Scrolled Window/main.js | 52 ++++++++++++++--------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/Library/demos/Scrolled Window/main.js b/src/Library/demos/Scrolled Window/main.js index ff265869e..f77f60108 100644 --- a/src/Library/demos/Scrolled Window/main.js +++ b/src/Library/demos/Scrolled Window/main.js @@ -6,21 +6,20 @@ const container = workbench.builder.get_object("container"); const toggle_orientation = workbench.builder.get_object("toggle_orientation"); const button_start = workbench.builder.get_object("button_start"); const button_end = workbench.builder.get_object("button_end"); +let auto_scrolling = false; button_start.sensitive = false; -const scrollbars = [ - scrolled_window.get_hscrollbar(), - scrolled_window.get_vscrollbar(), -]; -let orientation = 0; +const scrollbars = { + [Gtk.Orientation.HORIZONTAL]: scrolled_window.get_hscrollbar(), + [Gtk.Orientation.VERTICAL]: scrolled_window.get_vscrollbar(), +}; + toggle_orientation.connect("toggled", () => { if (toggle_orientation.active) { container.orientation = Gtk.Orientation.HORIZONTAL; - orientation = 0; } else { container.orientation = Gtk.Orientation.VERTICAL; - orientation = 1; } }); @@ -29,25 +28,39 @@ for (let i = 0; i < num_items; i++) { populateContainer(container, `Item ${i + 1}`); } -scrolled_window.connect("edge-reached", () => { +for (const orientation in scrollbars) { const scrollbar = scrollbars[orientation]; const adj = scrollbar.adjustment; - // Enable end button if scrollbar is at the start - button_end.sensitive = adj.value === adj.lower; - button_start.sensitive = !button_end.sensitive; + adj.connect("value-changed", () => { + if (adj.value === adj.lower) { + button_end.sensitive = true; + button_start.sensitive = false; + } else if (adj.value === adj.upper - adj.page_size) { + button_end.sensitive = false; + button_start.sensitive = true; + } else { + // Disable buttons if scrollbar is auto-scrolling + button_end.sensitive = !auto_scrolling; + button_start.sensitive = !auto_scrolling; + } + }); +} + +scrolled_window.connect("edge-reached", () => { + const scrollbar = scrollbars[container.orientation]; console.log("Edge Reached"); }); button_start.connect("clicked", () => { - disableButtons(); - const scrollbar = scrollbars[orientation]; + auto_scrolling = true; + const scrollbar = scrollbars[container.orientation]; const anim = createScrollbarAnim(scrollbar, 0); anim.play(); }); button_end.connect("clicked", () => { - disableButtons(); - const scrollbar = scrollbars[orientation]; + auto_scrolling = true; + const scrollbar = scrollbars[container.orientation]; const anim = createScrollbarAnim(scrollbar, 1); anim.play(); }); @@ -68,11 +81,6 @@ function populateContainer(container, label) { container.append(item); } -function disableButtons() { - button_start.sensitive = false; - button_end.sensitive = false; -} - function createScrollbarAnim(scrollbar, direction) { // direction = 0 -> Animates to Start // direction = 1 -> Animates to End @@ -86,5 +94,9 @@ function createScrollbarAnim(scrollbar, direction) { easing: Adw.Easing["LINEAR"], target: target, }); + + animation.connect("done", () => { + auto_scrolling = false; + }); return animation; } From 520c09ae0de98c8b320d718f8b07c3b408424c27 Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Fri, 11 Aug 2023 08:13:58 -0500 Subject: [PATCH 019/461] library: add Overlay Split View entry (#463) --- src/Library/demos/Overlay Split View/main.blp | 85 +++++++++++++++++++ src/Library/demos/Overlay Split View/main.js | 13 +++ .../demos/Overlay Split View/main.json | 7 ++ 3 files changed, 105 insertions(+) create mode 100644 src/Library/demos/Overlay Split View/main.blp create mode 100644 src/Library/demos/Overlay Split View/main.js create mode 100644 src/Library/demos/Overlay Split View/main.json diff --git a/src/Library/demos/Overlay Split View/main.blp b/src/Library/demos/Overlay Split View/main.blp new file mode 100644 index 000000000..1e6502b5d --- /dev/null +++ b/src/Library/demos/Overlay Split View/main.blp @@ -0,0 +1,85 @@ +using Gtk 4.0; +using Adw 1; + +Adw.Window { + width-request: 360; + height-request: 200; + default-width: 640; + default-height: 480; + title: _("Overlay Split view"); + + Adw.Breakpoint { + condition ("max-width: 400sp") + setters { + split_view.collapsed: true; + } + } + + content: Adw.ToolbarView { + top-bar-style: raised; + + [top] + Adw.HeaderBar { + + [start] + ToggleButton show_sidebar_button { + icon-name: "dock-left"; + tooltip-text: _("Toggle Sidebar"); + active: bind split_view.show-sidebar; + visible: bind start_toggle.active; + } + + [end] + ToggleButton { + icon-name: "dock-right"; + tooltip-text: _("Toggle Sidebar"); + active: bind show_sidebar_button.active; + visible: bind end_toggle.active; + } + } + + content: Adw.OverlaySplitView split_view { + show-sidebar: bind show_sidebar_button.active; + + sidebar: Adw.StatusPage { + title: _("Sidebar"); + + child: Box { + orientation: vertical; + halign: center; + spacing: 18; + + ToggleButton start_toggle { + label: _("Start"); + can-shrink: true; + active: true; + styles ["pill"] + } + + ToggleButton end_toggle { + label: _("End"); + can-shrink: true; + group: start_toggle; + styles ["pill"] + } + }; + }; + + content: Adw.StatusPage { + title: _("Content"); + + Box { + orientation: vertical; + valign: center; + spacing: 18; + + LinkButton { + label: "API Reference"; + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.OverlaySplitView.html"; + margin-top: 24; + } + } + }; + }; + }; +} diff --git a/src/Library/demos/Overlay Split View/main.js b/src/Library/demos/Overlay Split View/main.js new file mode 100644 index 000000000..44ae37e2c --- /dev/null +++ b/src/Library/demos/Overlay Split View/main.js @@ -0,0 +1,13 @@ +import Gtk from "gi://Gtk"; + +const split_view = workbench.builder.get_object("split_view"); +const start_toggle = workbench.builder.get_object("start_toggle"); +const end_toggle = workbench.builder.get_object("end_toggle"); + +start_toggle.connect("toggled", () => { + split_view.sidebar_position = Gtk.PackType.START; +}); + +end_toggle.connect("toggled", () => { + split_view.sidebar_position = Gtk.PackType.END; +}); diff --git a/src/Library/demos/Overlay Split View/main.json b/src/Library/demos/Overlay Split View/main.json new file mode 100644 index 000000000..3e9dee673 --- /dev/null +++ b/src/Library/demos/Overlay Split View/main.json @@ -0,0 +1,7 @@ +{ + "name": "Overlay Split View", + "category": "navigation", + "description": "A content and sidebar view", + "panels": ["ui", "preview"], + "autorun": true +} From 07ed8db2b58880f26abd24155f24cbb6fe816d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n=20M=2EE?= <76420970+Diego-Ivan@users.noreply.github.com> Date: Fri, 11 Aug 2023 07:21:04 -0600 Subject: [PATCH 020/461] library: Port system APIs demos to Vala (#483) * library: Port Wallpaper and Screenshot demos to Vala * library: Port Account and Color Picker demos to Vala * library: Port Email demo to Vala * library: Port Location demo to Vala --- src/Library/demos/Account/main.vala | 54 ++++++++++ src/Library/demos/Color Picker/main.vala | 36 +++++++ src/Library/demos/Email/main.vala | 40 ++++++++ src/Library/demos/Location/main.vala | 125 +++++++++++++++++++++++ src/Library/demos/Screenshot/main.vala | 37 +++++++ src/Library/demos/Wallpaper/main.vala | 33 ++++++ 6 files changed, 325 insertions(+) create mode 100644 src/Library/demos/Account/main.vala create mode 100644 src/Library/demos/Color Picker/main.vala create mode 100644 src/Library/demos/Email/main.vala create mode 100644 src/Library/demos/Location/main.vala create mode 100644 src/Library/demos/Screenshot/main.vala create mode 100644 src/Library/demos/Wallpaper/main.vala diff --git a/src/Library/demos/Account/main.vala b/src/Library/demos/Account/main.vala new file mode 100644 index 000000000..b1e1cfcf8 --- /dev/null +++ b/src/Library/demos/Account/main.vala @@ -0,0 +1,54 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 --pkg libportal-gtk4 + +private Gtk.Revealer revealer; +private Adw.EntryRow entry; +private Adw.Avatar avatar; +private Gtk.Label username; +private Gtk.Label display; +private Xdp.Portal portal; +private Xdp.Parent parent; + +public void main () { + portal = new Xdp.Portal (); + parent = Xdp.parent_new_gtk (workbench.window); + + revealer = (Gtk.Revealer) workbench.builder.get_object ("revealer"); + entry = (Adw.EntryRow) workbench.builder.get_object ("entry"); + avatar = (Adw.Avatar) workbench.builder.get_object ("avatar"); + username = (Gtk.Label) workbench.builder.get_object ("username"); + display = (Gtk.Label) workbench.builder.get_object ("name"); + + var button = (Gtk.Button) workbench.builder.get_object ("button"); + button.clicked.connect (on_button_clicked); +} + +private async void on_button_clicked () { + try { + string reason = entry.text; + Variant result = yield portal.get_user_information (parent, reason, NONE, null); + + /* + * result is a Variant dictionary containing the following fields: + * id (s): the user id + * name (s): the users real name + * image (s): the uri of an image file for the users avatar picture + */ + + var id = (string) result.lookup_value ("id", VariantType.STRING); + var name = (string) result.lookup_value ("name", VariantType.STRING); + var uri = (string) result.lookup_value ("image", VariantType.STRING); + + var file = File.new_for_uri (uri); + var texture = Gdk.Texture.from_file (file); + + username.label = id; + display.label = name; + avatar.custom_image = texture; + revealer.reveal_child = true; + + entry.text = ""; + message ("Information Retrieved"); + } catch (Error e) { + critical (e.message); + } +} diff --git a/src/Library/demos/Color Picker/main.vala b/src/Library/demos/Color Picker/main.vala new file mode 100644 index 000000000..7663a5174 --- /dev/null +++ b/src/Library/demos/Color Picker/main.vala @@ -0,0 +1,36 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 --pkg libportal-gtk4 + +private Xdp.Portal portal; +private Xdp.Parent parent; + +public void main () { + portal = new Xdp.Portal (); + parent = Xdp.parent_new_gtk (workbench.window); + + var button = (Gtk.Button) workbench.builder.get_object ("button"); + button.clicked.connect (on_button_clicked); +} + +private async void on_button_clicked () { + try { + // result is a variant of the form (ddd), containing red green and blue components in the range [0,1] + Variant result = yield portal.pick_color (parent, null); + + double r, g, b; + VariantIter iter = result.iterator (); // Iterate over the array in the variant + iter.next ("d", out r); + iter.next ("d", out g); + iter.next ("d", out b); + + var color = Gdk.RGBA () { + red = (float) r, + green = (float) g, + blue = (float) b, + alpha = 1.0f + }; + + message (@"Selected color is $color"); + } catch (Error e) { + critical (e.message); + } +} diff --git a/src/Library/demos/Email/main.vala b/src/Library/demos/Email/main.vala new file mode 100644 index 000000000..a4624c526 --- /dev/null +++ b/src/Library/demos/Email/main.vala @@ -0,0 +1,40 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 --pkg libportal-gtk4 + +private Xdp.Portal portal; +private Xdp.Parent parent; +private Gtk.Entry entry; + +public void main () { + portal = new Xdp.Portal (); + parent = Xdp.parent_new_gtk (workbench.window); + + entry = (Gtk.Entry) workbench.builder.get_object ("entry"); + var button = (Gtk.Button) workbench.builder.get_object ("button"); + button.clicked.connect (on_button_clicked); +} + +private async void on_button_clicked () { + string email_address = entry.text; + + try { + bool success = yield portal.compose_email ( + parent, + { email_address }, // addresses + null, // cc + null, // bcc + "Email from Workbench", // subject + "Hello World!", // body + null, + NONE, + null + ); + + if (success) { + message ("Success"); + return; + } + message ("Failure: verify that you have an email application."); + } catch (Error e) { + critical (e.message); + } +} diff --git a/src/Library/demos/Location/main.vala b/src/Library/demos/Location/main.vala new file mode 100644 index 000000000..34a0ebe32 --- /dev/null +++ b/src/Library/demos/Location/main.vala @@ -0,0 +1,125 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 --pkg libportal-gtk4 + +private Xdp.Portal portal; +private Xdp.Parent parent; + +private Gtk.Revealer revealer; +private Gtk.Button start_button; +private Gtk.Button close_button; +private Gtk.SpinButton distance_threshold; +private Gtk.SpinButton time_threshold; +private Adw.ComboRow accuracy_button; + +private Gtk.Label latitude_label; +private Gtk.Label longitude_label; +private Gtk.Label accuracy_label; +private Gtk.Label altitude_label; +private Gtk.Label speed_label; +private Gtk.Label heading_label; +private Gtk.Label description_label; +private Gtk.Label timestamp_label; + +public void main () { + portal = new Xdp.Portal (); + parent = Xdp.parent_new_gtk (workbench.window); + + revealer = (Gtk.Revealer) workbench.builder.get_object ("revealer"); + start_button = (Gtk.Button) workbench.builder.get_object ("start"); + close_button = (Gtk.Button) workbench.builder.get_object ("close"); + distance_threshold = (Gtk.SpinButton) workbench.builder.get_object ("distance_threshold"); + time_threshold = (Gtk.SpinButton) workbench.builder.get_object ("time_threshold"); + accuracy_button = (Adw.ComboRow) workbench.builder.get_object ("accuracy_button"); + + latitude_label = (Gtk.Label) workbench.builder.get_object ("latitude"); + longitude_label = (Gtk.Label) workbench.builder.get_object ("longitude"); + accuracy_label = (Gtk.Label) workbench.builder.get_object ("accuracy"); + altitude_label = (Gtk.Label) workbench.builder.get_object ("altitude"); + speed_label = (Gtk.Label) workbench.builder.get_object ("speed"); + heading_label = (Gtk.Label) workbench.builder.get_object ("heading"); + description_label = (Gtk.Label) workbench.builder.get_object ("description"); + timestamp_label = (Gtk.Label) workbench.builder.get_object ("timestamp"); + + start_button.clicked.connect (start_session); + close_button.clicked.connect (close_session); + + time_threshold.value_changed.connect (() => { + message ("Time threshold changed"); + restart_session (); + }); + + distance_threshold.value_changed.connect (() => { + message ("Distance threshold changed"); + restart_session (); + }); + + accuracy_button.notify["selected-item"].connect (() => { + message ("Accuracy changed"); + restart_session (); + }); + + portal.location_updated.connect (on_location_updated); +} + +private void on_location_updated ( + double latitude, + double longitude, + double altitude, + double accuracy, + double speed, + double heading, + string description, + int64 timestamp_seconds, + int64 timestamp_ms +) { + message ("Location updated"); + latitude_label.label = latitude.to_string (); + longitude_label.label = longitude.to_string (); + accuracy_label.label = accuracy.to_string (); + altitude_label.label = altitude.to_string (); + speed_label.label = speed.to_string (); + heading_label.label = heading.to_string (); + description_label.label = description; + + // Convert UNIX timestamp to local date and time string + var timestamp = new DateTime.from_unix_local (timestamp_ms); + timestamp_label.label = timestamp.to_string (); +} + +private void restart_session () { + portal.location_monitor_stop (); + revealer.reveal_child = false; + start_session.begin (); +} + +private async void start_session () { + start_button.sensitive = false; + close_button.sensitive = true; + + try { + bool result = yield portal.location_monitor_start ( + parent, + (uint) distance_threshold.value, + (uint) time_threshold.value, + (Xdp.LocationAccuracy) accuracy_button.selected, + NONE, + null + ); + + if (result) { + message ("Location access granted"); + revealer.reveal_child = true; + return; + } + message ("Error retrieving location"); + } catch (Error e) { + critical (e.message); + } +} + +private void close_session () { + start_button.sensitive = false; + close_button.sensitive = false; + portal.location_monitor_stop (); + revealer.reveal_child = false; + message ("Session Closed"); +} diff --git a/src/Library/demos/Screenshot/main.vala b/src/Library/demos/Screenshot/main.vala new file mode 100644 index 000000000..6cb7d6c4e --- /dev/null +++ b/src/Library/demos/Screenshot/main.vala @@ -0,0 +1,37 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 --pkg libportal-gtk4 + +private Xdp.Portal portal; +private Xdp.Parent parent; +private Gtk.Picture picture; + +public void main () { + portal = new Xdp.Portal (); + parent = Xdp.parent_new_gtk (workbench.window); + picture = (Gtk.Picture) workbench.builder.get_object ("picture"); + + var button = (Gtk.Button) workbench.builder.get_object ("button"); + button.clicked.connect (on_button_clicked); +} + +private async void on_button_clicked () { + try { + string uri = yield portal.take_screenshot (parent, NONE, null); + picture.file = File.new_for_uri (uri); + } catch (Error e) { + show_permission_error (); + } +} + +private void show_permission_error () { + var dialog = new Adw.MessageDialog ( + workbench.window, + "Permission Error", + "Ensure Screenshot permission is enabled in\nSettings → Apps → Workbench" + ) { + close_response = "ok", + modal = true, + }; + + dialog.add_response ("ok", "OK"); + dialog.present (); +} diff --git a/src/Library/demos/Wallpaper/main.vala b/src/Library/demos/Wallpaper/main.vala new file mode 100644 index 000000000..dd7e610cf --- /dev/null +++ b/src/Library/demos/Wallpaper/main.vala @@ -0,0 +1,33 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 --pkg libportal-gtk4 + +private Xdp.Portal portal; +private Xdp.Parent parent; +private string image_uri; + +public void main () { + portal = new Xdp.Portal (); + parent = Xdp.parent_new_gtk (workbench.window); + image_uri = workbench.resolve ("./wallpaper.png"); + + var button = (Gtk.Button) workbench.builder.get_object ("button"); + button.clicked.connect (on_button_clicked); +} + +private async void on_button_clicked () { + try { + bool success = yield portal.set_wallpaper ( + parent, + image_uri, + PREVIEW | BACKGROUND | LOCKSCREEN, + null + ); + + if (success) { + message ("Wallpaper set successfully"); + return; + } + message ("Could not set wallpaper"); + } catch (Error e) { + critical (e.message); + } +} From 20bf5c4338bc4527a21d4cc6503f2d330060debe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n=20M=2EE?= <76420970+Diego-Ivan@users.noreply.github.com> Date: Sat, 12 Aug 2023 05:03:07 -0600 Subject: [PATCH 021/461] library: Port Event Controllers demo to Vala (#486) * library: Port Event Controllers demo to Vala * library: Cast workbench.window when add_controller is called --- src/Library/demos/Event Controllers/main.vala | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/Library/demos/Event Controllers/main.vala diff --git a/src/Library/demos/Event Controllers/main.vala b/src/Library/demos/Event Controllers/main.vala new file mode 100644 index 000000000..e2328c497 --- /dev/null +++ b/src/Library/demos/Event Controllers/main.vala @@ -0,0 +1,90 @@ +#!/usr/bin/env -S vala workbench.vala --pkg libadwaita-1 + +private bool ctrl_pressed = false; + +public void main () { + Gtk.Window window = workbench.window; + + var pic1 = (Gtk.Picture) workbench.builder.get_object ("pic1"); + var pic2 = (Gtk.Picture) workbench.builder.get_object ("pic2"); + + pic1.file = File.new_for_uri (workbench.resolve ("image1.png")); + pic2.file = File.new_for_uri (workbench.resolve ("image2.png")); + + var stack = (Gtk.Stack) workbench.builder.get_object ("stack"); + var primary_button = (Gtk.Button) workbench.builder.get_object ("primary_button"); + var middle_button = (Gtk.Button) workbench.builder.get_object ("middle_button"); + var secondary_button = (Gtk.Button) workbench.builder.get_object ("secondary_button"); + var ctrl_button = (Gtk.Button) workbench.builder.get_object ("ctrl_button"); + + var key_controller = new Gtk.EventControllerKey (); + // Gtk.Window hides Gtk.Widget's add_controller method, thus we need to cast it + ((Gtk.Widget) window).add_controller (key_controller); + + key_controller.key_pressed.connect ((keyval, keycode, state) => { + if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) { + ctrl_pressed = true; + } + return true; + }); + + key_controller.key_released.connect ((keyval, keycode, state) => { + if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) { + ctrl_pressed = false; + } + }); + + ctrl_button.clicked.connect (() => { + if (ctrl_pressed) { + ctrl_button.label = "Click to Deactivate"; + ctrl_button.add_css_class ("suggested-action"); + } else { + ctrl_button.label = "Ctrl + Click to Activate"; + ctrl_button.remove_css_class ("suggested-action"); + } + }); + + var gesture_click = new Gtk.GestureClick () { + button = 0 + }; + ((Gtk.Widget) window).add_controller (gesture_click); + + gesture_click.pressed.connect ((gesture, n_press, x, y) => { + switch (gesture.get_current_button ()) { + case Gdk.BUTTON_PRIMARY: + primary_button.add_css_class ("suggested-action"); + break; + case Gdk.BUTTON_MIDDLE: + middle_button.add_css_class ("suggested-action"); + break; + case Gdk.BUTTON_SECONDARY: + secondary_button.add_css_class ("suggested-action"); + break; + } + }); + + gesture_click.released.connect ((gesture, n_press, x, y) => { + switch (gesture.get_current_button ()) { + case Gdk.BUTTON_PRIMARY: + primary_button.remove_css_class ("suggested-action"); + break; + case Gdk.BUTTON_MIDDLE: + middle_button.remove_css_class ("suggested-action"); + break; + case Gdk.BUTTON_SECONDARY: + secondary_button.remove_css_class ("suggested-action"); + break; + } + }); + + var gesture_swipe = new Gtk.GestureSwipe (); + stack.add_controller (gesture_swipe); + + gesture_swipe.swipe.connect ((vel_x, vel_y) => { + if (vel_x > 0) { + stack.visible_child_name = "pic1"; + } else { + stack.visible_child_name = "pic2"; + } + }); +} From 0fc03952b661999ea39657bfd09282235371d6e7 Mon Sep 17 00:00:00 2001 From: AkshayWarrier <58233418+AkshayWarrier@users.noreply.github.com> Date: Sun, 13 Aug 2023 19:36:11 +0530 Subject: [PATCH 022/461] library: Add Power Profile Monitor demo (#489) --- .../demos/Power Profile Monitor/main.blp | 32 +++++++++++++++++++ .../demos/Power Profile Monitor/main.js | 25 +++++++++++++++ .../demos/Power Profile Monitor/main.json | 6 ++++ 3 files changed, 63 insertions(+) create mode 100644 src/Library/demos/Power Profile Monitor/main.blp create mode 100644 src/Library/demos/Power Profile Monitor/main.js create mode 100644 src/Library/demos/Power Profile Monitor/main.json diff --git a/src/Library/demos/Power Profile Monitor/main.blp b/src/Library/demos/Power Profile Monitor/main.blp new file mode 100644 index 000000000..4e4555892 --- /dev/null +++ b/src/Library/demos/Power Profile Monitor/main.blp @@ -0,0 +1,32 @@ +using Gtk 4.0; +using Adw 1; + +Adw.ToastOverlay overlay { + Adw.StatusPage { + title: _("Power Profile Monitor"); + description: _("Monitor Power Mode"); + + Box { + spacing: 24; + orientation: vertical; + + Box { + halign: center; + spacing: 6; + Image { + icon-name: "lightbulb-symbolic"; + styles ["dim-label"] + } + Label { + label: _("Try toggling Power Mode to \"Power Saver\" from Settings → Power\n or from Quick Toggles"); + styles ["dim-label"] + } + } + + LinkButton { + label: "API Reference"; + uri: "https://docs.gtk.org/gio/iface.PowerProfileMonitor.html"; + } + } + } +} diff --git a/src/Library/demos/Power Profile Monitor/main.js b/src/Library/demos/Power Profile Monitor/main.js new file mode 100644 index 000000000..604b29d6b --- /dev/null +++ b/src/Library/demos/Power Profile Monitor/main.js @@ -0,0 +1,25 @@ +import Adw from "gi://Adw"; +import Gio from "gi://Gio"; + +const power_profile_monitor = Gio.PowerProfileMonitor.dup_default(); +const overlay = workbench.builder.get_object("overlay"); + +power_profile_monitor.connect("notify::power-saver-enabled", () => { + let toast; + + if (power_profile_monitor.power_saver_enabled) { + toast = new Adw.Toast({ + title: "Backup paused to save power", + button_label: "Resume", + priority: Adw.ToastPriority.HIGH, + }); + } else { + toast = new Adw.Toast({ + title: "Backup resumed", + priority: Adw.ToastPriority.HIGH, + }); + } + + overlay.add_toast(toast); +}); + diff --git a/src/Library/demos/Power Profile Monitor/main.json b/src/Library/demos/Power Profile Monitor/main.json new file mode 100644 index 000000000..3a9be6e2f --- /dev/null +++ b/src/Library/demos/Power Profile Monitor/main.json @@ -0,0 +1,6 @@ +{ + "category": "platform", + "description": "Monitor Power Mode", + "panels": ["code", "preview"], + "autorun": true +} From b56c7e9c6b62e6e44b33dc417af0d35efd4a2816 Mon Sep 17 00:00:00 2001 From: AkshayWarrier <58233418+AkshayWarrier@users.noreply.github.com> Date: Sun, 13 Aug 2023 19:43:04 +0530 Subject: [PATCH 023/461] library: Add Network Monitor demo (#488) --- src/Library/demos/Network Monitor/main.blp | 173 ++++++++++++++++++++ src/Library/demos/Network Monitor/main.css | 3 + src/Library/demos/Network Monitor/main.js | 21 +++ src/Library/demos/Network Monitor/main.json | 6 + 4 files changed, 203 insertions(+) create mode 100644 src/Library/demos/Network Monitor/main.blp create mode 100644 src/Library/demos/Network Monitor/main.css create mode 100644 src/Library/demos/Network Monitor/main.js create mode 100644 src/Library/demos/Network Monitor/main.json diff --git a/src/Library/demos/Network Monitor/main.blp b/src/Library/demos/Network Monitor/main.blp new file mode 100644 index 000000000..6f4e426a4 --- /dev/null +++ b/src/Library/demos/Network Monitor/main.blp @@ -0,0 +1,173 @@ +using Gtk 4.0; +using Adw 1; + +Box { + orientation: vertical; + + Adw.Banner banner { + button-label: _("Resume"); + title: _("Metered Network — syncing paused"); + use-markup: true; + revealed: false; + } + + Adw.StatusPage { + title: _("Network Monitor"); + description: _("Monitor network status"); + vexpand: true; + + Box { + spacing: 54; + orientation: vertical; + halign: center; + + Box { + homogeneous: true; + + Box { + spacing: 6; + orientation: vertical; + + Label { + halign: start; + label: _("Network Metered"); + styles ["title-4"] + } + + Label { + halign: start; + label: _("Check if your network is metered"); + styles ["dim-label"] + } + } + + MenuButton { + halign: end; + valign: center; + icon-name: "lightbulb-symbolic"; + + popover: Popover { + Box steps { + margin-top: 6; + margin-bottom: 6; + margin-start: 6; + margin-end: 6; + orientation: vertical; + spacing: 12; + + Label { + halign: start; + label: _("To mark your network as metered"); + } + + Label { + halign: start; + label: _("1. Go to Settings > Wi-Fi"); + } + + Label { + halign: start; + label: _("2. Click on the gear next to your network's name"); + } + + Label { + halign: start; + label: _("3. Check off \"Metered connection: has data limits or can incur charges\""); + } + + Label { + halign: start; + label: _("4. Apply the changes and reconnect to the network"); + } + } + }; + styles ["flat"] + } + } + + Box { + spacing: 24; + orientation: vertical; + halign: center; + + Box { + homogeneous: true; + + Box { + spacing: 6; + orientation: vertical; + + Label { + halign: start; + label: _("Network Connectivity"); + styles ["title-4"] + } + + Label { + halign: start; + label: _("Check your network connectivity status"); + styles ["dim-label"] + } + } + + MenuButton { + valign: center; + halign: end; + icon-name: "lightbulb-symbolic"; + popover: Popover { + Box { + margin-top: 6; + margin-bottom: 6; + margin-start: 6; + margin-end:6; + + Label { + label: _("You can try turning your network off/on"); + } + } + }; + + styles ["flat"] + } + } + + + Box { + orientation: vertical; + spacing: 12; + + LevelBar level_bar{ + mode: discrete; + min-value: 0; + max-value: 4; + } + + Box { + homogeneous: true; + + Label { + label: _("Local"); + } + + Label { + label: _("Limited"); + } + + Label { + label: _("Portal"); + } + + Label { + label: _("Full"); + } + } + } + } + + LinkButton { + label: "API Reference"; + uri: "https://docs.gtk.org/gio/iface.NetworkMonitor.html"; + } + } + } +} diff --git a/src/Library/demos/Network Monitor/main.css b/src/Library/demos/Network Monitor/main.css new file mode 100644 index 000000000..c142ce0bc --- /dev/null +++ b/src/Library/demos/Network Monitor/main.css @@ -0,0 +1,3 @@ +levelbar block.full { + background-color: @blue_3; +} diff --git a/src/Library/demos/Network Monitor/main.js b/src/Library/demos/Network Monitor/main.js new file mode 100644 index 000000000..5bbd28e69 --- /dev/null +++ b/src/Library/demos/Network Monitor/main.js @@ -0,0 +1,21 @@ +import Gio from "gi://Gio"; + +const banner = workbench.builder.get_object("banner"); +const network_monitor = Gio.NetworkMonitor.get_default(); +const scale = workbench.builder.get_object("scale"); +const level_bar = workbench.builder.get_object("level_bar"); + +function setNetworkStatus() { + banner.revealed = network_monitor.network_metered; + level_bar.value = network_monitor.connectivity; +} + +setNetworkStatus(); +network_monitor.connect("network-changed", () => { + setNetworkStatus(); +}); + +banner.connect("button-clicked", () => { + banner.revealed = false; +}); + diff --git a/src/Library/demos/Network Monitor/main.json b/src/Library/demos/Network Monitor/main.json new file mode 100644 index 000000000..74dd2fe9b --- /dev/null +++ b/src/Library/demos/Network Monitor/main.json @@ -0,0 +1,6 @@ +{ + "category": "platform", + "description": "Monitor network status", + "panels": ["code", "preview"], + "autorun": true +} From e36f7152151fb71733027f5d388f4a75ed6898df Mon Sep 17 00:00:00 2001 From: Sriyansh Shivam <96797205+SoNiC-HeRE@users.noreply.github.com> Date: Sun, 13 Aug 2023 20:02:21 +0530 Subject: [PATCH 024/461] library: add Adw.Clamp entry (#301) --- src/Library/demos/Clamp/main.blp | 46 +++++++++++++++++++++++++++++++ src/Library/demos/Clamp/main.js | 29 +++++++++++++++++++ src/Library/demos/Clamp/main.json | 7 +++++ 3 files changed, 82 insertions(+) create mode 100644 src/Library/demos/Clamp/main.blp create mode 100644 src/Library/demos/Clamp/main.js create mode 100644 src/Library/demos/Clamp/main.json diff --git a/src/Library/demos/Clamp/main.blp b/src/Library/demos/Clamp/main.blp new file mode 100644 index 000000000..2158162e0 --- /dev/null +++ b/src/Library/demos/Clamp/main.blp @@ -0,0 +1,46 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + title: "Clamp"; + description: "A widget constraining its child to a given size."; + + Box { + orientation: vertical; + halign: center; + + Box { + halign: center; + spacing: 6; + orientation: horizontal; + + Button button_increase { + icon-name: "plus"; + } + + Button button_decrease { + icon-name: "minus"; + } + } + + LinkButton { + margin-top: 12; + label: "API Reference"; + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.3/class.Clamp.html"; + } + + Adw.Clamp clamp { + margin-top: 24; + maximum-size: 400; + tightening-threshold: 200; + margin-bottom: 24; + + Label label { + wrap: true; + label: _("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "); + } + } + } +} + + diff --git a/src/Library/demos/Clamp/main.js b/src/Library/demos/Clamp/main.js new file mode 100644 index 000000000..aef82eae6 --- /dev/null +++ b/src/Library/demos/Clamp/main.js @@ -0,0 +1,29 @@ +const button_increase = workbench.builder.get_object("button_increase"); +const button_decrease = workbench.builder.get_object("button_decrease"); +const clamp = workbench.builder.get_object("clamp"); + +function increase() { + const current_size = clamp.get_maximum_size(); + const current_threshold = clamp.get_tightening_threshold(); + clamp.maximum_size = current_size + 300; + clamp.tightening_threshold = current_threshold + 200; + + if (clamp.tightening_threshold === 1000) { + console.log("Maximum size reached"); + } +} + +function decrease() { + const current_size = clamp.get_maximum_size(); + const current_threshold = clamp.get_tightening_threshold(); + clamp.maximum_size = current_size - 300; + clamp.tightening_threshold = current_threshold - 200; + + if (clamp.tightening_threshold === 0) { + console.log("Minimum size reached"); + } +} + +button_increase.connect("clicked", increase); +button_decrease.connect("clicked", decrease); + diff --git a/src/Library/demos/Clamp/main.json b/src/Library/demos/Clamp/main.json new file mode 100644 index 000000000..58302ed6b --- /dev/null +++ b/src/Library/demos/Clamp/main.json @@ -0,0 +1,7 @@ +{ + "name": "Clamp", + "category": "layout", + "description": "A widget constraining its child to a given size.", + "panels": ["ui", "preview"], + "autorun": true +} From 23c6de264fce5112a4e6c56904bddfabca530f99 Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Sun, 13 Aug 2023 16:54:50 +0200 Subject: [PATCH 025/461] library: add SourceView example (#452) --- src/Library/demos/Source View/main.blp | 24 ++++++++++++++++++++++++ src/Library/demos/Source View/main.js | 25 +++++++++++++++++++++++++ src/Library/demos/Source View/main.json | 7 +++++++ src/Library/demos/Source View/main.vala | 23 +++++++++++++++++++++++ src/about.js | 1 + 5 files changed, 80 insertions(+) create mode 100644 src/Library/demos/Source View/main.blp create mode 100644 src/Library/demos/Source View/main.js create mode 100644 src/Library/demos/Source View/main.json create mode 100644 src/Library/demos/Source View/main.vala diff --git a/src/Library/demos/Source View/main.blp b/src/Library/demos/Source View/main.blp new file mode 100644 index 000000000..5d9bf1f14 --- /dev/null +++ b/src/Library/demos/Source View/main.blp @@ -0,0 +1,24 @@ +using Gtk 4.0; +using Adw 1; +using GtkSource 5; + +Adw.StatusPage { + title: "Source View"; + description: _("Widget that enables text-editing with advanced features like syntax highlighting"); + + Box { + orientation: vertical; + halign: center; + + ScrolledWindow source_view { + height-request: 180; + width-request: 600; + has-frame: true; + } + + LinkButton { + label: "API Reference"; + uri: "https://gnome.pages.gitlab.gnome.org/gtksourceview/gtksourceview5/class.View.html"; + } + } +} diff --git a/src/Library/demos/Source View/main.js b/src/Library/demos/Source View/main.js new file mode 100644 index 000000000..46a309abe --- /dev/null +++ b/src/Library/demos/Source View/main.js @@ -0,0 +1,25 @@ +import GtkSource from "gi://GtkSource"; + +// Strictly speaking we don't _have_ to do this here since WorkBench does this for us. +// However, you _have_ to call this once during the startup in your application - e.g. in GApplication::startup +GtkSource.init(); + +// Get the language we want to use +const language_manager = GtkSource.LanguageManager.get_default(); +const language = language_manager.get_language("js"); + +// Create the buffer - this holds the text that's used in the SourceView +const buffer = GtkSource.Buffer.new_with_language(language); +buffer.set_text('console.log("Hello World!");', -1); + +// Create the SourceView which displays the buffer's display +const source_view = GtkSource.View.new({ + auto_indent: true, + indent_width: 4, + buffer, + show_line_numbers: true, +}); + +// Add the SourceView to our ScrolledView so its displayed +const scrolled_window = workbench.builder.get_object("scrolled_window"); +scrolled_window.set_child(source_view); diff --git a/src/Library/demos/Source View/main.json b/src/Library/demos/Source View/main.json new file mode 100644 index 000000000..5a88c92e3 --- /dev/null +++ b/src/Library/demos/Source View/main.json @@ -0,0 +1,7 @@ +{ + "name": "Source View", + "category": "controls", + "description": "Widget that enables text-editing with advanced features like syntax highlighting", + "panels": ["code", "preview"], + "autorun": true +} diff --git a/src/Library/demos/Source View/main.vala b/src/Library/demos/Source View/main.vala new file mode 100644 index 000000000..6e96f474b --- /dev/null +++ b/src/Library/demos/Source View/main.vala @@ -0,0 +1,23 @@ +#!/usr/bin/env -S vala workbench.vala --pkg gtk4 --pkg libadwaita-1 --pkg gtksourceview-5 + +public void main () { + Gtk.init (); + GtkSource.init (); + + // Get the language we want to use + var language_manager = GtkSource.LanguageManager.get_default(); + var language = language_manager.get_language("js"); + // Create the buffer - this holds the text that's used in the SourceView + var buffer = new GtkSource.Buffer.with_language(language); + buffer.set_text("console.log(\"Hello World!\");"); + + // Create the SourceView which displays the buffer's display + var source_view = new GtkSource.View.with_buffer(buffer); + source_view.auto_indent = true; + source_view.indent_width = 4; + source_view.show_line_numbers = true; + + // Add the SourceView to our ScrolledView so its displayed + var scrolled_window = workbench.builder.get_object ("scrolled_window") as Gtk.ScrolledWindow; + scrolled_window.child = source_view; +} diff --git a/src/about.js b/src/about.js index 102641cef..2ed842ce9 100644 --- a/src/about.js +++ b/src/about.js @@ -70,6 +70,7 @@ ${getBlueprintVersion()} "JCWasmx86 https://github.com/JCWasmx86", "Alex (PaladinDev) https://github.com/SpikedPaladin", "Diego Iván M.E https://github.com/Diego-Ivan", + "Rasmus Thomsen ", "Marvin W https://github.com/mar-v-in", // Add yourself as // "John Doe", From c7428f48d5106d484600acb5938ab3c5b48ff1f6 Mon Sep 17 00:00:00 2001 From: Sriyansh Shivam <96797205+SoNiC-HeRE@users.noreply.github.com> Date: Sun, 13 Aug 2023 21:01:46 +0530 Subject: [PATCH 026/461] library: Adds Navigation View Entry (#485) * Adds Navigation View Entry * Minor Change * Applied Suggested Changes * Applied Changes * Applied Changes * Applied Changes --- src/Library/demos/Navigation View/main.blp | 83 +++++++++++++++++++++ src/Library/demos/Navigation View/main.js | 32 ++++++++ src/Library/demos/Navigation View/main.json | 6 ++ 3 files changed, 121 insertions(+) create mode 100644 src/Library/demos/Navigation View/main.blp create mode 100644 src/Library/demos/Navigation View/main.js create mode 100644 src/Library/demos/Navigation View/main.json diff --git a/src/Library/demos/Navigation View/main.blp b/src/Library/demos/Navigation View/main.blp new file mode 100644 index 000000000..a352da575 --- /dev/null +++ b/src/Library/demos/Navigation View/main.blp @@ -0,0 +1,83 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + Box { + halign: center; + valign: start; + orientation: vertical; + spacing: 18; + CenterBox { + [start] + Button previous_button { + icon-name: "go-previous-symbolic"; + sensitive: false; + styles ["circular", "suggested-action"] + } + [center] + Label title { + label: _("Page 1"); + styles ["title-4"] + } + [end] + Button next_button { + icon-name: "go-next-symbolic"; + styles ["circular", "suggested-action"] + } + } + Box { + height-request: 360; + width-request: 360; + halign: center; + orientation: vertical; + styles ["card"] + + Adw.NavigationView nav_view { + Adw.NavigationPage nav_pageone { + title: _("Page 1"); + Adw.StatusPage { + title: _("Hello"); + } + } + Adw.NavigationPage nav_pagetwo { + title: _("Page 2"); + Adw.StatusPage { + title: _("from"); + } + } + Adw.NavigationPage nav_pagethree { + title: _("Page 3"); + Adw.StatusPage { + title: _("Workbench :)"); + } + } + Adw.NavigationPage nav_pagefour { + title: _("Page 4"); + Adw.StatusPage { + title: _("Navigation View"); + description: _("A page-based navigation container."); + Box { + orientation: vertical; + spacing: 18; + vexpand:true; + LinkButton { + label: _("API Reference"); + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.NavigationView.html"; + } + } + } + } + } + } + Adw.PreferencesGroup{ + Adw.SwitchRow decisive_button_transition { + title: _("Animate Transitions"); + active: bind nav_view.animate-transitions bidirectional; + } + Adw.SwitchRow decisive_button_poponescape { + title: _("Pop on Escape"); + active: bind nav_view.pop-on-escape bidirectional; + } + } + } +} diff --git a/src/Library/demos/Navigation View/main.js b/src/Library/demos/Navigation View/main.js new file mode 100644 index 000000000..48a1b6310 --- /dev/null +++ b/src/Library/demos/Navigation View/main.js @@ -0,0 +1,32 @@ +const nav_view = workbench.builder.get_object("nav_view"); +const nav_pageone = workbench.builder.get_object("nav_pageone"); +const next_button = workbench.builder.get_object("next_button"); +const previous_button = workbench.builder.get_object("previous_button"); +const nav_pagetwo = workbench.builder.get_object("nav_pagetwo"); +const nav_pagethree = workbench.builder.get_object("nav_pagethree"); +const nav_pagefour = workbench.builder.get_object("nav_pagefour"); +const title = workbench.builder.get_object("title"); + +next_button.connect("clicked", () => { + switch (nav_view.visible_page) { + case nav_pageone: + nav_view.push(nav_pagetwo); + break; + case nav_pagetwo: + nav_view.push(nav_pagethree); + break; + case nav_pagethree: + nav_view.push(nav_pagefour); + break; + } +}); + +previous_button.connect("clicked", () => { + nav_view.pop(); +}); + +nav_view.connect("notify::visible-page", () => { + previous_button.sensitive = nav_view.visible_page !== nav_pageone; + next_button.sensitive = nav_view.visible_page !== nav_pagefour; + title.label = nav_view.visible_page.title; +}); diff --git a/src/Library/demos/Navigation View/main.json b/src/Library/demos/Navigation View/main.json new file mode 100644 index 000000000..c41791eb4 --- /dev/null +++ b/src/Library/demos/Navigation View/main.json @@ -0,0 +1,6 @@ +{ + "category": "navigation", + "description": "A page-based navigation container.", + "panels": ["ui", "preview"], + "autorun": true +} From 8a67d0a94bdb51abd43764cbf9a9590fbb568239 Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:02:01 -0500 Subject: [PATCH 027/461] library: add Breakpoint entry (#484) --- src/Library/demos/Breakpoints/main.blp | 61 +++++++++++++++++++++++++ src/Library/demos/Breakpoints/main.js | 11 +++++ src/Library/demos/Breakpoints/main.json | 6 +++ 3 files changed, 78 insertions(+) create mode 100644 src/Library/demos/Breakpoints/main.blp create mode 100644 src/Library/demos/Breakpoints/main.js create mode 100644 src/Library/demos/Breakpoints/main.json diff --git a/src/Library/demos/Breakpoints/main.blp b/src/Library/demos/Breakpoints/main.blp new file mode 100644 index 000000000..1ed4833b4 --- /dev/null +++ b/src/Library/demos/Breakpoints/main.blp @@ -0,0 +1,61 @@ +using Gtk 4.0; +using Adw 1; + +Gtk.Window { + width-request: 360; + height-request: 200; + default-width: 640; + default-height: 480; + title: bind page.title; + + Adw.StatusPage page { + title: _("Breakpoints"); + description: _("Resize the window to see the breakpoint effect"); + child: Box { + orientation: vertical; + spacing: 12; + valign: center; + + Image image { + icon-size: large; + icon-name: "smile-symbolic"; + } + + Adw.BreakpointBin breakpoint_bin { + width-request: 200; + height-request: 50; + + Adw.Breakpoint breakpoint { + condition ("max-width: 500sp") + setters { + breakpoint_bin.child: label_narrow; + image.icon-size: normal; + } + } + + child: label_wide; + } + + LinkButton { + margin-top: 24; + label: "Breakpoint"; + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Breakpoint.html"; + } + + LinkButton { + label: "Breakpoint Bin"; + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BreakpointBin.html"; + } + }; + } +} + +Label label_narrow { + label: _("Narrow"); + styles ["title-4"] +} + +Label label_wide { + label: _("Wide"); + styles ["title-1"] +} diff --git a/src/Library/demos/Breakpoints/main.js b/src/Library/demos/Breakpoints/main.js new file mode 100644 index 000000000..97f3118c5 --- /dev/null +++ b/src/Library/demos/Breakpoints/main.js @@ -0,0 +1,11 @@ +import Gtk from "gi://Gtk"; + +const breakpoint = workbench.builder.get_object("breakpoint"); + +breakpoint.connect("apply", () => { + console.log("Breakpoint Applied"); +}); + +breakpoint.connect("unapply", () => { + console.log("Breakpoint Unapplied"); +}); diff --git a/src/Library/demos/Breakpoints/main.json b/src/Library/demos/Breakpoints/main.json new file mode 100644 index 000000000..dad230599 --- /dev/null +++ b/src/Library/demos/Breakpoints/main.json @@ -0,0 +1,6 @@ +{ + "category": "layout", + "description": "Create adaptive UI", + "panels": ["ui", "preview"], + "autorun": true +} From 706459dee896d7f3e386dd2112816cd78bbd522b Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:46:50 -0500 Subject: [PATCH 028/461] Boxed Lists: show off activatable widget property. (#499) show off activatable widget --- src/Library/demos/Boxed Lists/main.blp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Library/demos/Boxed Lists/main.blp b/src/Library/demos/Boxed Lists/main.blp index febddf01e..ad806eed9 100644 --- a/src/Library/demos/Boxed Lists/main.blp +++ b/src/Library/demos/Boxed Lists/main.blp @@ -34,6 +34,18 @@ Adw.StatusPage { } } + Adw.ActionRow { + title: _("ActionRow can have a activatable widget"); + subtitle: _("Click on the row to activate it"); + activatable-widget: activatable_toggle; + + [suffix] + ToggleButton activatable_toggle { + icon-name: "hand-touch-symbolic"; + valign: center; + } + } + Adw.EntryRow { title: _("A row can be an entry"); } From 06933cc335f77c43ca090407412b4604bb39e1be Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Wed, 16 Aug 2023 13:32:17 -0500 Subject: [PATCH 029/461] library: add screencast entry (#377) --- re.sonny.Workbench.Devel.json | 36 +++++++++- re.sonny.Workbench.json | 36 +++++++++- src/Library/demos/Screencast/main.blp | 33 +++++++++ src/Library/demos/Screencast/main.js | 98 ++++++++++++++++++++++++++ src/Library/demos/Screencast/main.json | 7 ++ 5 files changed, 204 insertions(+), 6 deletions(-) create mode 100644 src/Library/demos/Screencast/main.blp create mode 100644 src/Library/demos/Screencast/main.js create mode 100644 src/Library/demos/Screencast/main.json diff --git a/re.sonny.Workbench.Devel.json b/re.sonny.Workbench.Devel.json index 1a62ee113..cd0fb641f 100644 --- a/re.sonny.Workbench.Devel.json +++ b/re.sonny.Workbench.Devel.json @@ -5,11 +5,15 @@ "sdk": "org.gnome.Sdk", "sdk-extensions": [ "org.freedesktop.Sdk.Extension.vala", - "org.gnome.Sdk.Docs" + "org.gnome.Sdk.Docs", + "org.freedesktop.Sdk.Extension.rust-stable" ], "build-options": { - "append-path": "/usr/lib/sdk/vala/bin", - "append-ld-library-path": "/usr/lib/sdk/vala/lib" + "append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/vala/bin", + "append-ld-library-path": "/usr/lib/sdk/vala/lib", + "env": { + "CARGO_HOME": "/run/build/cargo-c/cargo" + } }, "command": "workbench", "finish-args": [ @@ -71,6 +75,32 @@ } ] }, + { + "name": "cargo-c", + "buildsystem": "simple", + "build-commands": ["cargo install cargo-c --root /app"], + "build-options": { + "build-args": ["--share=network"] + }, + "cleanup": ["*"] + }, + { + "name": "gst-plugins-rs", + "buildsystem": "simple", + "sources": [ + { + "type": "git", + "url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git", + "commit": "f92dc28696cb4148183a9e67272437f6a6bce412" + } + ], + "build-options": { + "build-args": ["--share=network"] + }, + "build-commands": [ + "cargo cinstall --features wayland,x11glx,x11egl -p gst-plugin-gtk4 --prefix=/app" + ] + }, { "name": "vte", "buildsystem": "meson", diff --git a/re.sonny.Workbench.json b/re.sonny.Workbench.json index b03701fa7..07398a79b 100644 --- a/re.sonny.Workbench.json +++ b/re.sonny.Workbench.json @@ -5,11 +5,15 @@ "sdk": "org.gnome.Sdk", "sdk-extensions": [ "org.freedesktop.Sdk.Extension.vala", - "org.gnome.Sdk.Docs" + "org.gnome.Sdk.Docs", + "org.freedesktop.Sdk.Extension.rust-stable" ], "build-options": { - "append-path": "/usr/lib/sdk/vala/bin", - "append-ld-library-path": "/usr/lib/sdk/vala/lib" + "append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/vala/bin", + "append-ld-library-path": "/usr/lib/sdk/vala/lib", + "env": { + "CARGO_HOME": "/run/build/cargo-c/cargo" + } }, "command": "workbench", "finish-args": [ @@ -71,6 +75,32 @@ } ] }, + { + "name": "cargo-c", + "buildsystem": "simple", + "build-commands": ["cargo install cargo-c --root /app"], + "build-options": { + "build-args": ["--share=network"] + }, + "cleanup": ["*"] + }, + { + "name": "gst-plugins-rs", + "buildsystem": "simple", + "sources": [ + { + "type": "git", + "url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git", + "commit": "f92dc28696cb4148183a9e67272437f6a6bce412" + } + ], + "build-options": { + "build-args": ["--share=network"] + }, + "build-commands": [ + "cargo cinstall --features wayland,x11glx,x11egl -p gst-plugin-gtk4 --prefix=/app" + ] + }, { "name": "vte", "buildsystem": "meson", diff --git a/src/Library/demos/Screencast/main.blp b/src/Library/demos/Screencast/main.blp new file mode 100644 index 000000000..1bf915675 --- /dev/null +++ b/src/Library/demos/Screencast/main.blp @@ -0,0 +1,33 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + title: "Screencast"; + description: _("Capture your desktop"); + margin-top: 48; + + Box { + orientation: vertical; + halign: center; + + Picture output { + margin-bottom: 30; + width-request: 360; + height-request: 240; + } + + Button button { + label: _("Start Screencast Session"); + margin-bottom: 42; + halign: center; + styles ["suggested-action"] + } + + LinkButton { + label: "API Reference"; + uri: "https://libportal.org/class.Session.html"; + } + } +} + + diff --git a/src/Library/demos/Screencast/main.js b/src/Library/demos/Screencast/main.js new file mode 100644 index 000000000..88087f4ea --- /dev/null +++ b/src/Library/demos/Screencast/main.js @@ -0,0 +1,98 @@ +import Gtk from "gi://Gtk"; +import Xdp from "gi://Xdp"; +import XdpGtk from "gi://XdpGtk4"; +import GObject from "gi://GObject"; +import Gst from "gi://Gst"; +import Gio from "gi://Gio"; + +Gst.init(null); + +Gio._promisify( + Xdp.Portal.prototype, + "create_screencast_session", + "create_screencast_session_finish", +); + +Gio._promisify(Xdp.Session.prototype, "start", "start_finish"); + +const portal = new Xdp.Portal(); +const parent = XdpGtk.parent_new_gtk(workbench.window); +const output = workbench.builder.get_object("output"); +const button = workbench.builder.get_object("button"); + +button.connect("clicked", () => { + startScreencastSession().catch(logError); +}); + +async function startScreencastSession() { + const session = await portal.create_screencast_session( + Xdp.OutputType.MONITOR, + Xdp.ScreencastFlags.NONE, + Xdp.CursorMode.EMBEDDED, + Xdp.PersistMode.TRANSIENT, + null, + null, + ); + + if (!session) { + console.log("Permission denied"); + return; + } + + const success = await session.start(parent, null); + if (!success) { + console.log("Could not start session"); + return; + } + + const pw_remote = await session.open_pipewire_remote(); + + // Create the pipeline + const pipeline = new Gst.Pipeline(); + + // Create elements + const source = Gst.ElementFactory.make("pipewiresrc", "source"); + const queue = Gst.ElementFactory.make("queue", "queue"); // add a queue element + const paintable_sink = Gst.ElementFactory.make( + "gtk4paintablesink", + "paintable_sink", + ); + const glsinkbin = Gst.ElementFactory.make("glsinkbin", "glsinkbin"); + + // Set up and Link Pipeline + source.set_property("fd", pw_remote); // pw_remote is the file descriptor obtained from libportal + + // Obtain the node id from the screencast session + const streams = session.get_streams().deepUnpack(); + + // Assuming there's only one stream for simplicity + const node_id = streams[0][0]; + if (!node_id) { + console.error("No available node id"); + return; + } + + // Set the path property of pipewiresrc + source.set_property("path", node_id); + + glsinkbin.set_property("sink", paintable_sink); + + pipeline.add(source); + pipeline.add(queue); + pipeline.add(glsinkbin); + source.link(queue); + queue.link(glsinkbin); + + const paintable = new GObject.Value(); + paintable_sink.get_property("paintable", paintable); + output.paintable = paintable.get_object(); + + // Start the pipeline + pipeline.set_state(Gst.State.PLAYING); + + // Handle cleanup on application exit + output.connect("destroy", () => { + pipeline.set_state(Gst.State.NULL); + }); +} + diff --git a/src/Library/demos/Screencast/main.json b/src/Library/demos/Screencast/main.json new file mode 100644 index 000000000..25744ff82 --- /dev/null +++ b/src/Library/demos/Screencast/main.json @@ -0,0 +1,7 @@ +{ + "name": "Screencast", + "category": "platform", + "description": "Capture your display", + "panels": ["code", "preview"], + "autorun": true +} From d4ed20cbe8bcf3dc0c2d3ed94cfd660d34d1e740 Mon Sep 17 00:00:00 2001 From: halfmexican <103920890+halfmexican@users.noreply.github.com> Date: Wed, 16 Aug 2023 17:08:45 -0500 Subject: [PATCH 030/461] library: add CenterBox entry (#492) * add main.json * add main.blp * update main.json * add api reference and update .blp * Apply suggestions from code review Co-authored-by: Andy Holmes <1265208+andyholmes@users.noreply.github.com> --------- Co-authored-by: Andy Holmes <1265208+andyholmes@users.noreply.github.com> --- src/Library/demos/Center Box/main.blp | 46 ++++++++++++++++++++++++++ src/Library/demos/Center Box/main.json | 6 ++++ 2 files changed, 52 insertions(+) create mode 100644 src/Library/demos/Center Box/main.blp create mode 100644 src/Library/demos/Center Box/main.json diff --git a/src/Library/demos/Center Box/main.blp b/src/Library/demos/Center Box/main.blp new file mode 100644 index 000000000..de66a8cc8 --- /dev/null +++ b/src/Library/demos/Center Box/main.blp @@ -0,0 +1,46 @@ +using Gtk 4.0; +using Adw 1; + +Adw.StatusPage { + title: _("Center Box"); + description: _("Displays three child widgets, while keeping the middle centered"); + + child: Box { + spacing: 24; + orientation: vertical; + + Adw.Clamp { + maximum-size: bind width_adjustment.value; + child: CenterBox { + shrink-center-last: true; + + [start] + Switch { + valign: center; + } + + [center] + Entry {} + + [end] + CheckButton {} + }; + } + + Scale width_scale { + orientation: horizontal; + halign: center; + width-request: 120; + adjustment: Adjustment width_adjustment { + lower: 200; + upper: 500; + value: 325; + }; + } + + LinkButton { + label: "API Reference"; + uri: "https://docs.gtk.org/gtk4/class.CenterBox.html"; + } + }; +} diff --git a/src/Library/demos/Center Box/main.json b/src/Library/demos/Center Box/main.json new file mode 100644 index 000000000..5de5cf79e --- /dev/null +++ b/src/Library/demos/Center Box/main.json @@ -0,0 +1,6 @@ +{ + "category": "layout", + "description": "Displays three child widgets, while keeping the middle centered", + "panels": ["ui", "preview"], + "autorun": true +} From 5a71dbeb2a846228c7f00ba9aac22b8ca6db3684 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Thu, 17 Aug 2023 10:57:27 +0200 Subject: [PATCH 031/461] Update release notes (#502) --- README.md | 12 +++---- data/app.metainfo.xml | 84 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 84 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e5e89e864..2bc58a96d 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,17 @@ Learn and prototype with GNOME technologies Download on Flathub -Workbench goal is to let you experiment with GNOME technologies, no matter if tinkering for the first time or building and testing a GTK user interface. +Workbench lets you experiment with GNOME technologies, no matter if tinkering for the first time or building and testing a GTK user interface. Among other things, Workbench comes with -- realtime GTK/CSS preview -- library of examples and demos +- Live GTK/CSS preview +- Library of 100+ examples - JavaScript and Vala support - XML and Blueprint for describing user interface -- syntax highlighting, undo/redo, autosave, session restore -- code linter and formatter -- terminal output +- Syntax highlighting, undo/redo, autosave, sessions and projects +- Code linter and formatter +- Terminal output - 1000+ icons ℹ️ Workbench is made possible by Flatpak. Only Flathub Workbench is supported. diff --git a/data/app.metainfo.xml b/data/app.metainfo.xml index 5e9c34b6a..af2ca4690 100644 --- a/data/app.metainfo.xml +++ b/data/app.metainfo.xml @@ -10,16 +10,16 @@ Learn and prototype with GNOME technologies @app_id@ -

Workbench goal is to let you experiment with GNOME technologies, no matter if tinkering for the first time or building and testing a GTK user interface.

+

Workbench lets you experiment with GNOME technologies, no matter if tinkering for the first time or building and testing a GTK user interface.

Among other things, Workbench comes with

    -
  • realtime GTK/CSS preview
  • -
  • library of examples
  • +
  • Live GTK/CSS preview
  • +
  • Library of 100+ examples
  • JavaScript and Vala support
  • XML and Blueprint for describing user interface
  • -
  • syntax highlighting, undo/redo, autosave, session restore
  • -
  • code linter and formatter
  • -
  • terminal output
  • +
  • Syntax highlighting, undo/redo, autosave, sessions and projects
  • +
  • Code linter and formatter
  • +
  • Terminal output
  • 1000+ icons
@@ -47,6 +47,78 @@ + + +
    +
  • Use GNOME 45
  • +
  • Add multi windows and sessions support
  • +
  • Support saving and opening a project
  • +
  • Add offline Documentation Viewer
  • +
  • Use GTKCssLanguageServer
  • +
  • Update to Blueprint 0.10.0
  • +
  • Update to Rome 12.1.3
  • +
  • Update to vte 0.72.2
  • +
  • Update Icon Development Kit
  • +
  • Add a workbench.resolve API
  • +
  • Allow running Vala without UI code
  • +
  • New Library entry: Map
  • +
  • New Library entry: Search
  • +
  • New Library entry: Audio
  • +
  • New Library entry: Event Controllers
  • +
  • New Library entry: Action Bar
  • +
  • New Library entry: Location
  • +
  • New Library entry: Checkboxes
  • +
  • New Library entry: Radio Buttons
  • +
  • New Library entry: List View
  • +
  • New Library entry: Separator
  • +
  • New Library entry: Link Button
  • +
  • New Library entry: Actions
  • +
  • New Library entry: Tooltip
  • +
  • New Library entry: Flow Box
  • +
  • New Library entry: Emoji Chooser
  • +
  • New Library entry: Editable Label
  • +
  • New Library entry: Drop Zone
  • +
  • New Library entry: Label
  • +
  • New Library entry: Menu Button
  • +
  • New Library entry: Image
  • +
  • New Library entry: Column View
  • +
  • New Library entry: Menu
  • +
  • New Library entry: Laucher (File / Uri)
  • +
  • New Library entry: Navigation Split View
  • +
  • New Library entry: Overlay Split View
  • +
  • New Library entry: Navigation View
  • +
  • New Library entry: Scrolled Window
  • +
  • New Library entry: Power Profile Monitor
  • +
  • New Library entry: Network Monitor Demo
  • +
  • New Library entry: Clamp
  • +
  • New Library entry: Source View
  • +
  • New Library entry: Breakpoint
  • +
  • New Library entry: Screencast
  • +
  • Update Boxed List Library entry with Spin and Switch rows
  • +
  • Update Boxed List Library entry with activatable widget
  • +
  • Update Scale Library entry with Spin Button
  • +
  • Library entry ported to Vala: Text Fields
  • +
  • Library entry ported to Vala: HTTP Image
  • +
  • Library entry ported to Vala: Color Dialog
  • +
  • Library entry ported to Vala: Scale
  • +
  • Library entry ported to Vala: Stack
  • +
  • Library entry ported to Vala: Preferences Window
  • +
  • Library entry ported to Vala: List Model
  • +
  • Library entry ported to Vala: List View
  • +
  • Library entry ported to Vala: About Window
  • +
  • Library entry ported to Vala: Button
  • +
  • Library entry ported to Vala: Spinner
  • +
  • Library entry ported to Vala: Text View
  • +
  • Library entry ported to Vala: Wallpaper
  • +
  • Library entry ported to Vala: Screenshot
  • +
  • Library entry ported to Vala: Account
  • +
  • Library entry ported to Vala: Color Picker
  • +
  • Library entry ported to Vala: Email
  • +
  • Library entry ported to Vala: Location
  • +
  • Library entry ported to Vala: Event Controllers
  • +
+
+