Skip to content

Commit

Permalink
AboutWindow -> AboutDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
blissd committed Apr 11, 2024
1 parent 017d6a0 commit ad5ef77
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,7 @@ impl SimpleComponent for App {
folder_album.emit(AlbumInput::Refresh); // initial photo

let about_dialog = AboutDialog::builder()
.transient_for(&root)
.launch(())
.launch(root.clone())
.detach();

let preferences_dialog = PreferencesDialog::builder()
Expand Down
33 changes: 20 additions & 13 deletions src/app/components/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later

use gtk::prelude::GtkWindowExt;
use relm4::{adw, gtk, ComponentParts, ComponentSender, SimpleComponent};
use relm4::adw::prelude::AdwDialogExt;


use crate::config::{APP_ID, VERSION};

pub struct AboutDialog {}
pub struct AboutDialog {
parent: adw::ApplicationWindow,
dialog: adw::AboutDialog,
}

impl SimpleComponent for AboutDialog {
type Init = ();
type Widgets = adw::AboutWindow;
type Init = adw::ApplicationWindow;
type Widgets = adw::AboutDialog;
type Input = ();
type Output = ();
type Root = adw::AboutWindow;
type Root = adw::AboutDialog;

fn init_root() -> Self::Root {
adw::AboutWindow::builder()
adw::AboutDialog::builder()
.application_icon(APP_ID)
.license_type(gtk::License::Gpl30)
.website("https://github.com/blissd/fotema")
Expand All @@ -28,23 +32,26 @@ impl SimpleComponent for AboutDialog {
.copyright("© 2024 David Bliss")
.developers(vec!["David Bliss"])
.designers(vec!["David Bliss"])
.hide_on_close(true)
.can_close(true)
.build()
}

fn init(
_: Self::Init,
root: Self::Root,
parent: Self::Init,
dialog: Self::Root,
_sender: ComponentSender<Self>,
) -> ComponentParts<Self> {
let model = Self {};
let model = Self {
parent,
dialog: dialog.clone(),
};

let widgets = root.clone();
let widgets = dialog;

ComponentParts { model, widgets }
}

fn update_view(&self, dialog: &mut Self::Widgets, _sender: ComponentSender<Self>) {
dialog.present();
fn update_view(&self, _: &mut Self::Widgets, _sender: ComponentSender<Self>) {
self.dialog.present(&self.parent);
}
}

0 comments on commit ad5ef77

Please sign in to comment.