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>
68 lines
1.2 KiB
Plaintext
68 lines
1.2 KiB
Plaintext
using Gtk 4.0;
|
|
using Adw 1;
|
|
|
|
template $GcalNotesSection: Adw.PreferencesRow {
|
|
focusable: false;
|
|
selectable: false;
|
|
|
|
styles [
|
|
"entry",
|
|
]
|
|
|
|
GestureClick {
|
|
pressed => $on_row_pressed(notes_text) not-swapped;
|
|
}
|
|
|
|
child: Overlay {
|
|
css-name: "box";
|
|
|
|
styles [
|
|
"header",
|
|
]
|
|
|
|
[overlay]
|
|
Adw.Bin {
|
|
can-focus: false;
|
|
can-target: false;
|
|
|
|
styles [
|
|
"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 {
|
|
styles [
|
|
"editable-area",
|
|
]
|
|
|
|
child: TextView notes_text {
|
|
hexpand: true;
|
|
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 {
|
|
placeholder: _("Notes");
|
|
}
|
|
};
|
|
};
|
|
};
|
|
}
|