[fractal] attachment-dialog: Set default focus to send button



commit 6331bf022ed9d0232c094a04e29f630f86036f70
Author: Jacob Hughes <j distanthills org>
Date:   Tue May 17 17:07:48 2022 -0400

    attachment-dialog: Set default focus to send button

 data/resources/ui/attachment-dialog.ui                | 2 +-
 src/session/content/room_history/attachment_dialog.rs | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/data/resources/ui/attachment-dialog.ui b/data/resources/ui/attachment-dialog.ui
index 8fce210a0..8b3909535 100644
--- a/data/resources/ui/attachment-dialog.ui
+++ b/data/resources/ui/attachment-dialog.ui
@@ -17,7 +17,7 @@
           </object>
         </child>
         <child type="end">
-          <object class="GtkButton">
+          <object class="GtkButton" id="send_button">
             <property name="label" translatable="yes">_Send</property>
             <property name="use-underline">True</property>
             <property name="action-name">attachment-dialog.send</property>
diff --git a/src/session/content/room_history/attachment_dialog.rs 
b/src/session/content/room_history/attachment_dialog.rs
index 5108c1e35..272f5ea4c 100644
--- a/src/session/content/room_history/attachment_dialog.rs
+++ b/src/session/content/room_history/attachment_dialog.rs
@@ -13,6 +13,8 @@ mod imp {
     pub struct AttachmentDialog {
         pub send: Cell<bool>,
         #[template_child]
+        pub send_button: TemplateChild<gtk::Button>,
+        #[template_child]
         pub media: TemplateChild<MediaContentViewer>,
     }
 
@@ -63,6 +65,7 @@ impl AttachmentDialog {
         let obj: Self = glib::Object::new(&[("transient-for", transient_for), ("title", &title)])
             .expect("Failed to create AttachmentDialog");
         obj.imp().media.view_image(image);
+        obj.imp().send_button.grab_focus();
         obj
     }
 
@@ -70,6 +73,7 @@ impl AttachmentDialog {
         let obj: Self = glib::Object::new(&[("transient-for", transient_for), ("title", &title)])
             .expect("Failed to create AttachmentDialog");
         obj.imp().media.view_file(file.to_owned());
+        obj.imp().send_button.grab_focus();
         obj
     }
 
@@ -77,6 +81,7 @@ impl AttachmentDialog {
         let obj: Self = glib::Object::new(&[("transient-for", transient_for), ("title", &title)])
             .expect("Failed to create AttachmentDialog");
         obj.imp().media.view_location(geo_uri);
+        obj.imp().send_button.grab_focus();
         obj
     }
 


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