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
library: Add Toggle Button Entry #219
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
223090d
Add Toggle Button entry
SoNiC-HeRE a2b2318
Applied Suggested Changes
SoNiC-HeRE c82daa8
Applied Suggested Changes
SoNiC-HeRE a807b25
Improved JS Code
SoNiC-HeRE a036259
Improved UI and JS code
SoNiC-HeRE 39b2caa
Merge branch 'main' into Toggle-Button
sonnyp 44d9ec8
small improvements
sonnyp File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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,90 @@ | ||
using Gtk 4.0; | ||
using Adw 1; | ||
|
||
Adw.StatusPage { | ||
title: "Toggle Button"; | ||
description: _("Represent active-state visually"); | ||
|
||
Box { | ||
orientation: vertical; | ||
|
||
Box { | ||
orientation: horizontal; | ||
halign: center; | ||
margin-bottom: 6; | ||
styles ["linked"] | ||
|
||
ToggleButton button_no_look { | ||
active: true; | ||
icon-name: "eye-not-looking-symbolic"; | ||
} | ||
|
||
ToggleButton button_look { | ||
active: false; | ||
icon-name: "eye-open-negative-filled-symbolic"; | ||
group: button_no_look; | ||
} | ||
} | ||
|
||
Label { | ||
label: "Grouped"; | ||
margin-bottom: 24; | ||
} | ||
|
||
Box { | ||
orientation: horizontal; | ||
halign: center; | ||
spacing: 6; | ||
margin-bottom: 6; | ||
|
||
ToggleButton button_camera { | ||
active: false; | ||
icon-name: "photo-camera-symbolic"; | ||
halign: center; | ||
} | ||
|
||
ToggleButton button_flashlight { | ||
active: false; | ||
icon-name: "flashlight-symbolic"; | ||
halign: center; | ||
} | ||
} | ||
|
||
Label { | ||
label: "Independent"; | ||
margin-bottom: 24; | ||
} | ||
|
||
ToggleButton button_console { | ||
halign: center; | ||
margin-bottom: 6; | ||
|
||
Adw.ButtonContent { | ||
halign: center; | ||
valign: center; | ||
label: "Console"; | ||
icon-name: "terminal-symbolic"; | ||
} | ||
} | ||
|
||
Label { | ||
label: "With label"; | ||
margin-bottom: 24; | ||
} | ||
|
||
LinkButton{ | ||
label: "Tutorial"; | ||
uri: "https://developer.gnome.org/documentation/tutorials/beginners/components/toggle.html"; | ||
} | ||
|
||
LinkButton{ | ||
label: "API Reference"; | ||
uri: "https://docs.gtk.org/gtk4/class.ToggleButton.html"; | ||
} | ||
|
||
LinkButton{ | ||
label: "Human Interface Guidelines"; | ||
uri: "https://developer.gnome.org/hig/patterns/controls/buttons.html"; | ||
} | ||
} | ||
} |
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,14 @@ | ||
const buttons = { | ||
button_no_look: "Don't look", | ||
button_look: "Look", | ||
button_camera: "Camera", | ||
button_flashlight: "Flashlight", | ||
button_console: "Console", | ||
}; | ||
|
||
for (const [id, name] of Object.entries(buttons)) { | ||
const button = workbench.builder.get_object(id); | ||
button.connect("notify::active", () => { | ||
console.log(`${name} ${button.active ? "On" : "Off"}`); | ||
}); | ||
} |
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,10 @@ | ||
{ | ||
"name": "Toggle Button", | ||
"category": "user_interface", | ||
"description": "Represent active-state visually", | ||
"panels": [ | ||
"ui", | ||
"preview" | ||
], | ||
"autorun": true | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a label to this one as well - "With label"