-
-
Notifications
You must be signed in to change notification settings - Fork 65
Add Granite.Symbol #991
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
Draft
danirabbit
wants to merge
7
commits into
main
Choose a base branch
from
danirabbit/symbol
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add Granite.Symbol #991
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16d0dfc
Add Granite.Symbol
danirabbit d8509be
Bump GTK dep
danirabbit b608dce
Add file
danirabbit 9635458
Add first example symbol
danirabbit 59b1712
Add demo
danirabbit d2b3847
Fix up demo
danirabbit 4bafa42
Merge branch 'main' into danirabbit/symbol
danirabbit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,82 @@ | ||
| /* | ||
| * Copyright 2026 elementary, Inc. (https://elementary.io) | ||
| * SPDX-License-Identifier: LGPL-3.0-or-later | ||
| */ | ||
|
|
||
| public class SymbolView : DemoPage { | ||
| construct { | ||
| title = "Granite.Symbol"; | ||
|
|
||
| var symbol_button = new SymbolButton (AUDIO_VOLUME); | ||
|
|
||
| var flowbox = new Gtk.FlowBox () { | ||
| column_spacing = 12, | ||
| row_spacing = 12, | ||
| height_request = 256 | ||
| }; | ||
| flowbox.append (symbol_button); | ||
| flowbox.add_css_class (Granite.CssClass.CARD); | ||
|
|
||
| var size_header = new Granite.HeaderLabel ("Size"); | ||
|
|
||
| var size_scale = new Gtk.Scale.with_range (HORIZONTAL, 16, 128, 1) { | ||
| draw_value = true, | ||
| hexpand = true | ||
| }; | ||
| size_scale.adjustment.value = 32; | ||
|
|
||
| var weight_header = new Granite.HeaderLabel ("Weight"); | ||
|
|
||
| var weight_scale = new Gtk.Scale.with_range (HORIZONTAL, 100, 800, 100) { | ||
| draw_value = true, | ||
| hexpand = true | ||
| }; | ||
| weight_scale.adjustment.value = 300; | ||
|
|
||
| var main_box = new Granite.Box (VERTICAL) { | ||
| margin_top = 12, | ||
| margin_start = 12, | ||
| margin_end = 12, | ||
| margin_bottom = 12 | ||
| }; | ||
| main_box.append (flowbox); | ||
| main_box.append (size_header); | ||
| main_box.append (size_scale); | ||
| main_box.append (weight_header); | ||
| main_box.append (weight_scale); | ||
|
|
||
| child = main_box; | ||
|
|
||
| size_scale.adjustment.bind_property ("value", symbol_button, "pixel-size", SYNC_CREATE); | ||
| weight_scale.adjustment.bind_property ("value", symbol_button, "weight", SYNC_CREATE); | ||
| } | ||
|
|
||
| private class SymbolButton : Gtk.Button { | ||
| public int pixel_size { get; set; } | ||
| public double weight { get; set; } | ||
| public Granite.SymbolName symbol_name { get; construct; } | ||
|
|
||
| public SymbolButton (Granite.SymbolName symbol_name) { | ||
| Object (symbol_name: symbol_name); | ||
| } | ||
|
|
||
| construct { | ||
| var symbol = new Granite.Symbol (symbol_name); | ||
|
|
||
| child = symbol; | ||
| add_css_class ("image-button"); | ||
|
|
||
| bind_property ("pixel-size", symbol, "pixel-size", SYNC_CREATE); | ||
| bind_property ("weight", symbol, "weight", SYNC_CREATE); | ||
|
|
||
| clicked.connect (() => { | ||
| if (symbol.state_index == symbol.states_length - 1) { | ||
| symbol.state_index = 0; | ||
| return; | ||
| } | ||
|
|
||
| symbol.state_index++; | ||
| }); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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,22 @@ | ||
| ## Canvas Size | ||
|
|
||
| 16px x 16px | ||
|
|
||
| ## Fill | ||
|
|
||
| 10% opacity | ||
|
|
||
| ## Strokes | ||
|
|
||
| Main stroke width is 1px | ||
|
|
||
| ## Corner Radius | ||
|
|
||
| outside corners 0.5px | ||
| inside corners 0.25px | ||
|
|
||
| ## States | ||
|
|
||
| All symbols must have `normal` and `disabled` states | ||
|
|
||
| symbols can have additional custom states | ||
Oops, something went wrong.
Oops, something went wrong.
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.
So we had talked about going duotone by default. It doesn't look like we can have outline or solid style options at this time. Do we still wanna do duotones if that's our only option?