@@ -55,12 +55,6 @@ mod imp {
55
55
app. setup_css ( ) ;
56
56
app. setup_gactions ( ) ;
57
57
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 ( ) ;
64
58
65
59
if self . hold_guard . get ( ) . is_none ( ) {
66
60
app. ensure_rpc_running ( ) ;
@@ -71,14 +65,6 @@ mod imp {
71
65
warn ! ( error = %e, "couldn't request running in background from portal" ) ;
72
66
}
73
67
} ) ;
74
-
75
- if is_daemon {
76
- return glib:: ExitCode :: SUCCESS ;
77
- }
78
-
79
- app. ensure_window_present ( ) ;
80
-
81
- glib:: ExitCode :: SUCCESS
82
68
}
83
69
}
84
70
@@ -93,7 +79,13 @@ glib::wrapper! {
93
79
}
94
80
95
81
impl 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 ) {
97
89
if let Some ( window) = { self . imp ( ) . window . borrow ( ) . upgrade ( ) } {
98
90
if window. is_visible ( ) {
99
91
window. present ( ) ;
@@ -234,8 +226,8 @@ impl NotifyApplication {
234
226
let response = ashpd:: desktop:: background:: Background :: request ( )
235
227
. reason ( "Listen for coming notifications" )
236
228
. auto_start ( true )
237
- . command ( & [ "notify" , "--daemon " ] )
238
- . dbus_activatable ( false )
229
+ . command ( & [ "notify" , "--gapplication-service " ] )
230
+ . dbus_activatable ( true )
239
231
. send ( )
240
232
. await ?
241
233
. response ( ) ?;
@@ -279,6 +271,7 @@ impl NotifyApplication {
279
271
}
280
272
}
281
273
274
+ info ! ( title = %n. title, "showing notification" ) ;
282
275
app. send_notification ( None , & gio_notif) ;
283
276
}
284
277
} ) ;
@@ -325,13 +318,3 @@ impl NotifyApplication {
325
318
* self . imp ( ) . window . borrow_mut ( ) = window. downgrade ( ) ;
326
319
}
327
320
}
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