@@ -100,6 +100,7 @@ MyDesklet.prototype = {
100100 this . settings . bind ( "selected-poet" , "selected_poet" , this . _updateBeyt ) ;
101101 this . settings . bind ( "x-l" , "XL" , null ) ;
102102 this . settings . bind ( "poem-history" , "PoemHistory" , null ) ;
103+ this . settings . bind ( "history-save" , "HistorySave" , null ) ;
103104 this . settings . bind ( "history-size" , "HistorySize" , null ) ;
104105
105106 this . _clipboard = St . Clipboard . get_default ( ) ;
@@ -110,6 +111,11 @@ MyDesklet.prototype = {
110111 Gio . app_info_launch_default_for_uri ( this . poet . link , global . create_app_launch_context ( ) ) ;
111112 } ) ) ;
112113
114+ let nextPoemMenuItem = new PopupMenu . PopupIconMenuItem ( "Next" , "go-next" , St . IconType . SYMBOLIC ) ;
115+ nextPoemMenuItem . connect ( 'activate' , Lang . bind ( this , function ( menuItem , event ) {
116+ this . _updateBeyt ( ) ;
117+ } ) ) ;
118+
113119 let previousPoemMenuItem = new PopupMenu . PopupIconMenuItem ( "Previous" , "go-previous" , St . IconType . SYMBOLIC ) ;
114120 previousPoemMenuItem . connect ( 'activate' , Lang . bind ( this , function ( menuItem , event ) {
115121 if ( this . history . length ) {
@@ -137,6 +143,7 @@ MyDesklet.prototype = {
137143 this . _menu . addMenuItem ( takeShotMenuItem , 0 ) ;
138144 this . _menu . addMenuItem ( copyLinkMenuItem , 0 ) ;
139145 this . _menu . addMenuItem ( copyMenuItem , 0 ) ;
146+ this . _menu . addMenuItem ( nextPoemMenuItem , 0 ) ;
140147 this . _menu . addMenuItem ( previousPoemMenuItem , 0 ) ;
141148 this . _menu . addMenuItem ( openLinkMenuItem , 0 ) ;
142149
@@ -256,10 +263,12 @@ MyDesklet.prototype = {
256263 text = text . replace ( / & # x ( [ 0 - 9 A - F a - f ] + ) ; / g, ( match , hex ) => String . fromCharCode ( parseInt ( hex , 16 ) ) ) ;
257264 this . setText ( text , true ) ;
258265
266+ if ( this . HistorySave ) {
259267 if ( this . PoemHistory . length > this . HistorySize )
260268 this . PoemHistory . splice ( Math . floor ( Math . random ( ) * this . PoemHistory . length ) , this . PoemHistory . length - this . HistorySize ) ;
261269 this . PoemHistory . push ( text ) ;
262270 this . settings . _saveToFile ( ) ;
271+ }
263272 } else {
264273 this . setText ( this . PoemHistory [ Math . floor ( Math . random ( ) * this . PoemHistory . length ) ] , false ) ;
265274 }
0 commit comments