notificationDaemon: Remove support for action-icons

This capability was only really useful for media players, and with
music notifications no longer being special, we can simplify a bit
by removing support for it.

https://bugzilla.gnome.org/show_bug.cgi?id=744815
This commit is contained in:
Florian Müllner 2015-02-16 16:43:30 +01:00
parent ea9e5bc52c
commit f4301147bb

View File

@ -311,19 +311,6 @@ const FdoNotificationDaemon = new Lang.Class({
return invocation.return_value(GLib.Variant.new('(u)', [id])); return invocation.return_value(GLib.Variant.new('(u)', [id]));
}, },
_makeButton: function(id, label, useActionIcons) {
let button = new St.Button({ can_focus: true });
let iconName = id.endsWith('-symbolic') ? id : id + '-symbolic';
if (useActionIcons && Gtk.IconTheme.get_default().has_icon(iconName)) {
button.add_style_class_name('notification-icon-button');
button.child = new St.Icon({ icon_name: iconName });
} else {
button.add_style_class_name('notification-button');
button.label = label;
}
return button;
},
_notifyForSource: function(source, ndata) { _notifyForSource: function(source, ndata) {
let [id, icon, summary, body, actions, hints, notification] = let [id, icon, summary, body, actions, hints, notification] =
[ndata.id, ndata.icon, ndata.summary, ndata.body, [ndata.id, ndata.icon, ndata.summary, ndata.body,
@ -375,19 +362,16 @@ const FdoNotificationDaemon = new Lang.Class({
let hasDefaultAction = false; let hasDefaultAction = false;
if (actions.length) { if (actions.length) {
let useActionIcons = (hints['action-icons'] == true);
for (let i = 0; i < actions.length - 1; i += 2) { for (let i = 0; i < actions.length - 1; i += 2) {
let [actionId, label] = [actions[i], actions[i+1]]; let [actionId, label] = [actions[i], actions[i+1]];
if (actionId == 'default') { if (actionId == 'default')
hasDefaultAction = true; hasDefaultAction = true;
} else { else
notification.addButton(this._makeButton(actionId, label, useActionIcons), Lang.bind(this, function() { notification.addAction(label, Lang.bind(this, function() {
this._emitActionInvoked(ndata.id, actionId); this._emitActionInvoked(ndata.id, actionId);
})); }));
} }
} }
}
if (hasDefaultAction) { if (hasDefaultAction) {
notification.connect('clicked', Lang.bind(this, function() { notification.connect('clicked', Lang.bind(this, function() {
@ -431,7 +415,7 @@ const FdoNotificationDaemon = new Lang.Class({
GetCapabilities: function() { GetCapabilities: function() {
return [ return [
'actions', 'actions',
'action-icons', // 'action-icons',
'body', 'body',
// 'body-hyperlinks', // 'body-hyperlinks',
// 'body-images', // 'body-images',