chore: Use AdwToolbarView wherever possible

This commit is contained in:
Kévin Commaille 2023-09-18 10:21:09 +02:00 committed by Kévin Commaille
parent 4b98c9caef
commit d560572193
10 changed files with 436 additions and 466 deletions

View File

@ -2,9 +2,8 @@
<interface>
<template class="ErrorPage" parent="AdwBin">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="GtkHeaderBar">
<property name="title-widget">
<object class="AdwWindowTitle">
@ -13,7 +12,7 @@
</property>
</object>
</child>
<child>
<property name="content">
<object class="AdwStatusPage" id="page">
<property name="title" translatable="yes">Secret Service Error</property>
<property name="icon-name">dialog-password-symbolic</property>
@ -196,7 +195,7 @@
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</template>

View File

@ -11,8 +11,6 @@ mod imp {
#[derive(Debug, Default, CompositeTemplate)]
#[template(resource = "/org/gnome/Fractal/ui/greeter.ui")]
pub struct Greeter {
#[template_child]
pub back_button: TemplateChild<gtk::Button>,
#[template_child]
pub login_button: TemplateChild<gtk::Button>,
#[template_child]

View File

@ -2,15 +2,9 @@
<interface>
<template class="Greeter" parent="AdwBin">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<property name="title-widget">
<object class="AdwWindowTitle">
<property name="title">Fractal</property>
</object>
</property>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<child type="start">
<object class="GtkButton" id="back_button">
<property name="action-name">app.show-session</property>
@ -36,7 +30,7 @@
</child>
</object>
</child>
<child>
<property name="content">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-height">True</property>
@ -131,7 +125,7 @@
</object>
</property>
</object>
</child>
</property>
</object>
</child>
</template>

View File

@ -2,15 +2,10 @@
<interface>
<template class="Login" parent="AdwBin">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<property name="title-widget">
<object class="GtkBox">
<property name="visible">False</property>
</object>
</property>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="show-title">False</property>
<child type="start">
<object class="GtkButton" id="back_button">
<property name="icon-name">go-previous-symbolic</property>
@ -22,6 +17,9 @@
</style>
</object>
</child>
<property name="content">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwBanner" id="offline_banner"/>
</child>
@ -127,6 +125,8 @@
</object>
</child>
</object>
</property>
</object>
</child>
</template>
</interface>

View File

@ -1,6 +1,7 @@
use std::cell::Cell;
use gtk::{gdk, gio, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate};
use adw::subclass::prelude::*;
use gtk::{gdk, gio, glib, glib::clone, prelude::*, CompositeTemplate};
use once_cell::sync::Lazy;
use crate::components::MediaContentViewer;
@ -24,7 +25,7 @@ mod imp {
impl ObjectSubclass for AttachmentDialog {
const NAME: &'static str = "AttachmentDialog";
type Type = super::AttachmentDialog;
type ParentType = gtk::Window;
type ParentType = adw::Window;
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
@ -48,13 +49,15 @@ mod imp {
SIGNALS.as_ref()
}
}
impl WidgetImpl for AttachmentDialog {}
impl WindowImpl for AttachmentDialog {}
impl AdwWindowImpl for AttachmentDialog {}
}
glib::wrapper! {
pub struct AttachmentDialog(ObjectSubclass<imp::AttachmentDialog>)
@extends gtk::Widget, gtk::Window;
@extends gtk::Widget, gtk::Window, gtk::Root, adw::Window;
}
impl AttachmentDialog {

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="AttachmentDialog" parent="GtkWindow">
<template class="AttachmentDialog" parent="AdwWindow">
<property name="modal">True</property>
<property name="title"></property>
<property name="default-width">400</property>
<property name="default-height">400</property>
<property name="destroy-with-parent">True</property>
<property name="titlebar">
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="GtkHeaderBar">
<property name="show-title-buttons">False</property>
<child>
@ -27,9 +29,10 @@
</object>
</child>
</object>
</child>
<property name="content">
<object class="ComponentsMediaContentViewer" id="media"/>
</property>
<property name="child">
<object class="ComponentsMediaContentViewer" id="media">
</object>
</property>
<child>

View File

@ -6,23 +6,13 @@
<property name="default-width">380</property>
<property name="default-height">620</property>
<property name="content">
<object class="GtkWindowHandle">
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<style>
<class name="flat"/>
</style>
<property name="title-widget">
<object class="GtkBox">
<property name="visible">False</property>
</object>
</property>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="show-title">False</property>
</object>
</child>
<child>
<child type="top">
<object class="AdwClamp">
<property name="hexpand">True</property>
<child>
@ -52,7 +42,7 @@
</child>
</object>
</child>
<child>
<property name="content">
<object class="GtkStack" id="stack">
<child>
<object class="GtkStackPage">
@ -130,11 +120,8 @@
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</template>
</interface>

View File

@ -7,9 +7,8 @@
<property name="default-width">500</property>
<property name="default-height">300</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="GtkHeaderBar">
<child type="start">
<object class="GtkButton">
@ -20,7 +19,7 @@
</child>
</object>
</child>
<child>
<property name="content">
<object class="GtkScrolledWindow">
<style>
<class name="event-source-dialog"/>
@ -48,7 +47,7 @@
</object>
</property>
</object>
</child>
</property>
</object>
</child>
</template>

View File

@ -8,23 +8,13 @@
<property name="content">
<object class="AdwToastOverlay" id="toast_overlay">
<child>
<object class="GtkWindowHandle">
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<style>
<class name="flat"/>
</style>
<property name="title-widget">
<object class="GtkBox">
<property name="visible">False</property>
</object>
</property>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="show-title">False</property>
</object>
</child>
<child>
<property name="content">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-height">True</property>
@ -39,7 +29,7 @@
<property name="margin-bottom">24</property>
<property name="margin-start">24</property>
<property name="margin-end">24</property>
<child>
<child type="top">
<object class="GtkLabel" id="heading">
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
@ -216,8 +206,6 @@
</object>
</property>
</object>
</child>
</object>
</property>
</object>
</child>

View File

@ -14,16 +14,13 @@
<child>
<object class="GtkWindowHandle" id="loading">
<property name="child">
<object class="AdwToolbarView">
<child>
<object class="GtkHeaderBar"/>
</child>
<property name="content">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<property name="show-title-buttons">True</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="AdwBanner" id="offline_banner"/>
</child>
@ -40,6 +37,8 @@
</object>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="Greeter" id="greeter"/>