summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2025-02-19 21:07:25 +0300
committerVika <vika@fireburn.ru>2025-02-19 21:07:25 +0300
commit060f5330d772a3caf803fdf24f7cd5b531a96dd5 (patch)
tree7a138411b0ab448c5752be3179b5d357fb20e9f1 /src
parentf4dd8846a599a97203ecec0ae397ed450c097ca0 (diff)
downloadbowl-060f5330d772a3caf803fdf24f7cd5b531a96dd5.tar.zst
Use WrapLayout for the tag pill widget
This is what I originally wanted to use, actually.
Diffstat (limited to 'src')
-rw-r--r--src/components/post_editor.rs24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/components/post_editor.rs b/src/components/post_editor.rs
index c42b06a..d9d85c0 100644
--- a/src/components/post_editor.rs
+++ b/src/components/post_editor.rs
@@ -211,19 +211,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
                             },
                         },
 
-                        #[name = "tag_viewport"]
-                        gtk::ScrolledWindow {
-                            set_height_request: 32,
-                            set_valign: gtk::Align::Center,
-
-                            gtk::Viewport {
-                                set_scroll_to_focus: true,
-                                set_valign: gtk::Align::Center,
-
-                                #[wrap(Some)]
-                                set_child = model.tags.widget(),
-                            }
-                        },
+                        model.tags.widget(),
 
                         #[name = "content_label"]
                         gtk::Label {
@@ -354,8 +342,12 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
             tags: FactoryVecDeque::builder()
                 .launch({
                     let listbox = gtk::Box::default();
-                    listbox.set_orientation(gtk::Orientation::Horizontal);
-                    listbox.set_spacing(5);
+                    let layout = adw::WrapLayout::builder()
+                        .child_spacing(5)
+                        .line_spacing(5)
+                        .build();
+
+                    listbox.set_layout_manager(Some(layout));
                     listbox
                 })
                 .forward(
@@ -427,7 +419,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
             Row::TwoColumn(&widgets.name_label, widgets.name_field.upcast_ref::<gtk::Widget>()),
             Row::TwoColumn(&widgets.summary_label, widgets.summary_field.upcast_ref::<gtk::Widget>()),
             Row::TwoColumn(&widgets.tag_label, widgets.tag_holder.upcast_ref::<gtk::Widget>()),
-            Row::SecondColumn(widgets.tag_viewport.upcast_ref::<gtk::Widget>()),
+            Row::SecondColumn(model.tags.widget().upcast_ref::<gtk::Widget>()),
             Row::TwoColumn(&widgets.content_label, widgets.content_textarea_wrapper.upcast_ref::<gtk::Widget>()),
             Row::Span(widgets.misc_prop_wrapper.upcast_ref::<gtk::Widget>()),
         ].into_iter().enumerate() {