summary refs log tree commit diff
path: root/src/components/post_editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/post_editor.rs')
-rw-r--r--src/components/post_editor.rs44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/components/post_editor.rs b/src/components/post_editor.rs
index fe69ac7..86bd91d 100644
--- a/src/components/post_editor.rs
+++ b/src/components/post_editor.rs
@@ -139,10 +139,9 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
                         #[name = "name_label"]
                         gtk::Label {
                             set_markup: "Name",
-                            set_margin_vertical: 10,
                             set_margin_horizontal: 10,
                             set_halign: gtk::Align::Start,
-                            set_valign: gtk::Align::Start,
+                            set_valign: gtk::Align::Center,
                         },
                         #[name = "name_field"]
                         gtk::Entry {
@@ -155,10 +154,9 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
                         #[name = "summary_label"]
                         gtk::Label {
                             set_markup: "Summary",
-                            set_margin_vertical: 10,
                             set_margin_horizontal: 10,
                             set_halign: gtk::Align::Start,
-                            set_valign: gtk::Align::Start,
+                            set_valign: gtk::Align::Center,
                         },
                         #[name = "summary_field"]
                         gtk::Box {
@@ -178,17 +176,15 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
                         #[name = "tag_label"]
                         gtk::Label {
                             set_markup: "Tags",
-                            set_margin_vertical: 10,
                             set_margin_horizontal: 10,
                             set_halign: gtk::Align::Start,
-                            set_valign: gtk::Align::Start,
+                            set_valign: gtk::Align::Center,
                         },
                         #[name = "tag_holder"]
                         gtk::Box {
                             set_hexpand: true,
                             set_orientation: gtk::Orientation::Vertical,
                             set_spacing: 5,
-                            set_height_request: 36,
 
                             gtk::Box {
                                 add_css_class: "linked",
@@ -199,23 +195,29 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
                                     set_hexpand: true,
                                     set_width_request: 200,
                                     set_buffer: &model.pending_tag_buffer,
+                                    connect_activate => Self::Input::AddTagFromBuffer,
                                     #[track = "model.changed(Self::sending())"]
                                     set_sensitive: !model.sending,
                                 },
                                 gtk::Button {
-                                    set_icon_name: "plus-symbolic",
+                                    set_icon_name: "list-add-symbolic",
                                     add_css_class: "suggested-action",
                                     connect_clicked => Self::Input::AddTagFromBuffer,
                                 }
                             },
+                        },
 
-                            gtk::ScrolledWindow {
-                                gtk::Viewport {
-                                    set_scroll_to_focus: true,
+                        #[name = "tag_viewport"]
+                        gtk::ScrolledWindow {
+                            set_height_request: 32,
+                            set_valign: gtk::Align::Center,
 
-                                    #[wrap(Some)]
-                                    set_child = model.tags.widget(),
-                                }
+                            gtk::Viewport {
+                                set_scroll_to_focus: true,
+                                set_valign: gtk::Align::Center,
+
+                                #[wrap(Some)]
+                                set_child = model.tags.widget(),
                             }
                         },
 
@@ -395,6 +397,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
             model.visibility = post.visibility;
         }
 
+        let prev_layout = widgets.content.layout_manager().unwrap();
         let layout = &model.wide_layout;
         widgets.content.set_layout_manager(Some(layout.clone()));
         layout.set_column_homogeneous(false);
@@ -402,13 +405,15 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
 
         enum Row<'a> {
             TwoColumn(&'a gtk::Label, &'a gtk::Widget),
-            Span(&'a gtk::Widget)
+            Span(&'a gtk::Widget),
+            SecondColumn(&'a gtk::Widget)
         }
 
         for (row, content) in [
             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::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() {
@@ -432,11 +437,18 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post
                         .unwrap();
                     widget_layout.set_row(row as i32);
                     widget_layout.set_column_span(2);
+                },
+                Row::SecondColumn(widget) => {
+                    let widget_layout = layout.layout_child(widget)
+                        .downcast::<GridLayoutChild>()
+                        .unwrap();
+                    widget_layout.set_row(row as i32);
+                    widget_layout.set_column(1);
                 }
             }
         }
 
-        widgets.content.set_layout_manager(Some(model.narrow_layout.clone()));
+        widgets.content.set_layout_manager(Some(prev_layout));
 
         ComponentParts { model, widgets }
     }