[fractal/fractal-next] Use AdwApplication
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fractal-next] Use AdwApplication
- Date: Tue, 14 Dec 2021 12:08:30 +0000 (UTC)
commit 8b8631130dc07a4926b9db35104108c430925ee3
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Mon Oct 4 22:01:52 2021 +0200
Use AdwApplication
This allows to have a separate css file for dark mode.
src/application.rs | 21 ++++-----------------
src/main.rs | 1 -
2 files changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/src/application.rs b/src/application.rs
index 94823f37..440c7003 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -6,7 +6,7 @@ use glib::clone;
use glib::WeakRef;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
-use gtk::{gdk, gio, glib};
+use gtk::{gio, glib};
use gtk_macros::action;
use log::{debug, info};
@@ -33,7 +33,7 @@ mod imp {
impl ObjectSubclass for Application {
const NAME: &'static str = "Application";
type Type = super::Application;
- type ParentType = gtk::Application;
+ type ParentType = adw::Application;
}
impl ObjectImpl for Application {}
@@ -49,8 +49,6 @@ mod imp {
return;
}
- app.setup_css();
-
let window = Window::new(app);
self.window
.set(window.downgrade())
@@ -69,11 +67,12 @@ mod imp {
}
impl GtkApplicationImpl for Application {}
+ impl AdwApplicationImpl for Application {}
}
glib::wrapper! {
pub struct Application(ObjectSubclass<imp::Application>)
- @extends gio::Application, gtk::Application, @implements gio::ActionMap, gio::ActionGroup;
+ @extends gio::Application, gtk::Application, adw::Application, @implements gio::ActionMap,
gio::ActionGroup;
}
impl Application {
@@ -144,18 +143,6 @@ impl Application {
self.set_accels_for_action("win.show-help-overlay", &["<Control>question"]);
}
- fn setup_css(&self) {
- let provider = gtk::CssProvider::new();
- provider.load_from_resource("/org/gnome/FractalNext/style.css");
- if let Some(display) = gdk::Display::default() {
- gtk::StyleContext::add_provider_for_display(
- &display,
- &provider,
- gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
- );
- }
- }
-
fn show_about_dialog(&self) {
let dialog = gtk::AboutDialogBuilder::new()
.logo_icon_name(config::APP_ID)
diff --git a/src/main.rs b/src/main.rs
index 2fe9eb23..cf0afab2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -47,7 +47,6 @@ fn main() {
gtk::glib::set_application_name("Fractal");
gtk::init().expect("Unable to start GTK4");
- adw::init();
gst::init().expect("Failed to initalize gst");
let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]