Skip to content
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
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"mesonbuild.mesonbuild",
"prince781.vala",
"bodil.blueprint-gtk",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"ms-python.black-formatter"
]
}
15 changes: 5 additions & 10 deletions src/IconLibrary/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Gtk from "gi://Gtk?version=4.0";
import Gdk from "gi://Gdk";

import Adw from "gi://Adw";
import Gio from "gi://Gio";

import { build } from "../../troll/src/builder.js";

import IconWidget from "./IconWidget.js";
import resource from "./main.blp";
import resource from "./main.blp" with { type: "uri" };

const toasts = new Set();

Expand All @@ -21,10 +22,8 @@ export default function IconLibrary() {
dev_kit_icons,
);

const builder = Gtk.Builder.new_from_resource(resource);

const overlay = builder.get_object("overlay");
const search_entry = builder.get_object("search_entry");
const { window, overlay, search_entry, flow_box_devkit, flow_box_platform } =
build(resource);

function selectIcon(icon_name) {
clipboard.set(icon_name);
Expand All @@ -41,9 +40,6 @@ export default function IconLibrary() {
overlay.add_toast(toast);
}

const flow_box_devkit = builder.get_object("flow_box_devkit");
const flow_box_platform = builder.get_object("flow_box_platform");

function filter_func({ icon_name }) {
return icons[icon_name]?.some((tag) => tag.includes(search_entry.text));
}
Expand Down Expand Up @@ -84,7 +80,6 @@ export default function IconLibrary() {
populateIconDevKit();
populatePlatformIcons();

const window = builder.get_object("window");
return window;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Library/Library.blp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;

Adw.PreferencesWindow library {
Adw.PreferencesWindow window {
hide-on-close: true;
modal: false;
title: _("Library");
Expand Down
14 changes: 7 additions & 7 deletions src/Library/Library.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Gio from "gi://Gio";
import Gtk from "gi://Gtk";

import {
decode,
Expand All @@ -9,17 +8,18 @@ import {
} from "../util.js";
import Window from "../window.js";

import resource from "./Library.blp";
import resource from "./Library.blp" with { type: "uri" };
import { createSessionFromDemo } from "../sessions.js";
import EntryRow from "./EntryRow.js";

import illustration from "./library.svg";

export default function Library({ application }) {
const builder = Gtk.Builder.new_from_resource(resource);
const window = builder.get_object("library");
import { build } from "../../troll/src/builder.js";

const picture_illustration = builder.get_object("picture_illustration");
export default function Library({ application }) {
const objects = build(resource);
const { window, picture_illustration } = objects;
window.application = application;
picture_illustration.set_resource(illustration);

let last_selected;
Expand All @@ -39,7 +39,7 @@ export default function Library({ application }) {
}).catch(console.error);
});

builder.get_object(`library_${demo.category}`).add(widget);
objects[`library_${demo.category}`].add(widget);
});

const action_library = new Gio.SimpleAction({
Expand Down
2 changes: 1 addition & 1 deletion src/shortcutsWindow.blp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Gtk 4.0;

ShortcutsWindow window_shortcuts {
ShortcutsWindow window {
hide-on-close: true;

ShortcutsSection {
Expand Down
18 changes: 9 additions & 9 deletions src/shortcutsWindow.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import Gtk from "gi://Gtk";
import Gio from "gi://Gio";

import resource from "./shortcutsWindow.blp";
import resource from "./shortcutsWindow.blp" with { type: "uri" };

import { build } from "../troll/src/builder.js";

export default function ShortcutsWindow({ application }) {
let window_shortcuts;
let window;

const action_shortcuts = new Gio.SimpleAction({
name: "shortcuts",
parameter_type: null,
});
action_shortcuts.connect("activate", () => {
if (!window_shortcuts) {
const builder = Gtk.Builder.new_from_resource(resource);
window_shortcuts = builder.get_object("window_shortcuts");
window_shortcuts.set_transient_for(application.get_active_window());
window_shortcuts.set_application(application);
if (!window) {
({ window } = build(resource));
window.set_transient_for(application.get_active_window());
window.set_application(application);
}
window_shortcuts.present();
window.present();
});
application.add_action(action_shortcuts);
application.set_accels_for_action("app.shortcuts", ["<Control>question"]);
Expand Down