From 1f85dd1ec57633a4051bb2d7b2ad6bc96d1e0c47 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Tue, 8 Sep 2026 16:49:04 +0200 Subject: [PATCH] add fullscreen button to the attachment window --- application/note/src/attachments_window.rs | 14 +++++++++++++- ui/gtk/window.c | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/application/note/src/attachments_window.rs b/application/note/src/attachments_window.rs index b53e462..88ca092 100644 --- a/application/note/src/attachments_window.rs +++ b/application/note/src/attachments_window.rs @@ -28,7 +28,7 @@ use std::path::Path; use backend::backend::BackendHandle; use ui_rs::ui::*; -use ui_rs::{action, button, imageviewer, tabview, ui_actions, webview, UiModel}; +use ui_rs::{action, button, imageviewer, tabview, togglebutton, ui_actions, webview, UiModel}; pub fn attachments_window_create(backend: BackendHandle, note_id: i32, selected_attachment: Option) { let mut data = AttachmentsWindow::new(backend, note_id); @@ -43,6 +43,10 @@ pub fn attachments_window_create(backend: BackendHandle, note_id: i32, selected_ button!(obj, icon = UiIconSet::GoForward.as_str(), action = "go_forward"); button!(obj, icon = UiIconSet::SaveLocal.as_str(), action = "save_as"); }); + hb.end(|obj|{ + togglebutton!(obj, icon = UiIconSet::ViewFullscreen.as_str(), action = "view_fullscreen"); + + }); }); tabview!(obj, tabview_type = TabViewType::Invisible, varname = "attachment_view_type", fill = true, |tv|{ @@ -245,4 +249,12 @@ impl AttachmentsWindow { Some(()) } + + #[action] + pub fn view_fullscreen(&mut self, event: &ActionEvent) { + let Some(obj) = self.obj.get_object() else { + return; + }; + obj.enable_fullscreen(event.intval != 0); + } } diff --git a/ui/gtk/window.c b/ui/gtk/window.c index fc6e9e2..eb82805 100644 --- a/ui/gtk/window.c +++ b/ui/gtk/window.c @@ -1115,3 +1115,11 @@ UiObject* ui_dialog_window_create(UiObject *parent, UiDialogWindowArgs *args) { return obj; } + +void ui_window_fullscreen(UiObject *obj, UiBool fullscreen) { + if(fullscreen) { + gtk_window_fullscreen(GTK_WINDOW(obj->widget)); + } else { + gtk_window_unfullscreen(GTK_WINDOW(obj->widget)); + } +} -- 2.52.0