(key, value, gicon)
| 508 | } |
| 509 | |
| 510 | _createHotItem(key, value, gicon) { |
| 511 | let item = new St.BoxLayout({ |
| 512 | style_class: 'vitals-panel-item', |
| 513 | }); |
| 514 | this._hotItems[key] = item; |
| 515 | this._menuLayout.add_child(item); |
| 516 | |
| 517 | if (!this._settings.get_boolean('hide-icons') || key == '_default_icon_') { |
| 518 | let icon = this._defaultIcon(key); |
| 519 | if (gicon) icon.gicon = gicon; |
| 520 | item.add_child(icon); |
| 521 | } |
| 522 | |
| 523 | // don't add a label when no sensors are in the panel |
| 524 | if (key == '_default_icon_') return; |
| 525 | |
| 526 | let label = new St.Label({ |
| 527 | style_class: 'vitals-panel-label', |
| 528 | text: (value)?value:'\u2026', // ... |
| 529 | y_expand: true, |
| 530 | y_align: Clutter.ActorAlign.CENTER |
| 531 | }); |
| 532 | // attempt to prevent ellipsizes |
| 533 | label.get_clutter_text().ellipsize = 0; |
| 534 | // keep track of label for removal later |
| 535 | this._hotLabels[key] = label; |
| 536 | // prevent "called on the widget" "which is not in the stage" errors by adding before width below |
| 537 | item.add_child(label); |
| 538 | |
| 539 | // support for fixed widths #55, save label (text) width |
| 540 | this._widths[key] = label.get_clutter_text().width; |
| 541 | } |
| 542 | |
| 543 | _showHideSensorsChanged(self, sensor) { |
| 544 | this._sensors.resetHistory(); |
no test coverage detected