@@ -55,12 +55,7 @@ mod imp {
5555 app. setup_css ( ) ;
5656 app. setup_gactions ( ) ;
5757 app. setup_accels ( ) ;
58- }
59- fn command_line ( & self , command_line : & gio:: ApplicationCommandLine ) -> glib:: ExitCode {
60- debug ! ( "AdwApplication<NotifyApplication>::command_line" ) ;
61- let arguments = command_line. arguments ( ) ;
62- let is_daemon = arguments. get ( 1 ) . map ( |x| x. to_str ( ) ) == Some ( Some ( "--daemon" ) ) ;
63- let app = self . obj ( ) ;
58+
6459
6560 if self . hold_guard . get ( ) . is_none ( ) {
6661 app. ensure_rpc_running ( ) ;
@@ -71,14 +66,6 @@ mod imp {
7166 warn ! ( error = %e, "couldn't request running in background from portal" ) ;
7267 }
7368 } ) ;
74-
75- if is_daemon {
76- return glib:: ExitCode :: SUCCESS ;
77- }
78-
79- app. ensure_window_present ( ) ;
80-
81- glib:: ExitCode :: SUCCESS
8269 }
8370 }
8471
@@ -93,7 +80,13 @@ glib::wrapper! {
9380}
9481
9582impl NotifyApplication {
96- fn ensure_window_present ( & self ) {
83+ pub fn new ( ) -> Self {
84+ glib:: Object :: builder ( )
85+ . property ( "application-id" , APP_ID )
86+ . property ( "resource-base-path" , "/com/ranfdev/Notify/" )
87+ . build ( )
88+ }
89+ pub fn ensure_window_present ( & self ) {
9790 if let Some ( window) = { self . imp ( ) . window . borrow ( ) . upgrade ( ) } {
9891 if window. is_visible ( ) {
9992 window. present ( ) ;
@@ -234,8 +227,8 @@ impl NotifyApplication {
234227 let response = ashpd:: desktop:: background:: Background :: request ( )
235228 . reason ( "Listen for coming notifications" )
236229 . auto_start ( true )
237- . command ( & [ "notify" , "--daemon " ] )
238- . dbus_activatable ( false )
230+ . command ( & [ "notify" , "--gapplication-service " ] )
231+ . dbus_activatable ( true )
239232 . send ( )
240233 . await ?
241234 . response ( ) ?;
@@ -279,6 +272,7 @@ impl NotifyApplication {
279272 }
280273 }
281274
275+ info ! ( title = %n. title, "showing notification" ) ;
282276 app. send_notification ( None , & gio_notif) ;
283277 }
284278 } ) ;
@@ -325,13 +319,3 @@ impl NotifyApplication {
325319 * self . imp ( ) . window . borrow_mut ( ) = window. downgrade ( ) ;
326320 }
327321}
328-
329- impl Default for NotifyApplication {
330- fn default ( ) -> Self {
331- glib:: Object :: builder ( )
332- . property ( "application-id" , APP_ID )
333- . property ( "flags" , gio:: ApplicationFlags :: HANDLES_COMMAND_LINE )
334- . property ( "resource-base-path" , "/com/ranfdev/Notify/" )
335- . build ( )
336- }
337- }
0 commit comments