Skip to content

Commit 63c6534

Browse files
authored
Merge branch 'main' into lenemter/remove-accounts-service
2 parents 8a12163 + b76b402 commit 63c6534

File tree

421 files changed

+4455
-3411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+4455
-3411
lines changed

demo/Views/ControlsView.vala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ public class ControlsView : DemoPage {
2323
tooltip_text = "Gtk.ToggleButton.icon_name"
2424
};
2525

26-
var back_button = new Gtk.Button.with_label ("Granite.CssClass.BACK");
27-
back_button.add_css_class (Granite.CssClass.BACK);
26+
var back_button = new Granite.BackButton ("Granite.BackButton") {
27+
halign = START
28+
};
2829

2930
var destructive_button = new Gtk.Button.with_label ("Granite.CssClass.DESTRUCTIVE");
3031
destructive_button.add_css_class (Granite.CssClass.DESTRUCTIVE);

lib/Constants.vala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Granite {
1212
/**
1313
* Style class for shaping a {@link Gtk.Button}
1414
*/
15-
[Version (deprecated = true, deprecated_since = "7.7.0", replacement = "Granite.CssClass.BACK")]
15+
[Version (deprecated = true, deprecated_since = "7.7.0", replacement = "Granite.BackButton")]
1616
public const string STYLE_CLASS_BACK_BUTTON = "back-button";
1717
/**
1818
* Style class to match the window background
@@ -226,11 +226,6 @@ namespace Granite {
226226
*/
227227
public const string ACCENT = "accent";
228228

229-
/**
230-
* Style class for a {@link Gtk.Button} which is used to navigate backwards
231-
*/
232-
public const string BACK = "back-button";
233-
234229
/**
235230
* Style class for adding a small shadow to a container such as for image thumbnails
236231
*/

lib/Styles/Gtk/Button.scss

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -57,44 +57,6 @@ button {
5757
}
5858
}
5959

60-
// Stopgap since we can't do angled buttons in GtkCSS, and generating all
61-
// the necessary SVGs for light/dark and accent color combinations is
62-
// untenable. Ideally we'd deprecate this in favor of something like a
63-
// Granite.BackButton with custom drawing; until then, stick an icon in it.
64-
65-
&.back-button {
66-
background-repeat: no-repeat no-repeat;
67-
background-size: 16px, cover;
68-
69-
&:dir(ltr) {
70-
background-image:
71-
-gtk-icontheme('go-previous-symbolic'),
72-
linear-gradient(
73-
to bottom,
74-
#{'alpha(@highlight_color, 0.2)'},
75-
rgba(white, 0)
76-
);
77-
padding-left: calc(#{rem(9px)} + 16px);
78-
background-position:
79-
#{rem(6px)} 50%,
80-
center, center;
81-
}
82-
83-
&:dir(rtl) {
84-
background-image:
85-
-gtk-icontheme('go-next-symbolic'),
86-
linear-gradient(
87-
to bottom,
88-
#{'alpha(@highlight_color, 0.2)'},
89-
rgba(white, 0)
90-
);
91-
padding-right: calc(#{rem(9px)} + 16px);
92-
background-position:
93-
calc(100% - #{rem(6px)}) 50%,
94-
center, center;
95-
}
96-
}
97-
9860
&.osd {
9961
@include control;
10062
@include border-interactive-roundrect;
@@ -150,4 +112,9 @@ button {
150112
shadow(2);
151113
}
152114
}
115+
116+
// Almost certainly a button with text and image
117+
> box.horizontal {
118+
border-spacing: $button-spacing / 2;
119+
}
153120
}

lib/Styles/_exported.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
// these exported GtkCSS variables should be considered public API.
44

55
@define-color fg_color #{"" + $fg-color};
6+
@define-color bg_color #{"" + bg-color(2)};
7+
8+
@define-color base_color #{"" + bg-color(1)};
9+
@define-color highlight_color #{"" + $highlight_color};
10+
@define-color borders #{"" + $border-color};
611

712
@define-color selected_bg_color #{'alpha(@accent_color, 0.25)'};
813
@define-color selected_fg_color #{'shade(@accent_color, 0.5)'};

lib/Widgets/BackButton.vala

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2025 elementary, Inc. (https://elementary.io)
3+
* SPDX-License-Identifier: GPL-2.0-or-later
4+
*/
5+
6+
/**
7+
* BackButton is meant to be used in headers to navigate in
8+
* {@link Adw.NavigationView}.
9+
*
10+
* By default `action_name` is set to `navigation.pop`
11+
*/
12+
[Version (since = "7.7.0")]
13+
public class Granite.BackButton : Gtk.Button {
14+
/**
15+
* Text of the label inside of #this
16+
*/
17+
public new string label { get; set; }
18+
19+
public BackButton (string label) {
20+
Object (label: label);
21+
}
22+
23+
construct {
24+
var image = new Gtk.Image.from_icon_name ("go-previous-symbolic");
25+
26+
var label_widget = new Gtk.Label ("");
27+
28+
var box = new Gtk.Box (HORIZONTAL, 0);
29+
box.append (image);
30+
box.append (label_widget);
31+
32+
action_name = "navigation.pop";
33+
child = box;
34+
tooltip_markup = Granite.markup_accel_tooltip ({"<alt>Left"});
35+
36+
add_css_class ("text-button");
37+
bind_property ("label", label_widget, "label");
38+
}
39+
}

lib/Widgets/Utils.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public static string accel_to_string (string? accel) {
2626

2727
string[] arr = {};
2828
if (Gdk.ModifierType.SUPER_MASK in accel_mods) {
29-
arr += "";
29+
/// TRANSLATORS: The "Super", "Windows", or "Command" key on the keyboard
30+
arr += _("Super");
3031
}
3132

3233
if (Gdk.ModifierType.SHIFT_MASK in accel_mods) {

lib/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ libgranite_sources = files(
1717
'Widgets/AbstractSettingsPage.vala',
1818
'Widgets/AbstractSimpleSettingsPage.vala',
1919
'Widgets/AccelLabel.vala',
20+
'Widgets/BackButton.vala',
2021
'Widgets/Bin.vala',
2122
'Widgets/Box.vala',
2223
'Widgets/DatePicker.vala',

po/aa.po

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
msgid ""
22
msgstr ""
33
"Report-Msgid-Bugs-To: \n"
4-
"POT-Creation-Date: 2025-03-24 15:21+0000\n"
4+
"POT-Creation-Date: 2025-05-14 16:40+0000\n"
55
"MIME-Version: 1.0\n"
66
"Content-Type: text/plain; charset=UTF-8\n"
77

@@ -137,68 +137,73 @@ msgstr ""
137137
msgid ":"
138138
msgstr ""
139139

140-
#: lib/Widgets/Utils.vala:33
140+
#. / TRANSLATORS: The "Super", "Windows", or "Command" key on the keyboard
141+
#: lib/Widgets/Utils.vala:30
142+
msgid "Super"
143+
msgstr ""
144+
145+
#: lib/Widgets/Utils.vala:34
141146
msgid "Shift"
142147
msgstr ""
143148

144-
#: lib/Widgets/Utils.vala:37
149+
#: lib/Widgets/Utils.vala:38
145150
msgid "Ctrl"
146151
msgstr ""
147152

148-
#: lib/Widgets/Utils.vala:41
153+
#: lib/Widgets/Utils.vala:42
149154
msgid "Alt"
150155
msgstr ""
151156

152157
#. /TRANSLATORS: The Alt key on the left side of the keyboard
153-
#: lib/Widgets/Utils.vala:59
158+
#: lib/Widgets/Utils.vala:60
154159
msgid "Left Alt"
155160
msgstr ""
156161

157162
#. /TRANSLATORS: The Alt key on the right side of the keyboard
158-
#: lib/Widgets/Utils.vala:63
163+
#: lib/Widgets/Utils.vala:64
159164
msgid "Right Alt"
160165
msgstr ""
161166

162167
#. /TRANSLATORS: The Ctrl key on the right side of the keyboard
163-
#: lib/Widgets/Utils.vala:70
168+
#: lib/Widgets/Utils.vala:71
164169
msgid "Right Ctrl"
165170
msgstr ""
166171

167172
#. /TRANSLATORS: The Ctrl key on the left side of the keyboard
168-
#: lib/Widgets/Utils.vala:74
173+
#: lib/Widgets/Utils.vala:75
169174
msgid "Left Ctrl"
170175
msgstr ""
171176

172177
#. /TRANSLATORS: This is a non-symbol representation of the "-" key
173-
#: lib/Widgets/Utils.vala:79
178+
#: lib/Widgets/Utils.vala:80
174179
msgid "Minus"
175180
msgstr ""
176181

177182
#. /TRANSLATORS: This is a non-symbol representation of the "+" key
178-
#: lib/Widgets/Utils.vala:84
183+
#: lib/Widgets/Utils.vala:85
179184
msgid "Plus"
180185
msgstr ""
181186

182187
#. /TRANSLATORS: This is a non-symbol representation of the "=" key
183-
#: lib/Widgets/Utils.vala:89
188+
#: lib/Widgets/Utils.vala:90
184189
msgid "Equals"
185190
msgstr ""
186191

187-
#: lib/Widgets/Utils.vala:92
192+
#: lib/Widgets/Utils.vala:93
188193
msgid "Enter"
189194
msgstr ""
190195

191196
#. /TRANSLATORS: The Shift key on the left side of the keyboard
192-
#: lib/Widgets/Utils.vala:96
197+
#: lib/Widgets/Utils.vala:97
193198
msgid "Left Shift"
194199
msgstr ""
195200

196201
#. /TRANSLATORS: The Shift key on the right side of the keyboard
197-
#: lib/Widgets/Utils.vala:100
202+
#: lib/Widgets/Utils.vala:101
198203
msgid "Right Shift"
199204
msgstr ""
200205

201206
#. /TRANSLATORS: This is a delimiter that separates two keyboard shortcut labels like "⌘ + →, Control + A"
202-
#: lib/Widgets/Utils.vala:163
207+
#: lib/Widgets/Utils.vala:164
203208
msgid ", "
204209
msgstr ""

po/ab.po

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
msgid ""
22
msgstr ""
33
"Report-Msgid-Bugs-To: \n"
4-
"POT-Creation-Date: 2025-03-24 15:21+0000\n"
4+
"POT-Creation-Date: 2025-05-14 16:40+0000\n"
55
"MIME-Version: 1.0\n"
66
"Content-Type: text/plain; charset=UTF-8\n"
77

@@ -137,68 +137,73 @@ msgstr ""
137137
msgid ":"
138138
msgstr ""
139139

140-
#: lib/Widgets/Utils.vala:33
140+
#. / TRANSLATORS: The "Super", "Windows", or "Command" key on the keyboard
141+
#: lib/Widgets/Utils.vala:30
142+
msgid "Super"
143+
msgstr ""
144+
145+
#: lib/Widgets/Utils.vala:34
141146
msgid "Shift"
142147
msgstr ""
143148

144-
#: lib/Widgets/Utils.vala:37
149+
#: lib/Widgets/Utils.vala:38
145150
msgid "Ctrl"
146151
msgstr ""
147152

148-
#: lib/Widgets/Utils.vala:41
153+
#: lib/Widgets/Utils.vala:42
149154
msgid "Alt"
150155
msgstr ""
151156

152157
#. /TRANSLATORS: The Alt key on the left side of the keyboard
153-
#: lib/Widgets/Utils.vala:59
158+
#: lib/Widgets/Utils.vala:60
154159
msgid "Left Alt"
155160
msgstr ""
156161

157162
#. /TRANSLATORS: The Alt key on the right side of the keyboard
158-
#: lib/Widgets/Utils.vala:63
163+
#: lib/Widgets/Utils.vala:64
159164
msgid "Right Alt"
160165
msgstr ""
161166

162167
#. /TRANSLATORS: The Ctrl key on the right side of the keyboard
163-
#: lib/Widgets/Utils.vala:70
168+
#: lib/Widgets/Utils.vala:71
164169
msgid "Right Ctrl"
165170
msgstr ""
166171

167172
#. /TRANSLATORS: The Ctrl key on the left side of the keyboard
168-
#: lib/Widgets/Utils.vala:74
173+
#: lib/Widgets/Utils.vala:75
169174
msgid "Left Ctrl"
170175
msgstr ""
171176

172177
#. /TRANSLATORS: This is a non-symbol representation of the "-" key
173-
#: lib/Widgets/Utils.vala:79
178+
#: lib/Widgets/Utils.vala:80
174179
msgid "Minus"
175180
msgstr ""
176181

177182
#. /TRANSLATORS: This is a non-symbol representation of the "+" key
178-
#: lib/Widgets/Utils.vala:84
183+
#: lib/Widgets/Utils.vala:85
179184
msgid "Plus"
180185
msgstr ""
181186

182187
#. /TRANSLATORS: This is a non-symbol representation of the "=" key
183-
#: lib/Widgets/Utils.vala:89
188+
#: lib/Widgets/Utils.vala:90
184189
msgid "Equals"
185190
msgstr ""
186191

187-
#: lib/Widgets/Utils.vala:92
192+
#: lib/Widgets/Utils.vala:93
188193
msgid "Enter"
189194
msgstr ""
190195

191196
#. /TRANSLATORS: The Shift key on the left side of the keyboard
192-
#: lib/Widgets/Utils.vala:96
197+
#: lib/Widgets/Utils.vala:97
193198
msgid "Left Shift"
194199
msgstr ""
195200

196201
#. /TRANSLATORS: The Shift key on the right side of the keyboard
197-
#: lib/Widgets/Utils.vala:100
202+
#: lib/Widgets/Utils.vala:101
198203
msgid "Right Shift"
199204
msgstr ""
200205

201206
#. /TRANSLATORS: This is a delimiter that separates two keyboard shortcut labels like "⌘ + →, Control + A"
202-
#: lib/Widgets/Utils.vala:163
207+
#: lib/Widgets/Utils.vala:164
203208
msgid ", "
204209
msgstr ""

0 commit comments

Comments
 (0)