[fractal/split-async-state-ui-appop-mgmt: 2/13] Move about_dialog from AppOp to UI




commit d0611a58fbfb389e9763b8604d8873c28a608fdf
Author: Alejandro Domínguez <adomu net-c com>
Date:   Thu Dec 3 12:53:10 2020 +0100

    Move about_dialog from AppOp to UI

 fractal-gtk/src/actions/global.rs      |  2 +-
 fractal-gtk/src/appop/mod.rs           |  1 -
 fractal-gtk/src/meson.build            |  2 +-
 fractal-gtk/src/{appop => ui}/about.rs | 16 ++++------------
 fractal-gtk/src/ui/mod.rs              |  3 ++-
 5 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/fractal-gtk/src/actions/global.rs b/fractal-gtk/src/actions/global.rs
index 94c03467..bda620a6 100644
--- a/fractal-gtk/src/actions/global.rs
+++ b/fractal-gtk/src/actions/global.rs
@@ -143,7 +143,7 @@ pub fn new(appop: &AppOp) {
     }));
 
     about.connect_activate(clone!(@strong app_runtime => move |_, _| {
-        app_runtime.update_state_with(|state| state.about_dialog());
+        app_runtime.update_state_with(|state| state.ui.about_dialog());
     }));
     main_menu.connect_activate(clone!(@strong app_runtime => move |_, _| {
         app_runtime.update_state_with(|state| state.main_menu());
diff --git a/fractal-gtk/src/appop/mod.rs b/fractal-gtk/src/appop/mod.rs
index 5982fe3d..42d35898 100644
--- a/fractal-gtk/src/appop/mod.rs
+++ b/fractal-gtk/src/appop/mod.rs
@@ -21,7 +21,6 @@ use crate::app::AppRuntime;
 use crate::cache;
 use crate::ui;
 
-mod about;
 mod account;
 pub mod attach;
 mod directory;
diff --git a/fractal-gtk/src/meson.build b/fractal-gtk/src/meson.build
index 1a69a165..fb6a507c 100644
--- a/fractal-gtk/src/meson.build
+++ b/fractal-gtk/src/meson.build
@@ -54,7 +54,6 @@ app_sources = files(
   'api/r0.rs',
   'app/mod.rs',
   'app/windowstate.rs',
-  'appop/about.rs',
   'appop/account.rs',
   'appop/attach.rs',
   'appop/directory.rs',
@@ -101,6 +100,7 @@ app_sources = files(
   'ui/connect/roomlist_search.rs',
   'ui/connect/send.rs',
   'ui/connect/swipeable_widgets.rs',
+  'ui/about.rs',
   'ui/mod.rs',
   'util/i18n.rs',
   'util/mod.rs',
diff --git a/fractal-gtk/src/appop/about.rs b/fractal-gtk/src/ui/about.rs
similarity index 83%
rename from fractal-gtk/src/appop/about.rs
rename to fractal-gtk/src/ui/about.rs
index e04031d5..7c245db7 100644
--- a/fractal-gtk/src/appop/about.rs
+++ b/fractal-gtk/src/ui/about.rs
@@ -1,18 +1,10 @@
+use super::UI;
+use crate::config;
 use crate::util::i18n::i18n;
-
 use gtk::prelude::*;
 
-use crate::appop::AppOp;
-use crate::config;
-
-impl AppOp {
+impl UI {
     pub fn about_dialog(&self) {
-        let window: gtk::ApplicationWindow = self
-            .ui
-            .builder
-            .get_object("main_window")
-            .expect("Can't find main_window in ui file.");
-
         let program_name = format!("Fractal{}", config::NAME_SUFFIX);
 
         let dialog = gtk::AboutDialog::new();
@@ -28,7 +20,7 @@ impl AppOp {
         dialog.set_website(Some("https://wiki.gnome.org/Fractal";));
         dialog.set_website_label(Some(i18n("Learn more about Fractal").as_str()));
         dialog.set_translator_credits(Some(i18n("translator-credits").as_str()));
-        dialog.set_transient_for(Some(&window));
+        dialog.set_transient_for(Some(&self.main_window));
 
         dialog.set_artists(&["Tobias Bernard"]);
 
diff --git a/fractal-gtk/src/ui/mod.rs b/fractal-gtk/src/ui/mod.rs
index 02bee00c..a15ec1e0 100644
--- a/fractal-gtk/src/ui/mod.rs
+++ b/fractal-gtk/src/ui/mod.rs
@@ -3,11 +3,12 @@ use crate::model::{member::Member, message::Message};
 use crate::util::i18n::i18n;
 use crate::widgets::{self, SVEntry};
 use chrono::prelude::{DateTime, Local};
-use gtk::{self, prelude::*};
+use gtk::prelude::*;
 use matrix_sdk::identifiers::{EventId, UserId};
 use std::path::PathBuf;
 use url::Url;
 
+pub mod about;
 pub mod connect;
 
 pub struct UI {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]