Support deprecation of Shell.GenericContainer

This commit is contained in:
Charles Gagnon
2018-10-11 00:38:21 -04:00
parent e75292a4d3
commit 4b639ec12c
5 changed files with 39 additions and 15 deletions

View File

@@ -1415,6 +1415,7 @@ function extendShowAppsIcon(showAppsIcon, settings) {
/* the variable equivalent to toggleButton has a different name in the appIcon class
(actor): duplicate reference to easily reuse appIcon methods */
showAppsIcon.actor = showAppsIcon.toggleButton;
showAppsIcon.actor.name = 'show-apps-btn';
// Re-use appIcon methods
showAppsIcon._removeMenuTimeout = AppDisplay.AppIcon.prototype._removeMenuTimeout;
@@ -1463,6 +1464,13 @@ function extendShowAppsIcon(showAppsIcon, settings) {
showAppsIcon.icon._createIconTexture(showAppsIcon.icon.iconSize);
});
setShowAppsPadding();
settings.connect('changed::appicon-padding', setShowAppsPadding);
function setShowAppsPadding() {
showAppsIcon.actor.set_style('padding:' + (settings.get_int('appicon-padding') + 2) + 'px;');
}
showAppsIcon.popupMenu = function() {
showAppsIcon._removeMenuTimeout();
showAppsIcon.actor.fake_release();

View File

@@ -30,6 +30,7 @@
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Clutter = imports.gi.Clutter;
const Gtk = imports.gi.Gtk;
const Gi = imports._gi;
const Utils = Me.imports.utils;
const Taskbar = Me.imports.taskbar;
const PanelStyle = Me.imports.panelStyle;
@@ -138,16 +139,24 @@ var dtpPanel = new Lang.Class({
this.oldRightBoxAllocate(box, flags);
});
this._panelConnectId = this.panel.actor.connect('allocate', Lang.bind(this, function(actor,box,flags){this._allocate(actor,box,flags);}));
if (this.panel.vfunc_allocate) {
this._panelConnectId = 0;
this._oldAllocate = this.panel.__proto__.vfunc_allocate;
this.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', (box, flags) => {
//panel inherits from St.Widget, invoke its parent allocation
St.Widget.prototype.vfunc_allocate.call(this.panel, box, flags);
this._allocate(null, box, flags);
});
} else {
this._panelConnectId = this.panel.actor.connect('allocate', (actor,box,flags) => this._allocate(actor,box,flags));
}
this.panel._leftBox.remove_child(this.appMenu.container);
this.taskbar = new Taskbar.taskbar(this._dtpSettings);
Main.overview.dashIconSize = this.taskbar.iconSize;
this.container.insert_child_at_index( this.taskbar.actor, 2 );
this._oldLeftBoxStyle = this.panel._leftBox.get_style();
this._oldCenterBoxStyle = this.panel._centerBox.get_style();
this._oldRightBoxStyle = this.panel._rightBox.get_style();
this._setActivitiesButtonVisible(this._dtpSettings.get_boolean('show-activities-button'));
this._setAppmenuVisible(this._dtpSettings.get_boolean('show-appmenu'));
this._setClockLocation(this._dtpSettings.get_string('location-clock'));
@@ -254,7 +263,12 @@ var dtpPanel = new Lang.Class({
this._setAppmenuVisible(false);
this.panel._leftBox.add_child(this.appMenu.container);
this.taskbar.destroy();
this.panel.actor.disconnect(this._panelConnectId);
if (this._panelConnectId) {
this.panel.actor.disconnect(this._panelConnectId);
} else if (this._oldAllocate) {
this.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', this._oldAllocate);
}
if (this.startIntellihideId) {
Mainloop.source_remove(this.startIntellihideId);
@@ -734,7 +748,7 @@ function newPopupOpen(animate) {
}
this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment);
this._boxPointer.show(animate);
(this._boxPointer.open || this._boxPointer.show).call(this._boxPointer, animate);
this.actor.raise_top();

View File

@@ -24,12 +24,18 @@
#dashtopanelScrollview .app-well-app .overview-icon {
border-radius: 0;
border: none;
padding: 2px;
}
#dashtopanelScrollview .app-well-app .overview-label {
padding-right: 8px;
}
#show-apps-btn, #show-apps-btn .overview-icon {
margin: 0;
padding: 0;
}
#dashtopanelScrollview .app-well-app:hover .overview-icon,
#dashtopanelScrollview .app-well-app:focus .overview-icon {
background: none;

View File

@@ -613,12 +613,12 @@ var taskbar = new Lang.Class({
});
},
_getTaskbarIcons: function() {
_getTaskbarIcons: function(includeAnimated) {
return this._box.get_children().filter(function(actor) {
return actor.child &&
actor.child._delegate &&
actor.child._delegate.icon &&
!actor.animatingOut;
(includeAnimated || !actor.animatingOut);
});
},
@@ -871,12 +871,8 @@ var taskbar = new Lang.Class({
// Reset the displayed apps icon to mantain the correct order
resetAppIcons : function() {
let children = this._box.get_children().filter(function(actor) {
return actor.child &&
actor.child._delegate &&
actor.child._delegate.icon;
});
let children = this._getTaskbarIcons(true);
for (let i = 0; i < children.length; i++) {
let item = children[i];
item.destroy();

View File

@@ -255,7 +255,7 @@ var thumbnailPreviewMenu = new Lang.Class({
this._activeMenuItem.setActive(false);
if (this._boxPointer.actor.visible) {
this._boxPointer.hide(animate, Lang.bind(this, function() {
(this._boxPointer.close || this._boxPointer.hide).call(this._boxPointer, animate, Lang.bind(this, function() {
this.emit('menu-closed', this);
}));
}