Add icon buttons to notifications

Now if an id is passed to Notification.addButton that matches a theme icon,
it will be displayed as an icon.  This is another in the implement the
music player mockups series.
http://live.gnome.org/GnomeShell/Design/Guidelines/MessageTray/MusicPlayer

https://bugzilla.gnome.org/show_bug.cgi?id=621014
This commit is contained in:
Matt Novenstern 2010-06-11 23:19:18 +02:00 committed by Florian Müllner
parent a94978db36
commit d1e1afdaab
3 changed files with 26 additions and 3 deletions

View File

@ -860,6 +860,19 @@ StTooltip {
background: #808080;
}
.notification-icon-button {
border: 2px rgba(0,0,0,0.0);
border-radius: 5px;
padding: 5px;
}
.notification-icon-button:hover {
background: rgba(192,192,192,0.7);
}
.notification-icon-button:active {
background: rgba(128,128,128,0.7);
}
.chat-received {
background-gradient-direction: horizontal;
background-gradient-start: #606060;

View File

@ -19,6 +19,7 @@ const SUMMARY_TIMEOUT = 1;
const HIDE_TIMEOUT = 0.2;
const ICON_SIZE = 24;
const BUTTON_ICON_SIZE = 36;
const MAX_SOURCE_TITLE_WIDTH = 180;
@ -262,8 +263,16 @@ Notification.prototype = {
this._buttonBox = box;
}
let button = new St.Button({ style_class: 'notification-button',
label: label });
let button = new St.Button();
if (Gtk.IconTheme.get_default().has_icon(id)) {
button.add_style_class_name('notification-icon-button');
button.child = St.TextureCache.get_default().load_icon_name(id, BUTTON_ICON_SIZE);
} else {
button.add_style_class_name('notification-button');
button.label = label;
}
this._buttonBox.add(button);
button.connect('clicked', Lang.bind(this, function() { this.emit('action-invoked', id); }));
},

View File

@ -245,8 +245,9 @@ NotificationDaemon.prototype = {
// 'body-images',
'body-markup',
// 'icon-multi',
'icon-static'
'icon-static',
// 'sound',
'x-gnome-icon-buttons'
];
},