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

Enable workbench-cli ci and fix issues #48

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ setup:
cd Workbench && make setup

lint:
# JavaScript
./Workbench/build-aux/fun workbench-cli ci javascript demos/**/*.js
# Vala
# ./Workbench/build-aux/fun workbench-cli ci vala demos/**/*.vala
# Blueprint
# ./Workbench/build-aux/fun workbench-cli ci blueprint demos/**/*.blp
# CSS
# ./Workbench/build-aux/fun workbench-cli ci css demos/**/*.css
# Rust
./Workbench/build-aux/fun rustfmt --check --edition 2021 demos/**/*.rs
# Python
Expand All @@ -29,6 +21,7 @@ format:
./Workbench/build-aux/fun workbench-cli format vala demos/**/*.vala

test: lint
./Workbench/build-aux/fun workbench-cli ci demos/*

ci: setup test

Expand Down
1 change: 1 addition & 0 deletions demos/Dialogs/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ Adw.StatusPage {
}
}
}

18 changes: 3 additions & 15 deletions demos/Dialogs/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ public void main () {
}

private void _create_confirmation_dialog (Gtk.Button button) {
// Get the parent window
var window_type = GLib.Type.from_name ("GtkWindow");
Gtk.Window window = workbench.window;

Adw.MessageDialog dialog = new Adw.MessageDialog
(window,
(workbench.window,
"Replace File?",
"""A file named "example.png" already exists. Do you want to replace it?""");

Expand All @@ -36,12 +32,8 @@ private void _create_confirmation_dialog (Gtk.Button button) {
}

private void _create_error_dialog (Gtk.Button button) {
// Get the parent window
var window_type = GLib.Type.from_name ("GtkWindow");
Gtk.Window window = button.get_ancestor (window_type) as Gtk.Window;

Adw.MessageDialog dialog = new Adw.MessageDialog
(window,
(workbench.window,
"Critical Error",
"You did something you should not have");

Expand All @@ -57,12 +49,8 @@ private void _create_error_dialog (Gtk.Button button) {
}

private void _create_advanced_dialog (Gtk.Button button) {
// Get the parent window
var window_type = GLib.Type.from_name ("GtkWindow");
Gtk.Window window = button.get_ancestor (window_type) as Gtk.Window;

Adw.MessageDialog dialog = new Adw.MessageDialog (
window,
workbench.window,
"Login",
"A valid password is needed to continue");

Expand Down
1 change: 1 addition & 0 deletions demos/Drag and Drop/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ Adw.StatusPage {
}
}
}

4 changes: 2 additions & 2 deletions demos/Drag and Drop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ for (const row of list) {
});

drag_source.connect("drag-begin", (_source, drag) => {
const allocation = row.get_allocation();
const drag_widget = new Gtk.ListBox();

drag_widget.set_size_request(allocation.width, allocation.height);
drag_widget.set_size_request(row.get_width(), row.get_height());
drag_widget.add_css_class("boxed-list");

const drag_row = new Adw.ActionRow({ title: row.title });
Expand Down Expand Up @@ -85,3 +84,4 @@ drop_target.connect("drop", (_drop, value, _x, y) => {
// If everything is successful, return true to accept the drop
return true;
});

4 changes: 1 addition & 3 deletions demos/Drag and Drop/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ public void main() {
});

drag_source.drag_begin.connect((drag) => {
Gtk.Allocation allocation;
row.get_allocation(out allocation);
var drag_widget = new Gtk.ListBox();

drag_widget.set_size_request(allocation.width, allocation.height);
drag_widget.set_size_request(row.get_width(), row.get_height());
drag_widget.add_css_class("boxed-list");

var drag_row = new Adw.ActionRow() {
Expand Down
29 changes: 17 additions & 12 deletions demos/Preferences Window/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,22 @@ Adw.PreferencesWindow pref_window {
}
}

Adw.StatusPage subpage {
description: _("Custom Subpage");

Gtk.Button subpage_button {
label: _("Go back");
halign: center;
valign: center;

styles [
"suggested-action",
"pill"
]
Adw.NavigationPage subpage {
title: bind subpage_row.title;

Adw.StatusPage {
description: _("Custom Subpage");

Gtk.Button subpage_button {
label: _("Go back");
halign: center;
valign: center;

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

5 changes: 3 additions & 2 deletions demos/Preferences Window/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ dm_switch.connect("notify::active", () => {

// Preferences windows can display subpages
subpage_row.connect("activated", () => {
pref_window.present_subpage(subpage);
pref_window.push_subpage(subpage);
});

subpage_button.connect("clicked", () => {
pref_window.close_subpage();
pref_window.pop_subpage();
});

toast_button.connect("clicked", () => {
Expand All @@ -35,3 +35,4 @@ toast_button.connect("clicked", () => {

pref_window.add_toast(toast);
});

4 changes: 2 additions & 2 deletions demos/Preferences Window/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
)

# Preferences windows can display subpages
subpage_row.connect("activated", lambda *_: pref_window.present_subpage(subpage))
subpage_row.connect("activated", lambda *_: pref_window.push_subpage(subpage))

subpage_button.connect("clicked", lambda *_: pref_window.close_subpage())
subpage_button.connect("clicked", lambda *_: pref_window.pop_subpage())

toast_button.connect(
"clicked",
Expand Down
6 changes: 3 additions & 3 deletions demos/Preferences Window/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public void main () {
var pref_window = (Adw.PreferencesWindow) workbench.builder.get_object ("pref_window");
var dm_switch = (Adw.SwitchRow) workbench.builder.get_object ("dm_switch");
var subpage = (Adw.StatusPage) workbench.builder.get_object ("subpage");
var subpage = (Adw.NavigationPage) workbench.builder.get_object ("subpage");
var subpage_row = (Adw.ActionRow) workbench.builder.get_object ("subpage_row");
var subpage_button = (Gtk.Button) workbench.builder.get_object ("subpage_button");
var toast_button = (Gtk.Button) workbench.builder.get_object ("toast_button");
Expand All @@ -21,9 +21,9 @@ public void main () {
});

// Preferences windows can display subpages
subpage_row.activated.connect (() => pref_window.present_subpage (subpage));
subpage_row.activated.connect (() => pref_window.push_subpage (subpage));

subpage_button.clicked.connect (() => pref_window.close_subpage ());
subpage_button.clicked.connect (() => pref_window.pop_subpage ());

toast_button.clicked.connect (() => {
var toast = new Adw.Toast ("Preferences windows can display toasts");
Expand Down