diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b35af735c..5bd86320b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,11 +23,13 @@ jobs:
- name: Install Dependencies
run: |
apt update
- apt install -y desktop-file-utils gettext libdistinst-dev libgtk-3-dev libgee-0.8-dev libgranite-dev libhandy-1-dev libxml2-dev libjson-glib-dev libpwquality-dev libxml2-utils meson valac
- - name: Build
+ apt install -y desktop-file-utils gettext libadwaita-1-dev libdistinst-dev libgee-0.8-dev libgranite-7-dev libgtk-4-dev libxml2-dev libjson-glib-dev libpwquality-dev libxml2-utils meson valac
+ - name: Build and Test
+ env:
+ DESTDIR: out
run: |
- meson build
- ninja -C build
+ meson setup build
+ ninja -C build install
lint:
runs-on: ubuntu-latest
diff --git a/README.md b/README.md
index 1d9dba723..47c4aa6d4 100644
--- a/README.md
+++ b/README.md
@@ -16,10 +16,10 @@ You'll need the following dependencies:
- gettext
- gparted
- libgnomekbd-dev
- - libgranite-dev >= 0.5
- - libgtk-3-dev
+ - libgranite-7-dev >=7.4.0
+ - libgtk-4-dev
- libgee-0.8-dev
- - libhandy-1-dev
+ - libadwaita-1-dev >=1.0.0
- libjson-glib-dev
- libpwquality-dev
- libxml2-dev
diff --git a/data/Application.css b/data/Application.css
index e1e1d4003..f9a9c864d 100644
--- a/data/Application.css
+++ b/data/Application.css
@@ -1,3 +1,125 @@
.button-box button {
min-width: 86px; /* https://github.com/elementary/granite/issues/577#issuecomment-1318979272 */
}
+
+.logo {
+ animation: rainbow-bg 30s linear infinite;
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@BLUEBERRY_500, 0.25),
+ alpha(@BLUEBERRY_700, 0.75)
+ );
+ border-radius: 50%;
+ 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);
+ color: white;
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@BLUEBERRY_900, 0.2);
+ -gtk-icon-style: symbolic;
+}
+
+@keyframes rainbow-bg {
+ from {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@BLUEBERRY_500, 0.25),
+ alpha(@BLUEBERRY_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@BLUEBERRY_900, 0.2);
+ }
+
+ 12.5% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@MINT_500, 0.25),
+ alpha(@MINT_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@MINT_900, 0.2);
+ }
+
+ 25% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@LIME_500, 0.25),
+ alpha(@LIME_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@LIME_900, 0.2);
+ }
+
+ 37.5% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@BANANA_500, 0.25),
+ alpha(@BANANA_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@BANANA_900, 0.2);
+ }
+
+ 50% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@ORANGE_500, 0.25),
+ alpha(@ORANGE_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@ORANGE_900, 0.2);
+ }
+
+ 62.5% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@STRAWBERRY_500, 0.25),
+ alpha(@STRAWBERRY_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@STRAWBERRY_900, 0.2);
+ }
+
+ 75% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@BUBBLEGUM_500, 0.25),
+ alpha(@BUBBLEGUM_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@BUBBLEGUM_900, 0.2);
+ }
+
+ 87.5% {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@GRAPE_500, 0.25),
+ alpha(@GRAPE_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@GRAPE_900, 0.2);
+ }
+
+ to {
+ background-image: linear-gradient(
+ to bottom,
+ alpha(@BLUEBERRY_500, 0.25),
+ alpha(@BLUEBERRY_700, 0.75)
+ );
+ -gtk-icon-shadow:
+ 0 1px 1px alpha(black, 0.3),
+ 0 2px 3px alpha(@BLUEBERRY_900, 0.2);
+ }
+}
diff --git a/data/ProgressView.css b/data/ProgressView.css
deleted file mode 100644
index af5d04e76..000000000
--- a/data/ProgressView.css
+++ /dev/null
@@ -1,146 +0,0 @@
-avatar.image {
- animation: rainbow-bg 30s linear infinite;
- background-image: linear-gradient(
- to bottom,
- alpha(@BLUEBERRY_500, 0.25),
- alpha(@BLUEBERRY_700, 0.75)
- );
-}
-
-.logo {
- animation: rainbow-shadow 30s linear infinite;
- color: white;
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@BLUEBERRY_900, 0.2);
-}
-
-@keyframes rainbow-bg {
- from {
- background-image: linear-gradient(
- to bottom,
- alpha(@BLUEBERRY_500, 0.25),
- alpha(@BLUEBERRY_700, 0.75)
- );
- }
-
- 12.5% {
- background-image: linear-gradient(
- to bottom,
- alpha(@MINT_500, 0.25),
- alpha(@MINT_700, 0.75)
- );
- }
-
- 25% {
- background-image: linear-gradient(
- to bottom,
- alpha(@LIME_500, 0.25),
- alpha(@LIME_700, 0.75)
- );
- }
-
- 37.5% {
- background-image: linear-gradient(
- to bottom,
- alpha(@BANANA_500, 0.25),
- alpha(@BANANA_700, 0.75)
- );
- }
-
- 50% {
- background-image: linear-gradient(
- to bottom,
- alpha(@ORANGE_500, 0.25),
- alpha(@ORANGE_700, 0.75)
- );
- }
-
- 62.5% {
- background-image: linear-gradient(
- to bottom,
- alpha(@STRAWBERRY_500, 0.25),
- alpha(@STRAWBERRY_700, 0.75)
- );
- }
-
- 75% {
- background-image: linear-gradient(
- to bottom,
- alpha(@BUBBLEGUM_500, 0.25),
- alpha(@BUBBLEGUM_700, 0.75)
- );
- }
-
- 87.5% {
- background-image: linear-gradient(
- to bottom,
- alpha(@GRAPE_500, 0.25),
- alpha(@GRAPE_700, 0.75)
- );
- }
-
- to {
- background-image: linear-gradient(
- to bottom,
- alpha(@BLUEBERRY_500, 0.25),
- alpha(@BLUEBERRY_700, 0.75)
- );
- }
-}
-
-@keyframes rainbow-shadow {
- from {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@BLUEBERRY_900, 0.2);
- }
-
- 12.5% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@MINT_900, 0.2);
- }
-
- 25% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@LIME_900, 0.2);
- }
-
- 37.5% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@BANANA_900, 0.2);
- }
-
- 50% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@ORANGE_900, 0.2);
- }
-
- 62.5% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@STRAWBERRY_900, 0.2);
- }
-
- 75% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@BUBBLEGUM_900, 0.2);
- }
-
- 87.5% {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@GRAPE_900, 0.2);
- }
-
- to {
- -gtk-icon-shadow:
- 0 1px 1px alpha(black, 0.3),
- 0 2px 3px alpha(@BLUEBERRY_900, 0.2);
- }
-}
diff --git a/data/disk-bar-fallback.css b/data/disk-bar-fallback.css
index 5464e619c..c2326a221 100644
--- a/data/disk-bar-fallback.css
+++ b/data/disk-bar-fallback.css
@@ -93,8 +93,3 @@ levelbar block image {
0 1px 1px alpha(#000, 0.2),
0 1px 3px alpha(#000, 0.1);
}
-
-levelbar .h4 {
- opacity: 1;
- padding: 0;
-}
diff --git a/data/io.elementary.installer.gresource.xml b/data/io.elementary.installer.gresource.xml
index e08676d4d..a43779f25 100644
--- a/data/io.elementary.installer.gresource.xml
+++ b/data/io.elementary.installer.gresource.xml
@@ -3,7 +3,6 @@
Application.css
disk-bar-fallback.css
- ProgressView.css
wallpaper.jpg
diff --git a/meson.build b/meson.build
index 2a1db3212..b48486ec3 100644
--- a/meson.build
+++ b/meson.build
@@ -15,11 +15,11 @@ i18n = import('i18n')
distinst_dep = dependency('distinst')
glib_dep = dependency('glib-2.0', version: '>=2.74')
gobject_dep = dependency('gobject-2.0')
-gtk_dep = dependency('gtk+-3.0')
+gtk_dep = dependency('gtk4')
gee_dep = dependency('gee-0.8')
gio_dep = dependency('gio-2.0')
-granite_dep = dependency('granite', version: '>=0.5')
-handy_dep = dependency('libhandy-1', version: '>=0.90.0')
+granite_dep = dependency('granite-7', version: '>=7.4.0')
+adw_dep = dependency('libadwaita-1', version: '>=1.0.0')
json_glib_dep = dependency('json-glib-1.0')
xml2_dep = dependency('libxml-2.0')
pwquality_dep = dependency('pwquality')
diff --git a/src/Application.vala b/src/Application.vala
index 21062fe74..b2e931a11 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -32,19 +32,12 @@ public class Installer.App : Gtk.Application {
public override void startup () {
base.startup ();
- var css_provider = new Gtk.CssProvider ();
- css_provider.load_from_resource ("io/elementary/installer/Application.css");
-
- Gtk.StyleContext.add_provider_for_screen (
- Gdk.Screen.get_default (),
- css_provider,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
+ Granite.init ();
var css_fallback = new Gtk.CssProvider ();
css_fallback.load_from_resource ("io/elementary/installer/disk-bar-fallback.css");
- Gtk.StyleContext.add_provider_for_screen (
- Gdk.Screen.get_default (),
+ Gtk.StyleContext.add_provider_for_display (
+ Gdk.Display.get_default (),
css_fallback,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
@@ -58,7 +51,7 @@ public class Installer.App : Gtk.Application {
icon_name = application_id,
title = _("Install %s").printf (Utils.get_pretty_name ())
};
- window.show_all ();
+ window.present ();
add_window (window);
inhibit (
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 202ab6661..2faf178f8 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -22,14 +22,14 @@ public interface UPower : GLib.Object {
public abstract bool on_battery { owned get; set; }
}
-public class Installer.MainWindow : Hdy.Window {
+public class Installer.MainWindow : Gtk.Window {
// We have to do it step by step because the vala compiler has overflows with big numbers.
private const uint64 ONE_GB = 1000 * 1000 * 1000;
// Minimum 15 GB
private const uint64 MINIMUM_SPACE = 15 * ONE_GB;
private Gtk.Label infobar_label;
- private Hdy.Deck deck;
+ private Adw.Leaflet leaflet;
private LanguageView language_view;
private TryInstallView try_install_view;
private bool check_ignored = false;
@@ -38,10 +38,12 @@ public class Installer.MainWindow : Hdy.Window {
construct {
language_view = new LanguageView ();
- deck = new Hdy.Deck () {
- can_swipe_back = true
+ leaflet = new Adw.Leaflet () {
+ can_navigate_back = true,
+ can_unfold = false,
+ homogeneous = false
};
- deck.add (language_view);
+ leaflet.append (language_view);
infobar_label = new Gtk.Label ("") {
use_markup = true
@@ -57,15 +59,16 @@ public class Installer.MainWindow : Hdy.Window {
halign = Gtk.Align.START, // Can't cover action area; need to select language
valign = Gtk.Align.END
};
- battery_infobar.get_content_area ().add (infobar_label);
- battery_infobar.get_style_context ().add_class ("frame");
+ battery_infobar.add_child (infobar_label);
+ battery_infobar.add_css_class (Granite.STYLE_CLASS_FRAME);
var overlay = new Gtk.Overlay () {
- child = deck
+ child = leaflet
};
overlay.add_overlay (battery_infobar);
child = overlay;
+ titlebar = new Gtk.Grid () { visible = false };
language_view.next_step.connect (() => {
// Don't prompt for screen reader if we're able to navigate without it
@@ -126,21 +129,21 @@ public class Installer.MainWindow : Hdy.Window {
return Source.REMOVE;
});
- deck.notify["visible-child"].connect (() => {
+ leaflet.notify["visible-child"].connect (() => {
update_navigation ();
});
- deck.notify["transition-running"].connect (() => {
+ leaflet.notify["child-transition-running"].connect (() => {
update_navigation ();
});
}
private void update_navigation () {
- if (!deck.transition_running) {
+ if (!leaflet.child_transition_running) {
// We need to rebuild the views to reflect language changes and forking paths
- if (deck.visible_child == language_view || deck.visible_child == try_install_view) {
- while (deck.get_adjacent_child (FORWARD) != null) {
- deck.remove (deck.get_adjacent_child (FORWARD));
+ if (leaflet.visible_child == language_view || leaflet.visible_child == try_install_view) {
+ while (leaflet.get_adjacent_child (FORWARD) != null) {
+ leaflet.remove (leaflet.get_adjacent_child (FORWARD));
}
}
}
@@ -150,16 +153,16 @@ public class Installer.MainWindow : Hdy.Window {
var keyboard_layout_view = new KeyboardLayoutView ();
try_install_view = new TryInstallView ();
- deck.add (keyboard_layout_view);
- deck.add (try_install_view);
+ leaflet.append (keyboard_layout_view);
+ leaflet.append (try_install_view);
- deck.visible_child = keyboard_layout_view;
+ leaflet.visible_child = keyboard_layout_view;
try_install_view.custom_step.connect (() => {
load_check_view ();
load_partitioning_view ();
load_drivers_view ();
- deck.navigate (FORWARD);
+ leaflet.navigate (FORWARD);
});
try_install_view.next_step.connect (() => {
@@ -167,16 +170,16 @@ public class Installer.MainWindow : Hdy.Window {
load_disk_view ();
load_encrypt_view ();
load_drivers_view ();
- deck.navigate (FORWARD);
+ leaflet.navigate (FORWARD);
});
}
private void load_disk_view () {
var disk_view = new DiskView ();
- deck.add (disk_view);
+ leaflet.append (disk_view);
disk_view.load.begin (MINIMUM_SPACE);
- disk_view.cancel.connect (() => deck.navigate (BACK));
+ disk_view.cancel.connect (() => leaflet.navigate (BACK));
}
private void load_check_view () {
@@ -186,41 +189,41 @@ public class Installer.MainWindow : Hdy.Window {
var check_view = new Installer.CheckView ();
if (check_view.has_messages) {
- deck.add (check_view);
+ leaflet.append (check_view);
}
- check_view.cancel.connect (() => deck.navigate (BACK));
+ check_view.cancel.connect (() => leaflet.navigate (BACK));
check_view.next_step.connect (() => {
check_ignored = true;
- deck.navigate (FORWARD);
+ leaflet.navigate (FORWARD);
});
}
private void load_encrypt_view () {
var encrypt_view = new EncryptView ();
- deck.add (encrypt_view);
+ leaflet.append (encrypt_view);
encrypt_view.cancel.connect (() => {
- deck.visible_child = try_install_view;
+ leaflet.visible_child = try_install_view;
});
}
private void load_partitioning_view () {
var partitioning_view = new PartitioningView (MINIMUM_SPACE);
- deck.add (partitioning_view);
+ leaflet.append (partitioning_view);
partitioning_view.next_step.connect (() => {
unowned Configuration config = Configuration.get_default ();
config.luks = (owned) partitioning_view.luks;
config.mounts = (owned) partitioning_view.mounts;
- deck.navigate (FORWARD);
+ leaflet.navigate (FORWARD);
});
}
private void load_drivers_view () {
var drivers_view = new DriversView ();
- deck.add (drivers_view);
+ leaflet.append (drivers_view);
drivers_view.next_step.connect (() => load_progress_view ());
}
@@ -228,9 +231,9 @@ public class Installer.MainWindow : Hdy.Window {
private void load_progress_view () {
var progress_view = new ProgressView ();
- deck.add (progress_view);
- deck.visible_child = progress_view;
- deck.can_swipe_back = false;
+ leaflet.append (progress_view);
+ leaflet.visible_child = progress_view;
+ leaflet.can_navigate_back = false;
progress_view.on_success.connect (() => load_success_view ());
@@ -242,18 +245,18 @@ public class Installer.MainWindow : Hdy.Window {
private void load_success_view () {
var success_view = new SuccessView ();
- deck.add (success_view);
- deck.visible_child = success_view;
+ leaflet.append (success_view);
+ leaflet.visible_child = success_view;
}
private void load_error_view (string log) {
var error_view = new ErrorView (log);
- deck.add (error_view);
- deck.visible_child = error_view;
+ leaflet.append (error_view);
+ leaflet.visible_child = error_view;
error_view.retry_install.connect (() => {
- deck.visible_child = try_install_view;
- deck.can_swipe_back = true;
+ leaflet.visible_child = try_install_view;
+ leaflet.can_navigate_back = true;
});
}
diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala
index 4476bae58..943e8fc3a 100644
--- a/src/Views/AbstractInstallerView.vala
+++ b/src/Views/AbstractInstallerView.vala
@@ -33,7 +33,7 @@ public abstract class AbstractInstallerView : Gtk.Box {
title_area = new Gtk.Box (VERTICAL, 12) {
valign = CENTER
};
- title_area.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);
+ title_area.add_css_class (Granite.STYLE_CLASS_H2_LABEL);
content_area = new Gtk.Box (VERTICAL, 24);
@@ -42,8 +42,8 @@ public abstract class AbstractInstallerView : Gtk.Box {
hexpand = true,
vexpand = true,
};
- box.add (title_area);
- box.add (content_area);
+ box.append (title_area);
+ box.append (content_area);
action_box_end = new Gtk.Box (HORIZONTAL, 6) {
halign = END,
@@ -56,17 +56,17 @@ public abstract class AbstractInstallerView : Gtk.Box {
};
var action_area = new Gtk.Box (HORIZONTAL, 12);
- action_area.add (action_box_start);
- action_area.get_style_context ().add_class ("button-box");
+ action_area.append (action_box_start);
+ action_area.add_css_class ("button-box");
if (Installer.App.test_mode) {
var test_label = new Gtk.Label (_("Test Mode"));
- test_label.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR);
+ test_label.add_css_class (Granite.STYLE_CLASS_ERROR);
- action_area.add (test_label);
+ action_area.append (test_label);
}
- action_area.add (action_box_end);
+ action_area.append (action_box_end);
if (cancellable) {
var cancel_button = new Gtk.Button.with_label (_("Cancel Installation"));
@@ -74,7 +74,7 @@ public abstract class AbstractInstallerView : Gtk.Box {
cancel ();
});
- action_box_end.add (cancel_button);
+ action_box_end.append (cancel_button);
}
var main_box = new Gtk.Box (VERTICAL, 24) {
@@ -83,9 +83,9 @@ public abstract class AbstractInstallerView : Gtk.Box {
margin_bottom = 12,
margin_start = 12
};
- main_box.add (box);
- main_box.add (action_area);
+ main_box.append (box);
+ main_box.append (action_area);
- add (main_box);
+ append (main_box);
}
}
diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala
index 40fc661ca..a9d3efe86 100644
--- a/src/Views/CheckView.vala
+++ b/src/Views/CheckView.vala
@@ -30,7 +30,7 @@ public class Installer.CheckView : AbstractInstallerView {
private Gtk.Box message_box;
public bool has_messages {
get {
- return message_box.get_children ().length () > 0;
+ return message_box.get_first_child != null;
}
}
@@ -42,7 +42,7 @@ public class Installer.CheckView : AbstractInstallerView {
}
construct {
- var image = new Gtk.Image.from_icon_name ("io.elementary.installer.caution", Gtk.IconSize.DIALOG) {
+ var image = new Gtk.Image.from_icon_name ("io.elementary.installer.caution") {
pixel_size = 128,
valign = Gtk.Align.END
};
@@ -75,16 +75,16 @@ public class Installer.CheckView : AbstractInstallerView {
vexpand = true
};
- title_area.add (image);
- title_area.add (title_label);
+ title_area.append (image);
+ title_area.append (title_label);
- content_area.add (message_box);
+ content_area.append (message_box);
var ignore_button = new Gtk.Button.with_label (_("Install Anyway"));
- ignore_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
+ ignore_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);
ignore_button.clicked.connect (() => next_step ());
- action_box_end.add (ignore_button);
+ action_box_end.append (ignore_button);
bool minimum_specs = true;
@@ -104,21 +104,19 @@ public class Installer.CheckView : AbstractInstallerView {
var dis = new DataInputStream (@is);
if ("daily" in dis.read_line ()) {
- message_box.add (beta_view);
+ message_box.append (beta_view);
}
} catch (Error e) {
critical ("Couldn't read apt sources: %s", e.message);
}
if (get_vm ()) {
- message_box.add (vm_view);
+ message_box.append (vm_view);
}
if (!minimum_specs) {
- message_box.add (specs_view);
+ message_box.append (specs_view);
}
-
- show_all ();
}
private int get_frequency () {
@@ -176,7 +174,8 @@ public class Installer.CheckView : AbstractInstallerView {
private class CheckView : Gtk.Grid {
public CheckView (string title, string description, string icon_name) {
- var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DND) {
+ var image = new Gtk.Image.from_icon_name (icon_name) {
+ icon_size = LARGE,
valign = Gtk.Align.START
};
@@ -186,7 +185,7 @@ public class Installer.CheckView : AbstractInstallerView {
wrap = true,
xalign = 0
};
- title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ title_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var description_label = new Gtk.Label (description) {
max_width_chars = 1, // Make Gtk wrap, but not expand the window
@@ -200,8 +199,6 @@ public class Installer.CheckView : AbstractInstallerView {
attach (image, 0, 0, 1, 2);
attach (title_label, 1, 0);
attach (description_label, 1, 1);
-
- show_all ();
}
}
@@ -210,13 +207,13 @@ public class Installer.CheckView : AbstractInstallerView {
hexpand = true,
xalign = 0
};
- recommended_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
+ recommended_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL);
var your_device_label = new Gtk.Label (_("Your Device:")) {
hexpand = true,
xalign = 0
};
- your_device_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
+ your_device_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL);
var processor_1 = new Gtk.Label (_("Processor:")) {
xalign = 1
diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala
index a84f09f75..817413093 100644
--- a/src/Views/DiskView.vala
+++ b/src/Views/DiskView.vala
@@ -27,11 +27,11 @@ public class Installer.DiskView : AbstractInstallerView {
}
construct {
- var install_image = new Gtk.Image.from_icon_name ("drive-harddisk", Gtk.IconSize.DIALOG) {
+ var install_image = new Gtk.Image.from_icon_name ("drive-harddisk") {
pixel_size = 128
};
- var install_badge = new Gtk.Image.from_icon_name ("io.elementary.installer.emblem-downloads", Gtk.IconSize.DND) {
+ var install_badge = new Gtk.Image.from_icon_name ("io.elementary.installer.emblem-downloads") {
pixel_size = 64,
halign = Gtk.Align.END,
valign = Gtk.Align.END
@@ -55,7 +55,7 @@ public class Installer.DiskView : AbstractInstallerView {
disk_box = new Gtk.Box (VERTICAL, 6);
- var disk_scrolled = new Gtk.ScrolledWindow (null, null) {
+ var disk_scrolled = new Gtk.ScrolledWindow () {
child = disk_box,
hscrollbar_policy = Gtk.PolicyType.NEVER,
propagate_natural_height = true
@@ -71,38 +71,36 @@ public class Installer.DiskView : AbstractInstallerView {
max_width_chars = 45,
wrap = true
};
- load_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ load_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var load_box = new Gtk.Box (VERTICAL, 12) {
halign = CENTER,
valign = CENTER
};
- load_box.add (load_spinner);
- load_box.add (load_label);
+ load_box.append (load_spinner);
+ load_box.append (load_label);
load_stack = new Gtk.Stack () {
transition_type = Gtk.StackTransitionType.CROSSFADE
};
- load_stack.add (load_box);
+ load_stack.add_child (load_box);
load_stack.add_named (disk_scrolled, "disk");
- title_area.add (image_overlay);
- title_area.add (install_label);
+ title_area.append (image_overlay);
+ title_area.append (install_label);
content_area.valign = CENTER;
- content_area.add (install_desc_label);
- content_area.add (load_stack);
+ content_area.append (install_desc_label);
+ content_area.append (load_stack);
next_button = new Gtk.Button.with_label (_("Next")) {
// Make sure we can skip this view in Test Mode
sensitive = Installer.App.test_mode
};
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
- next_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (FORWARD));
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
+ next_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (FORWARD));
- action_box_end.add (next_button);
-
- show_all ();
+ action_box_end.append (next_button);
}
public async void load (uint64 minimum_disk_size) {
@@ -147,7 +145,7 @@ public class Installer.DiskView : AbstractInstallerView {
disabled_buttons += disk_button;
} else {
- disk_button.clicked.connect (() => {
+ disk_button.toggled.connect (() => {
if (disk_button.active) {
next_button.sensitive = true;
}
@@ -158,21 +156,20 @@ public class Installer.DiskView : AbstractInstallerView {
}
// Force the user to make a conscious selection, not spam "Next"
- var no_selection = new Gtk.RadioButton (null) {
+ var no_selection = new Gtk.CheckButton () {
active = true
};
foreach (DiskButton disk_button in enabled_buttons) {
disk_button.group = no_selection;
- disk_box.add (disk_button);
+ disk_box.append (disk_button);
}
foreach (DiskButton disk_button in disabled_buttons) {
disk_button.group = no_selection;
- disk_box.add (disk_button);
+ disk_box.append (disk_button);
}
- disk_box.show_all ();
load_stack.set_visible_child_name ("disk");
}
}
diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala
index a071694b6..ac02f53bc 100644
--- a/src/Views/DriversView.vala
+++ b/src/Views/DriversView.vala
@@ -19,7 +19,7 @@
public signal void next_step ();
construct {
- var image = new Gtk.Image.from_icon_name ("application-x-firmware", Gtk.IconSize.INVALID) {
+ var image = new Gtk.Image.from_icon_name ("application-x-firmware") {
pixel_size = 128
};
@@ -30,7 +30,7 @@
wrap = true,
xalign = 0
};
- description_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ description_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var warning_row = new DescriptionRow (
_("Proprietary drivers contain private code that can't be reviewed. Security and other updates are dependent on the driver vendor."),
@@ -62,32 +62,30 @@
valign = CENTER,
vexpand = true
};
- message_box.add (description_label);
- message_box.add (warning_row);
- message_box.add (internet_row);
- message_box.add (install_later_row);
- message_box.add (drivers_check);
+ message_box.append (description_label);
+ message_box.append (warning_row);
+ message_box.append (internet_row);
+ message_box.append (install_later_row);
+ message_box.append (drivers_check);
- title_area.add (image);
- title_area.add (title_label);
+ title_area.append (image);
+ title_area.append (title_label);
- content_area.add (message_box);
+ content_area.append (message_box);
var back_button = new Gtk.Button.with_label (_("Back"));
- back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (BACK));
+ back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK));
var next_button = new Gtk.Button.with_label (_("Erase and Install"));
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
+ next_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);
next_button.clicked.connect (() => next_step ());
- action_box_end.add (back_button);
- action_box_end.add (next_button);
+ action_box_end.append (back_button);
+ action_box_end.append (next_button);
drivers_check.toggled.connect (() => {
unowned var configuration = Configuration.get_default ();
configuration.install_drivers = drivers_check.active;
});
-
- show_all ();
}
}
diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala
index b03f2de71..8a08bfe40 100644
--- a/src/Views/EncryptView.vala
+++ b/src/Views/EncryptView.vala
@@ -30,11 +30,11 @@ public class EncryptView : AbstractInstallerView {
}
construct {
- var image = new Gtk.Image.from_icon_name ("drive-harddisk", Gtk.IconSize.INVALID) {
+ var image = new Gtk.Image.from_icon_name ("drive-harddisk") {
pixel_size = 128
};
- var overlay_image = new Gtk.Image.from_icon_name ("security-high", Gtk.IconSize.INVALID) {
+ var overlay_image = new Gtk.Image.from_icon_name ("security-high") {
pixel_size = 64,
halign = Gtk.Align.END,
valign = Gtk.Align.END
@@ -55,7 +55,7 @@ public class EncryptView : AbstractInstallerView {
wrap = true,
xalign = 0
};
- details_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ details_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var protect_row = new DescriptionRow (
_("Data will only be protected from others with physical access to this device when it is shut down."),
@@ -78,10 +78,10 @@ public class EncryptView : AbstractInstallerView {
var description_box = new Gtk.Box (VERTICAL, 32) {
valign = CENTER
};
- description_box.add (details_label);
- description_box.add (protect_row);
- description_box.add (restart_row);
- description_box.add (keyboard_row);
+ description_box.append (details_label);
+ description_box.append (protect_row);
+ description_box.append (restart_row);
+ description_box.append (keyboard_row);
var description = new Gtk.Label (
_("If you forget the encryption password, you will not be able to recover data. This is a unique password for this device, not the password for your user account.")
@@ -97,7 +97,7 @@ public class EncryptView : AbstractInstallerView {
var pw_label = new Granite.HeaderLabel (_("Choose Encryption Password"));
pw_error_revealer = new ErrorRevealer (".");
- pw_error_revealer.label_widget.get_style_context ().add_class (Gtk.STYLE_CLASS_WARNING);
+ pw_error_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_WARNING);
pw_entry = new ValidatedEntry ();
pw_entry.visibility = false;
@@ -116,44 +116,44 @@ public class EncryptView : AbstractInstallerView {
};
confirm_entry_revealer = new ErrorRevealer (".");
- confirm_entry_revealer.label_widget.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR);
+ confirm_entry_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_ERROR);
var password_box = new Gtk.Box (VERTICAL, 3) {
valign = CENTER
};
- password_box.add (description);
- password_box.add (pw_label);
- password_box.add (pw_entry);
- password_box.add (pw_levelbar);
- password_box.add (pw_error_revealer);
- password_box.add (confirm_label);
- password_box.add (confirm_entry);
- password_box.add (confirm_entry_revealer);
+ password_box.append (description);
+ password_box.append (pw_label);
+ password_box.append (pw_entry);
+ password_box.append (pw_levelbar);
+ password_box.append (pw_error_revealer);
+ password_box.append (confirm_label);
+ password_box.append (confirm_entry);
+ password_box.append (confirm_entry_revealer);
var stack = new Gtk.Stack () {
transition_type = SLIDE_LEFT_RIGHT,
vexpand = true
};
- stack.add (description_box);
- stack.add (password_box);
+ stack.add_child (description_box);
+ stack.add_child (password_box);
- title_area.add (overlay);
- title_area.add (title_label);
+ title_area.append (overlay);
+ title_area.append (title_label);
- content_area.add (stack);
+ content_area.append (stack);
var back_button = new Gtk.Button.with_label (_("Back"));
var encrypt_button = new Gtk.Button.with_label (_("Choose Password"));
next_button = new Gtk.Button.with_label (_(SKIP_STRING)) {
- can_default = true
+ receives_default = true
};
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
- action_box_end.add (back_button);
- action_box_end.add (encrypt_button);
- action_box_end.add (next_button);
+ action_box_end.append (back_button);
+ action_box_end.append (encrypt_button);
+ action_box_end.append (next_button);
next_button.grab_focus ();
@@ -180,7 +180,7 @@ public class EncryptView : AbstractInstallerView {
Configuration.get_default ().encryption_password = pw_entry.text;
}
- ((Hdy.Deck) get_parent ()).navigate (FORWARD);
+ ((Adw.Leaflet) get_parent ()).navigate (FORWARD);
});
pw_entry.changed.connect (() => {
@@ -194,7 +194,6 @@ public class EncryptView : AbstractInstallerView {
update_next_button ();
});
- show_all ();
back_button.hide ();
}
@@ -252,7 +251,7 @@ public class EncryptView : AbstractInstallerView {
private void update_next_button () {
if (pw_entry.is_valid && confirm_entry.is_valid) {
next_button.sensitive = true;
- next_button.has_default = true;
+ ((Gtk.Window) get_root ()).default_widget = next_button;
} else {
next_button.sensitive = false;
}
@@ -284,14 +283,14 @@ public class EncryptView : AbstractInstallerView {
wrap = true,
xalign = 1
};
- label_widget.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);
+ label_widget.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL);
var revealer = new Gtk.Revealer () {
child = label_widget,
transition_type = CROSSFADE
};
- add (revealer);
+ append (revealer);
bind_property ("reveal-child", revealer, "reveal-child");
bind_property ("label", label_widget, "label");
diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala
index 6607373e7..0957e4d67 100644
--- a/src/Views/ErrorView.vala
+++ b/src/Views/ErrorView.vala
@@ -24,7 +24,7 @@ public class ErrorView : AbstractInstallerView {
}
construct {
- var image = new Gtk.Image.from_icon_name ("dialog-error", Gtk.IconSize.DIALOG) {
+ var image = new Gtk.Image.from_icon_name ("dialog-error") {
pixel_size = 128
};
@@ -37,7 +37,7 @@ public class ErrorView : AbstractInstallerView {
xalign = 0
};
- var redo_image = new Gtk.Image.from_icon_name ("edit-undo-symbolic", Gtk.IconSize.MENU) {
+ var redo_image = new Gtk.Image.from_icon_name ("edit-undo-symbolic") {
margin_start = 6
};
@@ -48,7 +48,7 @@ public class ErrorView : AbstractInstallerView {
xalign = 0
};
- var demo_image = new Gtk.Image.from_icon_name ("document-properties-symbolic", Gtk.IconSize.MENU) {
+ var demo_image = new Gtk.Image.from_icon_name ("document-properties-symbolic") {
margin_start = 6
};
@@ -58,7 +58,7 @@ public class ErrorView : AbstractInstallerView {
xalign = 0
};
- var restart_image = new Gtk.Image.from_icon_name ("system-reboot-symbolic", Gtk.IconSize.MENU) {
+ var restart_image = new Gtk.Image.from_icon_name ("system-reboot-symbolic") {
margin_start = 6
};
@@ -71,15 +71,15 @@ public class ErrorView : AbstractInstallerView {
var terminal_button_label = new Gtk.Label (_("Details"));
var terminal_button_box = new Gtk.Box (HORIZONTAL, 0);
- terminal_button_box.add (new Gtk.Image.from_icon_name ("utilities-terminal-symbolic", BUTTON));
- terminal_button_box.add (terminal_button_label);
+ terminal_button_box.append (new Gtk.Image.from_icon_name ("utilities-terminal-symbolic"));
+ terminal_button_box.append (terminal_button_label);
var terminal_button = new Gtk.ToggleButton () {
child = terminal_button_box,
halign = START,
+ has_frame = false,
margin_top = 12
};
- terminal_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
terminal_button_label.mnemonic_widget = terminal_button;
@@ -108,21 +108,21 @@ public class ErrorView : AbstractInstallerView {
grid.attach (terminal_button, 0, 4, 2);
grid.attach (terminal_revealer, 0, 5, 2);
- title_area.add (image);
- title_area.add (title_label);
+ title_area.append (image);
+ title_area.append (title_label);
- content_area.add (grid);
+ content_area.append (grid);
var restart_button = new Gtk.Button.with_label (_("Restart Device"));
var demo_button = new Gtk.Button.with_label (_("Try Demo Mode"));
var install_button = new Gtk.Button.with_label (_("Try Installing Again"));
- install_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ install_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
- action_box_end.add (restart_button);
- action_box_end.add (demo_button);
- action_box_end.add (install_button);
+ action_box_end.append (restart_button);
+ action_box_end.append (demo_button);
+ action_box_end.append (install_button);
restart_button.clicked.connect (Utils.restart);
@@ -136,7 +136,5 @@ public class ErrorView : AbstractInstallerView {
terminal_view.attempt_scroll ();
}
});
-
- show_all ();
}
}
diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala
index 991420b2c..d392af729 100644
--- a/src/Views/KeyboardLayoutView.vala
+++ b/src/Views/KeyboardLayoutView.vala
@@ -22,7 +22,7 @@ public class KeyboardLayoutView : AbstractInstallerView {
construct {
keyboard_settings = new GLib.Settings ("org.gnome.desktop.input-sources");
- var image = new Gtk.Image.from_icon_name ("input-keyboard", Gtk.IconSize.DIALOG) {
+ var image = new Gtk.Image.from_icon_name ("input-keyboard") {
pixel_size = 128,
valign = Gtk.Align.END
};
@@ -41,29 +41,29 @@ public class KeyboardLayoutView : AbstractInstallerView {
};
var stack_box = new Gtk.Box (VERTICAL, 12);
- stack_box.add (input_variant_widget);
- stack_box.add (keyboard_test_entry);
+ stack_box.append (input_variant_widget);
+ stack_box.append (keyboard_test_entry);
- title_area.add (image);
- title_area.add (title_label);
+ title_area.append (image);
+ title_area.append (title_label);
- content_area.add (stack_box);
+ content_area.append (stack_box);
var back_button = new Gtk.Button.with_label (_("Back"));
var next_button = new Gtk.Button.with_label (_("Select")) {
sensitive = false
};
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
- action_box_end.add (back_button);
- action_box_end.add (next_button);
+ action_box_end.append (back_button);
+ action_box_end.append (next_button);
input_variant_widget.variant_listbox.row_activated.connect (() => {
next_button.activate ();
});
- back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (BACK));
+ back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK));
next_button.clicked.connect (() => {
unowned Gtk.ListBoxRow row = input_variant_widget.main_listbox.get_selected_row ();
@@ -89,7 +89,7 @@ public class KeyboardLayoutView : AbstractInstallerView {
return;
}
- ((Hdy.Deck) get_parent ()).navigate (FORWARD);
+ ((Adw.Leaflet) get_parent ()).navigate (FORWARD);
});
input_variant_widget.main_listbox.row_activated.connect ((row) => {
@@ -163,22 +163,23 @@ public class KeyboardLayoutView : AbstractInstallerView {
return new LayoutRow (layout as Installer.KeyboardLayout);
});
- show_all ();
-
Idle.add_once (() => {
unowned string? country = Configuration.get_default ().country;
if (country != null) {
- string default_layout = country.down ();
+ var default_layout = country.down ();
- foreach (weak Gtk.Widget child in input_variant_widget.main_listbox.get_children ()) {
+ var child = input_variant_widget.main_listbox.get_first_child ();
+ while (child != null) {
if (child is LayoutRow) {
- weak LayoutRow row = (LayoutRow) child;
+ unowned var row = (LayoutRow) child;
if (row.layout.name == default_layout) {
input_variant_widget.main_listbox.select_row (row);
row.grab_focus ();
break;
}
}
+
+ child = child.get_next_sibling ();
}
}
});
@@ -205,10 +206,9 @@ public class KeyboardLayoutView : AbstractInstallerView {
margin_start = 6,
xalign = 0
};
- label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
- add (label);
- show_all ();
+ child = label;
}
}
@@ -228,10 +228,9 @@ public class KeyboardLayoutView : AbstractInstallerView {
margin_start = 6,
xalign = 0
};
- label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
- add (label);
- show_all ();
+ child = label;
}
}
}
diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala
index 378e66ec4..8cfbca683 100644
--- a/src/Views/LanguageView.vala
+++ b/src/Views/LanguageView.vala
@@ -45,7 +45,7 @@ public class Installer.LanguageView : AbstractInstallerView {
preferred_langs.add (lang);
}
- var image = new Gtk.Image.from_icon_name ("preferences-desktop-locale", Gtk.IconSize.DIALOG) {
+ var image = new Gtk.Image.from_icon_name ("preferences-desktop-locale") {
pixel_size = 128,
valign = Gtk.Align.END
};
@@ -57,15 +57,11 @@ public class Installer.LanguageView : AbstractInstallerView {
select_stack = new Gtk.Stack ();
select_stack.valign = Gtk.Align.START;
select_stack.transition_type = Gtk.StackTransitionType.CROSSFADE;
- select_stack.add (select_label);
+ select_stack.add_child (select_label);
select_stack.notify["transition-running"].connect (() => {
if (!select_stack.transition_running) {
- select_stack.get_children ().foreach ((child) => {
- if (child != select_stack.get_visible_child ()) {
- child.destroy ();
- }
- });
+ select_stack.remove (select_stack.get_visible_child ().get_prev_sibling ());
}
});
@@ -99,7 +95,6 @@ public class Installer.LanguageView : AbstractInstallerView {
margin_bottom = 3,
margin_start = 6
};
- separator.show_all ();
row.set_header (separator);
}
}
@@ -109,18 +104,18 @@ public class Installer.LanguageView : AbstractInstallerView {
if (lang_entry.key in preferred_langs) {
var pref_langrow = new LangRow (lang_entry.value);
pref_langrow.preferred_row = true;
- lang_variant_widget.main_listbox.add (pref_langrow);
+ lang_variant_widget.main_listbox.append (pref_langrow);
}
var langrow = new LangRow (lang_entry.value);
- lang_variant_widget.main_listbox.add (langrow);
+ lang_variant_widget.main_listbox.append (langrow);
}
next_button = new Gtk.Button.with_label (_("Select"));
next_button.sensitive = false;
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
- action_box_end.add (next_button);
+ action_box_end.append (next_button);
lang_variant_widget.main_listbox.row_selected.connect (row_selected);
lang_variant_widget.main_listbox.select_row (lang_variant_widget.main_listbox.get_row_at_index (0));
@@ -171,10 +166,10 @@ public class Installer.LanguageView : AbstractInstallerView {
lang_variant_widget.main_listbox.row_selected.disconnect (row_selected);
});
- title_area.add (image);
- title_area.add (select_stack);
+ title_area.append (image);
+ title_area.append (select_stack);
- content_area.add (lang_variant_widget);
+ content_area.append (lang_variant_widget);
timeout ();
}
@@ -203,7 +198,8 @@ public class Installer.LanguageView : AbstractInstallerView {
var lang_entry = ((LangRow) row).lang_entry;
- foreach (Gtk.Widget child in lang_variant_widget.main_listbox.get_children ()) {
+ var child = lang_variant_widget.main_listbox.get_first_child ();
+ while (child != null) {
if (child is LangRow) {
var lang_row = (LangRow) child;
if (lang_row.lang_entry.get_code () == lang_entry.get_code ()) {
@@ -212,22 +208,28 @@ public class Installer.LanguageView : AbstractInstallerView {
lang_row.selected = false;
}
}
+
+ child = child.get_next_sibling ();
}
next_button.sensitive = true;
}
private void variant_row_selected (Gtk.ListBoxRow? row) {
- var country_entry = ((CountryRow) row).country_entry;
- foreach (Gtk.Widget child in lang_variant_widget.variant_listbox.get_children ()) {
+ unowned var country_entry = ((CountryRow) row).country_entry;
+
+ var child = lang_variant_widget.variant_listbox.get_first_child ();
+ while (child != null) {
if (child is CountryRow) {
- var country_row = (CountryRow) child;
+ unowned var country_row = (CountryRow) child;
if (country_row.country_entry.alpha_2 == country_entry.alpha_2) {
country_row.selected = true;
} else {
country_row.selected = false;
}
}
+
+ child = child.get_next_sibling ();
}
next_button.sensitive = true;
@@ -245,12 +247,11 @@ public class Installer.LanguageView : AbstractInstallerView {
lang_variant_widget.clear_variants ();
lang_variant_widget.variant_listbox.row_selected.connect (variant_row_selected);
foreach (var country in countries) {
- lang_variant_widget.variant_listbox.add (new CountryRow (country));
+ lang_variant_widget.variant_listbox.append (new CountryRow (country));
}
lang_variant_widget.variant_listbox.select_row (lang_variant_widget.variant_listbox.get_row_at_index (0));
- lang_variant_widget.variant_listbox.show_all ();
Environment.set_variable ("LANGUAGE", lang_entry.get_code (), true);
Intl.textdomain (Build.GETTEXT_PACKAGE);
lang_variant_widget.show_variants (_("Languages"), "%s".printf (lang_entry.name));
@@ -270,8 +271,7 @@ public class Installer.LanguageView : AbstractInstallerView {
unowned string label_text = LocaleHelper.lang_gettext (N_("Select a Language"), ((LangRow) row).lang_entry.get_code ());
select_label = new Gtk.Label (label_text);
- select_label.show_all ();
- select_stack.add (select_label);
+ select_stack.add_child (select_label);
select_stack.set_visible_child (select_label);
select_number++;
@@ -306,13 +306,12 @@ public class Installer.LanguageView : AbstractInstallerView {
image = new Gtk.Image ();
image.hexpand = true;
image.halign = Gtk.Align.END;
- image.icon_size = Gtk.IconSize.BUTTON;
var label = new Gtk.Label (lang_entry.name) {
ellipsize = Pango.EllipsizeMode.END,
xalign = 0
};
- label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var box = new Gtk.Box (HORIZONTAL, 6) {
margin_top = 6,
@@ -320,8 +319,8 @@ public class Installer.LanguageView : AbstractInstallerView {
margin_bottom = 6,
margin_start = 6
};
- box.add (label);
- box.add (image);
+ box.append (label);
+ box.append (image);
child = box;
}
@@ -353,10 +352,9 @@ public class Installer.LanguageView : AbstractInstallerView {
image = new Gtk.Image ();
image.hexpand = true;
image.halign = Gtk.Align.END;
- image.icon_size = Gtk.IconSize.BUTTON;
var label = new Gtk.Label (country_entry.name);
- label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
label.xalign = 0;
var box = new Gtk.Box (HORIZONTAL, 6) {
@@ -365,8 +363,8 @@ public class Installer.LanguageView : AbstractInstallerView {
margin_bottom = 6,
margin_start = 6
};
- box.add (label);
- box.add (image);
+ box.append (label);
+ box.append (image);
child = box;
}
diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala
index 9372f04a1..8a279a4e3 100644
--- a/src/Views/PartitioningView.vala
+++ b/src/Views/PartitioningView.vala
@@ -23,7 +23,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
private Gtk.Button next_button;
private Gtk.Button modify_partitions_button;
- private Gtk.Grid disk_list;
+ private Gtk.Box disk_list;
private Gtk.Stack load_stack;
private string required_description;
@@ -85,19 +85,17 @@ public class Installer.PartitioningView : AbstractInstallerView {
margin_end = 12,
margin_start = 12
};
- description_box.add (format_row);
- description_box.add (required_row);
- description_box.add (recommended_row);
+ description_box.append (format_row);
+ description_box.append (required_row);
+ description_box.append (recommended_row);
- disk_list = new Gtk.Grid () {
+ disk_list = new Gtk.Box (VERTICAL, 24) {
margin_end = 12,
margin_start = 12,
- row_spacing = 24,
- orientation = VERTICAL,
- valign = Gtk.Align.CENTER
+ valign = CENTER
};
- var disk_scroller = new Gtk.ScrolledWindow (null, null) {
+ var disk_scroller = new Gtk.ScrolledWindow () {
child = disk_list,
hexpand = true,
hscrollbar_policy = NEVER,
@@ -111,7 +109,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
load_spinner.start ();
var load_label = new Gtk.Label (_("Getting the current configuration…"));
- load_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);
+ load_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL);
var load_box = new Gtk.Box (VERTICAL, 12) {
hexpand = true,
@@ -119,8 +117,8 @@ public class Installer.PartitioningView : AbstractInstallerView {
valign = CENTER,
halign = CENTER
};
- load_box.add (load_spinner);
- load_box.add (load_label);
+ load_box.append (load_spinner);
+ load_box.append (load_label);
load_stack = new Gtk.Stack () {
transition_type = CROSSFADE
@@ -128,11 +126,11 @@ public class Installer.PartitioningView : AbstractInstallerView {
load_stack.add_named (load_box, "loading");
load_stack.add_named (disk_scroller, "disk");
- title_area.add (title_label);
+ title_area.append (title_label);
content_area.valign = CENTER;
- content_area.add (description_box);
- content_area.add (load_stack);
+ content_area.append (description_box);
+ content_area.append (load_stack);
load_disks.begin ();
@@ -142,17 +140,15 @@ public class Installer.PartitioningView : AbstractInstallerView {
var back_button = new Gtk.Button.with_label (_("Back"));
next_button = new Gtk.Button.with_label (_("Next"));
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
next_button.sensitive = false;
- action_box_start.add (modify_partitions_button);
- action_box_end.add (back_button);
- action_box_end.add (next_button);
+ action_box_start.append (modify_partitions_button);
+ action_box_end.append (back_button);
+ action_box_end.append (next_button);
- back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (Hdy.NavigationDirection.BACK));
+ back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK));
next_button.clicked.connect (() => next_step ());
-
- show_all ();
}
private async void load_disks () {
@@ -181,15 +177,13 @@ public class Installer.PartitioningView : AbstractInstallerView {
}
var disk_bar = new DiskBar (disk.name, path, size, (owned) partitions);
- disk_list.add (disk_bar);
+ disk_list.append (disk_bar);
}
foreach (unowned InstallerDaemon.Disk disk in disks.logical_disks) {
add_logical_disk (disk);
}
- disk_list.show_all ();
-
load_stack.set_visible_child_name ("disk");
}
@@ -211,7 +205,11 @@ public class Installer.PartitioningView : AbstractInstallerView {
public void reset_view () {
debug ("Resetting partitioning view");
- disk_list.get_children ().foreach ((child) => child.destroy ());
+
+ while (disk_list.get_first_child () != null) {
+ disk_list.remove (disk_list.get_first_child ());
+ }
+
mounts.clear ();
luks.clear ();
next_button.sensitive = false;
@@ -232,7 +230,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
}
var disk_bar = new DiskBar (disk.name, path, size, (owned) partitions);
- disk_list.add (disk_bar);
+ disk_list.append (disk_bar);
}
private void validate_status () {
diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala
index 94e87c69a..254b1e579 100644
--- a/src/Views/ProgressView.vala
+++ b/src/Views/ProgressView.vala
@@ -25,34 +25,22 @@ public class ProgressView : Gtk.Box {
private const int NUM_STEP = 5;
construct {
- var style_provider = new Gtk.CssProvider ();
- style_provider.load_from_resource ("io/elementary/installer/ProgressView.css");
-
var logo_icon_name = Environment.get_os_info ("LOGO");
if (logo_icon_name == "" || logo_icon_name == null) {
logo_icon_name = "distributor-logo";
}
- var logo = new Hdy.Avatar (192, "", false) {
+ var logo = new Adw.Avatar (192, "", false) {
// In case the wallpaper can't be loaded, we don't want an icon or text
- icon_name = "invalid-icon-name",
- // We need this for the shadow to not get clipped by Gtk.Overlay
- margin_top = 6,
- margin_end = 6,
- margin_bottom = 6,
- margin_start = 6
+ icon_name = "invalid-icon-name"
};
- logo.loadable_icon = new FileIcon (File.new_for_uri ("resource://io/elementary/installer/wallpaper.jpg"));
- logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ logo.custom_image = Gdk.Texture.from_resource ("/io/elementary/installer/wallpaper.jpg");
var icon = new Gtk.Image () {
icon_name = logo_icon_name + "-symbolic",
pixel_size = 192
};
-
- 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 ("logo");
var logo_overlay = new Gtk.Overlay () {
child = logo,
@@ -67,21 +55,21 @@ public class ProgressView : Gtk.Box {
var logo_stack = new Gtk.Stack () {
transition_type = Gtk.StackTransitionType.OVER_UP_DOWN
};
- logo_stack.add (logo_overlay);
- logo_stack.add (terminal_view);
+ logo_stack.add_child (logo_overlay);
+ logo_stack.add_child (terminal_view);
var terminal_button = new Gtk.ToggleButton () {
halign = Gtk.Align.END,
- image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic", Gtk.IconSize.SMALL_TOOLBAR),
+ icon_name = "utilities-terminal-symbolic",
tooltip_text = _("Show log")
};
- terminal_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
+ terminal_button.add_css_class (Granite.STYLE_CLASS_FLAT);
progressbar_label = new Gtk.Label (null) {
use_markup = true,
xalign = 0
};
- progressbar_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
+ progressbar_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
progressbar = new Gtk.ProgressBar () {
hexpand = true
@@ -99,7 +87,7 @@ public class ProgressView : Gtk.Box {
content_area.attach (terminal_button, 1, 1);
content_area.attach (progressbar, 0, 2, 2);
- add (content_area);
+ append (content_area);
terminal_button.toggled.connect (() => {
if (terminal_button.active) {
@@ -111,8 +99,6 @@ public class ProgressView : Gtk.Box {
logo_stack.visible_child = logo_overlay;
}
});
-
- show_all ();
}
public string get_log () {
diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala
index e72558035..46b991bfc 100644
--- a/src/Views/SuccessView.vala
+++ b/src/Views/SuccessView.vala
@@ -21,7 +21,7 @@ public class SuccessView : AbstractInstallerView {
private Gtk.Label secondary_label;
construct {
- var image = new Gtk.Image.from_icon_name ("process-completed", Gtk.IconSize.DIALOG) {
+ var image = new Gtk.Image.from_icon_name ("process-completed") {
pixel_size = 128
};
@@ -33,7 +33,7 @@ public class SuccessView : AbstractInstallerView {
wrap = true,
xalign = 0
};
- primary_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ primary_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
secondary_label = new Gtk.Label (null) {
max_width_chars = 1, // Make Gtk wrap, but not expand the window
@@ -50,20 +50,20 @@ public class SuccessView : AbstractInstallerView {
message_grid.attach (primary_label, 0, 0);
message_grid.attach (secondary_label, 0, 1);
- title_area.add (image);
- title_area.add (title_label);
+ title_area.append (image);
+ title_area.append (title_label);
- content_area.add (message_grid);
+ content_area.append (message_grid);
var shutdown_button = new Gtk.Button.with_label (_("Shut Down"));
shutdown_button.clicked.connect (Utils.shutdown);
var restart_button = new Gtk.Button.with_label (_("Restart Device"));
- restart_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ restart_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
restart_button.clicked.connect (Utils.restart);
- action_box_end.add (shutdown_button);
- action_box_end.add (restart_button);
+ action_box_end.append (shutdown_button);
+ action_box_end.append (restart_button);
update_secondary_label ();
@@ -82,8 +82,6 @@ public class SuccessView : AbstractInstallerView {
return Source.CONTINUE;
});
-
- show_all ();
}
private void update_secondary_label () {
diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala
index 7e1d0c53e..f5f94976e 100644
--- a/src/Views/TryInstallView.vala
+++ b/src/Views/TryInstallView.vala
@@ -20,14 +20,14 @@ public class Installer.TryInstallView : AbstractInstallerView {
public signal void next_step ();
construct {
- var type_image = new Gtk.Image.from_icon_name (Application.get_default ().application_id, Gtk.IconSize.DIALOG) {
+ var type_image = new Gtk.Image.from_icon_name (Application.get_default ().application_id) {
pixel_size = 128
};
var type_label = new Gtk.Label (_("Try or Install"));
// Force the user to make a conscious selection, not spam "Next"
- var no_selection = new Gtk.RadioButton (null) {
+ var no_selection = new Gtk.CheckButton () {
active = true
};
@@ -59,49 +59,49 @@ public class Installer.TryInstallView : AbstractInstallerView {
valign = CENTER,
vexpand = true
};
- type_box.add (demo_button);
- type_box.add (clean_install_button);
- type_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL));
- type_box.add (custom_button);
+ type_box.append (demo_button);
+ type_box.append (clean_install_button);
+ type_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL));
+ type_box.append (custom_button);
- var type_scrolled = new Gtk.ScrolledWindow (null, null) {
+ var type_scrolled = new Gtk.ScrolledWindow () {
child = type_box,
hscrollbar_policy = NEVER,
propagate_natural_height = true
};
- title_area.add (type_image);
- title_area.add (type_label);
+ title_area.append (type_image);
+ title_area.append (type_label);
- content_area.add (type_scrolled);
+ content_area.append (type_scrolled);
var back_button = new Gtk.Button.with_label (_("Back"));
var next_button = new Gtk.Button.with_label (_("Next")) {
sensitive = false
};
- next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
- action_box_end.add (back_button);
- action_box_end.add (next_button);
+ action_box_end.append (back_button);
+ action_box_end.append (next_button);
- back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (Hdy.NavigationDirection.BACK));
+ back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK));
- demo_button.clicked.connect (() => {
+ demo_button.toggled.connect (() => {
if (demo_button.active) {
next_button.label = demo_button.title;
next_button.sensitive = true;
}
});
- clean_install_button.clicked.connect (() => {
+ clean_install_button.toggled.connect (() => {
if (clean_install_button.active) {
next_button.label = clean_install_button.title;
next_button.sensitive = true;
}
});
- custom_button.clicked.connect (() => {
+ custom_button.toggled.connect (() => {
if (custom_button.active) {
next_button.label = _("Custom Install");
next_button.sensitive = true;
@@ -117,7 +117,5 @@ public class Installer.TryInstallView : AbstractInstallerView {
custom_step ();
}
});
-
- show_all ();
}
}
diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala
index 9bbbc868c..43d3bf41d 100644
--- a/src/Widgets/DecryptMenu.vala
+++ b/src/Widgets/DecryptMenu.vala
@@ -40,15 +40,18 @@ public class Installer.DecryptMenu: Gtk.Popover {
margin_start = 12
};
create_decrypt_view ();
- add (stack);
- stack.show_all ();
+ child = stack;
}
private void create_decrypt_view () {
- var image = new Gtk.Image.from_icon_name ("drive-harddisk", Gtk.IconSize.DIALOG);
+ var image = new Gtk.Image.from_icon_name ("drive-harddisk") {
+ pixel_size = 48
+ };
image.valign = Gtk.Align.START;
- var overlay_image = new Gtk.Image.from_icon_name ("dialog-password", Gtk.IconSize.DND);
+ var overlay_image = new Gtk.Image.from_icon_name ("dialog-password") {
+ icon_size = LARGE
+ };
overlay_image.halign = Gtk.Align.END;
overlay_image.valign = Gtk.Align.END;
@@ -61,7 +64,7 @@ public class Installer.DecryptMenu: Gtk.Popover {
overlay.add_overlay (overlay_image);
var primary_label = new Gtk.Label (_("Decrypt This Partition"));
- primary_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ primary_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
primary_label.halign = Gtk.Align.START;
var secondary_label = new Gtk.Label (_("Enter the partition's encryption password and set a device name for the decrypted partition."));
@@ -106,7 +109,7 @@ public class Installer.DecryptMenu: Gtk.Popover {
decrypt_button = new Gtk.Button.with_label (_("Decrypt"));
decrypt_button.halign = Gtk.Align.END;
decrypt_button.sensitive = false;
- decrypt_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ decrypt_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
decrypt_button.clicked.connect (() => {
decrypt.begin (pv_entry.get_text ());
});
@@ -122,7 +125,7 @@ public class Installer.DecryptMenu: Gtk.Popover {
decrypt_view.attach (pv_entry, 1, 2);
decrypt_view.attach (decrypt_button, 0, 3, 2);
- stack.add (decrypt_view);
+ stack.add_child (decrypt_view);
stack.visible_child = decrypt_view;
pass_entry.grab_focus_without_selecting ();
}
@@ -180,11 +183,10 @@ public class Installer.DecryptMenu: Gtk.Popover {
var info = new Gtk.Label (_("LUKS volume was decrypted"));
var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6);
- box.add (label);
- box.add (info);
- box.show_all ();
+ box.append (label);
+ box.append (info);
- stack.add (box);
+ stack.add_child (box);
stack.visible_child = box;
}
diff --git a/src/Widgets/DescriptionRow.vala b/src/Widgets/DescriptionRow.vala
index 60e6c90c3..057189132 100644
--- a/src/Widgets/DescriptionRow.vala
+++ b/src/Widgets/DescriptionRow.vala
@@ -17,12 +17,12 @@ public class DescriptionRow : Gtk.Box {
}
construct {
- var image = new Gtk.Image.from_icon_name (icon_name, LARGE_TOOLBAR) {
+ var image = new Gtk.Image.from_icon_name (icon_name) {
pixel_size = 24,
valign = START
};
- image.get_style_context ().add_class (Granite.STYLE_CLASS_ACCENT);
- image.get_style_context ().add_class (color);
+ image.add_css_class (Granite.STYLE_CLASS_ACCENT);
+ image.add_css_class (color);
var description_label = new Gtk.Label (description) {
hexpand = true,
@@ -33,7 +33,7 @@ public class DescriptionRow : Gtk.Box {
};
spacing = 12;
- add (image);
- add (description_label);
+ append (image);
+ append (description_label);
}
}
diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala
index e6284863f..3641d11e5 100644
--- a/src/Widgets/DiskBar.vala
+++ b/src/Widgets/DiskBar.vala
@@ -27,27 +27,11 @@ public class Installer.DiskBar: Gtk.Box {
}
construct {
- var name_label = new Granite.HeaderLabel (disk_name);
-
- var size_label = new Gtk.Label ("%s %s".printf (disk_path, GLib.format_size (size))) {
- xalign = 0
+ var name_label = new Granite.HeaderLabel (disk_name) {
+ secondary_text = "%s %s".printf (disk_path, GLib.format_size (size))
};
- size_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
- size_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);
-
- var label_box = new Gtk.Box (VERTICAL, 0);
- label_box.add (name_label);
- label_box.add (size_label);
-
- var bar = new Gtk.Grid ();
-
- bar.size_allocate.connect ((alloc) => {
- update_sector_lengths (partitions, alloc);
- });
- foreach (PartitionBar part in partitions) {
- bar.add (part);
- }
+ var bar = new PartitionContainer (size, partitions);
legend_box = new Gtk.Box (VERTICAL, 6) {
halign = START
@@ -56,7 +40,7 @@ public class Installer.DiskBar: Gtk.Box {
foreach (PartitionBar p in partitions) {
add_legend (
p.partition.device_path,
- p.get_size () * 512,
+ p.get_partition_size () * 512,
Distinst.strfilesys (p.partition.filesystem),
p.volume_group,
p.menu
@@ -65,37 +49,31 @@ public class Installer.DiskBar: Gtk.Box {
uint64 used = 0;
foreach (PartitionBar partition in partitions) {
- used += partition.get_size ();
+ used += partition.get_partition_size ();
}
var unused = size - (used * 512);
if (size / 100 < unused) {
add_legend ("unused", unused, "unused", null, null);
-
- var unused_bar = new Block () {
- hexpand = true,
- vexpand = true
- };
- unused_bar.get_style_context ().add_class ("unused");
-
- bar.add (unused_bar);
}
orientation = VERTICAL;
hexpand = true;
spacing = 12;
- add (label_box);
- add (bar);
- add (legend_box);
- show_all ();
+ append (name_label );
+ append (bar);
+ append (legend_box);
+
+ // Lie about orientation for styling reasons
+ css_classes = {"horizontal"};
}
private void add_legend (string ppath, uint64 size, string fs, string? vg, Gtk.Popover? menu) {
var fill_round = new Block () {
valign = CENTER
};
- fill_round.get_style_context ().add_class ("legend");
- fill_round.get_style_context ().add_class (fs);
+ fill_round.add_css_class ("legend");
+ fill_round.add_css_class (fs);
var format_size = GLib.format_size (size);
@@ -106,8 +84,8 @@ public class Installer.DiskBar: Gtk.Box {
) {
halign = START,
};
- info.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
- info.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);
+ info.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
+ info.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL);
info.use_markup = true;
var path = new Gtk.Label (ppath) {
@@ -121,65 +99,139 @@ public class Installer.DiskBar: Gtk.Box {
legend.attach (path, 1, 0);
legend.attach (info, 1, 1);
- var event_box = new Gtk.EventBox ();
- event_box.add (legend);
-
if (menu != null) {
- event_box.button_press_event.connect (() => {
- menu.popup ();
- return true;
- });
+ var click_gesture = new Gtk.GestureClick ();
+ click_gesture.released.connect (menu.popup);
+
+ legend.add_controller (click_gesture);
}
- legend_box.add (event_box);
+ legend_box.append (legend);
}
- private void update_sector_lengths (Gee.ArrayList partitions, Gtk.Allocation alloc) {
- var alloc_width = alloc.width;
- var disk_sectors = this.size / 512;
-
- int[] lengths = {};
- for (int x = 0; x < partitions.size; x++) {
- var part = partitions[x];
- var requested = part.calculate_length (alloc_width, disk_sectors);
-
- var excess = requested - alloc_width;
- while (excess > 0) {
- var reduce_by = x / excess;
- if (reduce_by == 0) reduce_by = 1;
-
- // Begin by resizing all partitions over 20px wide.
- bool excess_modified = false;
- for (int y = 0; excess > 0 && y < x; y++) {
- if (lengths[y] <= 20) continue;
- lengths[y] -= reduce_by;
- excess -= reduce_by;
- excess_modified = true;
- }
-
- // In case all are below that width, shrink beyond limit.
- if (!excess_modified) {
- for (int y = 0; excess > 0 && y < x; y++) {
- lengths[y] -= reduce_by;
- excess -= reduce_by;
- excess_modified = true;
- }
- }
+ private class PartitionContainer : Gtk.Widget {
+ public Gee.ArrayList partitions { get; construct; }
+ public uint64 size { get; construct; }
+
+ public PartitionContainer (uint64 size, Gee.ArrayList partitions) {
+ Object (
+ partitions: partitions,
+ size: size
+ );
+ }
+
+ class construct {
+ set_layout_manager_type (typeof (Gtk.ConstraintLayout));
+ }
+
+ construct {
+ uint64 used = 0;
+ var disk_sectors = size / 512;
+ foreach (var partition in partitions) {
+ double percent_requested = (double) partition.get_partition_size () / disk_sectors;
+ percent_requested = percent_requested.clamp (0.01, 0.99);
+
+ used += partition.get_partition_size ();
+
+ append_partition (
+ partition,
+ percent_requested
+ );
+ }
+
+ var unused = size - (used * 512);
+ if (size / 100 < unused) {
+ var unused_bar = new Block ();
+ unused_bar.add_css_class ("unused");
+
+ append_partition (unused_bar, unused / size);
}
- alloc_width -= requested;
- disk_sectors -= part.get_size ();
- lengths += requested;
+ var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ());
+ // Position last child at end
+ layout_manager.add_constraint (
+ new Gtk.Constraint (
+ get_last_child (),
+ END,
+ EQ,
+ this,
+ END,
+ 1.0,
+ 0.0,
+ Gtk.ConstraintStrength.REQUIRED
+ )
+ );
}
- var new_alloc = Gtk.Allocation ();
- new_alloc.x = alloc.x;
- new_alloc.y = alloc.y;
- new_alloc.height = alloc.height;
- for (int x = 0; x < partitions.size; x++) {
- new_alloc.width = lengths[x];
- partitions[x].size_allocate (new_alloc);
- new_alloc.x += new_alloc.width;
+ ~PartitionContainer () {
+ while (get_first_child () != null) {
+ get_first_child ().unparent ();
+ }
+ }
+
+ private void append_partition (Gtk.Widget widget, double percentage) {
+ widget.set_parent (this);
+
+ var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ());
+
+ // Fill height of this
+ layout_manager.add_constraint (
+ new Gtk.Constraint (
+ widget,
+ HEIGHT,
+ EQ,
+ this,
+ HEIGHT,
+ 1.0,
+ 0.0,
+ Gtk.ConstraintStrength.REQUIRED
+ )
+ );
+
+ // Fill width based on partition size
+ layout_manager.add_constraint (
+ new Gtk.Constraint (
+ widget,
+ WIDTH,
+ EQ,
+ this,
+ WIDTH,
+ percentage,
+ 0,
+ Gtk.ConstraintStrength.STRONG
+ )
+ );
+
+ var previous_child = widget.get_prev_sibling ();
+ if (previous_child == null) {
+ // Position at start
+ layout_manager.add_constraint (
+ new Gtk.Constraint (
+ widget,
+ START,
+ EQ,
+ this,
+ START,
+ 1.0,
+ 0.0,
+ Gtk.ConstraintStrength.REQUIRED
+ )
+ );
+ } else {
+ // Position end to end
+ layout_manager.add_constraint (
+ new Gtk.Constraint (
+ widget,
+ START,
+ EQ,
+ previous_child,
+ END,
+ 1.0,
+ 0.0,
+ Gtk.ConstraintStrength.REQUIRED
+ )
+ );
+ }
}
}
diff --git a/src/Widgets/DiskGrid.vala b/src/Widgets/DiskGrid.vala
index 2de17d5eb..b268974e3 100644
--- a/src/Widgets/DiskGrid.vala
+++ b/src/Widgets/DiskGrid.vala
@@ -17,7 +17,7 @@
* Authored by: Corentin Noël
*/
-public class Installer.DiskButton : Gtk.RadioButton {
+public class Installer.DiskButton : Gtk.CheckButton {
public string disk_name { get; construct; }
public string icon_name { get; construct; }
public string disk_path { get; construct; }
@@ -33,9 +33,10 @@ public class Installer.DiskButton : Gtk.RadioButton {
}
construct {
- get_style_context ().add_class ("image-button");
+ add_css_class ("image-button");
- var disk_image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG) {
+ var disk_image = new Gtk.Image.from_icon_name (icon_name) {
+ pixel_size = 48,
use_fallback = true
};
@@ -44,7 +45,7 @@ public class Installer.DiskButton : Gtk.RadioButton {
halign = Gtk.Align.START,
valign = Gtk.Align.END
};
- name_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ name_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var size_label = new Gtk.Label ("%s %s".printf (disk_path, GLib.format_size (size))) {
ellipsize = Pango.EllipsizeMode.MIDDLE,
@@ -63,7 +64,7 @@ public class Installer.DiskButton : Gtk.RadioButton {
grid.attach (name_label, 1, 0);
grid.attach (size_label, 1, 1);
- add (grid);
+ child = grid;
notify["active"].connect (() => {
if (active) {
diff --git a/src/Widgets/InstallTypeGrid.vala b/src/Widgets/InstallTypeGrid.vala
index 939b8e3bc..da04f8635 100644
--- a/src/Widgets/InstallTypeGrid.vala
+++ b/src/Widgets/InstallTypeGrid.vala
@@ -17,7 +17,7 @@
* Authored by: Cassidy James Blaede
*/
-public class Installer.InstallTypeButton : Gtk.RadioButton {
+public class Installer.InstallTypeButton : Gtk.CheckButton {
public string title { get; construct; }
public string icon_name { get; construct; }
public string subtitle { get; construct; }
@@ -31,15 +31,17 @@ public class Installer.InstallTypeButton : Gtk.RadioButton {
}
construct {
- get_style_context ().add_class ("image-button");
+ add_css_class ("image-button");
- var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG);
+ var image = new Gtk.Image.from_icon_name (icon_name) {
+ pixel_size = 48
+ };
var title_label = new Gtk.Label (title) {
hexpand = true,
xalign = 0
};
- title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
+ title_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);
var subtitle_label = new Gtk.Label (subtitle) {
max_width_chars = 1, // Make Gtk wrap, but not expand the window
@@ -59,6 +61,6 @@ public class Installer.InstallTypeButton : Gtk.RadioButton {
grid.attach (title_label, 1, 0);
grid.attach (subtitle_label, 1, 1);
- add (grid);
+ child = grid;
}
}
diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala
index fa0193326..219ec8518 100644
--- a/src/Widgets/PartitionBar.vala
+++ b/src/Widgets/PartitionBar.vala
@@ -5,7 +5,7 @@
* Authored by: Michael Aaron Murphy
*/
-public class Installer.PartitionBar : Gtk.EventBox {
+public class Installer.PartitionBar : Gtk.Box {
public signal void decrypted (InstallerDaemon.LuksCredentials credential);
public Icon? icon { get; set; default = null; }
@@ -17,8 +17,6 @@ public class Installer.PartitionBar : Gtk.EventBox {
public string? volume_group { get; private set; }
public Gtk.Popover menu { get; private set; }
- private Gtk.GestureMultiPress click_gesture;
-
public PartitionBar (
InstallerDaemon.Partition partition,
string parent_path,
@@ -41,11 +39,13 @@ public class Installer.PartitionBar : Gtk.EventBox {
menu = new PartitionMenu (partition.device_path, parent_path, partition.filesystem, lvm, set_mount, unset_mount, mount_set, this);
}
- menu.relative_to = this;
+ menu.set_parent (this);
menu.position = BOTTOM;
- click_gesture = new Gtk.GestureMultiPress (this);
+ var click_gesture = new Gtk.GestureClick ();
click_gesture.released.connect (menu.popup);
+
+ add_controller (click_gesture);
}
class construct {
@@ -61,23 +61,16 @@ public class Installer.PartitionBar : Gtk.EventBox {
valign = END
};
- add (image);
+ append (image);
hexpand = true;
tooltip_text = partition.device_path;
- get_style_context ().add_class (Distinst.strfilesys (partition.filesystem));
+ add_css_class (Distinst.strfilesys (partition.filesystem));
bind_property ("icon", image, "gicon", SYNC_CREATE);
}
- public uint64 get_size () {
+ public uint64 get_partition_size () {
return partition.end_sector - partition.start_sector;
}
-
- public int calculate_length (int alloc_width, uint64 disk_sectors) {
- var percent = ((double) get_size () / (double) disk_sectors);
- var request = alloc_width * percent;
- if (request < 20) request = 20;
- return (int) request;
- }
}
diff --git a/src/Widgets/PartitionMenu.vala b/src/Widgets/PartitionMenu.vala
index 18654f18d..659ada23d 100644
--- a/src/Widgets/PartitionMenu.vala
+++ b/src/Widgets/PartitionMenu.vala
@@ -136,9 +136,8 @@ public class Installer.PartitionMenu : Gtk.Popover {
};
grid.attach (use_partition, 0, 0);
grid.attach (bottom_revealer, 0, 1);
- grid.show_all ();
- add (grid);
+ child = grid;
custom.visible = false;
@@ -268,7 +267,7 @@ public class Installer.PartitionMenu : Gtk.Popover {
partition_path,
parent_disk,
mount,
- partition_bar.get_size (),
+ partition_bar.get_partition_size (),
(format_partition.active ? InstallerDaemon.MountFlags.FORMAT : 0)
+ (is_lvm ? InstallerDaemon.MountFlags.LVM : 0),
filesystem,
diff --git a/src/Widgets/Terminal.vala b/src/Widgets/Terminal.vala
index 344e2ed25..7260ec8a7 100644
--- a/src/Widgets/Terminal.vala
+++ b/src/Widgets/Terminal.vala
@@ -45,9 +45,9 @@ public class Installer.Terminal : Gtk.Box {
pixels_below_lines = 3,
wrap_mode = Gtk.WrapMode.WORD
};
- view.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW);
+ view.remove_css_class (Granite.STYLE_CLASS_VIEW);
- scrolled_window = new Gtk.ScrolledWindow (null, null) {
+ scrolled_window = new Gtk.ScrolledWindow () {
child = view,
hexpand = true,
vexpand = true,
@@ -56,7 +56,7 @@ public class Installer.Terminal : Gtk.Box {
};
scrolled_window.get_style_context ().add_class (Granite.STYLE_CLASS_TERMINAL);
- add (scrolled_window);
+ append (scrolled_window);
Idle.add (() => {
attempt_scroll ();
diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala
index 385217f1f..cad8fdb0a 100644
--- a/src/Widgets/VariantWidget.vala
+++ b/src/Widgets/VariantWidget.vala
@@ -12,12 +12,12 @@ public class VariantWidget : Gtk.Frame {
private Gtk.Button back_button;
private Gtk.Box variant_box;
private Gtk.Label variant_title;
- private Hdy.Deck deck;
+ private Adw.Leaflet leaflet;
construct {
main_listbox = new Gtk.ListBox ();
- var main_scrolled = new Gtk.ScrolledWindow (null, null) {
+ var main_scrolled = new Gtk.ScrolledWindow () {
child = main_listbox,
hscrollbar_policy = NEVER
};
@@ -25,7 +25,7 @@ public class VariantWidget : Gtk.Frame {
variant_listbox = new Gtk.ListBox ();
variant_listbox.activate_on_single_click = false;
- var variant_scrolled = new Gtk.ScrolledWindow (null, null) {
+ var variant_scrolled = new Gtk.ScrolledWindow () {
child = variant_listbox,
hscrollbar_policy = NEVER,
vexpand = true
@@ -38,7 +38,7 @@ public class VariantWidget : Gtk.Frame {
margin_bottom = 6,
margin_start = 6
};
- back_button.get_style_context ().add_class (Granite.STYLE_CLASS_BACK_BUTTON);
+ back_button.add_css_class (Granite.STYLE_CLASS_BACK_BUTTON);
variant_title = new Gtk.Label ("") {
hexpand = true,
@@ -49,43 +49,42 @@ public class VariantWidget : Gtk.Frame {
wrap = true
};
- var header_box = new Gtk.Box (HORIZONTAL, 0) {
+ var header_box = new Gtk.CenterBox () {
+ start_widget = back_button,
+ center_widget = variant_title,
hexpand = true
};
- header_box.add (back_button);
- header_box.set_center_widget (variant_title);
variant_box = new Gtk.Box (VERTICAL, 0);
- variant_box.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW);
- variant_box.add (header_box);
- variant_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL));
- variant_box.add (variant_scrolled);
-
- deck = new Hdy.Deck () {
- can_swipe_back = true
+ variant_box.add_css_class (Granite.STYLE_CLASS_VIEW);
+ variant_box.append (header_box);
+ variant_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL));
+ variant_box.append (variant_scrolled);
+
+ leaflet = new Adw.Leaflet () {
+ can_navigate_back = true,
+ can_unfold = false
};
- deck.add (main_scrolled);
- deck.add (variant_box);
+ leaflet.append (main_scrolled);
+ leaflet.append (variant_box);
- child = deck;
+ child = leaflet;
vexpand = true;
back_button.clicked.connect (() => {
going_to_main ();
- deck.navigate (BACK);
+ leaflet.navigate (BACK);
});
}
public void show_variants (string back_button_label, string variant_title_label) {
back_button.label = back_button_label;
variant_title.label = variant_title_label;
- deck.visible_child = variant_box;
+ leaflet.visible_child = variant_box;
}
public void clear_variants () {
- variant_listbox.get_children ().foreach ((child) => {
- child.destroy ();
- });
+ variant_listbox.remove_all ();
}
}
diff --git a/src/meson.build b/src/meson.build
index 917843ff1..e9dcca0cb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -62,7 +62,7 @@ gui_dependencies = [
gobject_dep,
granite_dep,
gtk_dep,
- handy_dep,
+ adw_dep,
json_glib_dep,
pwquality_dep,
xml2_dep