Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Adw.NavigationPage #790

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You'll need the following dependencies:
- libgranite-7-dev >=7.4.0
- libgtk-4-dev
- libgee-0.8-dev
- libadwaita-1-dev >=1.0.0
- libadwaita-1-dev >=1.4.0
- libjson-glib-dev
- libpwquality-dev
- libxml2-dev
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gtk_dep = dependency('gtk4')
gee_dep = dependency('gee-0.8')
gio_dep = dependency('gio-2.0')
granite_dep = dependency('granite-7', version: '>=7.4.0')
adw_dep = dependency('libadwaita-1', version: '>=1.0.0')
adw_dep = dependency('libadwaita-1', version: '>=1.4.0')
json_glib_dep = dependency('json-glib-1.0')
xml2_dep = dependency('libxml-2.0')
pwquality_dep = dependency('pwquality')
Expand Down
22 changes: 5 additions & 17 deletions src/Views/AbstractInstallerView.vala
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
/*-
* Copyright 2017–2021 elementary, Inc. (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2017-2024 elementary, Inc. (https://elementary.io)
*/

public abstract class AbstractInstallerView : Gtk.Box {
public abstract class AbstractInstallerView : Adw.NavigationPage {
public bool cancellable { get; construct; }

public signal void cancel ();
Expand Down Expand Up @@ -86,6 +74,6 @@ public abstract class AbstractInstallerView : Gtk.Box {
main_box.append (box);
main_box.append (action_area);

append (main_box);
child = main_box;
}
}
4 changes: 3 additions & 1 deletion src/Views/CheckView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public class Installer.CheckView : AbstractInstallerView {
valign = Gtk.Align.END
};

var title_label = new Gtk.Label (_("Before Installing")) {
title = _("Before Installing");

var title_label = new Gtk.Label (title) {
valign = Gtk.Align.START
};

Expand Down
4 changes: 3 additions & 1 deletion src/Views/DiskView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public class Installer.DiskView : AbstractInstallerView {
};
image_overlay.add_overlay (install_badge);

var install_label = new Gtk.Label (_("Select a Drive"));
title = _("Select a Drive");

var install_label = new Gtk.Label (title);

var install_desc_label = new Gtk.Label (
_("This will erase all data on the selected drive. If you have not backed your data up, you can cancel the installation and use Demo Mode.")
Expand Down
4 changes: 3 additions & 1 deletion src/Views/DriversView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
pixel_size = 128
};

var title_label = new Gtk.Label (_("Additional Drivers"));
title = _("Additional Drivers");

var title_label = new Gtk.Label (title);

var description_label = new Gtk.Label (_("Broadcom® Wi-Fi adapters, NVIDIA® graphics, and some virtual machines may not function properly without additional drivers. Most devices do not require additional drivers.")) {
max_width_chars = 1, // Make Gtk wrap, but not expand the window
Expand Down
4 changes: 3 additions & 1 deletion src/Views/EncryptView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public class EncryptView : AbstractInstallerView {
};
overlay.add_overlay (overlay_image);

var title_label = new Gtk.Label (_("Enable Drive Encryption"));
title = _("Enable Drive Encryption");

var title_label = new Gtk.Label (title);

var details_label = new Gtk.Label (_("Encrypt this device's drive if required for added protection, but be sure you understand:")) {
hexpand = true,
Expand Down
4 changes: 3 additions & 1 deletion src/Views/ErrorView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public class ErrorView : AbstractInstallerView {
pixel_size = 128
};

var title_label = new Gtk.Label (_("Could Not Install"));
title = _("Could Not Install");

var title_label = new Gtk.Label (title);

var description_label = new Gtk.Label (_("Installing %s failed, possibly due to a hardware error. The device may not restart properly. You can try the following:").printf (Utils.get_pretty_name ())) {
margin_bottom = 12,
Expand Down
4 changes: 3 additions & 1 deletion src/Views/KeyboardLayoutView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class KeyboardLayoutView : AbstractInstallerView {
valign = Gtk.Align.END
};

var title_label = new Gtk.Label (_("Select Keyboard Layout")) {
title = _("Select Keyboard Layout");

var title_label = new Gtk.Label (title) {
valign = Gtk.Align.START
};

Expand Down
1 change: 1 addition & 0 deletions src/Views/LanguageView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public class Installer.LanguageView : AbstractInstallerView {
}

unowned string label_text = LocaleHelper.lang_gettext (N_("Select a Language"), ((LangRow) row).lang_entry.get_code ());
title = label_text;
select_label = new Gtk.Label (label_text);
select_stack.add_child (select_label);
select_stack.set_visible_child (select_label);
Expand Down
4 changes: 3 additions & 1 deletion src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public class Installer.PartitioningView : AbstractInstallerView {
mounts = new Gee.ArrayList<Installer.Mount> ();
luks = new Gee.ArrayList<InstallerDaemon.LuksCredentials?> ();

var title_label = new Gtk.Label (_("Select Partitions"));
title = _("Select Partitions");

var title_label = new Gtk.Label (title);

var format_row = new DescriptionRow (
_("Selecting “Format” will erase <i>all</i> data on the selected partition."),
Expand Down
5 changes: 3 additions & 2 deletions src/Views/ProgressView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

public class ProgressView : Gtk.Box {
public class ProgressView : Adw.NavigationPage {
public signal void on_success ();
public signal void on_error ();

Expand Down Expand Up @@ -87,7 +87,8 @@ public class ProgressView : Gtk.Box {
content_area.attach (terminal_button, 1, 1);
content_area.attach (progressbar, 0, 2, 2);

append (content_area);
title = _("Installing");
child = content_area;

terminal_button.toggled.connect (() => {
if (terminal_button.active) {
Expand Down
4 changes: 3 additions & 1 deletion src/Views/SuccessView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public class SuccessView : AbstractInstallerView {
pixel_size = 128
};

var title_label = new Gtk.Label (_("Continue Setting Up"));
title = _("Continue Setting Up");

var title_label = new Gtk.Label (title);

var primary_label = new Gtk.Label (_("%s has been installed").printf (Utils.get_pretty_name ())) {
hexpand = true,
Expand Down
4 changes: 3 additions & 1 deletion src/Views/TryInstallView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class Installer.TryInstallView : AbstractInstallerView {
pixel_size = 128
};

var type_label = new Gtk.Label (_("Try or Install"));
title = _("Try or Install");

var type_label = new Gtk.Label (title);

// Force the user to make a conscious selection, not spam "Next"
var no_selection = new Gtk.CheckButton () {
Expand Down
Loading