-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using Gtk 4.0; | ||
using Adw 1; | ||
|
||
Adw.StatusPage { | ||
title: _("Dialog"); | ||
description: _("An adaptive dialog container"); | ||
|
||
Box { | ||
orientation: vertical; | ||
halign: center; | ||
spacing: 28; | ||
|
||
ListBox { | ||
width-request: 320; | ||
selection-mode: none; | ||
|
||
styles [ | ||
"boxed-list" | ||
] | ||
|
||
Adw.ComboRow combo_row { | ||
title: _("Presentation Mode"); | ||
|
||
model: StringList list { | ||
strings [ | ||
_("Auto"), | ||
_("Floating"), | ||
_("Bottom Sheet") | ||
] | ||
}; | ||
} | ||
} | ||
|
||
Button button { | ||
label: _("Open Dialog"); | ||
halign: center; | ||
|
||
styles [ | ||
"suggested-action", | ||
"pill" | ||
] | ||
} | ||
|
||
Box { | ||
orientation: vertical; | ||
|
||
LinkButton { | ||
label: _("API Reference"); | ||
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/class.Dialog.html"; | ||
} | ||
|
||
LinkButton { | ||
label: _("Human Interface Guidelines"); | ||
uri: "https://developer.gnome.org/hig/patterns/feedback/dialogs.html"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
Adw.Dialog dialog { | ||
can-close: false; | ||
presentation-mode: bind combo_row.selected; | ||
|
||
Adw.ToolbarView { | ||
[top] | ||
Adw.HeaderBar {} | ||
|
||
Image image { | ||
pixel-size: 320; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Gio from "gi://Gio"; | ||
|
||
const dialog = workbench.builder.get_object("dialog"); | ||
const button = workbench.builder.get_object("button"); | ||
const image = workbench.builder.get_object("image"); | ||
|
||
image.file = Gio.File.new_for_uri(workbench.resolve("image.svg")).get_path(); | ||
|
||
async function openDialog() { | ||
dialog.present(workbench.window); | ||
} | ||
|
||
button.connect("clicked", () => { | ||
openDialog().catch(console.error); | ||
}); | ||
|
||
dialog.connect("close-attempt", () => { | ||
console.log("Close Attempt"); | ||
dialog.force_close(); | ||
}); | ||
|
||
dialog.connect("closed", () => { | ||
console.log("Closed"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"category": "feedback", | ||
"description": "An adaptive dialog container", | ||
"panels": ["code", "ui", "preview"], | ||
"autorun": true | ||
} |