Import part of the notification area applet, and use it to add a
notification are to the panel. A bit warty, but we don't know how we want the final UI to look anyway. (The fact that transparency doesn't work is a known bug.) svn path=/trunk/; revision=44
This commit is contained in:
@ -4,10 +4,12 @@ const Mainloop = imports.mainloop;
|
||||
|
||||
const Shell = imports.gi.Shell;
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Tidy = imports.gi.Tidy;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const PANEL_HEIGHT = 32;
|
||||
const TRAY_HEIGHT = 24;
|
||||
const PANEL_BACKGROUND_COLOR = new Clutter.Color();
|
||||
PANEL_BACKGROUND_COLOR.from_pixel(0xeeddccff);
|
||||
|
||||
@ -26,7 +28,7 @@ Panel.prototype = {
|
||||
width: global.screen_width+2,
|
||||
height: PANEL_HEIGHT+1,
|
||||
border_width: 1});
|
||||
background.set_position(-1, -1)
|
||||
background.set_position(-1, -1);
|
||||
this._group.add_actor(background);
|
||||
|
||||
let message = new Clutter.Label({ font_name: "Sans Bold 16px",
|
||||
@ -35,11 +37,35 @@ Panel.prototype = {
|
||||
message.set_position(5, 5);
|
||||
this._group.add_actor(message);
|
||||
|
||||
this._grid = new Tidy.Grid({ height: TRAY_HEIGHT,
|
||||
valign: 0.5,
|
||||
end_align: true,
|
||||
column_gap: 2 })
|
||||
this._group.add_actor(this._grid);
|
||||
|
||||
this._clock = new Clutter.Label({ font_name: "Sans Bold 16px",
|
||||
text: "" });
|
||||
this._clock.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
this._clock.set_position(global.screen_width - 5, 5);
|
||||
this._group.add_actor(this._clock);
|
||||
this._grid.add_actor(this._clock);
|
||||
|
||||
this._grid.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
this._grid.set_position(global.screen_width - 2, (PANEL_HEIGHT - TRAY_HEIGHT) / 2);
|
||||
|
||||
this._traymanager = new Shell.TrayManager();
|
||||
let panel = this;
|
||||
this._traymanager.connect('tray-icon-added',
|
||||
function(o, icon) {
|
||||
panel._grid.add_actor(icon);
|
||||
/* bump the clock back to the end */
|
||||
panel._grid.remove_actor(panel._clock);
|
||||
panel._grid.add_actor(panel._clock);
|
||||
panel._grid.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
});
|
||||
this._traymanager.connect('tray-icon-removed',
|
||||
function(o, icon) {
|
||||
panel._grid.remove_actor(icon);
|
||||
panel._grid.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
});
|
||||
this._traymanager.manage_stage(global.stage);
|
||||
|
||||
message.connect('button-press-event',
|
||||
function(o, event) {
|
||||
@ -68,8 +94,6 @@ Panel.prototype = {
|
||||
|
||||
_updateClock: function() {
|
||||
this._clock.set_text(new Date().toLocaleFormat("%H:%M"));
|
||||
this._clock.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user