@@ -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
@@ -65,6 +65,18 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
6565
6666 _openMenu ( ) {
6767 this . _update_timestamp ( ) ;
68+
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 => {
76+ global . reparentActor ( notification . actor , this . _notificationbin ) ;
77+ } ) ;
78+ }
79+
6880 this . menu . toggle ( ) ;
6981 }
7082
@@ -138,8 +150,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
138150 if ( notification . _destroyed ) {
139151 this . notifications . splice ( existing_index , 1 ) ;
140152 } else {
141- notification . _inNotificationBin = true ;
142- global . reparentActor ( notification . actor , this . _notificationbin ) ;
143153 notification . _timeLabel . show ( ) ;
144154 }
145155 this . update_list ( ) ;
@@ -148,11 +158,8 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
148158 return ;
149159 }
150160 // Add notification to list.
151- notification . _inNotificationBin = true ;
152161 this . notifications . push ( notification ) ;
153- // Steal the notification panel.
154- this . _notificationbin . add ( notification . actor ) ;
155- notification . actor . _parent_container = this . _notificationbin ;
162+
156163 notification . actor . add_style_class_name ( 'notification-applet-padding' ) ;
157164 // Register for destruction.
158165 notification . connect ( 'scrolling-changed' , ( notif , scrolling ) => { this . menu . passEvents = scrolling } ) ;
@@ -174,7 +181,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
174181 this . actor . show ( ) ;
175182 this . clear_action . actor . show ( ) ;
176183 this . set_applet_label ( count . toString ( ) ) ;
177- this . _reorderNotifications ( ) ;
178184 // Find max urgency and derive list icon.
179185 let max_urgency = - 1 ;
180186 for ( let i = 0 ; i < count ; i ++ ) {
@@ -233,25 +239,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
233239 this . update_list ( ) ;
234240 }
235241
236- _reorderNotifications ( ) {
237- let orderedNotifications = this . notifications . slice ( ) ;
238-
239- if ( this . showNewestFirst ) {
240- orderedNotifications . reverse ( ) ;
241- }
242-
243- // Remove all children without destroying them.
244- let children = this . _notificationbin . get_children ( ) ;
245- for ( let i = 0 ; i < children . length ; i ++ ) {
246- this . _notificationbin . remove_child ( children [ i ] ) ;
247- }
248-
249- // Add them back in desired order.
250- for ( let i = 0 ; i < orderedNotifications . length ; i ++ ) {
251- this . _notificationbin . add_child ( orderedNotifications [ i ] . actor ) ;
252- }
253- }
254-
255242 _show_hide_tray ( ) { // Show or hide the notification tray.
256243 if ( ! global . settings . get_boolean ( PANEL_EDIT_MODE_KEY ) ) {
257244 if ( this . notifications . length || this . showEmptyTray ) {
0 commit comments