Ë
    lê
jÕ'  ã                   óÔ   — d dl Z d dlmZ d dlZd dlZd dlZd dlmZ d dlZe j                   Z G d„ d«      Z	 G d„ d«      Z
 G d„ d	«      Z G d
„ d«      Z G d„ d«      Z G d„ d«      Zy)é    N)ÚGio)ÚOpStatusc                   ó<   — e Zd Zd„ Zej
                  d„ «       Zd„ Zy)ÚNewOpUserNotificationc                 ó2   — || _         | j                  «        y ©N©ÚopÚsend_notification©Úselfr
   s     ú(/usr/libexec/warpinator/notifications.pyÚ__init__zNewOpUserNotification.__init__   ó   € ØˆŒà×ÑÕ ó    c                 óà  ‡ ‡— t        j                  «       �r×t        j                  j	                  t        d«      «      }t        j                  «       �ržt        j                  t        d«      t        d«      ‰ j                  j                  «      ‰ j                  j                  ‰ j                  j                  ‰ j                  j                  d   dœz  }|j                  |«       |j                  t        j                  d¬«      «       |j!                  t        d«      d	«       |j!                  t        d
«      d«       |j#                  d«       |j%                  t        j&                  j(                  «       t        j*                  j-                  «       Š‰j/                  d«      j1                  d‰ j2                  ‰ j                  «       ‰ j                  j1                  dˆˆ fd„«       n¹t        j                  t        d«      t        d«      ‰ j                  j                  «      ‰ j                  j                  ‰ j                  j                  ‰ j                  j                  d   dœz  }|j                  |«       |j                  t        j                  d¬«      «       t        j*                  j-                  «       j5                  ‰ j                  j6                  |«       y y )NzNew incoming fileszK%(sender_name)s would like to send you %(file_count)d file (%(file_name)s).z;%(sender_name)s would like to send you %(file_count)d filesr   )Úsender_nameÚ
file_countÚ	file_nameúorg.x.Warpinator-symbolic©ÚnameÚAcceptz!app.notification-response::acceptÚDeclinez"app.notification-response::declineú app.notification-response::focusúnotification-responseÚactivatezstatus-changedc                 óŒ   •— ‰j                   j                  t        j                  k7  r‰j	                  | j
                  «      S d S r   )r
   Ústatusr   ÚWAITING_PERMISSIONÚwithdraw_notificationÚsender)r
   Úappr   s    €€r   ú<lambda>z9NewOpUserNotification.send_notification.<locals>.<lambda>3   s1   ø€ ÀdÇgÁgÇnÁnÔX`×XsÑXsÒFs˜c×7Ñ7¸¿	¹	ÓB€ Ðy}€ r   zC%(sender_name)s is sending you %(file_count)d file (%(file_name)s).z3%(sender_name)s is sending you %(file_count)d files)ÚprefsÚget_show_notificationsr   ÚNotificationÚnewÚ_Úrequire_permission_for_transferÚgettextÚngettextr
   Útotal_countr   Útop_dir_basenamesÚset_bodyÚset_iconÚ
ThemedIconÚ
add_buttonÚset_default_actionÚset_priorityÚNotificationPriorityÚURGENTÚApplicationÚget_defaultÚlookup_actionÚconnectÚ_notification_responser   r"   ©r   ÚnotificationÚbodyr#   s   `  @r   r   z'NewOpUserNotification.send_notification   s.  ù€ ä×'Ñ'Õ)Ü×+Ñ+×/Ñ/´Ð2FÓ0GÓHˆLä×4Ñ4Õ6ô ×&Ñ&ÜÐcÓdÜÐSÓTÐUY×U\ÑU\×UhÑUhójð .2¯W©W×-@Ñ-@Ø,0¯G©G×,?Ñ,?Ø+/¯7©7×+DÑ+DÀQÑ+Gññ�ð ×%Ñ% dÔ+Ø×%Ñ%¤c§n¡nÐ:UÔ&VÔWà×'Ñ'¬¨(«Ð5XÔYØ×'Ñ'¬¨)«Ð6ZÔ[Ø×/Ñ/Ð0RÔSà×)Ñ)¬#×*BÑ*B×*IÑ*IÔJä—o‘o×1Ñ1Ó3�Ø×!Ñ!Ð"9Ó:×BÑBÀ:Èt×OjÑOjÐlp×lsÑlsÔtà—‘—‘Ð 0Ü}õô
 ×&Ñ&ÜÐ[Ó\ÜÐKÓLÈdÏgÉg×NaÑNaócð .2¯W©W×-@Ñ-@Ø,0¯G©G×,?Ñ,?Ø+/¯7©7×+DÑ+DÀQÑ+Gññ�ð ×%Ñ% dÔ+Ø×%Ñ%¤c§n¡nÐ:UÔ&VÔWä�O‰O×'Ñ'Ó)×;Ñ;¸D¿G¹G¿N¹NÈLÕYðY *r   c                 ó,  — |j                  «       }|dk(  r|j                  «        n&|dk(  r|j                  «        n|j                  «        t        j
                  j                  «       }|j                  d«      j                  | j                  «       y )NÚacceptÚdecliner   )
ÚunpackÚaccept_transferÚdecline_transfer_requestÚfocusr   r7   r8   r9   Údisconnect_by_funcr;   ©r   ÚactionÚvariantr
   Úresponser#   s         r   r;   z,NewOpUserNotification._notification_responseE   sq   € Ø—>‘>Ó#ˆà�xÒØ×ÑÕ Ø˜Ò"Ø×'Ñ'Õ)à�H‰HŒJä�o‰o×)Ñ)Ó+ˆØ×ÑÐ1Ó2×EÑEÀd×FaÑFaÕbr   N©Ú__name__Ú
__module__Ú__qualname__r   ÚmiscÚ_idler   r;   © r   r   r   r      s(   „ ò!ð
 
‡Z�Zñ-Zó ð-Zó^cr   r   c                   ó>   — e Zd Zdd„Zej
                  d„ «       Zd„ Zy)ÚTransferCompleteNotificationc                 óN   — || _         || _        || _        | j                  «        y r   )r
   r"   Úwarnr   )r   r
   r"   rU   s       r   r   z%TransferCompleteNotification.__init__S   s#   € ØˆŒØˆŒØˆŒ	à×ÑÕ r   c                 óð  — t        j                  «       �rát        j                  j	                  t        d«      «      }| j                  rR| j                  r#t        d«      | j                  j                  z  }ntt        d«      | j                  j                  z  }nQ| j                  r#t        d«      | j                  j                  z  }n"t        d«      | j                  j                  z  }|j                  |«       | j                  rd}nd}|j                  t        j                  |¬«      «       |j                  d	«       |j                  t        j                   j"                  «       t        j$                  j'                  «       }|j)                  d
«      j+                  d| j,                  | j                  «       |j'                  «       j/                  | j                  j                  |«       y y )NzTransfer completez0The transfer to %s has finished, but with errorsz,The transfer to %s has finished successfullyz2The transfer from %s has finished, but with errorsz.The transfer from %s has finished successfullyzxsi-dialog-warning-symboliczxsi-emblem-ok-symbolicr   r   r   r   )r%   r&   r   r'   r(   r)   r"   rU   r
   Úreceiver_namer   r/   r0   r1   r3   r4   r5   ÚNORMALr7   r8   r9   r:   r;   r   )r   r=   r>   Ú	icon_namer#   s        r   r   z.TransferCompleteNotification.send_notificationZ   ss  € ä×'Ñ'Õ)Ü×+Ñ+×/Ñ/´Ð2EÓ0FÓGˆLØ�{Š{Ø—9’9ÜÐPÓQÐTX×T[ÑT[×TiÑTiÑi‘DäÐLÓMÐPT×PWÑPW×PeÑPeÑe‘Dà—9’9ÜÐRÓSÐVZ×V]ÑV]×ViÑViÑi‘DäÐNÓOÐRV×RYÑRY×ReÑReÑe�Dà×!Ñ! $Ô'à�yŠyØ9‘	à4�	Ø×!Ñ!¤#§.¡.°iÔ"@ÔAØ×+Ñ+Ð,NÔOà×%Ñ%¤c×&>Ñ&>×&EÑ&EÔFä—/‘/×-Ñ-Ó/ˆCØ×ÑÐ5Ó6×>Ñ>¸zÈ4×KfÑKfÐhl×hoÑhoÔpà�O‰OÓ×/Ñ/°·±·±ÀÕMð7 *r   c                 ó´   — |j                  «        t        j                  j                  «       }|j	                  d«      j                  | j                  «       y ©Nr   ©rE   r   r7   r8   r9   rF   r;   ©r   rH   rI   r
   r#   s        r   r;   z3TransferCompleteNotification._notification_responsey   ó=   € Ø
�‰Œ
ä�o‰o×)Ñ)Ó+ˆØ×ÑÐ1Ó2×EÑEÀd×FaÑFaÕbr   N)TFrK   rQ   r   r   rS   rS   R   s'   „ ó!ð 
‡Z�ZñNó ðNó<cr   rS   c                   ó>   — e Zd Zdd„Zej
                  d„ «       Zd„ Zy)ÚTransferFailedNotificationc                 ó@   — || _         || _        | j                  «        y r   ©r
   r"   r   ©r   r
   r"   s      r   r   z#TransferFailedNotification.__init__€   ó   € ØˆŒØˆŒà×ÑÕ r   c                 ó  — t        j                  «       �rrt        j                  j	                  t        d«      «      }| j                  r#t        d«      | j                  j                  z  }n"t        d«      | j                  j                  z  }|j                  |«       |j                  t        j                  d¬«      «       |j                  d«       |j                  t        j                  j                   «       t        j"                  j%                  «       }|j'                  d«      j)                  d| j*                  | j                  «       |j%                  «       j-                  | j                  j                  |«       y y )	NzTransfer failedz,Something went wrong with the transfer to %sz.Something went wrong with the transfer from %szxsi-dialog-error-symbolicr   r   r   r   ©r%   r&   r   r'   r(   r)   r"   r
   rW   r   r/   r0   r1   r3   r4   r5   rX   r7   r8   r9   r:   r;   r   r<   s       r   r   z,TransferFailedNotification.send_notification†   s  € ä×'Ñ'Õ)Ü×+Ñ+×/Ñ/´Ð2CÓ0DÓEˆLà�{Š{ÜÐHÓIÈDÏGÉG×LaÑLaÑa‘äÐJÓKÈdÏgÉg×NaÑNaÑa�à×!Ñ! $Ô'Ø×!Ñ!¤#§.¡.Ð6QÔ"RÔSØ×+Ñ+Ð,NÔOà×%Ñ%¤c×&>Ñ&>×&EÑ&EÔFä—/‘/×-Ñ-Ó/ˆCØ×ÑÐ5Ó6×>Ñ>¸zÈ4×KfÑKfÐhl×hoÑhoÔpà�O‰OÓ×/Ñ/°·±·±ÀÕMð# *r   c                 ó´   — |j                  «        t        j                  j                  «       }|j	                  d«      j                  | j                  «       y r[   r\   r]   s        r   r;   z1TransferFailedNotification._notification_response›   r^   r   N©TrK   rQ   r   r   r`   r`      ó'   „ ó!ð 
‡Z�ZñNó ðNó(cr   r`   c                   ó>   — e Zd Zdd„Zej
                  d„ «       Zd„ Zy)ÚTransferStoppedNotificationc                 ó@   — || _         || _        | j                  «        y r   rb   rc   s      r   r   z$TransferStoppedNotification.__init__¢   rd   r   c                 ó  — t        j                  «       �rrt        j                  j	                  t        d«      «      }| j                  r#t        d«      | j                  j                  z  }n"t        d«      | j                  j                  z  }|j                  |«       |j                  t        j                  d¬«      «       |j                  d«       |j                  t        j                  j                   «       t        j"                  j%                  «       }|j'                  d«      j)                  d| j*                  | j                  «       |j%                  «       j-                  | j                  j                  |«       y y )	NzTransfer cancelledz!Your transfer to %s was cancelledz*An incoming transfer from %s was cancelledúdialog-info-symbolicr   r   r   r   rf   r<   s       r   r   z-TransferStoppedNotification.send_notification¨   s  € ä×'Ñ'Õ)Ü×+Ñ+×/Ñ/´Ð2FÓ0GÓHˆLà�{Š{ÜÐ=Ó>ÀÇÁ×AVÑAVÑV‘äÐFÓGÈ$Ï'É'×J]ÑJ]Ñ]�à×!Ñ! $Ô'Ø×!Ñ!¤#§.¡.Ð6LÔ"MÔNØ×+Ñ+Ð,NÔOà×%Ñ%¤c×&>Ñ&>×&EÑ&EÔFä—/‘/×-Ñ-Ó/ˆCØ×ÑÐ5Ó6×>Ñ>¸zÈ4×KfÑKfÐhl×hoÑhoÔpà�O‰OÓ×/Ñ/°·±·±ÀÕMð# *r   c                 ó´   — |j                  «        t        j                  j                  «       }|j	                  d«      j                  | j                  «       y r[   r\   r]   s        r   r;   z2TransferStoppedNotification._notification_response½   r^   r   Nrh   rK   rQ   r   r   rk   rk   ¡   ri   r   rk   c                   ó<   — e Zd Zd„ Zej
                  d„ «       Zd„ Zy)ÚWarpinatorSendNotificationc                 ó2   — || _         | j                  «        y r   r	   r   s     r   r   z#WarpinatorSendNotification.__init__Ä   r   r   c                 óŠ  — t        j                  «       �r®t        j                  j	                  t        d«      «      }| j                  j                  dkD  r9t        d«      | j                  j                  | j                  j                  fz  }n;t        d«      | j                  j                  d   | j                  j                  fz  }|j                  |«       |j                  t        j                  d¬«      «       |j                  d«       |j                  t        j                  j                   «       t        j"                  j%                  «       }|j'                  d	«      j)                  d
| j*                  | j                  «       |j%                  «       j-                  | j                  j.                  |«       y y )NzSending filesé   zSending %d files to %szSending '%s' to %sr   rn   r   r   r   r   )r%   r&   r   r'   r(   r)   r
   r-   rW   r.   r/   r0   r1   r3   r4   r5   rX   r7   r8   r9   r:   r;   r   r"   r<   s       r   r   z,WarpinatorSendNotification.send_notificationÉ   sE  € ä×'Ñ'Õ)Ü×+Ñ+×/Ñ/´°/Ó0BÓCˆLà�w‰w×"Ñ" QÒ&ÜÐ2Ó3°t·w±w×7JÑ7JÈDÏGÉG×LaÑLaÐ6bÑb‘äÐ.Ó/°4·7±7×3LÑ3LÈQÑ3OÐQU×QXÑQX×QfÑQfÐ2gÑg�à×!Ñ! $Ô'Ø×!Ñ!¤#§.¡.Ð6LÔ"MÔNØ×+Ñ+Ð,NÔOà×%Ñ%¤c×&>Ñ&>×&EÑ&EÔFä—/‘/×-Ñ-Ó/ˆCØ×ÑÐ5Ó6×>Ñ>¸zÈ4×KfÑKfÐhl×hoÑhoÔpà�O‰OÓ×/Ñ/°·±·±ÀÕMð# *r   c                 ó´   — |j                  «        t        j                  j                  «       }|j	                  d«      j                  | j                  «       y r[   r\   r]   s        r   r;   z1WarpinatorSendNotification._notification_responseÞ   r^   r   NrK   rQ   r   r   rq   rq   Ã   s'   „ ò!ð
 
‡Z�ZñNó ðNó(cr   rq   c                   ó<   — e Zd Zd„ Zej
                  d„ «       Zd„ Zy)ÚTextMessageNotificationc                 ó2   — || _         | j                  «        y r   r	   r   s     r   r   z TextMessageNotification.__init__å   s   € ØˆŒØ×ÑÕ r   c                 óà  — t        j                  «       �rYt        j                  j	                  t        d«      | j                  j                  z  «      }|j                  | j                  j                  «       |j                  t        j                  d¬«      «       |j                  t        j                  j                  «       |j                  t        d«      d«       |j!                  d«       t        j"                  j%                  «       }|j'                  d«      j)                  d| j*                  | j                  «       |j-                  | j                  j.                  |«       y y )	NzNew message from %sr   r   ÚCopyzapp.notification-response::copyr   r   r   )r%   r&   r   r'   r(   r)   r
   r   r/   Úmessager0   r1   r4   r5   r6   r2   r3   r7   r8   r9   r:   r;   r   r"   )r   r=   r#   s      r   r   z)TextMessageNotification.send_notificationé   sÿ   € ä×'Ñ'Õ)Ü×+Ñ+×/Ñ/´Ð2GÓ0HÈ4Ï7É7×K^ÑK^Ñ0^Ó_ˆLØ×!Ñ! $§'¡'§/¡/Ô2Ø×!Ñ!¤#§.¡.Ð6QÔ"RÔSØ×%Ñ%¤c×&>Ñ&>×&EÑ&EÔFà×#Ñ#¤A f£IÐ/PÔQØ×+Ñ+Ð,NÔOä—/‘/×-Ñ-Ó/ˆCØ×ÑÐ5Ó6×>Ñ>¸zÈ4×KfÑKfÐhl×hoÑhoÔpØ×!Ñ! $§'¡'§.¡.°,Õ?ð *r   c                 ó   — |j                  «       }|dk(  r|j                  «        n|j                  «        t        j                  j                  «       }|j                  d«      j                  | j                  «       y )NÚcopyr   )	rB   Úcopy_messagerE   r   r7   r8   r9   rF   r;   rG   s         r   r;   z.TextMessageNotification._notification_responseø   s[   € Ø—>‘>Ó#ˆà�vÒØ�O‰OÕà�H‰HŒJä�o‰o×)Ñ)Ó+ˆØ×ÑÐ1Ó2×EÑEÀd×FaÑFaÕbr   NrK   rQ   r   r   rw   rw   ä   s'   „ ò!ð 
‡Z�Zñ@ó ð@ó	cr   rw   )r+   Úgi.repositoryr   ÚconfigrO   Úutilr   r%   r)   r   rS   r`   rk   rq   rw   rQ   r   r   ú<module>r‚      st   ðó å ã Û Û Ý Û à‡O�O€÷Acñ Ac÷F+cñ +c÷Z cñ  c÷D cñ  c÷Dcñ c÷Bcò cr   