File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 11project (' sticky-notes' ,
2- version : ' 0.2.1 ' ,
2+ version : ' 0.2.2 ' ,
33 meson_version : ' >= 0.62.0' ,
44 default_options : [ ' warning_level=2' , ' werror=false' , ],
55)
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class AbstractStickyNote extends Gtk.TextView {
4242 "tag-toggle" : {
4343 param_types : [ GObject . TYPE_STRING , GObject . TYPE_BOOLEAN ] ,
4444 } ,
45+ "content-changed" : { } ,
4546 "selection-changed" : { } ,
4647 "link-selected" : {
4748 param_types : [ GObject . TYPE_STRING ] ,
@@ -429,6 +430,7 @@ export class WriteableStickyNote extends AbstractStickyNote {
429430 this . update_links ( ) ;
430431 if ( this . buffer . text == this . note ! . content ) return ;
431432 this . change ( "content" , this . buffer . text ) ;
433+ this . emit ( "content-changed" ) ;
432434 } ) ;
433435
434436 this . buffer . connect ( "mark-set" , ( ) => {
Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ export class Window extends Adw.ApplicationWindow {
9898 this . default_width = note . width ;
9999 this . default_height = note . height ;
100100
101+ this . update_title ( ) ;
102+
101103 this . connect ( "close-request" , ( ) => {
102104 if ( this . deleted ) return ;
103105
@@ -121,6 +123,7 @@ export class Window extends Adw.ApplicationWindow {
121123
122124 this . view = new WriteableStickyNote ( note ) ;
123125 this . view . connect ( "selection-changed" , this . check_tags . bind ( this ) ) ;
126+ this . view . connect ( "content-changed" , this . update_title . bind ( this ) ) ;
124127 this . view . connect (
125128 "tag-toggle" ,
126129 ( _view : WriteableStickyNote , tag : string , active : boolean ) => {
@@ -151,6 +154,16 @@ export class Window extends Adw.ApplicationWindow {
151154 popover . add_child ( this . selector , "notestyleswitcher" ) ;
152155 }
153156
157+ update_title ( ) {
158+ const maxLength = 24 ;
159+ let title = this . note . content || `Sticky Note ${ this . note . uuid } ` ;
160+
161+ if ( title . length > maxLength ) {
162+ title = title . substring ( 0 , maxLength ) + "..." ;
163+ }
164+ this . set_title ( title ) ;
165+ }
166+
154167 last_revealer = false ;
155168
156169 update_link ( selected : boolean , text : string ) {
You can’t perform that action at this time.
0 commit comments