File tree Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -222,10 +222,10 @@ export class Note extends GObject.Object {
222222 "title" ,
223223 GObject . BindingFlags . SYNC_CREATE ,
224224 ( _ , content ) => {
225- if ( ! content ) return [ false , "" ] ;
226-
227- const title = content . split ( "\n" ) [ 0 ] ;
228- return [ true , title . length > 20 ? title . slice ( 0 , 20 ) + "..." : title ] ;
225+ if ( ! content ) return [ true , "" ] ;
226+ let title = content . split ( "\n" ) [ 0 ] . slice ( 0 , 20 ) ;
227+ if ( title . length ! = content . length ) title += "…" ;
228+ return [ true , title ] ;
229229 } ,
230230 null
231231 ) ;
Original file line number Diff line number Diff line change @@ -98,11 +98,12 @@ export class Window extends Adw.ApplicationWindow {
9898 this . default_width = note . width ;
9999 this . default_height = note . height ;
100100
101- this . update_title ( ) ;
102-
103- this . note . connect ( "notify::title" , ( ) => {
104- this . update_title ( ) ;
105- } ) ;
101+ this . note . bind_property (
102+ "title" ,
103+ this ,
104+ "title" ,
105+ GObject . BindingFlags . SYNC_CREATE
106+ ) ;
106107
107108 this . connect ( "close-request" , ( ) => {
108109 if ( this . deleted ) return ;
@@ -157,14 +158,6 @@ export class Window extends Adw.ApplicationWindow {
157158 popover . add_child ( this . selector , "notestyleswitcher" ) ;
158159 }
159160
160- update_title ( ) {
161- if ( ! this . note . title ) {
162- this . set_title ( "Untitled Note" ) ;
163- return ;
164- }
165- this . set_title ( this . note . title ) ;
166- }
167-
168161 last_revealer = false ;
169162
170163 update_link ( selected : boolean , text : string ) {
You can’t perform that action at this time.
0 commit comments