Compare commits

...

2 Commits

Author SHA1 Message Date
Jasper St. Pierre
5c2c60aaf4 implement maximize 2015-07-05 23:11:50 -07:00
Jasper St. Pierre
d20789bc61 status menu hackery 2015-07-05 23:11:14 -07:00
8 changed files with 63 additions and 42 deletions

View File

@ -697,7 +697,6 @@ const AggregateMenu = new Lang.Class({
this.menu.addMenuItem(this._location.menu);
this.menu.addMenuItem(this._rfkill.menu);
this.menu.addMenuItem(this._power.menu);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this._system.menu);
},
});

View File

@ -1059,11 +1059,6 @@ const PopupSubMenuMenuItem = new Lang.Class({
let expander = new St.Bin({ style_class: 'popup-menu-item-expander' });
this.actor.add(expander, { expand: true });
this.status = new St.Label({ style_class: 'popup-status-menu-item',
y_expand: true,
y_align: Clutter.ActorAlign.CENTER });
this.actor.add_child(this.status);
this._triangle = arrowIcon(St.Side.RIGHT);
this._triangle.pivot_point = new Clutter.Point({ x: 0.5, y: 0.6 });

View File

@ -101,8 +101,8 @@ const Indicator = new Lang.Class({
this._item.actor.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode;
if (nDevices > 0)
this._item.status.text = ngettext("%d Connected Device", "%d Connected Devices", nDevices).format(nDevices);
this._item.label.text = ngettext("%d Connected Device", "%d Connected Devices", nDevices).format(nDevices);
else
this._item.status.text = _("Not Connected");
this._item.label.text = _("Not Connected");
},
});

View File

@ -68,7 +68,7 @@ const Indicator = new Lang.Class({
this._agent = Gio.DBusExportedObject.wrapJSObject(AgentIface, this);
this._agent.export(Gio.DBus.system, '/org/freedesktop/GeoClue2/Agent');
this._item.status.text = _("Enabled");
this._item.label.text = _("Location Services in Use");
this._onOffAction = this._item.menu.addAction(_("Disable"), Lang.bind(this, this._onOnOffAction));
this._item.menu.addSettingsAction(_("Privacy Settings"), 'gnome-privacy-panel.desktop');
@ -112,7 +112,6 @@ const Indicator = new Lang.Class({
this._indicator.visible = this._proxy.InUse;
this._item.actor.visible = this._indicator.visible;
this._updateMenuLabels();
},
_connectToGeoclue: function() {
@ -171,19 +170,7 @@ const Indicator = new Lang.Class({
this.menu.setSensitive(sensitive);
},
_updateMenuLabels: function() {
if (this._settings.get_boolean(ENABLED)) {
this._item.status.text = this._indicator.visible ? _("In Use") : _("Enabled");
this._onOffAction.label.text = _("Disable");
} else {
this._item.status.text = _("Disabled");
this._onOffAction.label.text = _("Enable");
}
},
_onMaxAccuracyLevelChanged: function() {
this._updateMenuLabels();
// Gotta ensure geoclue is up and we are registered as agent to it
// before we emit the notify for this property change.
if (!this._connectToGeoclue())

View File

@ -257,16 +257,8 @@ const NMConnectionSection = new Lang.Class({
this._radioSection.actor.visible = (nItems > 1);
this._labelSection.actor.visible = (nItems == 1);
this.item.status.text = this._getStatus();
this.item.label.text = this._getStatus();
this.item.icon.icon_name = this._getMenuIcon();
// desc can be undefined at cold-plug, before we called
// NMGtk.disambiguate_device_names() at least once
let desc = this._getDescription();
if (desc)
this.item.label.text = desc;
else
this.item.label.text = '';
},
_getMenuIcon: function() {
@ -1282,9 +1274,8 @@ const NMDeviceWireless = new Lang.Class({
this._toggleItem.label.text = this._client.wireless_enabled ? _("Turn Off") : _("Turn On");
this._toggleItem.actor.visible = this._client.wireless_hardware_enabled;
this.item.status.text = this._getStatus();
this.item.icon.icon_name = this._getMenuIcon();
this.item.label.text = this._description;
this.item.label.text = this._getStatus();
},
setDeviceDescription: function(desc) {

View File

@ -112,12 +112,6 @@ const Indicator = new Lang.Class({
this._item.icon.icon_name = icon;
// The status label
this._item.status.text = this._getStatus();
// The sub-menu heading
if (this._proxy.Type == UPower.DeviceKind.UPS)
this._item.label.text = _("UPS");
else
this._item.label.text = _("Battery");
this._item.label.text = this._getStatus();
},
});

View File

@ -85,9 +85,8 @@ const Indicator = new Lang.Class({
// The menu only appears when airplane mode is on, so just
// statically build it as if it was on, rather than dynamically
// changing the menu contents.
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode"), true);
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
this._item.icon.icon_name = 'airplane-mode-symbolic';
this._item.status.text = _("On");
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
this._manager.airplaneMode = false;
}));

View File

@ -622,6 +622,7 @@ const WindowManager = new Lang.Class({
this._minimizing = [];
this._unminimizing = [];
this._sizeChanging = [];
this._mapping = [];
this._destroying = [];
this._movingWindow = null;
@ -636,6 +637,7 @@ const WindowManager = new Lang.Class({
this._shellwm.connect('kill-switch-workspace', Lang.bind(this, this._switchWorkspaceDone));
this._shellwm.connect('kill-window-effects', Lang.bind(this, function (shellwm, actor) {
this._minimizeWindowDone(shellwm, actor);
this._sizeChangeWindowDone(shellwm, actor);
this._mapWindowDone(shellwm, actor);
this._destroyWindowDone(shellwm, actor);
}));
@ -1157,6 +1159,60 @@ const WindowManager = new Lang.Class({
},
_sizeChangeWindow : function(shellwm, actor, whichChange, oldFrameRect, oldBufferRect) {
let types = [Meta.WindowType.NORMAL];
if (!this._shouldAnimateActor(actor, types)) {
shellwm.completed_size_change(actor);
return;
}
this._sizeChanging.push(actor);
let targetRect = actor.meta_window.get_frame_rect();
// The actor is in its old, "frozen" state. The borders that we have here
// are the difference between the frame and buffer rects. Offset the target
// with the same difference so it lines up nicely.
targetRect.x += oldBufferRect.x - oldFrameRect.x;
targetRect.y += oldBufferRect.y - oldFrameRect.y;
let frameX2 = oldFrameRect.x + oldFrameRect.width;
let bufferX2 = oldBufferRect.x + oldBufferRect.width;
targetRect.width += bufferX2 - frameX2;
let frameY2 = oldFrameRect.y + oldFrameRect.width;
let bufferY2 = oldBufferRect.y + oldBufferRect.width;
targetRect.width += bufferY2 - frameY2;
let scaleX = targetRect.width / actor.width;
let scaleY = targetRect.height / actor.height;
Tweener.addTween(actor,
{ x: targetRect.x,
y: targetRect.y,
scale_x: scaleX,
scale_y: scaleY,
time: WINDOW_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: () => { this._sizeChangeWindowDone(shellwm, actor); },
onOverwrite: () => { this._sizeChangeWindowOverwritten(shellwm, actor); },
});
},
_sizeChangeWindowDone: function(shellwm, actor) {
if (!this._removeEffect(this._sizeChanging, actor))
return;
Tweener.removeTweens(actor);
actor.scale_x = 1;
actor.scale_y = 1;
shellwm.completed_size_change(actor);
},
_sizeChangeWindowOverwritten: function(shellwm, actor) {
if (!this._removeEffect(this._sizeChanging, actor))
return;
shellwm.completed_size_change(actor);
},