1010 */
1111
1212 using GLib ;
13+ using Gst ;
1314 using Tuner.Coordinators ;
1415 using Tuner.Controllers ;
1516 using Tuner.Events ;
@@ -68,9 +69,6 @@ namespace Tuner {
6869 {
6970 private delegate void StringActionHandler (string value );
7071
71- /* * @brief Signal emitted when the shuffle mode changes */
72- public signal void shuffle_mode_sig (bool shuffle );
73-
7472 public static string ENV_LANG = " LANGUAGE" ;
7573
7674 /* * @brief Application version */
@@ -131,7 +129,7 @@ namespace Tuner {
131129 } catch (Error e) {
132130 warning(@" Error reading locale path: $(e.message)" );
133131 }
134- }
132+ } // static construct
135133
136134 // -------------------------------------
137135
@@ -227,7 +225,7 @@ namespace Tuner {
227225 _is_online = value ;
228226 is_offline = ! value ;
229227 if (events != null )
230- events. connectivity_changed (_is_online, is_offline );
228+ events. connectivity_changed_sig (_is_online );
231229 }
232230 }
233231
@@ -251,6 +249,7 @@ namespace Tuner {
251249 private bool _has_started = false ;
252250 // Coordinates startup-only cross-component flows (e.g., deferred autoplay).
253251 private StartupCoordinator _startup_coordinator;
252+ private Gst . Element ? _startup_jingle;
254253 // Coordinates playback restart behavior after online/offline transitions.
255254 private PlaybackRecoveryCoordinator _playback_recovery_coordinator;
256255 // Coordinates provider click/vote updates from player events.
@@ -261,7 +260,7 @@ namespace Tuner {
261260 * @brief Constructor for the Application
262261 */
263262 private Application () {
264- Object (
263+ GLib . Object (
265264 application_id: APP_ID ,
266265 flags: ApplicationFlags . FLAGS_NONE
267266 );
@@ -429,7 +428,7 @@ namespace Tuner {
429428 private void initialize_coordinators ()
430429 {
431430 _playback_recovery_coordinator = new PlaybackRecoveryCoordinator (this , events, player, settings);
432- _usage_tracking_coordinator = new UsageTrackingCoordinator (settings, player , provider);
431+ _usage_tracking_coordinator = new UsageTrackingCoordinator (settings, events , provider);
433432 }
434433
435434
@@ -548,16 +547,57 @@ namespace Tuner {
548547 private void create_main_window ()
549548 {
550549 window = new Window (this , player, settings, directory);
550+ play_startup_jingle ();
551551 _startup_coordinator = new StartupCoordinator (this , events, window, settings, directory);
552552 _startup_coordinator. start();
553553
554554 // Flathub screenshot sizing
555- window. resize(1000 , 625 ); // Screenshot sizing - round corners 80, ds op 1
555+ // window.resize(1000, 625); // Screenshot sizing - round corners 80, ds op 1
556556
557557 add_window(window);
558558 }
559559
560560
561+ /**
562+ * @brief Play the startup jingle (resource-backed WAV) once per launch.
563+ */
564+ private void play_startup_jingle ()
565+ {
566+ if (_startup_jingle != null )
567+ return ;
568+
569+ var playbin = Gst . ElementFactory . make (" playbin" , " startup-jingle" );
570+ if (playbin == null )
571+ return ;
572+
573+ var uri = " resource:///io/github/tuner_labs/tuner/sounds/tuner_startup.mp3" ;
574+ playbin. set (" uri" , uri);
575+ playbin. set (" volume" , settings. volume);
576+ _startup_jingle = playbin;
577+
578+ var bus = playbin. get_bus ();
579+ if (bus != null )
580+ {
581+ bus. add_signal_watch ();
582+ bus. message. connect ((message) = > {
583+ switch (message. type)
584+ {
585+ case Gst . MessageType . EOS:
586+ case Gst . MessageType . ERROR:
587+ playbin. set_state (Gst . State . NULL );
588+ bus. remove_signal_watch ();
589+ _startup_jingle = null ;
590+ break ;
591+ default:
592+ break ;
593+ }
594+ });
595+ }
596+
597+ playbin. set_state (Gst . State . PLAYING );
598+ }
599+
600+
561601 /**
562602 * @brief Create directory structure quietly
563603 *
@@ -589,7 +629,8 @@ namespace Tuner {
589629 {
590630 bool network_available = NETMON . get_network_available ();
591631
592- if (_monitor_changed_id > 0 )
632+ // Clean up the prior network monitor task
633+ if ( _monitor_changed_id > 0 )
593634 {
594635 Source . remove(_monitor_changed_id);
595636 _monitor_changed_id = 0 ;
@@ -600,7 +641,7 @@ namespace Tuner {
600641 wait 1 seconds before setting to online status
601642 to whatever the state is at that time
602643 */
603- if (network_available)
644+ if ( network_available )
604645 {
605646 if (is_online)
606647 return ;
@@ -660,7 +701,6 @@ namespace Tuner {
660701 }
661702
662703 return { exe };
663- }
664-
704+ } // build_restart_argv
665705 } // Application
666706} // namespace Tuner
0 commit comments