Skip to content
Snippets Groups Projects
Verified Commit a835727f authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Use Adwaita classes where possible

parent e5a577dc
No related branches found
No related tags found
No related merge requests found
...@@ -5,51 +5,49 @@ ...@@ -5,51 +5,49 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template RugbyAppWindow : ApplicationWindow { template RugbyAppWindow : Adw.ApplicationWindow {
title: "Rugby"; title: "Rugby";
default-height: 600; default-height: 600;
default-width: 400; default-width: 400;
[titlebar] Box {
HeaderBar { orientation: vertical;
SpinButton scorespin {
adjustment: Adjustment {
step-increment: 1;
upper: 200;
};
focusable: true;
tooltip-text: "Score";
}
[title] Adw.HeaderBar {
Label { SpinButton scorespin {
styles ["title"] adjustment: Adjustment {
step-increment: 1;
upper: 200;
};
focusable: true;
tooltip-text: "Score";
}
label: "Rugby"; [end]
MenuButton menu_button {
direction: none;
menu-model: app_menu;
}
} }
[end] ScrolledWindow {
MenuButton menu_button { vexpand: true;
direction: none;
menu-model: app_menu;
}
}
ScrolledWindow { Adw.ClampScrollable {
Adw.ClampScrollable { maximum-size: 600;
maximum-size: 600;
ListView listview { ListView listview {
styles ["rich-list"] styles ["rich-list"]
model: NoSelection { model: NoSelection {
model: .RugbyListStore { model: .RugbyListStore {
score: bind scorespin.value; score: bind scorespin.value;
};
}; };
}; factory: BuilderListItemFactory {
factory: BuilderListItemFactory { resource: "/uk/me/bcowan/rugby/score-item.ui";
resource: "/uk/me/bcowan/rugby/score-item.ui"; };
}; }
} }
} }
} }
...@@ -63,3 +61,4 @@ menu app_menu { ...@@ -63,3 +61,4 @@ menu app_menu {
item ("_About Rugby", "app.about") item ("_About Rugby", "app.about")
} }
} }
/* /*
* SPDX-FileCopyrightText: 2017-2021 Bruce Cowan <bruce@bcowan.me.uk> * SPDX-FileCopyrightText: 2017-2022 Bruce Cowan <bruce@bcowan.me.uk>
* *
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
struct _RugbyAppWindow struct _RugbyAppWindow
{ {
GtkApplicationWindow parent; AdwApplicationWindow parent;
}; };
G_DEFINE_TYPE (RugbyAppWindow, rugby_app_window, GTK_TYPE_APPLICATION_WINDOW) G_DEFINE_TYPE (RugbyAppWindow, rugby_app_window, ADW_TYPE_APPLICATION_WINDOW)
static char * static char *
item_tooltip_cb (GtkListItem *item) item_tooltip_cb (GtkListItem *item)
......
/* /*
* SPDX-FileCopyrightText: 2017 Bruce Cowan <bruce@bcowan.me.uk> * SPDX-FileCopyrightText: 2017-2022 Bruce Cowan <bruce@bcowan.me.uk>
*
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
#pragma once #pragma once
#include <gtk/gtk.h> #include <adwaita.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define RUGBY_TYPE_APP_WINDOW (rugby_app_window_get_type()) #define RUGBY_TYPE_APP_WINDOW (rugby_app_window_get_type())
G_DECLARE_FINAL_TYPE (RugbyAppWindow, rugby_app_window, RUGBY, APP_WINDOW, GtkApplicationWindow) G_DECLARE_FINAL_TYPE (RugbyAppWindow, rugby_app_window, RUGBY, APP_WINDOW, AdwApplicationWindow)
RugbyAppWindow * rugby_app_window_new (GtkApplication *app); RugbyAppWindow * rugby_app_window_new (GtkApplication *app);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment