
    Eg                     Z    d dl mZmZ d dlZd dlZd dlmZ  G d dej                        Zy)    )GtkGObjectN)trackersc                   l     e Zd ZdZdej
                  j                  ddfiZ fdZd	dZ	d Z
d Z xZS )
NotificationWidgetz
    Notification widget is a child of the InfoPanel - it is
    only shown if we've received intercepted a non-transient
    notification that hasn't been sent from a media player.
    notificationN c                 `   t         t        |           | j                  t        j
                  j                         | j                         j                  d       | j                  dd       d| _
        t	        j                  t        j                  j                        }| j                  |       t        j                  j!                  d      | _        |j%                  | j"                  ddd       t        j&                  j)                  d	t        j*                  j,                        | _        |j1                  | j.                  ddd       |j3                          t4        j6                  | _        t;        j<                         j?                  | j8                  d
| j@                         y )Nnotificationwidget2   r   )orientation0F   z!screensaver-notification-symbolicznotification-received)!superr   __init__set_shadow_typer   
ShadowTypeNONEget_style_context	add_classset_size_requestnotification_countBoxOrientation
HORIZONTALaddLabelnewlabel
pack_startImagenew_from_icon_nameIconSizeLARGE_TOOLBARimagepack_endshow_all
singletonsNotificationWatchernotification_watcherr   con_tracker_getconnecton_notification_received)selfbox	__class__s     =/usr/share/cinnamon-screensaver/widgets/notificationWidget.pyr   zNotificationWidget.__init__   s%    $02S^^001 **+?@b"%"#gg#//"<"<=YY]]3'
tzz5%3YY112UWZWcWcWqWqr
TZZq1$.$B$B!  "**4+D+D+B+/+H+H	J    c                    t         j                  }|j                         }|j                         |v ry dD ]  }||j                         v s y  | xj                  dz  c_        | j                          | j                  d       y )N)network   r   )r)   MediaPlayerWatcherget_all_player_nameslowerr   update_labelemit)r/   proxysenderdata
mp_watcherplayersignoreds          r2   r.   z+NotificationWidget.on_notification_received,   sw    22
113<<>W$# 	G&,,.(	 	1$		.!r3   c                      | j                   dkD  S )Nr   )r   r/   s    r2   should_showzNotificationWidget.should_show>   s    &&**r3   c                 `    | j                   j                  t        | j                               y N)r    set_textstrr   rC   s    r2   r:   zNotificationWidget.update_labelA   s    

C 7 789r3   rF   )__name__
__module____qualname____doc__r   SignalFlagsRUN_LAST__gsignals__r   r.   rD   r:   __classcell__)r1   s   @r2   r   r   	   s>     	,,55tR@LJ4"$+:r3   r   )	gi.repositoryr   r   r)   statusutilr   Framer   r	   r3   r2   <module>rU      s#    '   9: 9:r3   