Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
Add option to disable notifications #52
Browse files Browse the repository at this point in the history
  • Loading branch information
kajzer committed Aug 17, 2016
1 parent 9c0eb3f commit 8c80e2e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
24 changes: 24 additions & 0 deletions data/ui/settings-dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,30 @@
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Show notifications:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="ShowNotificationsSwitch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="OnlyShowWorkingStationsSwitch">
<property name="visible">True</property>
Expand Down
7 changes: 6 additions & 1 deletion schemas/de.haecker-felix.gradio.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@
</key>

<key name="close-to-tray" type="b">
<default>true</default>
<default>false</default>
<summary>Close window to tray</summary>
</key>

<key name="show-notifications" type="b">
<default>false</default>
<summary>Show notifications</summary>
</key>

<key name="window-height" type="i">
<default>500</default>
<summary>Height of the window</summary>
Expand Down
6 changes: 4 additions & 2 deletions src/Widgets/PlayerToolbar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -119,7 +120,8 @@ namespace Gradio{
}
});
}
current_title = App.player.tag_title;
current_title = App.player.tag_title;
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/Widgets/SettingsDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Gradio{
private Switch LoadPicturesSwitch;
[GtkChild]
private Switch CloseToTraySwitch;
[GtkChild]
private Switch ShowNotificationsSwitch;

private GLib.Settings settings;

Expand Down Expand Up @@ -58,13 +60,23 @@ 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){
UseDarkDesignSwitch.set_active(settings.get_boolean ("use-dark-design"));
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"));
}

}
Expand Down

0 comments on commit 8c80e2e

Please sign in to comment.