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:
parent
a94978db36
commit
d1e1afdaab
@ -860,6 +860,19 @@ StTooltip {
|
|||||||
background: #808080;
|
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 {
|
.chat-received {
|
||||||
background-gradient-direction: horizontal;
|
background-gradient-direction: horizontal;
|
||||||
background-gradient-start: #606060;
|
background-gradient-start: #606060;
|
||||||
|
@ -19,6 +19,7 @@ const SUMMARY_TIMEOUT = 1;
|
|||||||
const HIDE_TIMEOUT = 0.2;
|
const HIDE_TIMEOUT = 0.2;
|
||||||
|
|
||||||
const ICON_SIZE = 24;
|
const ICON_SIZE = 24;
|
||||||
|
const BUTTON_ICON_SIZE = 36;
|
||||||
|
|
||||||
const MAX_SOURCE_TITLE_WIDTH = 180;
|
const MAX_SOURCE_TITLE_WIDTH = 180;
|
||||||
|
|
||||||
@ -262,8 +263,16 @@ Notification.prototype = {
|
|||||||
this._buttonBox = box;
|
this._buttonBox = box;
|
||||||
}
|
}
|
||||||
|
|
||||||
let button = new St.Button({ style_class: 'notification-button',
|
let button = new St.Button();
|
||||||
label: label });
|
|
||||||
|
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);
|
this._buttonBox.add(button);
|
||||||
button.connect('clicked', Lang.bind(this, function() { this.emit('action-invoked', id); }));
|
button.connect('clicked', Lang.bind(this, function() { this.emit('action-invoked', id); }));
|
||||||
},
|
},
|
||||||
|
@ -245,8 +245,9 @@ NotificationDaemon.prototype = {
|
|||||||
// 'body-images',
|
// 'body-images',
|
||||||
'body-markup',
|
'body-markup',
|
||||||
// 'icon-multi',
|
// 'icon-multi',
|
||||||
'icon-static'
|
'icon-static',
|
||||||
// 'sound',
|
// 'sound',
|
||||||
|
'x-gnome-icon-buttons'
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user