From 4bf9e0d9b5a1e7a2e16f86bbc81a783e7e3a4145 Mon Sep 17 00:00:00 2001 From: Dipesh Acharya Date: Tue, 12 Mar 2013 20:38:15 +0545 Subject: [PATCH] refactored project name, configuration etc. from cpu-temperature to sensors [#57] --- .gitignore | 1 + extension.js | 16 ++++++++-------- metadata.json | 12 ++++++------ prefs.js | 10 +++++----- ...g.gnome.shell.extensions.sensors.gschema.xml} | 4 ++-- 5 files changed, 22 insertions(+), 21 deletions(-) rename schemas/{org.gnome.shell.extensions.cpu-temperature.gschema.xml => org.gnome.shell.extensions.sensors.gschema.xml} (93%) diff --git a/.gitignore b/.gitignore index a9bbac5..9ae0d77 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ gschemas.compiled +*~ diff --git a/extension.js b/extension.js index 40afa67..035e6fa 100644 --- a/extension.js +++ b/extension.js @@ -13,19 +13,19 @@ const Shell = imports.gi.Shell; let settings; let metadata = Me.metadata; -function CpuTemperature() { +function Sensors() { this._init.apply(this, arguments); } -CpuTemperature.prototype = { +Sensors.prototype = { __proto__: PanelMenu.SystemStatusButton.prototype, _init: function(){ - PanelMenu.SystemStatusButton.prototype._init.call(this, 'temperature'); + PanelMenu.SystemStatusButton.prototype._init.call(this, 'sensors'); this.statusLabel = new St.Label({ text: "--", - style_class: "temperature-label" + style_class: "sensors-label" }); // destroy all previously created children, and add our statusLabel @@ -43,7 +43,7 @@ CpuTemperature.prototype = { if (display_hdd_temp){ this.hddtempPath = this._detectHDDTemp(); } - this.command=["xdg-open", "http://github.com/xtranophilist/gnome-shell-extension-cpu-temperature/issues/"]; + this.command=["xdg-open", "http://github.com/xtranophilist/gnome-shell-extension-sensors/issues/"]; if(this.sensorsPath){ this.title='Error'; this.content='Run sensors-detect as root. If it doesn\'t help, click here to report with your sensors output!'; @@ -388,7 +388,7 @@ CpuTemperature.prototype = { } let format = '%.1f'; if (!settings.get_boolean('display-decimal-value')){ - ret = Math.round(value); + //ret = Math.round(value); format = '%d'; } if (settings.get_boolean('display-degree-sign')) { @@ -406,8 +406,8 @@ let indicator; let event=null; function enable() { - indicator = new CpuTemperature(); - Main.panel.addToStatusArea('temperature', indicator); + indicator = new Sensors(); + Main.panel.addToStatusArea('sensors', indicator); //TODO catch preference change signals with settings.connect('changed:: } diff --git a/metadata.json b/metadata.json index 173566b..331beb4 100644 --- a/metadata.json +++ b/metadata.json @@ -1,13 +1,13 @@ { - "description": "Shows CPU (and HDD) Temperature on Gnome Shell", - "name": "CPU Temperature Indicator", - "settings-schema": "org.gnome.shell.extensions.cpu-temperature", - "gettext-domain": "cpu-temperature", + "description": "Shows CPU temperature, HDD temperature, voltage and fan RPM", + "name": "Sensors", + "settings-schema": "org.gnome.shell.extensions.sensors", + "gettext-domain": "gse-sensors", "shell-version": [ "3.2", "3.4", "3.6" ], - "url": "http://motorscript.com/gnome-shell-extension-cpu-temperature/", + "url": "https://github.com/xtranophilist/gnome-shell-extension-sensors", "uuid": "temperature@xtranophilist" - } \ No newline at end of file + } diff --git a/prefs.js b/prefs.js index 7b9c599..8fd75b7 100644 --- a/prefs.js +++ b/prefs.js @@ -5,7 +5,7 @@ const Gtk = imports.gi.Gtk; const Lang = imports.lang; -const Gettext = imports.gettext.domain('cpu-temperature'); +const Gettext = imports.gettext.domain('gse-sensors'); const _ = Gettext.gettext; const ExtensionUtils = imports.misc.extensionUtils; @@ -16,9 +16,9 @@ function init() { Convenience.initTranslations(); } -const CPUTemperaturePrefsWidget = new GObject.Class({ - Name: 'CPUTemperature.Prefs.Widget', - GTypeName: 'CPUTemperaturePrefsWidget', +const SensorsPrefsWidget = new GObject.Class({ + Name: 'Sensors.Prefs.Widget', + GTypeName: 'SensorsPrefsWidget', Extends: Gtk.Grid, _init: function(params) { @@ -217,7 +217,7 @@ const CPUTemperaturePrefsWidget = new GObject.Class({ }); function buildPrefsWidget() { - let widget = new CPUTemperaturePrefsWidget(); + let widget = new SensorsPrefsWidget(); widget.show_all(); return widget; } diff --git a/schemas/org.gnome.shell.extensions.cpu-temperature.gschema.xml b/schemas/org.gnome.shell.extensions.sensors.gschema.xml similarity index 93% rename from schemas/org.gnome.shell.extensions.cpu-temperature.gschema.xml rename to schemas/org.gnome.shell.extensions.sensors.gschema.xml index 810bda8..606bb4d 100644 --- a/schemas/org.gnome.shell.extensions.cpu-temperature.gschema.xml +++ b/schemas/org.gnome.shell.extensions.sensors.gschema.xml @@ -1,7 +1,7 @@ - + - + 15