general: Use adw alias for libadwaita

This will make writing libadwaita-based code a bit
nicer, and make it nicer when we use crates that
libadwaita's API re-exports.

Also clean up the unused imports exposed by
this change.
This commit is contained in:
Christopher Davis 2021-12-21 12:15:46 -08:00
parent ec0f13d250
commit f9cbad9ad9
5 changed files with 20 additions and 22 deletions

View file

@ -17,13 +17,12 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
use adw::subclass::prelude::*;
use gio::prelude::*;
use glib::clone;
use glib::subclass::prelude::*;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::CompositeTemplate;
use libadwaita::subclass::prelude::*;
use crate::config;
use crate::widgets::LpImageView;
@ -52,7 +51,7 @@ mod imp {
// TemplateChild<T> wrapper, where T is the
// object type of the template child.
#[template_child]
pub flap: TemplateChild<libadwaita::Flap>,
pub flap: TemplateChild<adw::Flap>,
#[template_child]
pub headerbar: TemplateChild<gtk::HeaderBar>,
#[template_child]
@ -62,7 +61,7 @@ mod imp {
#[template_child]
pub stack: TemplateChild<gtk::Stack>,
#[template_child]
pub status_page: TemplateChild<libadwaita::StatusPage>,
pub status_page: TemplateChild<adw::StatusPage>,
#[template_child]
pub image_view: TemplateChild<LpImageView>,
#[template_child]
@ -73,7 +72,7 @@ mod imp {
impl ObjectSubclass for LpWindow {
const NAME: &'static str = "LpWindow";
type Type = super::LpWindow;
type ParentType = libadwaita::ApplicationWindow;
type ParentType = adw::ApplicationWindow;
fn class_init(klass: &mut Self::Class) {
// bind_template() is a function generated by the
@ -154,7 +153,7 @@ mod imp {
glib::wrapper! {
pub struct LpWindow(ObjectSubclass<imp::LpWindow>)
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, libadwaita::ApplicationWindow,
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, adw::ApplicationWindow,
@implements gio::ActionMap, gio::ActionGroup;
}
@ -167,7 +166,7 @@ impl LpWindow {
let imp = imp::LpWindow::from_instance(&self);
if fullscreen {
imp.flap.set_fold_policy(libadwaita::FlapFoldPolicy::Always);
imp.flap.set_fold_policy(adw::FlapFoldPolicy::Always);
imp.headerbar.add_css_class("osd");
imp.menu_button.unparent();
imp.fullscreen_button.unparent();
@ -175,7 +174,7 @@ impl LpWindow {
imp.headerbar.pack_end(&*imp.menu_button);
imp.fullscreen_button.set_icon_name("view-restore-symbolic");
} else {
imp.flap.set_fold_policy(libadwaita::FlapFoldPolicy::Never);
imp.flap.set_fold_policy(adw::FlapFoldPolicy::Never);
imp.headerbar.remove_css_class("osd");
imp.menu_button.unparent();
imp.fullscreen_button.unparent();