Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

feat: set activatable widget on action rows #789

Merged
merged 2 commits into from
Jun 26, 2023
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
1 change: 1 addition & 0 deletions data/ui/builtin_preset_row.blp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using Adw 1;

template GradienceBuiltinPresetRow : Adw.ActionRow {
subtitle: _("Made by @GradienceTeam");
activatable-widget: apply_button;

[suffix]
Button apply_button {
Expand Down
2 changes: 2 additions & 0 deletions data/ui/explore_preset_row.blp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using Gtk 4.0;
using Adw 1;

template GradienceExplorePresetRow : Adw.ActionRow {
activatable-widget: apply_button;

Box {
spacing: 6;

Expand Down
1 change: 1 addition & 0 deletions data/ui/monet_theming_group.blp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ template GradienceMonetThemingGroup : Adw.PreferencesGroup {

Adw.ActionRow file-chooser-row {
title: _("Select an Image");
activatable-widget: file-chooser-button;

[suffix]
Button file-chooser-button {
Expand Down
2 changes: 2 additions & 0 deletions data/ui/option_row.blp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using Gtk 4.0;
using Adw 1;

template GradienceOptionRow : Adw.ActionRow {
activatable-widget: color-value;

[suffix]
MenuButton warning-button {
valign: center;
Expand Down
2 changes: 2 additions & 0 deletions data/ui/plugin_row.blp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using Gtk 4.0;
using Adw 1;

template GradiencePluginRow : Adw.ActionRow {
activatable-widget: switch;

[suffix]
Switch switch {
valign: center;
Expand Down
1 change: 1 addition & 0 deletions data/ui/shell_theming_group.blp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ template GradienceShellThemingGroup : Adw.PreferencesGroup {

Adw.ActionRow custom-colors-row {
title: _("Customize Shell Theme");
activatable-widget: custom-colors-button;

[suffix]
Button custom-colors-button {
Expand Down
7 changes: 3 additions & 4 deletions gradience/frontend/widgets/option_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ def on_text_value_changed(self, _unused, update_vars, *_args):

@Gtk.Template.Callback()
def on_text_value_toggled(self, *_args):
if self.text_value_toggle.get_active():
self.value_stack.set_visible_child(self.text_value)
else:
self.value_stack.set_visible_child(self.color_value)
widget = self.text_value if self.text_value_toggle.get_active() else self.color_value
self.value_stack.set_visible_child(widget)
self.set_activatable_widget(widget)

def update_value(self, new_value, update_vars=False, **kwargs):
rgba = Gdk.RGBA()
Expand Down