Skip to content

Commit

Permalink
Add switch to change between MHz and GHz in taskbar
Browse files Browse the repository at this point in the history
  • Loading branch information
martin31821 committed Apr 21, 2016
1 parent b5e5339 commit f1dc4ee
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 14 deletions.
11 changes: 8 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const CPUFreqIndicator = new Lang.Class({
this.installed = installed;
let that = this;
this.settings = Convenience.getSettings(SETTINGS_ID);

this.cpufreq = 800;
this.parent(null, 'cpupower');
this.isTurboBoostActive = true;
Expand Down Expand Up @@ -181,7 +181,8 @@ const CPUFreqIndicator = new Lang.Class({
this.hbox.add_actor(this.lbl);


this.lblActive = (this.settings.get_boolean("show-freq-in-taskbar"))
this.lblActive = (this.settings.get_boolean("show-freq-in-taskbar"));
this.lblUnit = (this.settings.get_boolean("taskbar-freq-unit-ghz"));

this.hbox.add_actor(icon);
this.hbox.add_actor(PopupMenu.arrowIcon(St.Side.BOTTOM));
Expand Down Expand Up @@ -209,6 +210,7 @@ const CPUFreqIndicator = new Lang.Class({
that.menu.removeAll();

that.lblActive = (that.settings.get_boolean("show-freq-in-taskbar"));
that.lblUnit = (that.settings.get_boolean("taskbar-freq-unit-ghz"));

that._freqSection = new PopupMenu.PopupMenuSection();
that.menu.addMenuItem(that._freqSection);
Expand Down Expand Up @@ -442,7 +444,10 @@ const CPUFreqIndicator = new Lang.Class({

_getCurFreq: function()
{
return (this.cpufreq.toString() / 1000).toFixed(2) + 'GHz';
if(this.lblUnit)
return (this.cpufreq.toString() / 1000).toFixed(2) + 'GHz';
else
return this.cpufreq.toString() + 'MHz';
},

destroy: function()
Expand Down
Binary file modified locale/de/LC_MESSAGES/gnome-shell-extension-cpupower.mo
Binary file not shown.
58 changes: 48 additions & 10 deletions locale/de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,76 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-14 01:58+0200\n"
"PO-Revision-Date: 2015-07-18 10:55+0200\n"
"POT-Creation-Date: 2016-04-21 09:42+0200\n"
"PO-Revision-Date: 2016-04-21 09:43+0200\n"
"Last-Translator: Marek Pikuła <[email protected]>\n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.2\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.8.7.1\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: ../extension.js\n"
"X-Poedit-SearchPath-0: extension.js\n"
"X-Poedit-SearchPath-1: prefs.js\n"

#: ../extension.js:223
#: extension.js:220
msgid "No Policykit installed."
msgstr "Policykit ist nicht installiert."

#: extension.js:227
msgid "Installation required."
msgstr "Installation benötigt."

#: extension.js:253
msgid "Minimum Frequency:"
msgstr "Minimale Frequenz:"

#: ../extension.js:227
#: extension.js:257
msgid "Maximum Frequency:"
msgstr "Maximale Frequenz:"

#: ../extension.js:231
#: extension.js:261
msgid "Turbo Boost:"
msgstr "Turbo Boost:"

#: ../extension.js:266
#: extension.js:296
msgid "Current Frequency:"
msgstr "Aktuelle Frequenz:"

#: ../extension.js:292
#: extension.js:322
msgid "Preferences"
msgstr "Einstellungen"

#: prefs.js:59
msgid "Name of the profile"
msgstr "Profilname"

#: prefs.js:63
msgid "Minimum Frequency"
msgstr "Minimale Frequenz"

#: prefs.js:70
msgid "Maximum Frequency"
msgstr "Maximale Frequenz"

#: prefs.js:76
msgid "Turbo Boost"
msgstr "Turbo Boost"

#: prefs.js:247
msgid "Show current frequency"
msgstr "Aktuelle Frequenz anzeigen"

#: prefs.js:249
msgid "Use GHz instead of MHz as unit"
msgstr "GHz statt MHz als Einheit nutzen"

#: prefs.js:386
#, javascript-format
msgid "Remove profile %s ?"
msgstr "Profil %s entfernen?"

#~ msgid "CPU"
#~ msgstr "CPU"
17 changes: 16 additions & 1 deletion prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ const CPUPowerPrefsWidget = new GObject.Class(
this.initConfigWidget();
this.addLabel(_("Show current frequency"));
this.addSwitch("show_freq_taskbar");
this.addLabel(_("Use GHz instead of MHz as unit"));
this.addSwitch("taskbar_unit");
this.status("Inited config widget");
},

Expand Down Expand Up @@ -546,7 +548,14 @@ const CPUPowerPrefsWidget = new GObject.Class(
this.loadConfig();
return this.Settings.get_boolean("show-freq-in-taskbar");
},


get taskbar_unit()
{
if(!this.Settings)
this.loadConfig();
return this.Settings.get_boolean("taskbar-freq-unit-ghz");
},

get profiles()
{
if(!this.Settings)
Expand Down Expand Up @@ -589,6 +598,12 @@ const CPUPowerPrefsWidget = new GObject.Class(
this.Settings.set_boolean("show-freq-in-taskbar",v);
},

set taskbar_unit(v)
{
if (!this.Settings)
this.loadConfig();
this.Settings.set_boolean("taskbar-freq-unit-ghz", v);
},
x : [0,1],

y : [0,1],
Expand Down
Binary file modified schemas/gschemas.compiled
Binary file not shown.
5 changes: 5 additions & 0 deletions schemas/org.gnome.shell.extensions.cpupower.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@
<summary>Show current cpu frequency in taskbar</summary>
<description>Show current cpu frequency in the top bar</description>
</key>
<key name="taskbar-freq-unit-ghz" type="b">
<default>true</default>
<summary>Frequency in taskbar is shown in GHz or MHz</summary>
<description>Control which unit is used for the frequency</description>
</key>
</schema>
</schemalist>

0 comments on commit f1dc4ee

Please sign in to comment.