Skip to content

Commit

Permalink
Merge pull request #5940 from lestcape/indicators
Browse files Browse the repository at this point in the history
Indicators: Ensure a default icon size of 16px
  • Loading branch information
clefebvre committed Nov 22, 2016
2 parents d2d7be5 + 4c10393 commit 5ee8543
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions js/ui/indicatorManager.js
Expand Up @@ -1200,15 +1200,18 @@ IndicatorActor.prototype = {
return [path, realSize];
},

_createIconByName: function(path, realSize) {
_createIconByName: function(path, iconSize) {
try {
let pixbuf = GdkPixbuf.Pixbuf.new_from_file(path);
let icon = new St.Icon({
style_class: 'applet-icon',//FIXME: Use instead the status icon style class.
gicon: pixbuf,
});
if (realSize)
icon.set_icon_size(realSize);
if (iconSize)
icon.set_icon_size(iconSize);
//Connect this always, because the user can enable/disable the panel scale mode
//when he want, otherwise we need to control the scale mode internally.
icon.connect('notify::mapped', Lang.bind(this, this._onIconMapped));
return icon;
} catch (e) {
// the image data was probably bogus. We don't really know why, but it _does_ happen.
Expand Down Expand Up @@ -1252,6 +1255,9 @@ IndicatorActor.prototype = {
});
if (iconSize)
icon.set_icon_size(iconSize);
//Connect this always, because the user can enable/disable the panel scale mode
//when he want, otherwise we need to control the scale mode internally.
icon.connect('notify::mapped', Lang.bind(this, this._onIconMapped));
return icon;
} catch (e) {
// the image data was probably bogus. We don't really know why, but it _does_ happen.
Expand All @@ -1261,6 +1267,15 @@ IndicatorActor.prototype = {
return null;
},

_onIconMapped: function(actor, event) {
if (!this._iconSize) {
let themeNode = actor.get_theme_node();
let [found, size] = themeNode.lookup_length('icon-size', false);
if (!found)
actor.set_icon_size(16);
}
},

// updates the base icon
_updateIcon: function() {
// remove old icon
Expand Down

0 comments on commit 5ee8543

Please sign in to comment.