notifications: minor cleanup to rev423

This commit is contained in:
Tom Beckmann 2014-11-16 00:59:26 +01:00
parent ee19e68e79
commit e02db107d9
2 changed files with 10 additions and 20 deletions

View File

@ -214,23 +214,23 @@
</key>
</schema>
<schema path="/org/pantheon/desktop/gala/notifications/" id="org.pantheon.desktop.gala.notifications" gettext-domain="gala">
<schema path="/org/pantheon/desktop/gala/notifications/" id="org.pantheon.desktop.gala.notifications" gettext-domain="@GETTEXT_PACKAGE@">
<key type="b" name="do-not-disturb">
<default>false</default>
<summary>Disable all notifications</summary>
<_summary>Disable all notifications</_summary>
</key>
<key type="b" name="default-bubbles">
<default>true</default>
<summary>The default setting for the bubbles that would be used for new apps</summary>
<_summary>The default setting for the bubbles that would be used for new apps</_summary>
</key>
<key type="b" name="default-sounds">
<default>true</default>
<summary>The default setting for the sounds that would be used for new apps</summary>
<_summary>The default setting for the sounds that would be used for new apps</_summary>
</key>
<key type="as" name="apps">
<default>[]</default>
<summary>List of apps and their notification-permissions. Example: ['noise:show,on', 'pantheon-terminal:show,off']</summary>
<description>Structure: ['{APP-NAME}:{PRIORITY (show/hide)},{SOUNDS on/off}', ...]</description>
<_summary>List of apps and their notification-permissions. Example: ['noise:show,on', 'pantheon-terminal:show,off']</_summary>
<_description>Structure: ['{APP-NAME}:{PRIORITY (show/hide)},{SOUNDS on/off}', ...]</_description>
</key>
</schema>
</schemalist>

View File

@ -160,8 +160,8 @@ namespace Gala.Plugins.Notify
if (!confirmation) {
var app_found = false;
var param_bubbles = options.default_bubbles ? "show" : "hide";
var param_sounds = options.default_sounds ? "on" : "off";
var param_bubbles = (options.default_bubbles ? "show" : "hide");
var param_sounds = (options.default_sounds ? "on" : "off");
for (int i = 0; i < options.apps.length; i++) {
var properties = options.apps[i].split (":");
@ -183,9 +183,8 @@ namespace Gala.Plugins.Notify
}
}
// App found?
if (!app_found) {
// No, add the default values to the list.
// if no matching app was found, add the default values to the list
var apps_new = new string[options.apps.length + 1];
for (int i = 0; i < options.apps.length; i++) {
@ -197,16 +196,7 @@ namespace Gala.Plugins.Notify
options.apps = apps_new;
}
if (options.do_not_disturb == false) {
if (param_bubbles == "show") {
allow_bubble = true;
} else {
allow_bubble = false;
}
} else {
allow_bubble = false;
}
allow_bubble = (!options.do_not_disturb && param_bubbles == "show");
allow_sound = (allow_bubble && param_sounds == "on");
}