@@ -55,12 +55,6 @@ 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 ( ) ;
6458
6559 if self . hold_guard . get ( ) . is_none ( ) {
6660 app. ensure_rpc_running ( ) ;
@@ -71,14 +65,6 @@ mod imp {
7165 warn ! ( error = %e, "couldn't request running in background from portal" ) ;
7266 }
7367 } ) ;
74-
75- if is_daemon {
76- return glib:: ExitCode :: SUCCESS ;
77- }
78-
79- app. ensure_window_present ( ) ;
80-
81- glib:: ExitCode :: SUCCESS
8268 }
8369 }
8470
@@ -93,7 +79,13 @@ glib::wrapper! {
9379}
9480
9581impl NotifyApplication {
96- fn ensure_window_present ( & self ) {
82+ pub fn new ( ) -> Self {
83+ glib:: Object :: builder ( )
84+ . property ( "application-id" , APP_ID )
85+ . property ( "resource-base-path" , "/com/ranfdev/Notify/" )
86+ . build ( )
87+ }
88+ pub fn ensure_window_present ( & self ) {
9789 if let Some ( window) = { self . imp ( ) . window . borrow ( ) . upgrade ( ) } {
9890 if window. is_visible ( ) {
9991 window. present ( ) ;
@@ -234,8 +226,8 @@ impl NotifyApplication {
234226 let response = ashpd:: desktop:: background:: Background :: request ( )
235227 . reason ( "Listen for coming notifications" )
236228 . auto_start ( true )
237- . command ( & [ "notify" , "--daemon " ] )
238- . dbus_activatable ( false )
229+ . command ( & [ "notify" , "--gapplication-service " ] )
230+ . dbus_activatable ( true )
239231 . send ( )
240232 . await ?
241233 . response ( ) ?;
@@ -279,6 +271,7 @@ impl NotifyApplication {
279271 }
280272 }
281273
274+ info ! ( title = %n. title, "showing notification" ) ;
282275 app. send_notification ( None , & gio_notif) ;
283276 }
284277 } ) ;
@@ -325,13 +318,3 @@ impl NotifyApplication {
325318 * self . imp ( ) . window . borrow_mut ( ) = window. downgrade ( ) ;
326319 }
327320}
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