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

Save window size

parent 4036310c
No related branches found
No related tags found
No related merge requests found
// SPDX-FileCopyrightText: 2022 Bruce Cowan <bruce@bcowan.me.uk>
// SPDX-FileCopyrightText: 2022-2023 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: GPL-3.0-or-later
......@@ -7,8 +7,6 @@ using Adw 1;
template RugbyAppWindow : Adw.ApplicationWindow {
title: "Rugby";
default-height: 600;
default-width: 400;
Box {
orientation: vertical;
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2020 Bruce Cowan <bruce@bcowan.me.uk>
SPDX-FileCopyrightText: 2020-2023 Bruce Cowan <bruce@bcowan.me.uk>
SPDX-License-Identifier: GPL-3.0-or-later
-->
......@@ -22,4 +22,16 @@
<description>Number of points for a kick (drop goal or penalty)</description>
</key>
</schema>
<schema id="uk.me.bcowan.Rugby.window" path="/uk/me/bcowan/Rugby/window/">
<key name="height" type="i">
<default>600</default>
<summary>Window height</summary>
<description>The height of the window</description>
</key>
<key name="width" type="i">
<default>400</default>
<summary>Window width</summary>
<description>The width of the window</description>
</key>
</schema>
</schemalist>
/*
* SPDX-FileCopyrightText: 2017-2022 Bruce Cowan <bruce@bcowan.me.uk>
* SPDX-FileCopyrightText: 2017-2023 Bruce Cowan <bruce@bcowan.me.uk>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
......@@ -23,6 +23,8 @@ struct _RugbyAppWindow
GtkWidget *empty_page;
GtkWidget *list_page;
GSettings *win_settings;
GtkCustomFilter *try_filter;
};
......@@ -123,6 +125,7 @@ static void
rugby_app_window_dispose (GObject *object)
{
gtk_widget_dispose_template (GTK_WIDGET (object), RUGBY_TYPE_APP_WINDOW);
g_clear_object (&RUGBY_APP_WINDOW (object)->win_settings);
G_OBJECT_CLASS (rugby_app_window_parent_class)->dispose (object);
}
......@@ -181,6 +184,14 @@ rugby_app_window_init (RugbyAppWindow *self)
win_entries,
G_N_ELEMENTS (win_entries),
self);
self->win_settings = g_settings_new ("uk.me.bcowan.Rugby.window");
g_settings_bind (self->win_settings, "height",
self, "default-height",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->win_settings, "width",
self, "default-width",
G_SETTINGS_BIND_DEFAULT);
}
static void
......
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