Skip to content

Commit 06cce1a

Browse files
authored
Use an AdwDialog for Extensions (#900)
1 parent eb3a1e0 commit 06cce1a

File tree

8 files changed

+17
-43
lines changed

8 files changed

+17
-43
lines changed

data/app.gschema.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
<key name="recent-code-language" type="i">
1313
<default>0</default>
1414
</key>
15-
<key name="open-extensions" type="b">
16-
<default>false</default>
17-
</key>
1815
<key name="recent-projects" type="as">
1916
<default>[]</default>
2017
</key>

demos

Submodule demos updated 72 files

src/Extensions/Extensions.blp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
using Gtk 4.0;
22
using Adw 1;
33

4-
Adw.Window window {
5-
hide-on-close: true;
6-
modal: false;
7-
default-height: 750;
8-
default-width: 600;
9-
title: _("Workbench — Extensions");
4+
Adw.Dialog dialog {
5+
content-height: 750;
6+
content-width: 600;
7+
title: _("Extensions");
108

119
Adw.ToolbarView {
1210
[top]
13-
Adw.HeaderBar {
14-
show-title: false;
15-
}
11+
Adw.HeaderBar {}
1612

1713
content: ScrolledWindow {
1814
hscrollbar-policy: never;
@@ -38,15 +34,6 @@ Adw.Window window {
3834
}
3935
}
4036

41-
Label {
42-
label: _("Extensions");
43-
margin-bottom: 36;
44-
45-
styles [
46-
"title-1"
47-
]
48-
}
49-
5037
ListBox {
5138
selection-mode: none;
5239

src/Extensions/Extensions.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { build } from "../../troll/src/main.js";
44

55
import Interface from "./Extensions.blp" with { type: "uri" };
66
import illustration from "./extensions.svg";
7-
import { settings } from "../util.js";
87

98
import "./Extension.js";
109

@@ -13,9 +12,9 @@ export const action_extensions = new Gio.SimpleAction({
1312
parameter_type: null,
1413
});
1514

16-
export default function Extensions({ application }) {
15+
export function Extensions({ window }) {
1716
const {
18-
window,
17+
dialog,
1918
picture_illustration,
2019
extension_rust,
2120
extension_vala,
@@ -36,19 +35,10 @@ export default function Extensions({ application }) {
3635
}
3736

3837
action_extensions.connect("activate", () => {
39-
settings.set_boolean("open-extensions", true);
40-
window.present();
38+
dialog.present(window);
4139
});
4240

43-
window.connect("close-request", () => {
44-
settings.set_boolean("open-extensions", false);
45-
});
46-
47-
if (settings.get_boolean("open-extensions")) {
48-
window.present();
49-
}
50-
51-
application.add_action(action_extensions);
41+
window.add_action(action_extensions);
5242
}
5343

5444
let rust_enabled;

src/application.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Actions from "./actions.js";
66
import { settings, data_dir, ensureDir } from "./util.js";
77
import { overrides } from "./overrides.js";
88
import Library, { getDemo } from "./Library/Library.js";
9-
import Extensions from "./Extensions/Extensions.js";
109
import {
1110
Session,
1211
addToRecentProjects,
@@ -60,10 +59,6 @@ application.connect("startup", () => {
6059
application,
6160
});
6261

63-
Extensions({
64-
application,
65-
});
66-
6762
ShortcutsWindow({ application });
6863

6964
restoreSessions().catch(console.error);

src/window.blp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ menu menu_app {
681681

682682
item {
683683
label: _("Extensions");
684-
action: "app.extensions";
684+
action: "win.extensions";
685685
}
686686

687687
section {

src/window.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
action_extensions,
3838
isRustEnabled,
3939
isValaEnabled,
40+
Extensions,
4041
} from "./Extensions/Extensions.js";
4142
import { JavaScriptDocument } from "./langs/javascript/JavaScriptDocument.js";
4243
import { BlueprintDocument } from "./langs/blueprint/BlueprintDocument.js";
@@ -64,6 +65,10 @@ export default function Window({ application, session }) {
6465
window.application = application;
6566
window.title = `Workbench — ${session.name}`;
6667

68+
Extensions({
69+
window,
70+
});
71+
6772
// Popover menu theme switcher
6873
const button_menu = builder.get_object("button_menu");
6974
const popover = button_menu.get_popover();

src/workbench

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export WEBKIT_DISABLE_DMABUF_RENDERER=1
44
# export G_MESSAGES_DEBUG=@app_id@
5-
export GSK_RENDERER=gl
5+
# export GSK_RENDERER=gl
66

77
# Required to allow pkgconfig to find pc files in /app/lib/pkgconfig
88
export PKG_CONFIG_PATH=/app/lib/pkgconfig/:$PKG_CONFIG_PATH

0 commit comments

Comments
 (0)