diff --git a/data/window.blp b/data/window.blp index 67542cc48c4848f010831604425f01721f8b28d7..bba80b1b0d4db8cb3ee0961994fc76628678bd52 100644 --- a/data/window.blp +++ b/data/window.blp @@ -5,51 +5,49 @@ using Gtk 4.0; using Adw 1; -template RugbyAppWindow : ApplicationWindow { +template RugbyAppWindow : Adw.ApplicationWindow { title: "Rugby"; default-height: 600; default-width: 400; - [titlebar] - HeaderBar { - SpinButton scorespin { - adjustment: Adjustment { - step-increment: 1; - upper: 200; - }; - focusable: true; - tooltip-text: "Score"; - } + Box { + orientation: vertical; - [title] - Label { - styles ["title"] + Adw.HeaderBar { + SpinButton scorespin { + 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] - MenuButton menu_button { - direction: none; - menu-model: app_menu; - } - } + ScrolledWindow { + vexpand: true; - ScrolledWindow { - Adw.ClampScrollable { - maximum-size: 600; + Adw.ClampScrollable { + maximum-size: 600; - ListView listview { - styles ["rich-list"] + ListView listview { + styles ["rich-list"] - model: NoSelection { - model: .RugbyListStore { - score: bind scorespin.value; + model: NoSelection { + model: .RugbyListStore { + score: bind scorespin.value; + }; }; - }; - factory: BuilderListItemFactory { - resource: "/uk/me/bcowan/rugby/score-item.ui"; - }; + factory: BuilderListItemFactory { + resource: "/uk/me/bcowan/rugby/score-item.ui"; + }; + } } } } @@ -63,3 +61,4 @@ menu app_menu { item ("_About Rugby", "app.about") } } + diff --git a/src/rugby-app-window.c b/src/rugby-app-window.c index 3ed4d1f89fb5eb3c5ad3d573871f0441d9a3c3e1..1db52209e716863f9d822c36a35fac0a72cb866a 100644 --- a/src/rugby-app-window.c +++ b/src/rugby-app-window.c @@ -1,5 +1,5 @@ /* - * 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 */ @@ -14,10 +14,10 @@ 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 * item_tooltip_cb (GtkListItem *item) diff --git a/src/rugby-app-window.h b/src/rugby-app-window.h index abf70c82dd4dc21afafdafbcdeac08ed0f0045c9..1f3fb8dc9b940053de6ce2509bf7b5f9c9b4d9b0 100644 --- a/src/rugby-app-window.h +++ b/src/rugby-app-window.h @@ -1,17 +1,18 @@ /* - * 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 */ #pragma once -#include <gtk/gtk.h> +#include <adwaita.h> G_BEGIN_DECLS #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);