From ff80aca0d763c19715dfb6fb9f7c40df07002998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 30 May 2022 09:26:09 -0700 Subject: [PATCH 01/21] Begin porting to Gtk4 --- src/Plug.vala | 1 - src/Views/FirmwareReleaseView.vala | 39 +++++++-------- src/Views/FirmwareView.vala | 76 ++++++++++++++---------------- src/Views/HardwareView.vala | 9 ++-- src/Views/OperatingSystemView.vala | 14 +++--- src/Widgets/FirmwareUpdateRow.vala | 9 ++-- src/meson.build | 6 +-- 7 files changed, 71 insertions(+), 83 deletions(-) diff --git a/src/Plug.vala b/src/Plug.vala index ea36d54ac..2c5676440 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -75,7 +75,6 @@ public class About.Plug : Switchboard.Plug { }; main_grid.attach (stack_switcher, 0, 0); main_grid.attach (stack, 0, 1); - main_grid.show_all (); } return main_grid; diff --git a/src/Views/FirmwareReleaseView.vala b/src/Views/FirmwareReleaseView.vala index 0ae776525..d6653d577 100644 --- a/src/Views/FirmwareReleaseView.vala +++ b/src/Views/FirmwareReleaseView.vala @@ -24,7 +24,7 @@ public class About.FirmwareReleaseView : Gtk.Grid { private Fwupd.Device device; private Fwupd.Release? release; - private Granite.Widgets.AlertView placeholder; + private Granite.Placeholder placeholder; private Gtk.ScrolledWindow scrolled_window; private Gtk.Stack content; private Gtk.Revealer update_button_revealer; @@ -36,7 +36,7 @@ public class About.FirmwareReleaseView : Gtk.Grid { private Gtk.Label vendor_value_label; private Gtk.Label size_value_label; private Gtk.Label install_duration_value_label; - private Hdy.Deck? deck; + private Adw.Leaflet? deck; construct { var back_button = new Gtk.Button.with_label (_("All Updates")) { @@ -55,7 +55,7 @@ public class About.FirmwareReleaseView : Gtk.Grid { margin = 6, sensitive = false }; - update_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + update_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); update_button_revealer = new Gtk.Revealer (); update_button_revealer.add (update_button); @@ -121,7 +121,7 @@ public class About.FirmwareReleaseView : Gtk.Grid { margin_top = 12, row_spacing = 3 }; - key_val_grid.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + key_val_grid.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); key_val_grid.attach (version_label, 0, 0); key_val_grid.attach (version_value_label, 1, 0); @@ -132,12 +132,10 @@ public class About.FirmwareReleaseView : Gtk.Grid { key_val_grid.attach (install_duration_label, 0, 3); key_val_grid.attach (install_duration_value_label, 1, 3); - placeholder = new Granite.Widgets.AlertView ( - "", - _("There are no releases available for this device."), - "" - ); - placeholder.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW); + placeholder = new Granite.Placeholder ("") { + description = _("There are no releases available for this device.") + }; + placeholder.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); var grid = new Gtk.Grid () { halign = Gtk.Align.CENTER, @@ -150,22 +148,21 @@ public class About.FirmwareReleaseView : Gtk.Grid { grid.add (description_label); grid.add (key_val_grid); - scrolled_window = new Gtk.ScrolledWindow (null, null) { + scrolled_window = new Gtk.ScrolledWindow () { + child = grid, hscrollbar_policy = Gtk.PolicyType.NEVER, vexpand = true }; - scrolled_window.add (grid); content = new Gtk.Stack (); - content.add (placeholder); - content.add (scrolled_window); + content.add_child (placeholder); + content.add_child (scrolled_window); orientation = Gtk.Orientation.VERTICAL; - get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); + get_style_context ().add_class (Granite.STYLE_CLASS_VIEW); add (header_box); add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); add (content); - show_all (); back_button.clicked.connect (() => { go_back (); @@ -191,9 +188,9 @@ public class About.FirmwareReleaseView : Gtk.Grid { var icons = device.get_icons (); if (icons.data != null) { - placeholder.icon_name = icons.data[0]; + placeholder.icon = new ThemedIcon (icons.data[0]); } else { - placeholder.icon_name = "application-x-firmware"; + placeholder.icon = new ThemedIcon ("application-x-firmware"); } content.visible_child = placeholder; @@ -233,15 +230,13 @@ public class About.FirmwareReleaseView : Gtk.Grid { } else { install_duration_value_label.label = GLib.ngettext ("%llu minute", "%llu minutes", duration_minutes).printf (duration_minutes); } - - show_all (); } private void go_back () { if (deck == null) { - deck = (Hdy.Deck) get_ancestor (typeof (Hdy.Deck)); + deck = (Adw.Leaflet) get_ancestor (typeof (Adw.Leaflet)); } - deck.navigate (Hdy.NavigationDirection.BACK); + deck.navigate (Adw.NavigationDirection.BACK); } } diff --git a/src/Views/FirmwareView.vala b/src/Views/FirmwareView.vala index 4e4c65aff..4f99bdac8 100644 --- a/src/Views/FirmwareView.vala +++ b/src/Views/FirmwareView.vala @@ -21,10 +21,10 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { private Gtk.Stack stack; - private Hdy.Deck deck; + private Adw.Leaflet deck; private FirmwareReleaseView firmware_release_view; - private Granite.Widgets.AlertView progress_alert_view; - private Granite.Widgets.AlertView placeholder_alert_view; + private Granite.Placeholder progress_alert_view; + private Granite.Placeholder placeholder_alert_view; private Gtk.ListBox update_list; private uint num_updates = 0; private Fwupd.Client fwupd_client; @@ -38,20 +38,17 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { } construct { - progress_alert_view = new Granite.Widgets.AlertView ( - "", - _("Do not unplug the device during the update."), - "emblem-synchronized" - ); - progress_alert_view.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW); + progress_alert_view = new Granite.Placeholder ("") { + description = _("Do not unplug the device during the update."), + icon = new ThemedIcon ("emblem-synchronized") + }; + progress_alert_view.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); - placeholder_alert_view = new Granite.Widgets.AlertView ( - _("Checking for Updates"), - _("Connecting to the firmware service and searching for updates."), - "sync-synchronizing" - ); - placeholder_alert_view.show_all (); - placeholder_alert_view.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW); + placeholder_alert_view = new Granite.Placeholder (_("Checking for Updates")) { + description = _("Connecting to the firmware service and searching for updates."), + icon = new ThemedIcon ("sync-synchronizing") + }; + placeholder_alert_view.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); update_list = new Gtk.ListBox () { vexpand = true, @@ -61,28 +58,30 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { update_list.set_header_func ((Gtk.ListBoxUpdateHeaderFunc) header_rows); update_list.set_placeholder (placeholder_alert_view); - var update_scrolled = new Gtk.ScrolledWindow (null, null); - update_scrolled.add (update_list); + var update_scrolled = new Gtk.ScrolledWindow () { + child = update_list + }; firmware_release_view = new FirmwareReleaseView (); - deck = new Hdy.Deck () { - can_swipe_back = true + deck = new Adw.Leaflet () { + can_navigate_back = true }; - deck.add (update_scrolled); - deck.add (firmware_release_view); + deck.append (update_scrolled); + deck.append (firmware_release_view); deck.visible_child = update_scrolled; stack = new Gtk.Stack () { transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT }; - stack.add (deck); - stack.add (progress_alert_view); + stack.add_child (deck); + stack.add_child (progress_alert_view); - var frame = new Gtk.Frame (null); - frame.add (stack); + var frame = new Gtk.Frame (null) { + child = stack + }; - content_area.add (frame); + content_area.attach (frame, 0, 0); if (LoginManager.get_instance ().can_reboot_to_firmware_setup ()) { var reboot_to_firmware_setup_button = new Gtk.Button.with_label (_("Restart to Firmware Setup…")); @@ -120,7 +119,6 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { placeholder_alert_view.title = _("Firmware Updates Are Not Available"); placeholder_alert_view.description = _("Firmware updates are not supported on this or any connected devices."); - update_list.show_all (); } catch (Error e) { placeholder_alert_view.title = _("The Firmware Service Is Not Available"); placeholder_alert_view.description = _("Please make sure “fwupd” is installed and enabled."); @@ -149,9 +147,8 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { num_updates++; } - update_list.add (row); + update_list.append (row); update_list.invalidate_sort (); - update_list.show_all (); row.update.connect ((device, release) => { update.begin (device, release); @@ -174,7 +171,6 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { add_device (device); stack.visible_child = deck; - update_list.show_all (); } private void on_device_removed (Fwupd.Client client, Fwupd.Device device) { @@ -193,8 +189,6 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { } } } - - update_list.show_all (); } [CCode (instance_pos = -1)] @@ -327,7 +321,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { Gtk.ButtonsType.CLOSE ) { badge_icon = new ThemedIcon ("dialog-error"), - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; message_dialog.response.connect (message_dialog.destroy); @@ -348,15 +342,15 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { Gtk.ButtonsType.CANCEL ) { badge_icon = new ThemedIcon ("dialog-information"), - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; var suggested_button = (Gtk.Button) message_dialog.add_button (_("Continue"), Gtk.ResponseType.ACCEPT); - suggested_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); if (detach_image != null) { var custom_widget = new Gtk.Image.from_file (detach_image); - message_dialog.custom_bin.add (custom_widget); + message_dialog.custom_bin.append (custom_widget); } return message_dialog; @@ -370,11 +364,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { Gtk.ButtonsType.CANCEL ) { badge_icon = new ThemedIcon ("system-reboot"), - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; var suggested_button = (Gtk.Button) message_dialog.add_button (_("Restart"), Gtk.ResponseType.ACCEPT); - suggested_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); message_dialog.response.connect ((response) => { if (response == Gtk.ResponseType.ACCEPT) { @@ -394,11 +388,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { Gtk.ButtonsType.CANCEL ) { badge_icon = new ThemedIcon ("system-shutdown"), - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; var suggested_button = (Gtk.Button) message_dialog.add_button (_("Shut Down"), Gtk.ResponseType.ACCEPT); - suggested_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); message_dialog.response.connect ((response) => { if (response == Gtk.ResponseType.ACCEPT) { diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index 1acfecd5c..b0d6035dd 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -20,7 +20,7 @@ * Boston, MA 02110-1301 USA */ -public class About.HardwareView : Gtk.Grid { +public class About.HardwareView : Gtk.Box { private bool oem_enabled; private string manufacturer_icon_path; private string? manufacturer_icon_dark_path = null; @@ -120,7 +120,7 @@ public class About.HardwareView : Gtk.Grid { selectable = true, xalign = 0 }; - manufacturer_info.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + manufacturer_info.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); details_grid.add (product_name_info); details_grid.add (manufacturer_info); @@ -154,8 +154,8 @@ public class About.HardwareView : Gtk.Grid { column_spacing = 32; halign = Gtk.Align.CENTER; - add (manufacturer_logo); - add (details_grid); + append (manufacturer_logo); + append (details_grid); granite_settings.notify["prefers-color-scheme"].connect (() => { update_manufacturer_logo (); @@ -338,7 +338,6 @@ public class About.HardwareView : Gtk.Grid { if (secondary_gpu != null) { secondary_graphics_info.label = secondary_gpu; graphics_grid.add (secondary_graphics_info); - graphics_grid.show_all (); } } diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index 3718f7c02..add857671 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -18,7 +18,7 @@ * Boston, MA 02110-1301 USA */ -public class About.OperatingSystemView : Gtk.Grid { +public class About.OperatingSystemView : Gtk.Box { private string support_url; private Gtk.Grid software_grid; @@ -168,10 +168,9 @@ public class About.OperatingSystemView : Gtk.Grid { margin = 12; orientation = Gtk.Orientation.VERTICAL; - row_spacing = 12; - add (software_grid); - add (button_grid); - show_all (); + spacing = 12; + append (software_grid); + append (button_grid); settings_restore_button.clicked.connect (settings_restore_clicked); @@ -226,7 +225,6 @@ public class About.OperatingSystemView : Gtk.Grid { xalign = 0 }; software_grid.attach (based_off, 1, 1, 3); - software_grid.show_all (); } } @@ -245,10 +243,10 @@ public class About.OperatingSystemView : Gtk.Grid { "dialog-warning", Gtk.ButtonsType.CANCEL ); - dialog.transient_for = (Gtk.Window) get_toplevel (); + dialog.transient_for = (Gtk.Window) get_root (); var continue_button = dialog.add_button (_("Restore Settings"), Gtk.ResponseType.ACCEPT); - continue_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + continue_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); dialog.response.connect ((response) => { dialog.destroy (); diff --git a/src/Widgets/FirmwareUpdateRow.vala b/src/Widgets/FirmwareUpdateRow.vala index a5c43a5a1..91f4de63a 100644 --- a/src/Widgets/FirmwareUpdateRow.vala +++ b/src/Widgets/FirmwareUpdateRow.vala @@ -34,7 +34,7 @@ public class About.Widgets.FirmwareUpdateRow : Gtk.ListBoxRow { } construct { - var image = new Gtk.Image.from_icon_name ("application-x-firmware", Gtk.IconSize.DND) { + var image = new Gtk.Image.from_icon_name ("application-x-firmware") { pixel_size = 32 }; @@ -51,7 +51,10 @@ public class About.Widgets.FirmwareUpdateRow : Gtk.ListBoxRow { var grid = new Gtk.Grid () { column_spacing = 12, - margin = 6 + margin_top = 6, + margin_end = 6, + margin_bottom = 6, + margin_start = 6 }; grid.attach (image, 0, 0, 1, 2); grid.attach (device_name_label, 1, 0); @@ -78,6 +81,6 @@ public class About.Widgets.FirmwareUpdateRow : Gtk.ListBoxRow { grid.attach (update_button, 2, 0, 1, 2); } - add (grid); + child = grid; } } diff --git a/src/meson.build b/src/meson.build index c47557ee6..146c2c107 100644 --- a/src/meson.build +++ b/src/meson.build @@ -32,12 +32,12 @@ shared_module( glib_dep, dependency('gio-2.0'), dependency('gobject-2.0'), - dependency('granite'), - dependency('gtk+-3.0'), + dependency('granite-7'), + dependency('gtk4'), + dependency('libadwaita-1'), dependency('libgtop-2.0'), dependency('gudev-1.0'), dependency('udisks2'), - dependency('libhandy-1'), appstream_dep, meson.get_compiler('vala').find_library('posix'), switchboard_dep From d26177e480a6a9156ebdb9bc0554fb7118d95cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 Jun 2022 12:35:32 -0700 Subject: [PATCH 02/21] bump libs --- .github/workflows/main.yml | 2 +- README.md | 8 ++++---- src/meson.build | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b1c67ff5f..de240b910 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y meson libfwupd-dev libgranite-dev libgtk-3-dev libgtop2-dev libgudev-1.0-dev libudisks2-dev libhandy-1-dev libswitchboard-2.0-dev libappstream-dev valac + apt install -y meson libadwaita-1-dev libfwupd-dev libgranite-7-dev libgtk-4-dev libgtop2-dev libgudev-1.0-dev libudisks2-dev libswitchboard-3-dev libappstream-dev valac - name: Build env: DESTDIR: out diff --git a/README.md b/README.md index 2d9221b4d..8593aa14f 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,14 @@ You'll need the following dependencies: -* libswitchboard-2.0-dev +* libswitchboard-3-dev * libfwupd-dev -* libgranite-dev -* libgtk-3-dev +* libgranite-7-dev +* libgtk-4-dev * libgtop2-dev * libgudev-1.0-dev * libudisks2-dev -* libhandy-1-dev +* libadwaita-1-dev * libappstream-dev * meson * valac diff --git a/src/meson.build b/src/meson.build index 146c2c107..6babf8c90 100644 --- a/src/meson.build +++ b/src/meson.build @@ -10,7 +10,7 @@ plug_files = files( 'Widgets/FirmwareUpdateRow.vala' ) -switchboard_dep = dependency('switchboard-2.0') +switchboard_dep = dependency('switchboard-3') switchboard_plugsdir = switchboard_dep.get_pkgconfig_variable('plugsdir', define_variable: ['libdir', libdir]) config_data = configuration_data() From e62ca4c59af0aba380e6b2b20634bcaa3b97477b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 16 Oct 2023 12:45:30 -0700 Subject: [PATCH 03/21] start on dialog stuff --- src/Plug.vala | 2 +- src/Views/FirmwareView.vala | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Plug.vala b/src/Plug.vala index 2c5676440..bc4fdb929 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -65,7 +65,7 @@ public class About.Plug : Switchboard.Plug { var stack_switcher = new Gtk.StackSwitcher () { halign = Gtk.Align.CENTER, - homogeneous = true, + // homogeneous = true, margin_top = 24, stack = stack }; diff --git a/src/Views/FirmwareView.vala b/src/Views/FirmwareView.vala index 4f99bdac8..79a2dc28b 100644 --- a/src/Views/FirmwareView.vala +++ b/src/Views/FirmwareView.vala @@ -86,7 +86,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { if (LoginManager.get_instance ().can_reboot_to_firmware_setup ()) { var reboot_to_firmware_setup_button = new Gtk.Button.with_label (_("Restart to Firmware Setup…")); reboot_to_firmware_setup_button.clicked.connect (reboot_to_firmware_setup_clicked); - action_area.add (reboot_to_firmware_setup_button); + action_area.append (reboot_to_firmware_setup_button); } fwupd_client = new Fwupd.Client (); @@ -226,8 +226,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { construct { xalign = 0; - margin = 3; - get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + margin_top = 3; + margin_end = 3; + margin_bottom = 3; + margin_start = 3; + add_css_class (Granite.STYLE_CLASS_H4_LABEL); } } @@ -346,7 +349,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { }; var suggested_button = (Gtk.Button) message_dialog.add_button (_("Continue"), Gtk.ResponseType.ACCEPT); - suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); + suggested_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); if (detach_image != null) { var custom_widget = new Gtk.Image.from_file (detach_image); @@ -368,7 +371,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { }; var suggested_button = (Gtk.Button) message_dialog.add_button (_("Restart"), Gtk.ResponseType.ACCEPT); - suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); + suggested_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); message_dialog.response.connect ((response) => { if (response == Gtk.ResponseType.ACCEPT) { @@ -392,7 +395,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { }; var suggested_button = (Gtk.Button) message_dialog.add_button (_("Shut Down"), Gtk.ResponseType.ACCEPT); - suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); + suggested_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); message_dialog.response.connect ((response) => { if (response == Gtk.ResponseType.ACCEPT) { @@ -413,11 +416,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { ) { badge_icon = new ThemedIcon ("application-x-firmware"), modal = true, - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; var continue_button = dialog.add_button (_("Restart"), Gtk.ResponseType.ACCEPT); - continue_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + continue_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); dialog.response.connect ((result) => { dialog.destroy (); @@ -438,7 +441,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { ) { badge_icon = new ThemedIcon ("dialog-error"), modal = true, - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; message_dialog.show_error_details (error.message); message_dialog.present (); From 5e27c246142d801305751292781b01dbb3295412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 13:21:34 -0800 Subject: [PATCH 04/21] FirmwareReleaseView: Gtk4 prep --- src/Views/FirmwareReleaseView.vala | 90 ++++++++++++++---------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/src/Views/FirmwareReleaseView.vala b/src/Views/FirmwareReleaseView.vala index 0ae776525..8f42cb1d8 100644 --- a/src/Views/FirmwareReleaseView.vala +++ b/src/Views/FirmwareReleaseView.vala @@ -1,32 +1,18 @@ /* - * Copyright (c) 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, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA + * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2021-2023 elementary, Inc. (https://elementary.io) * * Authored by: Marius Meisenzahl */ -public class About.FirmwareReleaseView : Gtk.Grid { +public class About.FirmwareReleaseView : Gtk.Box { public signal void update (Fwupd.Device device, Fwupd.Release release); private Fwupd.Device device; private Fwupd.Release? release; private Granite.Widgets.AlertView placeholder; private Gtk.ScrolledWindow scrolled_window; - private Gtk.Stack content; + private Gtk.Stack stack; private Gtk.Revealer update_button_revealer; private Gtk.Button update_button; private Gtk.Label title_label; @@ -40,27 +26,34 @@ public class About.FirmwareReleaseView : Gtk.Grid { construct { var back_button = new Gtk.Button.with_label (_("All Updates")) { - halign = Gtk.Align.START, - margin = 6 + halign = START, + margin_top = 6, + margin_end = 6, + margin_bottom = 6, + margin_start = 6, }; back_button.get_style_context ().add_class (Granite.STYLE_CLASS_BACK_BUTTON); title_label = new Gtk.Label ("") { - ellipsize = Pango.EllipsizeMode.END, + ellipsize = END, use_markup = true }; update_button = new Gtk.Button.with_label ("") { - halign = Gtk.Align.END, - margin = 6, + halign = END, + margin_top = 6, + margin_end = 6, + margin_bottom = 6, + margin_start = 6, sensitive = false }; update_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - update_button_revealer = new Gtk.Revealer (); - update_button_revealer.add (update_button); + update_button_revealer = new Gtk.Revealer () { + child = update_button + }; - var header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { + var header_box = new Gtk.Box (HORIZONTAL, 6) { hexpand = true }; header_box.pack_start (back_button); @@ -68,13 +61,13 @@ public class About.FirmwareReleaseView : Gtk.Grid { header_box.pack_end (update_button_revealer); summary_label = new Gtk.Label ("") { - halign = Gtk.Align.START, + halign = START, wrap = true }; summary_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); description_label = new Gtk.Label ("") { - halign = Gtk.Align.START, + halign = START, wrap = true }; @@ -117,7 +110,7 @@ public class About.FirmwareReleaseView : Gtk.Grid { var key_val_grid = new Gtk.Grid () { column_homogeneous = true, column_spacing = 6, - halign = Gtk.Align.CENTER, + halign = CENTER, margin_top = 12, row_spacing = 3 }; @@ -139,32 +132,33 @@ public class About.FirmwareReleaseView : Gtk.Grid { ); placeholder.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW); - var grid = new Gtk.Grid () { - halign = Gtk.Align.CENTER, - margin = 12, - orientation = Gtk.Orientation.VERTICAL, - row_spacing = 12, + var box = new Gtk.Box (VERTICAL, 12) { + halign = CENTER, + margin_top = 12, + margin_end = 12, + margin_bottom = 12, + margin_start = 12, vexpand = true }; - grid.add (summary_label); - grid.add (description_label); - grid.add (key_val_grid); + box.add (summary_label); + box.add (description_label); + box.add (key_val_grid); scrolled_window = new Gtk.ScrolledWindow (null, null) { - hscrollbar_policy = Gtk.PolicyType.NEVER, + child = box, + hscrollbar_policy = NEVER, vexpand = true }; - scrolled_window.add (grid); - content = new Gtk.Stack (); - content.add (placeholder); - content.add (scrolled_window); + stack = new Gtk.Stack (); + stack.add (placeholder); + stack.add (scrolled_window); - orientation = Gtk.Orientation.VERTICAL; + orientation = VERTICAL; get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); add (header_box); - add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); - add (content); + add (new Gtk.Separator (HORIZONTAL)); + add (stack); show_all (); back_button.clicked.connect (() => { @@ -196,12 +190,12 @@ public class About.FirmwareReleaseView : Gtk.Grid { placeholder.icon_name = "application-x-firmware"; } - content.visible_child = placeholder; + stack.visible_child = placeholder; return; } - content.visible_child = scrolled_window; + stack.visible_child = scrolled_window; var release_version = release.get_version (); if (release.get_flags () == Fwupd.RELEASE_FLAG_IS_UPGRADE && release_version != device.get_version ()) { @@ -242,6 +236,6 @@ public class About.FirmwareReleaseView : Gtk.Grid { deck = (Hdy.Deck) get_ancestor (typeof (Hdy.Deck)); } - deck.navigate (Hdy.NavigationDirection.BACK); + deck.navigate (BACK); } } From 470bca10b2ab2b0225fc9f3d8af86c317d3933af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 14:09:26 -0800 Subject: [PATCH 05/21] HardwareView: GTK 4 prep --- src/Views/HardwareView.vala | 89 ++++++++++++++----------------------- 1 file changed, 34 insertions(+), 55 deletions(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index 1acfecd5c..c7a5a95e8 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -1,26 +1,12 @@ /* -* Copyright 2017–2021 elementary, Inc. (https://elementary.io) -* 2020 Justin Haygood -* 2010 Red Hat, Inc -* 2008 William Jon McCann -* -* 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, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA -*/ - -public class About.HardwareView : Gtk.Grid { + * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2017–2023 elementary, Inc. (https://elementary.io) + * 2020 Justin Haygood + * 2010 Red Hat, Inc + * 2008 William Jon McCann + */ + +public class About.HardwareView : Gtk.Box { private bool oem_enabled; private string manufacturer_icon_path; private string? manufacturer_icon_dark_path = null; @@ -38,7 +24,7 @@ public class About.HardwareView : Gtk.Grid { private Gtk.Label primary_graphics_info; private Gtk.Label secondary_graphics_info; - private Gtk.Grid graphics_grid; + private Gtk.Grid graphics_box; private Gtk.Label storage_info; @@ -50,57 +36,50 @@ public class About.HardwareView : Gtk.Grid { fetch_hardware_info (); var product_name_info = new Gtk.Label (get_host_name ()) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, selectable = true, xalign = 0 }; product_name_info.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); var processor_info = new Gtk.Label (processor) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, margin_top = 12, selectable = true, xalign = 0 }; var memory_info = new Gtk.Label (_("%s memory").printf (memory)) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, selectable = true, xalign = 0 }; primary_graphics_info = new Gtk.Label (_("Unknown Graphics")) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, selectable = true, xalign = 0 }; secondary_graphics_info = new Gtk.Label (null) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, selectable = true, xalign = 0 }; - graphics_grid = new Gtk.Grid () { - orientation = Gtk.Orientation.VERTICAL, - row_spacing = 6 - }; - - graphics_grid.add (primary_graphics_info); + graphics_box = new Gtk.Grid (VERTICAL, 6); + graphics_box.add (primary_graphics_info); storage_info = new Gtk.Label (_("Unknown storage")) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, selectable = true, xalign = 0 }; - var details_grid = new Gtk.Grid () { - orientation = Gtk.Orientation.VERTICAL, - row_spacing = 6 - }; + var details_box = new Gtk.BOX (VERTICAL, 6); manufacturer_logo = new Gtk.Image () { - halign = Gtk.Align.END, + halign = END, pixel_size = 128, use_fallback = true }; @@ -116,46 +95,46 @@ public class About.HardwareView : Gtk.Grid { } var manufacturer_info = new Gtk.Label (manufacturer_name) { - ellipsize = Pango.EllipsizeMode.MIDDLE, + ellipsize = MIDDLE, selectable = true, xalign = 0 }; manufacturer_info.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - details_grid.add (product_name_info); - details_grid.add (manufacturer_info); + details_box.add (product_name_info); + details_box.add (manufacturer_info); } else { - details_grid.add (product_name_info); + details_box.add (product_name_info); } update_manufacturer_logo (); - details_grid.add (processor_info); - details_grid.add (graphics_grid); + details_box.add (processor_info); + details_box.add (graphics_box); - details_grid.add (memory_info); - details_grid.add (storage_info); + details_box.add (memory_info); + details_box.add (storage_info); if (oem_enabled && manufacturer_support_url != null) { var manufacturer_website_info = new Gtk.LinkButton.with_label ( manufacturer_support_url, _("Manufacturer Website") ) { - halign = Gtk.Align.START, + halign = START, margin_top = 12, xalign = 0 }; - details_grid.add (manufacturer_website_info); + details_box.add (manufacturer_website_info); } margin_start = 16; margin_end = 16; - column_spacing = 32; - halign = Gtk.Align.CENTER; + spacing = 32; + halign = CENTER; add (manufacturer_logo); - add (details_grid); + add (details_box); granite_settings.notify["prefers-color-scheme"].connect (() => { update_manufacturer_logo (); @@ -337,8 +316,8 @@ public class About.HardwareView : Gtk.Grid { var secondary_gpu = yield get_gpu_info (false); if (secondary_gpu != null) { secondary_graphics_info.label = secondary_gpu; - graphics_grid.add (secondary_graphics_info); - graphics_grid.show_all (); + graphics_box.add (secondary_graphics_info); + graphics_box.show_all (); } } From fc2e57b074fc7a54732c4c3b80fac8f95e640f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 14:19:53 -0800 Subject: [PATCH 06/21] Update HardwareView.vala --- src/Views/HardwareView.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index c7a5a95e8..2391923ba 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -67,7 +67,7 @@ public class About.HardwareView : Gtk.Box { xalign = 0 }; - graphics_box = new Gtk.Grid (VERTICAL, 6); + graphics_box = new Gtk.Box (VERTICAL, 6); graphics_box.add (primary_graphics_info); storage_info = new Gtk.Label (_("Unknown storage")) { @@ -76,7 +76,7 @@ public class About.HardwareView : Gtk.Box { xalign = 0 }; - var details_box = new Gtk.BOX (VERTICAL, 6); + var details_box = new Gtk.Box (VERTICAL, 6); manufacturer_logo = new Gtk.Image () { halign = END, From 1f16b37d4c27e66c33bf906794729bccef13e255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 14:28:15 -0800 Subject: [PATCH 07/21] missed a spot --- src/Views/HardwareView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index 2391923ba..fbb385acb 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -24,7 +24,7 @@ public class About.HardwareView : Gtk.Box { private Gtk.Label primary_graphics_info; private Gtk.Label secondary_graphics_info; - private Gtk.Grid graphics_box; + private Gtk.Box graphics_box; private Gtk.Label storage_info; From 4f925b0728384e6cf9d9b43ece2e71a19ed74294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 14:41:28 -0800 Subject: [PATCH 08/21] OperatingSystemView --- data/OperatingSystemView.css | 5 +--- src/Views/OperatingSystemView.vala | 38 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/data/OperatingSystemView.css b/data/OperatingSystemView.css index 75058b3a5..4f9761bc8 100644 --- a/data/OperatingSystemView.css +++ b/data/OperatingSystemView.css @@ -1,12 +1,9 @@ -avatar.image { +.logo { background-image: linear-gradient( to bottom, alpha(@accent_color_500, 0.25), alpha(@accent_color_700, 0.75) ); -} - -.logo { color: white; -gtk-icon-shadow: 0 1px 1px alpha(black, 0.3), diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index add857671..c3a496df7 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -45,23 +45,19 @@ public class About.OperatingSystemView : Gtk.Box { var logo_overlay = new Gtk.Overlay (); - if (Gtk.IconTheme.get_default ().has_icon (logo_icon_name + "-symbolic")) { + if (Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).has_icon (logo_icon_name + "-symbolic")) { foreach (unowned var path in Environment.get_system_data_dirs ()) { var file = File.new_for_path ( Path.build_path (Path.DIR_SEPARATOR_S, path, "backgrounds", "elementaryos-default") ); if (file.query_exists ()) { - var file_icon = new FileIcon (file); - - var logo = new Hdy.Avatar (128, "", false) { - loadable_icon = file_icon, - // We need this for the shadow to not get clipped by Gtk.Overlay - margin = 6 + var logo = new Gtk.Image.from_file (file.get_path ()) { + pixel_size = 128 }; logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - logo_overlay.add (logo); + logo_overlay.child = logo; logo_overlay.add_overlay (icon); // 128 minus 3px padding on each side @@ -78,7 +74,7 @@ public class About.OperatingSystemView : Gtk.Box { if (icon.parent == null) { icon.pixel_size = 128; - logo_overlay.add (icon); + logo_overlay.child = icon; } // Intentionally not using GLib.OsInfoKey.PRETTY_NAME here because we @@ -136,19 +132,20 @@ public class About.OperatingSystemView : Gtk.Box { }); } - var settings_restore_button = new Gtk.Button.with_label (_("Restore Default Settings")); + var settings_restore_button = new Gtk.Button.with_label (_("Restore Default Settings")) { + halign = START, + hexpand = true + }; - var button_grid = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL) { - hexpand = true, - layout_style = Gtk.ButtonBoxStyle.END, - spacing = 6 + var button_grid = new Gtk.Box (HORIZONTAL, 6) { + homogeneous = true }; - button_grid.add (settings_restore_button); - button_grid.add (bug_button); + button_grid.append (settings_restore_button); + button_grid.append (bug_button); if (update_button != null) { - button_grid.add (update_button); + button_grid.append (update_button); } - button_grid.set_child_secondary (settings_restore_button, true); + button_grid.append (settings_restore_button); software_grid = new Gtk.Grid () { // The avatar has some built-in margin for shadows @@ -166,7 +163,10 @@ public class About.OperatingSystemView : Gtk.Box { software_grid.attach (help_button, 2, 3); software_grid.attach (translate_button, 3, 3); - margin = 12; + margin_top = 12; + margin_end = 12; + margin_bottom = 12; + margin_start = 12; orientation = Gtk.Orientation.VERTICAL; spacing = 12; append (software_grid); From e9cc84143146fdfe26d0a268b53739f004c5a764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 14:48:31 -0800 Subject: [PATCH 09/21] Make it compile --- src/Views/FirmwareReleaseView.vala | 2 +- src/Views/FirmwareView.vala | 43 ++++++++++++------------------ 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/Views/FirmwareReleaseView.vala b/src/Views/FirmwareReleaseView.vala index f213955cf..c3c27f05c 100644 --- a/src/Views/FirmwareReleaseView.vala +++ b/src/Views/FirmwareReleaseView.vala @@ -153,7 +153,7 @@ public class About.FirmwareReleaseView : Gtk.Box { stack.add_child (scrolled_window); orientation = VERTICAL; - get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); + get_style_context ().add_class (Granite.STYLE_CLASS_VIEW); append (header_box); append (new Gtk.Separator (HORIZONTAL)); append (stack); diff --git a/src/Views/FirmwareView.vala b/src/Views/FirmwareView.vala index 79a2dc28b..2cc033b3c 100644 --- a/src/Views/FirmwareView.vala +++ b/src/Views/FirmwareView.vala @@ -103,10 +103,8 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { } private async void update_list_view () { - foreach (unowned Gtk.Widget widget in update_list.get_children ()) { - if (widget is Widgets.FirmwareUpdateRow) { - update_list.remove (widget); - } + while (update_list.get_row_at_index (0) != null) { + update_list.remove (update_list.get_row_at_index (0)); } num_updates = 0; @@ -176,19 +174,27 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { private void on_device_removed (Fwupd.Client client, Fwupd.Device device) { debug ("Removed device: %s", device.get_name ()); - foreach (unowned Gtk.Widget widget in update_list.get_children ()) { - if (widget is Widgets.FirmwareUpdateRow) { - var row = (Widgets.FirmwareUpdateRow) widget; + unowned var child = update_list.get_first_child (); + while (child != null) { + Widgets.FirmwareUpdateRow row = null; + if (child is Widgets.FirmwareUpdateRow) { + row = (Widgets.FirmwareUpdateRow) child; + } + + child = child.get_next_sibling (); + + if (row != null) { if (row.device.get_id () == device.get_id ()) { if (row.is_updatable) { num_updates--; } - update_list.remove (widget); - update_list.invalidate_sort (); + update_list.remove (row); } } } + + update_list.invalidate_sort (); } [CCode (instance_pos = -1)] @@ -207,33 +213,18 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { [CCode (instance_pos = -1)] private void header_rows (Widgets.FirmwareUpdateRow row1, Widgets.FirmwareUpdateRow? row2) { if (row2 == null && row1.is_updatable) { - var header = new FirmwareHeaderRow ( + var header = new Granite.HeaderLabel ( dngettext (GETTEXT_PACKAGE, "%u Update Available", "%u Updates Available", num_updates).printf (num_updates) ); row1.set_header (header); } else if (row2 == null || row1.is_updatable != row2.is_updatable) { - var header = new FirmwareHeaderRow (_("Up to Date")); + var header = new Granite.HeaderLabel (_("Up to Date")); row1.set_header (header); } else { row1.set_header (null); } } - private class FirmwareHeaderRow : Gtk.Label { - public FirmwareHeaderRow (string label) { - Object (label: label); - } - - construct { - xalign = 0; - margin_top = 3; - margin_end = 3; - margin_bottom = 3; - margin_start = 3; - add_css_class (Granite.STYLE_CLASS_H4_LABEL); - } - } - private async void update (Fwupd.Device device, Fwupd.Release release) { progress_alert_view.title = _("“%s” is being updated").printf (device.get_name ()); stack.visible_child = progress_alert_view; From a064522b7c603908d85eac340a8c21e53a17a9bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 14:55:23 -0800 Subject: [PATCH 10/21] Fix up some logo style stuff --- data/OperatingSystemView.css | 4 ++-- src/Views/OperatingSystemView.vala | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/data/OperatingSystemView.css b/data/OperatingSystemView.css index 4f9761bc8..829d26e45 100644 --- a/data/OperatingSystemView.css +++ b/data/OperatingSystemView.css @@ -1,5 +1,5 @@ -.logo { - background-image: linear-gradient( +.card.circular { + background: linear-gradient( to bottom, alpha(@accent_color_500, 0.25), alpha(@accent_color_700, 0.75) diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index c3a496df7..b3917ec65 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -53,8 +53,10 @@ public class About.OperatingSystemView : Gtk.Box { if (file.query_exists ()) { var logo = new Gtk.Image.from_file (file.get_path ()) { + overflow = HIDDEN, pixel_size = 128 }; + logo.add_css_class (Granite.STYLE_CLASS_CIRCULAR); logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); logo_overlay.child = logo; @@ -63,9 +65,9 @@ public class About.OperatingSystemView : Gtk.Box { // 128 minus 3px padding on each side icon.pixel_size = 128 - 6; - unowned var icon_style_context = icon.get_style_context (); - icon_style_context.add_class ("logo"); - icon_style_context.add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + icon.add_css_class (Granite.STYLE_CLASS_CARD); + icon.add_css_class (Granite.STYLE_CLASS_CIRCULAR); + icon.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); break; } From 3dc85317b91b0253bbea53047916a540d831ca51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 15:13:27 -0800 Subject: [PATCH 11/21] Fix buttons --- src/Views/OperatingSystemView.vala | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index b3917ec65..0b6cd3504 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -134,20 +134,15 @@ public class About.OperatingSystemView : Gtk.Box { }); } - var settings_restore_button = new Gtk.Button.with_label (_("Restore Default Settings")) { - halign = START, - hexpand = true - }; + var settings_restore_button = new Gtk.Button.with_label (_("Restore Default Settings")); - var button_grid = new Gtk.Box (HORIZONTAL, 6) { - homogeneous = true - }; + var button_grid = new Gtk.Box (HORIZONTAL, 6); button_grid.append (settings_restore_button); + button_grid.append (new Gtk.Grid () { hexpand = true }); button_grid.append (bug_button); if (update_button != null) { button_grid.append (update_button); } - button_grid.append (settings_restore_button); software_grid = new Gtk.Grid () { // The avatar has some built-in margin for shadows From ce59a7525d9574e3c4c05d8df251f2a5f9032c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 15:15:03 -0800 Subject: [PATCH 12/21] Use a nested box --- src/Views/OperatingSystemView.vala | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index 0b6cd3504..2e6daf35b 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -136,14 +136,21 @@ public class About.OperatingSystemView : Gtk.Box { var settings_restore_button = new Gtk.Button.with_label (_("Restore Default Settings")); - var button_grid = new Gtk.Box (HORIZONTAL, 6); - button_grid.append (settings_restore_button); - button_grid.append (new Gtk.Grid () { hexpand = true }); - button_grid.append (bug_button); + var primary_button_box = new Gtk.Box (HORIZONTAL, 6) { + hexpand = true, + halign = END, + homogeneous = true + }; + primary_button_box.append (bug_button); if (update_button != null) { - button_grid.append (update_button); + primary_button_box.append (update_button); } + var button_grid = new Gtk.Box (HORIZONTAL, 6); + button_grid.append (settings_restore_button); + button_grid.append (primary_button_box); + + software_grid = new Gtk.Grid () { // The avatar has some built-in margin for shadows column_spacing = 32 - 6, From c4fbd4d72214ff88b7239fb7476d1a937aa1b488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 15:17:05 -0800 Subject: [PATCH 13/21] Fix firmware leaflet --- src/Views/FirmwareView.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Views/FirmwareView.vala b/src/Views/FirmwareView.vala index 2cc033b3c..e544916dd 100644 --- a/src/Views/FirmwareView.vala +++ b/src/Views/FirmwareView.vala @@ -65,7 +65,8 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { firmware_release_view = new FirmwareReleaseView (); deck = new Adw.Leaflet () { - can_navigate_back = true + can_navigate_back = true, + can_unfold = false }; deck.append (update_scrolled); deck.append (firmware_release_view); From b7ba1a47024fb3c931f6ed18a613c63d39b7a153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 20 Dec 2023 15:20:30 -0800 Subject: [PATCH 14/21] Remove margin workaround --- src/Views/OperatingSystemView.vala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index 2e6daf35b..b83cac3ff 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -150,10 +150,8 @@ public class About.OperatingSystemView : Gtk.Box { button_grid.append (settings_restore_button); button_grid.append (primary_button_box); - software_grid = new Gtk.Grid () { - // The avatar has some built-in margin for shadows - column_spacing = 32 - 6, + column_spacing = 32, halign = Gtk.Align.CENTER, row_spacing = 6, valign = Gtk.Align.CENTER, From 1abd00db4707544517a445410ce2484657a1bfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 10:59:46 -0800 Subject: [PATCH 15/21] Fix switcher size --- src/Plug.vala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Plug.vala b/src/Plug.vala index bc4fdb929..186160294 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -70,6 +70,13 @@ public class About.Plug : Switchboard.Plug { stack = stack }; + var size_group = new Gtk.SizeGroup (HORIZONTAL); + var child = stack_switcher.get_first_child (); + while (child != null) { + size_group.add_widget (child); + child = child.get_next_sibling (); + } + main_grid = new Gtk.Grid () { row_spacing = 12 }; From 669748ce35e6ba0640b171de8c1a499d97369709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 11:04:08 -0800 Subject: [PATCH 16/21] Remove unnecessary remove style class --- src/Plug.vala | 1 - src/Views/FirmwareReleaseView.vala | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Plug.vala b/src/Plug.vala index 186160294..0c7ed2551 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -65,7 +65,6 @@ public class About.Plug : Switchboard.Plug { var stack_switcher = new Gtk.StackSwitcher () { halign = Gtk.Align.CENTER, - // homogeneous = true, margin_top = 24, stack = stack }; diff --git a/src/Views/FirmwareReleaseView.vala b/src/Views/FirmwareReleaseView.vala index c8433a9b2..c39d51e64 100644 --- a/src/Views/FirmwareReleaseView.vala +++ b/src/Views/FirmwareReleaseView.vala @@ -128,7 +128,6 @@ public class About.FirmwareReleaseView : Gtk.Box { placeholder = new Granite.Placeholder ("") { description = _("There are no releases available for this device.") }; - placeholder.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); var box = new Gtk.Box (VERTICAL, 12) { halign = CENTER, From 5276f82dd1f7453fc657c7bb826e6c7fef32ba3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 11:07:05 -0800 Subject: [PATCH 17/21] More unnecessary remove class --- src/Views/FirmwareView.vala | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Views/FirmwareView.vala b/src/Views/FirmwareView.vala index e544916dd..117596a66 100644 --- a/src/Views/FirmwareView.vala +++ b/src/Views/FirmwareView.vala @@ -42,13 +42,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage { description = _("Do not unplug the device during the update."), icon = new ThemedIcon ("emblem-synchronized") }; - progress_alert_view.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); placeholder_alert_view = new Granite.Placeholder (_("Checking for Updates")) { description = _("Connecting to the firmware service and searching for updates."), icon = new ThemedIcon ("sync-synchronizing") }; - placeholder_alert_view.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); update_list = new Gtk.ListBox () { vexpand = true, From 947eca7b9575995751ecb365ba6ce482a72d47c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 11:13:25 -0800 Subject: [PATCH 18/21] Remove unnecessary xalign --- src/Views/HardwareView.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Views/HardwareView.vala b/src/Views/HardwareView.vala index c80e17a77..455fbef1f 100644 --- a/src/Views/HardwareView.vala +++ b/src/Views/HardwareView.vala @@ -122,7 +122,6 @@ public class About.HardwareView : Gtk.Box { ) { halign = START, margin_top = 12 - // xalign = 0 }; details_box.append (manufacturer_website_info); From 8073b392b64224f165b6d29e30784799ede7a9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 11:39:31 -0800 Subject: [PATCH 19/21] Revert back to Avatar for now --- data/OperatingSystemView.css | 13 ++++++++++--- src/Views/OperatingSystemView.vala | 10 +++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/data/OperatingSystemView.css b/data/OperatingSystemView.css index 829d26e45..12fcc41df 100644 --- a/data/OperatingSystemView.css +++ b/data/OperatingSystemView.css @@ -1,10 +1,17 @@ -.card.circular { - background: linear-gradient( +.logo { + color: white; + background-image: linear-gradient( to bottom, alpha(@accent_color_500, 0.25), alpha(@accent_color_700, 0.75) ); - color: white; + border-radius: 100%; + box-shadow: + inset 0 -2px 0 0 alpha(@highlight_color, 0.2), + inset 0 2px 0 0 alpha(@highlight_color, 0.3), + inset 2px 0 0 0 alpha(@highlight_color, 0.07), + inset -2px 0 0 0 alpha(@highlight_color, 0.07), + inset 0 0 0 1px alpha(black, 0.7); -gtk-icon-shadow: 0 1px 1px alpha(black, 0.3), 0 2px 3px alpha(@accent_color_900, 0.2); diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index b83cac3ff..12e900838 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -52,11 +52,9 @@ public class About.OperatingSystemView : Gtk.Box { ); if (file.query_exists ()) { - var logo = new Gtk.Image.from_file (file.get_path ()) { - overflow = HIDDEN, - pixel_size = 128 + var logo = new Adw.Avatar (128, "", false) { + custom_image = Gdk.Texture.from_file (file) }; - logo.add_css_class (Granite.STYLE_CLASS_CIRCULAR); logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); logo_overlay.child = logo; @@ -64,9 +62,7 @@ public class About.OperatingSystemView : Gtk.Box { // 128 minus 3px padding on each side icon.pixel_size = 128 - 6; - - icon.add_css_class (Granite.STYLE_CLASS_CARD); - icon.add_css_class (Granite.STYLE_CLASS_CIRCULAR); + icon.add_css_class ("logo"); icon.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); break; From 7ecc961dd49a506a5fac8fc960d79ffc3366e6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 11:48:19 -0800 Subject: [PATCH 20/21] Namespace --- .github/workflows/gettext.yml | 2 +- .github/workflows/release.yml | 2 +- data/meson.build | 4 ++-- ...d.about.appdata.xml.in => system.metainfo.xml.in} | 12 ++++++------ meson.build | 4 ++-- ...ut-plug.pot => io.elementary.settings.system.pot} | 0 6 files changed, 12 insertions(+), 12 deletions(-) rename data/{io.elementary.switchboard.about.appdata.xml.in => system.metainfo.xml.in} (91%) rename po/{about-plug.pot => io.elementary.settings.system.pot} (100%) diff --git a/.github/workflows/gettext.yml b/.github/workflows/gettext.yml index 3f5087d51..839f84b27 100644 --- a/.github/workflows/gettext.yml +++ b/.github/workflows/gettext.yml @@ -2,7 +2,7 @@ name: Gettext Updates on: push: - branches: [master] + branches: [main] jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 504e2b799..0b795bfff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: pull_request: - branches: [master] + branches: [main] types: [closed] jobs: release: diff --git a/data/meson.build b/data/meson.build index 8317272af..3964a4b90 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,6 +1,6 @@ i18n.merge_file( - input: 'io.elementary.switchboard.about.appdata.xml.in', - output: 'io.elementary.switchboard.about.appdata.xml', + input: 'system.metainfo.xml.in', + output: 'io.elementary.settings.system.metainfo.xml.in', po_dir: join_paths(meson.source_root (), 'po', 'extra'), install_dir: join_paths(datadir, 'metainfo'), install: true diff --git a/data/io.elementary.switchboard.about.appdata.xml.in b/data/system.metainfo.xml.in similarity index 91% rename from data/io.elementary.switchboard.about.appdata.xml.in rename to data/system.metainfo.xml.in index 96c28c400..3a232c5d4 100644 --- a/data/io.elementary.switchboard.about.appdata.xml.in +++ b/data/system.metainfo.xml.in @@ -1,11 +1,11 @@ - io.elementary.switchboard.about - io.elementary.switchboard + io.elementary.settings.system + io.elementary.settings System View operating system and hardware information application-x-firmware - about-plug + io.elementary.settings.system @@ -91,13 +91,13 @@ - https://raw.githubusercontent.com/elementary/switchboard-plug-about/master/data/screenshot.png + https://raw.githubusercontent.com/elementary/switchboard-plug-about/main/data/screenshot.png - https://raw.githubusercontent.com/elementary/switchboard-plug-about/master/data/screenshot-hardware.png + https://raw.githubusercontent.com/elementary/switchboard-plug-about/main/data/screenshot-hardware.png - https://raw.githubusercontent.com/elementary/switchboard-plug-about/master/data/screenshot-firmware.png + https://raw.githubusercontent.com/elementary/switchboard-plug-about/main/data/screenshot-firmware.png https://elementary.io diff --git a/meson.build b/meson.build index 35823ae99..ba8703c3d 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,10 @@ project( - 'about', + 'system', 'vala', 'c', version: '6.2.0' ) -gettext_name = meson.project_name() + '-plug' +gettext_name = 'io.elementary.settings.' + meson.project_name() gnome = import('gnome') i18n = import('i18n') diff --git a/po/about-plug.pot b/po/io.elementary.settings.system.pot similarity index 100% rename from po/about-plug.pot rename to po/io.elementary.settings.system.pot From 9561574b9642f56bd7f7ade9119c546dc056a136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Dec 2023 11:50:45 -0800 Subject: [PATCH 21/21] fix missed spots --- README.md | 4 ++-- data/gresource.xml | 2 +- po/extra/POTFILES | 2 +- src/Plug.vala | 2 +- src/Views/OperatingSystemView.vala | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8593aa14f..7e1246215 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Switchboard System Plug +# System Settings [![Translation status](https://l10n.elementary.io/widgets/switchboard/-/switchboard-plug-about/svg-badge.svg)](https://l10n.elementary.io/engage/switchboard/?utm_source=widget) ![screenshot](data/screenshot.png?raw=true) @@ -32,7 +32,7 @@ To install, use `ninja install` ## OEM Configuration -The Switchboard System plug can load OEM information supplied by an `oem.conf` file placed in `/etc` with the following format: +System Settings can load OEM information supplied by an `oem.conf` file placed in `/etc` with the following format: ```ini [OEM] diff --git a/data/gresource.xml b/data/gresource.xml index 7e1072343..ddaa79c17 100644 --- a/data/gresource.xml +++ b/data/gresource.xml @@ -1,6 +1,6 @@ - + OperatingSystemView.css diff --git a/po/extra/POTFILES b/po/extra/POTFILES index 57b806337..8878abb98 100644 --- a/po/extra/POTFILES +++ b/po/extra/POTFILES @@ -1 +1 @@ -data/io.elementary.switchboard.about.appdata.xml.in +data/system.metainfo.xml.in diff --git a/src/Plug.vala b/src/Plug.vala index 0c7ed2551..4fd5bdb24 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -38,7 +38,7 @@ public class About.Plug : Switchboard.Plug { Object ( category: Category.SYSTEM, - code_name: "io.elementary.switchboard.about", + code_name: "io.elementary.settings.system", display_name: _("System"), description: _("View operating system and hardware information"), icon: "application-x-firmware", diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala index 12e900838..a5767f0cd 100644 --- a/src/Views/OperatingSystemView.vala +++ b/src/Views/OperatingSystemView.vala @@ -25,7 +25,7 @@ public class About.OperatingSystemView : Gtk.Box { construct { var style_provider = new Gtk.CssProvider (); - style_provider.load_from_resource ("io/elementary/switchboard/system/OperatingSystemView.css"); + style_provider.load_from_resource ("io/elementary/settings/system/OperatingSystemView.css"); var uts_name = Posix.utsname ();