Skip to content

Commit

Permalink
Port demos to GNOME 46 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp authored Feb 21, 2024
1 parent fdab209 commit 6c657ba
Show file tree
Hide file tree
Showing 49 changed files with 437 additions and 295 deletions.
20 changes: 10 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ __pycache__
.vscode

# Project files - sync with Makefile
demos/**/settings
demos/**/workbench.vala
demos/**/main.ui
demos/**/libworkbenchcode.so
demos/**/__pycache__
demos/**/Cargo.lock
demos/**/Cargo.toml
demos/**/lib.rs
demos/**/workbench.rs
demos/**/biome.json
demos/*/settings
demos/*/workbench.vala
demos/*/main.ui
demos/*/libworkbenchcode.so
demos/*/__pycache__
demos/*/Cargo.lock
demos/*/Cargo.toml
demos/*/lib.rs
demos/*/workbench.rs
demos/*/target
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ ci: setup test

# Sync with .gitignore
clean:
rm -f demos/**/settings
rm -f demos/**/workbench.vala
rm -f demos/**/main.ui
rm -f demos/**/libworkbenchcode.so
rm -rf demos/**/__pycache__
rm -f demos/*/settings
rm -f demos/*/workbench.vala
rm -f demos/*/main.ui
rm -f demos/*/libworkbenchcode.so
rm -f demos/*/Cargo.toml
rm -f demos/*/Cargo.lockfile
rm -f demos/*/lib.rs
rm -f demos/*/workbench.rs
rm -rf demos/*/target
rm -rf demos/*/__pycache__
9 changes: 4 additions & 5 deletions demos/About Window/code.rs → demos/About Dialog/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ pub fn main() {
}

fn on_button_clicked() {
let dialog = adw::AboutWindow::builder()
.transient_for(workbench::window())
let dialog = adw::AboutDialog::builder()
.application_icon("application-x-executable")
.application_name("Typeset")
.developer_name("Angela Avery")
.version("1.2.3")
.comments("Typeset is an app that doesn’t exist and is used as an example content for About Window.")
.comments("Typeset is an app that doesn’t exist and is used as an example content for About Dialog.")
.website("https://example.org")
.issue_url("https://example.org")
.support_url("https://example.org")
Expand All @@ -29,7 +28,7 @@ fn on_button_clicked() {

dialog.add_link(
"Documentation",
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.AboutWindow.html",
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.AboutDialog.html",
);

dialog.add_legal_section(
Expand All @@ -41,5 +40,5 @@ fn on_button_clicked() {

dialog.add_acknowledgement_section(Some("Special thanks to"), &["My cat"]);

dialog.present();
dialog.present(workbench::window());
}
9 changes: 5 additions & 4 deletions demos/About Window/main.blp → demos/About Dialog/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ using Gtk 4.0;
using Adw 1;

Adw.StatusPage {
title: _("About Window");
description: _("A window showing information about the application");
title: _("About Dialog");
description: _("A dialog showing information about the application");

Box {
orientation: vertical;
Expand All @@ -14,13 +14,14 @@ Adw.StatusPage {
margin-bottom: 12;

styles [
'pill'
'pill',
'suggested-action'
]
}

LinkButton {
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.AboutWindow.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.AboutDialog.html";
}
}
}
14 changes: 6 additions & 8 deletions demos/About Window/main.js → demos/About Dialog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ import { gettext as _ } from "gettext";
import Adw from "gi://Adw";
import Gtk from "gi://Gtk";

const parent = workbench.window;
const button = workbench.builder.get_object("button");

function openAboutWindow() {
const dialog = new Adw.AboutWindow({
transient_for: parent,
function openAboutDialog() {
const dialog = new Adw.AboutDialog({
application_icon: "application-x-executable",
application_name: "Typeset",
developer_name: "Angela Avery",
version: "1.2.3",
comments: _(
"Typeset is an app that doesn’t exist and is used as an example content for About Window.",
"Typeset is an app that doesn’t exist and is used as an example content for About Dialog.",
),
website: "https://example.org",
issue_url: "https://example.org",
Expand All @@ -27,7 +25,7 @@ function openAboutWindow() {

dialog.add_link(
_("Documentation"),
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.AboutWindow.html",
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.AboutDialog.html",
);

dialog.add_legal_section(
Expand All @@ -41,7 +39,7 @@ function openAboutWindow() {

dialog.add_acknowledgement_section(_("Special thanks to"), [_("My cat")]);

dialog.present();
dialog.present(workbench.window);
}

button.connect("clicked", openAboutWindow);
button.connect("clicked", openAboutDialog);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"category": "user_interface",
"description": "A window showing information about the application",
"description": "A dialog showing information about the application",
"panels": ["code", "preview"],
"autorun": true
}
9 changes: 4 additions & 5 deletions demos/About Window/main.py → demos/About Dialog/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@


def open_about_window(_widget):
dialog = Adw.AboutWindow(
transient_for=workbench.window,
dialog = Adw.AboutDialog(
application_icon="application-x-executable",
application_name="Typeset",
developer_name="Angela Avery",
version="1.2.3",
comments=_(
"Typeset is an app that doesn’t exist and is used as an example content for About Window.",
"Typeset is an app that doesn’t exist and is used as an example content for About Dialog.",
),
website="https://example.org",
issue_url="https://example.org",
Expand All @@ -29,7 +28,7 @@ def open_about_window(_widget):

dialog.add_link(
_("Documentation"),
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.AboutWindow.html",
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.AboutDialog.html",
)

dialog.add_legal_section(
Expand All @@ -43,7 +42,7 @@ def open_about_window(_widget):

dialog.add_acknowledgement_section(_("Special thanks to"), [_("My cat")])

dialog.present()
dialog.present(workbench.window)


button: Gtk.Button = workbench.builder.get_object("button")
Expand Down
10 changes: 4 additions & 6 deletions demos/About Window/main.vala → demos/About Dialog/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ public void main () {
}

public void on_button_clicked () {
// https://valadoc.org/libadwaita-1/Adw.AboutWindow.html
var dialog = new Adw.AboutWindow () {
transient_for = workbench.window,
var dialog = new Adw.AboutDialog () {
application_icon = "application-x-executable",
application_name = "Typeset",
developer_name = "Angela Avery",
version = "1.2.3",
comments = "Typeset is an app that doesn’t exist and is used as an example content for About Window.",
comments = "Typeset is an app that doesn’t exist and is used as an example content for About Dialog.",
website = "https://example.org",
issue_url = "https://example.org",
support_url = "https://example.org",
Expand All @@ -27,7 +25,7 @@ public void on_button_clicked () {
};
dialog.add_link (
"Documentation",
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.AboutWindow.html"
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.AboutDialog.html"
);
dialog.add_legal_section (
"Fonts",
Expand All @@ -38,5 +36,5 @@ public void on_button_clicked () {

dialog.add_acknowledgement_section ("Special thanks to", { "My cat" });

dialog.present ();
dialog.present (workbench.window);
}
4 changes: 2 additions & 2 deletions demos/Advanced Buttons/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Adw.StatusPage {
LinkButton {
margin-bottom: 36;
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.SplitButton.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.SplitButton.html";
}

Box {
Expand Down Expand Up @@ -157,7 +157,7 @@ Adw.StatusPage {

LinkButton {
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.ButtonContent.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.ButtonContent.html";
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions demos/Animation/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ Adw.Clamp {

LinkButton {
label: _("Timed Animation");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.TimedAnimation.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.TimedAnimation.html";
}

LinkButton {
label: _("Spring Animation");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.SpringAnimation.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.SpringAnimation.html";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion demos/Avatar/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Adw.StatusPage {

LinkButton {
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.Avatar.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.Avatar.html";
}
}
}
2 changes: 1 addition & 1 deletion demos/Banner/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Adw.ToastOverlay overlay {

LinkButton {
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.Banner.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.Banner.html";
}

LinkButton {
Expand Down
2 changes: 1 addition & 1 deletion demos/Boxed Lists/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Adw.StatusPage {
LinkButton {
margin-top: 24;
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/boxed-lists.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/boxed-lists.html";
}

LinkButton {
Expand Down
4 changes: 2 additions & 2 deletions demos/Breakpoints/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ Gtk.Window {
LinkButton {
margin-top: 24;
label: _("Breakpoint");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.Breakpoint.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.Breakpoint.html";
}

LinkButton {
label: _("Breakpoint Bin");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.BreakpointBin.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.BreakpointBin.html";
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion demos/Carousel/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Box root_box {

LinkButton {
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.Carousel.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.Carousel.html";
margin-top: 12;
}
}
Expand Down
2 changes: 1 addition & 1 deletion demos/Clamp/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Adw.StatusPage {
LinkButton {
margin-top: 12;
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.4/class.Clamp.html";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.Clamp.html";
}

Adw.Clamp clamp {
Expand Down
44 changes: 44 additions & 0 deletions demos/Dialog/image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6c657ba

Please sign in to comment.