diff --git a/Cargo.toml b/Cargo.toml
index bd7cd4b..ed374b7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ opt-level = 3
[dependencies]
gtk = { version = "0.8.0", package = "gtk4", features = ["v4_12"]}
gdk = { version = "0.8.0", package = "gdk4" }
-adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"]}
+adw = { version = "0.6.0", package = "libadwaita", features = ["v1_5"]}
ashpd = { version = "0.8.0", default-features = false, features = [ "gtk4", "tokio" ]}
zbus = { version = "4.1.2", default-features = false, features = [ "tokio" ]}
diff --git a/data/resources/ui/about.blp.in b/data/resources/ui/about.blp.in
index 1ddd23d..c607586 100644
--- a/data/resources/ui/about.blp.in
+++ b/data/resources/ui/about.blp.in
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
-Adw.AboutWindow about {
+Adw.AboutDialog about {
application-icon: "icon";
application-name: "Flare";
version: "@VERSION@";
diff --git a/data/resources/ui/channel_info_dialog.blp b/data/resources/ui/channel_info_dialog.blp
index 01275a5..a68b608 100644
--- a/data/resources/ui/channel_info_dialog.blp
+++ b/data/resources/ui/channel_info_dialog.blp
@@ -1,56 +1,69 @@
using Gtk 4.0;
using Adw 1;
-template $FlChannelInfoDialog: Adw.MessageDialog {
- heading: bind template.channel as <$FlChannel>.title;
+template $FlChannelInfoDialog: Adw.Dialog {
+ can-focus: true;
+ content-height: 600;
+ content-width: 450;
- extra-child: Box {
- spacing: 5;
-
- orientation: vertical;
-
- Adw.PreferencesGroup {
- title: _("Channel Information");
- header-suffix:
- Adw.Avatar avatar {
- icon-name: "user-bookmarks-symbolic";
- size: 30;
- };
-
- Adw.ActionRow row_phone {
- styles ["property"]
-
- title: _("Phone Number");
- icon-name: "call-start-symbolic";
- }
-
- Adw.ActionRow row_disappearing {
- styles ["property"]
-
- title: _("Disappearing Messages");
- icon-name: "appointment-missed-symbolic";
- }
-
- Adw.ActionRow row_description {
- styles ["property"]
-
- title: _("Description");
- subtitle-lines: 2;
- }
+ Adw.ToolbarView {
+ [top]
+ Adw.HeaderBar {
+ title-widget: Adw.WindowTitle {
+ title: bind template.channel as <$FlChannel>.title;
+ };
}
- // Session Reset
- Button button_reset_session {
- accessibility {
- label: C_("accessibility", "Reset Session");
+ Adw.Clamp {
+ orientation: horizontal;
+ tightening-threshold: 300;
+ maximum-size: 600;
+
+ Box {
+ spacing: 5;
+
+ orientation: vertical;
+
+ Adw.PreferencesGroup {
+ title: _("Channel Information");
+ header-suffix:
+ Adw.Avatar avatar {
+ icon-name: "user-bookmarks-symbolic";
+ size: 30;
+ };
+
+ Adw.ActionRow row_phone {
+ styles ["property"]
+
+ title: _("Phone Number");
+ icon-name: "call-start-symbolic";
+ }
+
+ Adw.ActionRow row_disappearing {
+ styles ["property"]
+
+ title: _("Disappearing Messages");
+ icon-name: "appointment-missed-symbolic";
+ }
+
+ Adw.ActionRow row_description {
+ styles ["property"]
+
+ title: _("Description");
+ subtitle-lines: 2;
+ }
+ }
+
+ // Session Reset
+ Button button_reset_session {
+ accessibility {
+ label: C_("accessibility", "Reset Session");
+ }
+
+ label: _("Reset Session");
+ clicked => $reset_session() swapped;
+ }
}
-
- label: _("Reset Session");
- clicked => $reset_session() swapped;
}
- };
-
- responses [
- close: _("Close"),
- ]
+ }
}
diff --git a/data/resources/ui/dialog_clear_messages.blp b/data/resources/ui/dialog_clear_messages.blp
index d7566dd..eae81f2 100644
--- a/data/resources/ui/dialog_clear_messages.blp
+++ b/data/resources/ui/dialog_clear_messages.blp
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
-Adw.MessageDialog dialog {
+Adw.AlertDialog dialog {
heading: _("Clear messages");
body: _("This will clear all locally stored messages. This will also close the application.");
default-response: "cancel";
diff --git a/data/resources/ui/dialog_unlink.blp b/data/resources/ui/dialog_unlink.blp
index 82f62ed..b9765f7 100644
--- a/data/resources/ui/dialog_unlink.blp
+++ b/data/resources/ui/dialog_unlink.blp
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
-Adw.MessageDialog dialog {
+Adw.AlertDialog dialog {
heading: _("Unlink");
body: _("This will unlink this device and remove all locally saved data. This will also close the application such that it can be relinked when opening it again.");
default-response: "cancel";
diff --git a/data/resources/ui/error_dialog.blp b/data/resources/ui/error_dialog.blp
index 2a83b68..e8f9b96 100644
--- a/data/resources/ui/error_dialog.blp
+++ b/data/resources/ui/error_dialog.blp
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
-template $FlErrorDialog: Adw.MessageDialog {
+template $FlErrorDialog: Adw.AlertDialog {
heading: _("Error");
response => $handle_response();
diff --git a/data/resources/ui/linked_devices_window.blp b/data/resources/ui/linked_devices_window.blp
index 3c0db0d..9d08f83 100644
--- a/data/resources/ui/linked_devices_window.blp
+++ b/data/resources/ui/linked_devices_window.blp
@@ -1,14 +1,12 @@
using Gtk 4.0;
using Adw 1;
-template $FlLinkedDevicesWindow: Adw.Window {
+template $FlLinkedDevicesWindow: Adw.Dialog {
can-focus: true;
- default-height: 600;
- default-width: 450;
- destroy-with-parent: true;
- modal: true;
+ content-height: 600;
+ content-width: 450;
- content: Adw.ToolbarView {
+ Adw.ToolbarView {
[top]
Adw.HeaderBar {
title-widget: Adw.WindowTitle {
@@ -26,10 +24,10 @@ template $FlLinkedDevicesWindow: Adw.Window {
Gtk.ListView list_devices {}
}
- };
+ }
}
-Adw.MessageDialog add_device_dialog {
+Adw.AlertDialog add_device_dialog {
heading: _("Add Linked Device");
body: _("Please insert the URL of the device to link.");
default-response: "cancel";
diff --git a/data/resources/ui/preferences_window.blp b/data/resources/ui/preferences_window.blp
index 95b9ce0..9a54514 100644
--- a/data/resources/ui/preferences_window.blp
+++ b/data/resources/ui/preferences_window.blp
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
-template $FlPreferencesWindow: Adw.PreferencesWindow {
+template $FlPreferencesWindow: Adw.PreferencesDialog {
Adw.PreferencesPage {
title: _("General");
icon-name: "preferences-system-symbolic";
diff --git a/data/resources/ui/setup_window.blp b/data/resources/ui/setup_window.blp
index 7d5a817..919cb97 100644
--- a/data/resources/ui/setup_window.blp
+++ b/data/resources/ui/setup_window.blp
@@ -1,15 +1,12 @@
using Gtk 4.0;
using Adw 1;
-template $FlSetupWindow: Adw.Window {
+template $FlSetupWindow: Adw.Dialog {
can-focus: true;
- default-height: 600;
- default-width: 450;
- destroy-with-parent: true;
- modal: true;
- deletable: false;
+ content-height: 600;
+ content-width: 450;
- content: Adw.ToastOverlay toast_overlay {
+ Adw.ToastOverlay toast_overlay {
child: Box {
orientation: vertical;
@@ -532,5 +529,5 @@ template $FlSetupWindow: Adw.Window {
}
}
};
- };
+ }
}
diff --git a/data/resources/ui/submit_captcha_dialog.blp b/data/resources/ui/submit_captcha_dialog.blp
index 5294557..dbda5a6 100644
--- a/data/resources/ui/submit_captcha_dialog.blp
+++ b/data/resources/ui/submit_captcha_dialog.blp
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;
-Adw.MessageDialog dialog {
+Adw.AlertDialog dialog {
heading: _("Submit Captcha");
// Translators: Do not translate tags around "on this website".
body: _("Submit a Captcha challenge. The token can be obtained from the error message that was displayed from Flare. The captcha must be filled out on this website and the link to open Signal must be pasted to the corresponding entry. Note that the captcha is only valid for about one minute.");
diff --git a/flake.nix b/flake.nix
index 8cec553..0ebc570 100644
--- a/flake.nix
+++ b/flake.nix
@@ -11,6 +11,29 @@
pkgs = import nixpkgs {
inherit system;
};
+
+ libadwaita_1_5 = pkgs.libadwaita.overrideAttrs (finalAttrs: prevAttrs: {
+ version = "1.5.beta";
+ src = with pkgs; fetchFromGitLab {
+ domain = "gitlab.gnome.org";
+ owner = "GNOME";
+ repo = "libadwaita";
+ rev = "66edcd31c1acfb5a569db02870d1f7e471946fcf";
+ hash = "sha256-ipyifdRwZCO8H7qQOcEHOXW9PT9w+Ix+k374qHRfSjg=";
+ };
+ });
+
+ blueprint-compiler-git = pkgs.blueprint-compiler.overrideAttrs (finalAttrs: prevAttrs: {
+ version = "0.10.1.git";
+ src = with pkgs; fetchFromGitLab {
+ domain = "gitlab.gnome.org";
+ owner = "jwestman";
+ repo = "blueprint-compiler";
+ rev = "d47955c5a20b2f7cf85ff25a00b02160883aa0b1";
+ hash = "sha256-yNFgJpCGu2CrT6J004N4G+Nlt+3/DbEkSGOWkvSn4J8=";
+ };
+ });
+
name = "flare";
in
rec {
@@ -38,8 +61,8 @@
./flake.lock
]);
};
- buildInputs = with pkgs; [ pkgs.libadwaita pkgs.protobuf pkgs.libsecret pkgs.gst_all_1.gstreamer pkgs.gst_all_1.gst-plugins-base pkgs.gst_all_1.gst-plugins-good pkgs.gst_all_1.gst-plugins-bad pkgs.gtksourceview5 pkgs.gtk4 ];
- nativeBuildInputs = with pkgs; [ pkgs.appstream-glib pkgs.blueprint-compiler pkgs.desktop-file-utils pkgs.meson pkgs.ninja pkgs.pkg-config pkgs.wrapGAppsHook4 pkgs.rustPlatform.cargoSetupHook cargo rustc pkgs.glib ];
+ buildInputs = with pkgs; [ libadwaita_1_5 pkgs.protobuf pkgs.libsecret pkgs.gst_all_1.gstreamer pkgs.gst_all_1.gst-plugins-base pkgs.gst_all_1.gst-plugins-good pkgs.gst_all_1.gst-plugins-bad pkgs.gtksourceview5 pkgs.gtk4 ];
+ nativeBuildInputs = with pkgs; [ pkgs.appstream-glib blueprint-compiler-git pkgs.desktop-file-utils pkgs.meson pkgs.ninja pkgs.pkg-config pkgs.wrapGAppsHook4 pkgs.rustPlatform.cargoSetupHook cargo rustc pkgs.glib ];
PROTOC = "${pkgs.protobuf}/bin/protoc";
diff --git a/src/gui/attachment.rs b/src/gui/attachment.rs
index 0852407..1eca381 100644
--- a/src/gui/attachment.rs
+++ b/src/gui/attachment.rs
@@ -31,6 +31,7 @@ pub fn backend_to_gui(attachment: &crate::backend::Attachment) -> Attachment {
pub mod imp {
use std::{cell::RefCell, os::fd::AsFd};
+ use adw::prelude::*;
use ashpd::{desktop::open_uri::OpenFileRequest, WindowIdentifier};
use gdk::{
gio::File,
@@ -43,7 +44,7 @@ pub mod imp {
ParamSpec, ParamSpecObject, Value,
};
use gtk::{gio, glib, FileDialog};
- use gtk::{prelude::*, subclass::prelude::*, CompositeTemplate};
+ use gtk::{subclass::prelude::*, CompositeTemplate};
use once_cell::sync::Lazy;
use crate::{
@@ -139,7 +140,7 @@ pub mod imp {
if let Err(e) = attachment.save_to_file(&file).await {
let root = obj.imp().window();
let dialog = ErrorDialog::new(e.into(), &root);
- dialog.present();
+ dialog.present(&root);
}
}));
} else {
diff --git a/src/gui/channel_info_dialog.rs b/src/gui/channel_info_dialog.rs
index f400956..886a4ce 100644
--- a/src/gui/channel_info_dialog.rs
+++ b/src/gui/channel_info_dialog.rs
@@ -1,7 +1,4 @@
-use gdk::{
- glib::subclass::types::ObjectSubclassIsExt,
- prelude::{IsA, ObjectExt},
-};
+use gdk::{glib::subclass::types::ObjectSubclassIsExt, prelude::ObjectExt};
use glib::Object;
use gtk::glib;
@@ -9,18 +6,17 @@ use crate::backend::{Channel, Manager};
glib::wrapper! {
pub struct ChannelInfoDialog(ObjectSubclass)
- @extends adw::MessageDialog, gtk::Window, gtk::Widget,
+ @extends adw::Dialog, gtk::Widget,
@implements gtk::gio::ActionGroup, gtk::gio::ActionMap, gtk::Accessible, gtk::Buildable,
gtk::ConstraintTarget;
}
impl ChannelInfoDialog {
- pub fn new(channel: &Channel, manager: &Manager, parent: &impl IsA) -> Self {
+ pub fn new(channel: &Channel, manager: &Manager) -> Self {
log::trace!("Initializing `ChannelInfoDialog`");
let s = Object::builder::()
.property("channel", channel)
.property("manager", manager)
- .property("transient-for", parent)
.build();
s.imp().setup();
s
@@ -33,7 +29,7 @@ impl ChannelInfoDialog {
pub mod imp {
use adw::prelude::ActionRowExt;
- use adw::subclass::prelude::MessageDialogImpl;
+ use adw::subclass::dialog::AdwDialogImpl;
use std::cell::RefCell;
use glib::{subclass::InitializingObject, ParamSpec, ParamSpecObject, Value};
@@ -172,7 +168,7 @@ pub mod imp {
impl ObjectSubclass for ChannelInfoDialog {
const NAME: &'static str = "FlChannelInfoDialog";
type Type = super::ChannelInfoDialog;
- type ParentType = adw::MessageDialog;
+ type ParentType = adw::Dialog;
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
@@ -229,8 +225,6 @@ pub mod imp {
}
}
- impl WindowImpl for ChannelInfoDialog {}
- impl MessageDialogImpl for ChannelInfoDialog {}
+ impl AdwDialogImpl for ChannelInfoDialog {}
impl WidgetImpl for ChannelInfoDialog {}
- impl BoxImpl for ChannelInfoDialog {}
}
diff --git a/src/gui/channel_messages.rs b/src/gui/channel_messages.rs
index 00dc3fd..f2d5a35 100644
--- a/src/gui/channel_messages.rs
+++ b/src/gui/channel_messages.rs
@@ -138,11 +138,12 @@ impl ChannelMessages {
pub mod imp {
use std::cell::{Cell, RefCell};
+ use adw::prelude::*;
use glib::{
clone, subclass::InitializingObject, ParamSpec, ParamSpecBoolean, ParamSpecObject, Value,
};
use gtk::{gio, glib, FileDialog, PositionType, SignalListItemFactory};
- use gtk::{prelude::*, subclass::prelude::*, CompositeTemplate};
+ use gtk::{subclass::prelude::*, CompositeTemplate};
use once_cell::sync::Lazy;
use crate::backend::timeline::Timeline;
@@ -350,7 +351,7 @@ pub mod imp {
.dynamic_cast::()
.expect("Root of `ChannelMessages` to be a `Window`.");
let dialog = ErrorDialog::new(e, &root);
- dialog.present();
+ dialog.present(&root);
return;
}
}
@@ -362,7 +363,7 @@ pub mod imp {
.dynamic_cast::()
.expect("Root of `ChannelMessages` to be a `Window`.");
let dialog = ErrorDialog::new(e, &root);
- dialog.present();
+ dialog.present(&root);
}
})
);
diff --git a/src/gui/error_dialog.rs b/src/gui/error_dialog.rs
index 1c30d41..876c0cb 100644
--- a/src/gui/error_dialog.rs
+++ b/src/gui/error_dialog.rs
@@ -1,16 +1,18 @@
-use adw::prelude::MessageDialogExt;
+use adw::prelude::AlertDialogExt;
+use gdk::glib::object::ObjectExt;
use glib::{prelude::IsA, Object};
use gtk::glib;
use crate::ApplicationError;
+use super::Window;
+
const REPORT: &str = "report";
glib::wrapper! {
pub struct ErrorDialog(ObjectSubclass)
- @extends adw::MessageDialog, gtk::Window, gtk::Widget,
- @implements gtk::gio::ActionGroup, gtk::gio::ActionMap, gtk::Accessible, gtk::Buildable,
- gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
+ @extends adw::AlertDialog, adw::Dialog, gtk::Widget,
+ @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
}
impl ErrorDialog {
@@ -22,29 +24,39 @@ impl ErrorDialog {
.property("body", &error.to_string())
.property("secondary-error", &error.more_information())
.property("should-report", error.should_report())
- .property("transient-for", parent)
+ .property("window", parent)
.build();
s.set_response_enabled(REPORT, error.should_report());
s
}
+
+ fn window(&self) -> Window {
+ self.property("window")
+ }
}
pub mod imp {
pub(crate) use std::cell::Cell;
use std::cell::RefCell;
+ use adw::prelude::*;
use adw::subclass::prelude::*;
use gdk::gio;
+ use gdk::glib::ParamSpecObject;
use glib::{subclass::InitializingObject, ParamSpec, ParamSpecBoolean, ParamSpecString, Value};
+ use gtk::CompositeTemplate;
use gtk::{glib, UriLauncher};
- use gtk::{prelude::*, CompositeTemplate};
use once_cell::sync::Lazy;
+ use crate::gui::Window;
+
#[derive(CompositeTemplate, Default)]
#[template(resource = "/ui/error_dialog.ui")]
pub struct ErrorDialog {
secondary_error: RefCell