]> uap-core.de Git - note.git/commitdiff
add fullscreen button to the attachment window
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 8 Sep 2026 14:49:04 +0000 (16:49 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 8 Sep 2026 14:49:04 +0000 (16:49 +0200)
application/note/src/attachments_window.rs
ui/gtk/window.c

index b53e46208c6349b6b38630fd6a3b63f01878861b..88ca092748ff9c4bfc0799df6bb505ebf4238811 100644 (file)
@@ -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<i32>) {
     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);
+    }
 }
index fc6e9e28318e8f70ed0150c95ae9fbe6521e6c21..eb82805307669e99337c70540a89721d7f076f71 100644 (file)
@@ -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));
+    }
+}