diff --git a/data/ui/settings-dialog.ui b/data/ui/settings-dialog.ui index d3077140aad4c429ec6d3f2eb348906325321619..6ff7d1a30f8b6f958ff78ed1eab82394526e387a 100644 --- a/data/ui/settings-dialog.ui +++ b/data/ui/settings-dialog.ui @@ -131,6 +131,30 @@ 3 + + + True + False + end + Show notifications: + + + 0 + 4 + + + + + True + True + start + True + + + 1 + 4 + + True diff --git a/schemas/de.haecker-felix.gradio.gschema.xml b/schemas/de.haecker-felix.gradio.gschema.xml index e5d0f6c071327b87604818464792133537e8c94b..23214744ef7f71846aaf30f9760fc3aaf5c00968 100644 --- a/schemas/de.haecker-felix.gradio.gschema.xml +++ b/schemas/de.haecker-felix.gradio.gschema.xml @@ -26,10 +26,15 @@ - true + false Close window to tray + + false + Show notifications + + 500 Height of the window diff --git a/src/Widgets/PlayerToolbar.vala b/src/Widgets/PlayerToolbar.vala index 8e550425409b25a10b69d4c26b53e6bb27828466..cba932134b510ed5f64ebcfe86aba20ed64de850 100644 --- a/src/Widgets/PlayerToolbar.vala +++ b/src/Widgets/PlayerToolbar.vala @@ -99,7 +99,8 @@ namespace Gradio{ BitrateLabel.set_text(App.player.tag_bitrate.to_string() + " Bit/s"); CodecLabel.set_text(App.player.tag_audio_codec); ChannelModeLabel.set_text(App.player.tag_channel_mode); - if(current_title != App.player.tag_title && App.player.tag_title != null) { + if (App.settings.get_boolean ("show-notifications")) { + if(current_title != App.player.tag_title && App.player.tag_title != null) { if (App.player.tag_homepage != "") { Util.get_image_from_url.begin(App.player.tag_homepage, 48, 48, (obj, res) => { var icon = Util.get_image_from_url.end(res); @@ -119,7 +120,8 @@ namespace Gradio{ } }); } - current_title = App.player.tag_title; + current_title = App.player.tag_title; + } } } diff --git a/src/Widgets/SettingsDialog.vala b/src/Widgets/SettingsDialog.vala index a211eda062b086937b8c0e4d7fb94b502fc62bb9..3500eb08707af26fcefa95dbfeef08e5a88db6c1 100644 --- a/src/Widgets/SettingsDialog.vala +++ b/src/Widgets/SettingsDialog.vala @@ -12,6 +12,8 @@ namespace Gradio{ private Switch LoadPicturesSwitch; [GtkChild] private Switch CloseToTraySwitch; + [GtkChild] + private Switch ShowNotificationsSwitch; private GLib.Settings settings; @@ -58,6 +60,15 @@ namespace Gradio{ }); + ShowNotificationsSwitch.notify["active"].connect (() => { + if (ShowNotificationsSwitch.active) { + settings.set_boolean ("show-notifications", true); + } else { + settings.set_boolean ("show-notifications", false); + } + + }); + } private void load_settings(GLib.Settings settings){ @@ -65,6 +76,7 @@ namespace Gradio{ LoadPicturesSwitch.set_active(settings.get_boolean ("load-pictures")); OnlyShowWorkingStationsSwitch.set_active(settings.get_boolean ("only-show-working-stations")); CloseToTraySwitch.set_active(settings.get_boolean ("close-to-tray")); + ShowNotificationsSwitch.set_active(settings.get_boolean ("show-notifications")); } }