messageTray: Split out the building of the right menu to a separate method

Besides code cleanliness, this allows us to stub out a right-click menu
for resident sources.

https://bugzilla.gnome.org/show_bug.cgi?id=683438
This commit is contained in:
Jasper St. Pierre
2012-09-05 12:32:45 -03:00
parent 9627864ca8
commit 6f5b700833
2 changed files with 45 additions and 37 deletions

View File

@ -482,6 +482,22 @@ const ChatSource = new Lang.Class({
this._getLogMessages();
},
buildRightClickMenu: function() {
let item;
let rightClickMenu = this.parent();
item = new PopupMenu.PopupMenuItem('');
item.actor.connect('notify::mapped', Lang.bind(this, function() {
item.label.set_text(source.isMuted ? _("Unmute") : _("Mute"));
}));
item.connect('activate', Lang.bind(this, function() {
this.setMuted(!this.isMuted);
this.emit('done-displaying-content');
}));
rightClickMenu.add(item.actor);
return rightClickMenu;
},
_updateAlias: function() {
let oldAlias = this.title;
let newAlias = this._contact.get_alias();