event-editor/notes-section: Follow AdwEntryRow's style
The current notes text view has had a 2px offset for an unknown amount of time, due to us magic-numbering margins and/or padding. This approach works a little bit differently, in that it uses the `.editable-area` style class and sets the overlay's CSS name to "box" to use a predictable size of margins from AdwEntryRow. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/738>
This commit is contained in:
@@ -2,42 +2,60 @@ using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $GcalNotesSection: Adw.PreferencesRow {
|
||||
activatable: false;
|
||||
focusable: false;
|
||||
selectable: false;
|
||||
|
||||
styles [
|
||||
"entry",
|
||||
"notes-section",
|
||||
]
|
||||
|
||||
GestureClick {
|
||||
pressed => $on_row_pressed(notes_text) not-swapped;
|
||||
}
|
||||
|
||||
child: Overlay {
|
||||
css-name: "box";
|
||||
|
||||
styles [
|
||||
"header",
|
||||
]
|
||||
|
||||
[overlay]
|
||||
Label placeholder {
|
||||
label: _("Notes");
|
||||
Adw.Bin {
|
||||
can-focus: false;
|
||||
can-target: false;
|
||||
xalign: 0.0;
|
||||
yalign: 0.0;
|
||||
visible: bind $empty_string(notes_text.buffer.text);
|
||||
|
||||
styles [
|
||||
"dimmed",
|
||||
"placeholder",
|
||||
"editable-area",
|
||||
]
|
||||
|
||||
child: Label placeholder {
|
||||
label: _("Notes");
|
||||
xalign: 0.0;
|
||||
yalign: 0.0;
|
||||
visible: bind $empty_string(notes_text.buffer.text);
|
||||
margin-top: 12;
|
||||
margin-bottom: 12;
|
||||
|
||||
styles [
|
||||
"dimmed",
|
||||
"placeholder",
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
child: Adw.Bin {
|
||||
css-name: "box";
|
||||
styles [
|
||||
"editable-area",
|
||||
]
|
||||
|
||||
child: TextView notes_text {
|
||||
hexpand: true;
|
||||
top-margin: 6;
|
||||
bottom-margin: 6;
|
||||
left-margin: 6;
|
||||
right-margin: 6;
|
||||
sensitive: true;
|
||||
wrap-mode: word_char;
|
||||
accepts-tab: false;
|
||||
top-margin: 12;
|
||||
bottom-margin: 12;
|
||||
state-flags-changed => $on_notes_text_state_flags_changed_cb(template) not-swapped;
|
||||
|
||||
accessibility {
|
||||
|
||||
Reference in New Issue
Block a user