Skip to content

Commit 0a40b16

Browse files
committed
GNOME - Don't use Adw.ButtonContent outside a Gtk.Button
`Adw.ButtonContent` expects its parent to be a `Gtk.Button`, resulting in error messages here on startup.
1 parent 0ab1572 commit 0a40b16

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

NickvisionMoney.GNOME/Blueprints/window.blp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,19 @@ Adw.ApplicationWindow _root {
158158
hexpand: true;
159159
halign: fill;
160160

161-
Adw.ButtonContent _greeting {
161+
Gtk.Box {
162162
halign: center;
163163
margin-top: 24;
164164
margin-bottom: 14;
165+
166+
Gtk.Image _greetingIcon {
167+
pixel-size: 48;
168+
margin-end: 12;
169+
}
170+
171+
Gtk.Label _greetingLabel {
172+
styles ["greeting-title"]
173+
}
165174
}
166175

167176
Gtk.Label _dragLabel {

NickvisionMoney.GNOME/Views/MainWindow.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public partial class MainWindow : Adw.ApplicationWindow
3535
[Gtk.Connect] private readonly Adw.Bin _dashboardBin;
3636
[Gtk.Connect] private readonly Adw.ToastOverlay _toastOverlay;
3737
[Gtk.Connect] private readonly Adw.ViewStack _viewStack;
38-
[Gtk.Connect] private readonly Adw.ButtonContent _greeting;
38+
[Gtk.Connect] private readonly Gtk.Image _greetingIcon;
39+
[Gtk.Connect] private readonly Gtk.Label _greetingLabel;
3940
[Gtk.Connect] private readonly Adw.PreferencesGroup _startPageRecentAccountsGroup;
4041
[Gtk.Connect] private readonly Gtk.Button _newAccountButton;
4142
[Gtk.Connect] private readonly Gtk.Button _openAccountButton;
@@ -87,16 +88,8 @@ private MainWindow(Gtk.Builder builder, MainWindowController controller, Adw.App
8788
_windowTitle.SetTitle(_controller.AppInfo.ShortName);
8889
_graphToggleButton.SetActive(_controller.ShowGraphs);
8990
//Greeting
90-
_greeting.SetIconName(_controller.ShowSun ? "sun-outline-symbolic" : "moon-outline-symbolic");
91-
_greeting.SetLabel(_controller.Greeting);
92-
var image = (Gtk.Image)_greeting.GetFirstChild();
93-
image.SetPixelSize(48);
94-
image.SetMarginEnd(6);
95-
var label = (Gtk.Label)_greeting.GetLastChild();
96-
label.AddCssClass("greeting-title");
97-
_greeting.SetHalign(Gtk.Align.Center);
98-
_greeting.SetMarginTop(24);
99-
_greeting.SetMarginBottom(14);
91+
_greetingIcon.SetFromIconName(_controller.ShowSun ? "sun-outline-symbolic" : "moon-outline-symbolic");
92+
_greetingLabel.SetLabel(_controller.Greeting);
10093
//Page Tabs
10194
_tabView.OnClosePage += OnCloseAccountPage;
10295
//New Account Action

0 commit comments

Comments
 (0)