Skip to content

Commit

Permalink
dialog draft
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSnake04 committed Jun 29, 2023
1 parent 02d4397 commit 1503897
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 5 deletions.
30 changes: 29 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rnote-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ fs_extra = "1"
same-file = "1"
regex = "1.7"
directories = "5"
time = { version = "0.3.22", default-features = false, features = ["formatting"] }
29 changes: 29 additions & 0 deletions rnote-ui/data/ui/dialogs/dialogs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,33 @@ Do you want to save the current document?</property>
<object class="RnIconPicker" id="edit_selected_workspace_icon_picker"></object>
</child>
</object>

<object class="GtkPopover" id="recover_documents">
<object class="AdwClamp">
<property name="maximum-size">800</property>
<property name="tightening-threshold">600</property>
<property name="hexpand">true</property>
<property name="vexpand">false</property>
<property name="valign">fill</property>
<property name="halign">fill</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<style>
<class name="background" />
</style>
<child>
<object class="">

</object>
</child>
</object>
</child>
</object>
</object>
</interface>
1 change: 1 addition & 0 deletions rnote-ui/src/appwindow/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ impl RnAppWindow {
let canvas = appwindow.active_tab().canvas();

glib::MainContext::default().spawn_local(clone!(@weak canvas, @weak appwindow => async move {
if !canvas.unsaved_changes_recovery() {return;}
let tmp_file = canvas.get_or_generate_tmp_file();
appwindow.overlays().start_pulsing_progressbar();
canvas.set_recovery_in_progress(true);
Expand Down
12 changes: 12 additions & 0 deletions rnote-ui/src/appwindow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ impl RnAppWindow {
pub(crate) fn set_recovery(&self, recovery: bool) {
self.set_property("recovery", recovery.to_value());
}
#[allow(unused)]
pub(crate) fn recovery_interval_secs(&self) -> u32 {
self.property::<u32>("recovery-interval-secs")
}

#[allow(unused)]
pub(crate) fn set_recovery_interval_secs(&self, autosave_interval_secs: u32) {
self.set_property("recovery-interval-secs", autosave_interval_secs.to_value());
}

#[allow(unused)]
pub(crate) fn autosave_interval_secs(&self) -> u32 {
Expand Down Expand Up @@ -187,6 +196,9 @@ impl RnAppWindow {
self.overlays().undo_button().set_sensitive(false);
self.overlays().redo_button().set_sensitive(false);
self.refresh_ui_from_engine(&self.active_tab());
glib::MainContext::default().spawn_local(clone!(@weak self as appwindow => async move {
dialogs::dialog_recover_documents(&appwindow).await;
}));
}

/// Called to close the window
Expand Down
8 changes: 4 additions & 4 deletions rnote-ui/src/dialogs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Modules
pub(crate) mod export;
pub(crate) mod import;
mod recovery;

// Imports
use crate::appwindow::RnAppWindow;
Expand All @@ -19,6 +20,9 @@ use gtk4::{
Label, MenuButton, ResponseType, ShortcutsWindow, StringList,
};

// Re-exports
pub(crate) use recovery::dialog_recover_documents;

// About Dialog
pub(crate) fn dialog_about(appwindow: &RnAppWindow) {
let app_icon_name = if config::PROFILE == "devel" {
Expand Down Expand Up @@ -502,10 +506,6 @@ pub(crate) async fn dialog_edit_selected_workspace(appwindow: &RnAppWindow) {
}
}

pub(crate) async fn dialog_recover_documents() {
todo!()
}

const WORKSPACELISTENTRY_ICONS_LIST: &[&str] = &[
"workspacelistentryicon-bandaid-symbolic",
"workspacelistentryicon-bank-symbolic",
Expand Down

0 comments on commit 1503897

Please sign in to comment.