@@ -28,7 +28,7 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
2828 this . settings . bind ( "keyOpen" , "keyOpen" , this . _setKeybinding ) ;
2929 this . settings . bind ( "keyClear" , "keyClear" , this . _setKeybinding ) ;
3030 this . settings . bind ( "showNotificationCount" , "showNotificationCount" , this . update_list ) ;
31- this . settings . bind ( "showNewestFirst" , "showNewestFirst" , this . update_list ) ;
31+ this . settings . bind ( "showNewestFirst" , "showNewestFirst" , null ) ;
3232 this . _setKeybinding ( ) ;
3333
3434 // Layout
@@ -66,10 +66,16 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
6666 _openMenu ( ) {
6767 this . _update_timestamp ( ) ;
6868
69- this . notifications . forEach ( notification => {
70- if ( notification . actor . get_parent ( ) !== this . _notificationbin )
69+ this . _notificationbin . remove_all_children ( ) ;
70+ if ( this . showNewestFirst ) {
71+ for ( let i = this . notifications . length - 1 ; i >= 0 ; i -- ) {
72+ global . reparentActor ( this . notifications [ i ] . actor , this . _notificationbin ) ;
73+ }
74+ } else {
75+ this . notifications . forEach ( notification => {
7176 global . reparentActor ( notification . actor , this . _notificationbin ) ;
72- } ) ;
77+ } ) ;
78+ }
7379
7480 this . menu . toggle ( ) ;
7581 }
@@ -175,7 +181,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
175181 this . actor . show ( ) ;
176182 this . clear_action . actor . show ( ) ;
177183 this . set_applet_label ( count . toString ( ) ) ;
178- this . _reorderNotifications ( ) ;
179184 // Find max urgency and derive list icon.
180185 let max_urgency = - 1 ;
181186 for ( let i = 0 ; i < count ; i ++ ) {
@@ -234,25 +239,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
234239 this . update_list ( ) ;
235240 }
236241
237- _reorderNotifications ( ) {
238- let orderedNotifications = this . notifications . slice ( ) ;
239-
240- if ( this . showNewestFirst ) {
241- orderedNotifications . reverse ( ) ;
242- }
243-
244- // Remove all children without destroying them.
245- let children = this . _notificationbin . get_children ( ) ;
246- for ( let i = 0 ; i < children . length ; i ++ ) {
247- this . _notificationbin . remove_child ( children [ i ] ) ;
248- }
249-
250- // Add them back in desired order.
251- for ( let i = 0 ; i < orderedNotifications . length ; i ++ ) {
252- this . _notificationbin . add_child ( orderedNotifications [ i ] . actor ) ;
253- }
254- }
255-
256242 _show_hide_tray ( ) { // Show or hide the notification tray.
257243 if ( ! global . settings . get_boolean ( PANEL_EDIT_MODE_KEY ) ) {
258244 if ( this . notifications . length || this . showEmptyTray ) {
0 commit comments