()
| 354 | } |
| 355 | |
| 356 | _initializeMenu() { |
| 357 | // display sensor categories |
| 358 | for (let sensor in this._sensorIcons) { |
| 359 | // groups associated sensors under accordion menu |
| 360 | if (sensor in this._groups) continue; |
| 361 | |
| 362 | //handle gpus separately. |
| 363 | if (sensor === 'gpu') continue; |
| 364 | |
| 365 | this._initializeMenuGroup(sensor, sensor); |
| 366 | } |
| 367 | |
| 368 | for (let i = 1; i <= this._numGpus; i++) |
| 369 | this._initializeMenuGroup('gpu#' + i, 'gpu', (this._numGpus > 1 ? ' ' + i : '')); |
| 370 | |
| 371 | // add separator |
| 372 | this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); |
| 373 | |
| 374 | let item = new PopupMenu.PopupBaseMenuItem({ |
| 375 | reactive: false, |
| 376 | style_class: 'vitals-menu-button-container' |
| 377 | }); |
| 378 | |
| 379 | let customButtonBox = new St.BoxLayout({ |
| 380 | style_class: 'vitals-button-box', |
| 381 | vertical: false, |
| 382 | clip_to_allocation: true, |
| 383 | x_align: Clutter.ActorAlign.CENTER, |
| 384 | y_align: Clutter.ActorAlign.CENTER, |
| 385 | reactive: true, |
| 386 | x_expand: true |
| 387 | }); |
| 388 | |
| 389 | // custom round refresh button |
| 390 | let refreshButton = this._createRoundButton('view-refresh-symbolic', _('Refresh')); |
| 391 | refreshButton.connect('clicked', (self) => { |
| 392 | // force refresh by clearing history |
| 393 | this._sensors.resetHistory(); |
| 394 | this._values.resetHistory(this._numGpus); |
| 395 | |
| 396 | // make sure timer fires at next full interval |
| 397 | this._updateTimeChanged(); |
| 398 | |
| 399 | // refresh sensors now |
| 400 | this._querySensors(); |
| 401 | }); |
| 402 | customButtonBox.add_child(refreshButton); |
| 403 | |
| 404 | // custom round monitor button |
| 405 | let monitorButton = this._createRoundButton('org.gnome.SystemMonitor-symbolic', _('System Monitor')); |
| 406 | monitorButton.connect('clicked', (self) => { |
| 407 | this.menu._getTopMenu().close(); |
| 408 | Util.spawn(this._settings.get_string('monitor-cmd').split(" ")); |
| 409 | }); |
| 410 | customButtonBox.add_child(monitorButton); |
| 411 | |
| 412 | // custom round preferences button |
| 413 | let prefsButton = this._createRoundButton('preferences-system-symbolic', _('Preferences')); |
no test coverage detected