Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port demos to GNOME 46 #71

Merged
merged 11 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ demos/**/Cargo.lock
demos/**/Cargo.toml
demos/**/lib.rs
demos/**/workbench.rs
demos/**/biome.json
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ clean:
rm -f demos/**/main.ui
rm -f demos/**/libworkbenchcode.so
rm -rf demos/**/__pycache__
rm -rf demos/**/Cargo.toml
rm -rf demos/**/Cargo.lockfile
rm -rf demos/**/lib.rs
rm -rf demos/**/workbench.rs
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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.AboutDialog.html",
"https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/struct.AboutDialog.html",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I feel like this should be addressed globally

could you file a PR or issue for updating all urls in Rust code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, if you prefer that

);

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
Loading