diff --git a/data/ui/settings-dialog.ui b/data/ui/settings-dialog.ui index d3077140..6ff7d1a3 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 e5d0f6c0..23214744 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 8e550425..cba93213 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 a211eda0..3500eb08 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")); } }