Skip to content

Commit 7432ed6

Browse files
committed
Update cleaning
1 parent bf1cdc6 commit 7432ed6

File tree

8 files changed

+10
-42
lines changed

8 files changed

+10
-42
lines changed

common/Application.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010

1111
imports.gi.versions.Gtk = '3.0';
1212

13-
let d = new Date ();
13+
/*let d = new Date ();
1414
print ("\x1b[00;32m[" + d.toString().substring (0, d.toString().indexOf (" GMT")) + "." + (d.getMilliseconds() / 1000).toFixed(3).slice(2, 5) +
15-
"](DD) [cpufreq][application]\x1b[0m Starting application");
15+
"](DD) [cpufreq][application]\x1b[0m Starting application");*/
1616

1717
const Gtk = imports.gi.Gtk;
1818
const Gdk = imports.gi.Gdk;
1919
const Gio = imports.gi.Gio;
2020
const GLib = imports.gi.GLib;
2121
const Lang = imports.lang;
2222

23+
const Logger = imports.common.Logger;
2324
const Convenience = imports.convenience;
2425
const cpu = imports.common.HelperCPUFreq;
2526
const Settings = imports.common.Settings;
26-
const Logger = imports.common.Logger;
2727
const MainWindow = imports.common.ui.MainWindow;
2828

2929
var DEBUG_LVL = 0;
@@ -91,52 +91,39 @@ var CPUFreqApplication = new Lang.Class ({
9191
let v = options.lookup_value ("profile", null);
9292
if (v) [v, ] = v.get_string ();
9393
this.process_profile (v);
94-
Logger.debug ("finishing loading profile: \`%s\`".format (v));
9594
//TODO: fix https://gitlab.gnome.org/GNOME/gjs/issues/232
9695
return 0;
9796
}
9897

99-
Logger.debug ("verbose:%s debug:%s extension:%s".format (DEBUG_LVL>0, DEBUG_LVL>1, this.extension));
98+
//Logger.debug ("verbose:%s debug:%s extension:%s".format (DEBUG_LVL>0, DEBUG_LVL>1, this.extension));
10099
return -1;
101100
},
102101

103102
vfunc_startup: function () {
104-
Logger.info ("startup");
105103
this.parent();
106104
this.initialize ();
107-
108-
/*this.connect ('open', Lang.bind (this, (files) => {
109-
print ("open", files.map(function(f) { return f.get_uri(); }));
110-
}));*/
111105
},
112106

113107
initialize: function () {
114108
if (this.settings) return;
115-
Logger.info ("initialization ...");
116109
this.settings = new Settings.Settings ();
117-
Logger.info ("Settings creatad.");
118110
cpu.init (this.settings);
119-
Logger.info ("CPUFreq initialized.");
120111
},
121112

122113
vfunc_activate: function () {
123-
Logger.info ("activating ... " + !this.finishing);
124114
if (this.finishing) return;
125115
if (!this.active_window) {
126116
window = new MainWindow.MainWindow ({ application:this });
127-
Logger.info ("created MainWindow");
128117
window.connect ("destroy", () => {
129118
return true;
130119
});
131120
window.show_all ();
132121
cpu.profile_changed_callback = Lang.bind (this, this.on_profile_changed);
133-
Logger.info ("restoring saved " + this.settings.save);
134122
if (this.settings.save) cpu.restore_saved ();
135-
Logger.info ("post_init " + !!window.cpanel);
136123
if (window.cpanel) window.cpanel.post_init ();
137124
else this.quit ();
138125
window.connect ("realize", () => {
139-
Logger.info ("realize");
126+
Logger.debug ("realize");
140127
});
141128
} else {
142129
if (this.extension) {

common/HelperCPUFreq.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ function init (prefs) {
6363
get_governors ();
6464
get_frequencies ();
6565
default_profile = get_default_profile ();
66-
67-
//get_profile ("Testing Profile");
6866
}
6967

7068
function check_install () {
@@ -86,7 +84,6 @@ function check_install () {
8684
localctl = get_command_line_string (APPDIR + "/cpufreqctl version");
8785
debug ("Versions local:%s global:%s".format (localctl, globalctl));
8886
updated = localctl == globalctl;
89-
//if (!updated) cpufreqctl_path = APPDIR + "/cpufreqctl";
9087
}
9188
}
9289

@@ -354,7 +351,6 @@ function load_stage (prf) {
354351
} else if (stage == 3) {
355352
set_turbo (prf.turbo);
356353
} else if (stage == 4) {
357-
//TODO: Test applying per core frequencies on pstate
358354
if (pstate_present) {
359355
GLib.spawn_command_line_sync (pkexec_path + " " + cpufreqctl_path + " min " + prf.minf);
360356
} else {

common/Settings.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ var Settings = new Lang.Class({
9191
update_user_profile: function () {
9292
let s = JSON.stringify (current);
9393
this.set_string (USER_PROFILE_KEY, s);
94-
print ("Updating settings");
9594
},
9695

9796
get monitor () { return this.get_int (MONITOR_KEY); },
@@ -101,7 +100,6 @@ var Settings = new Lang.Class({
101100
return _guid;
102101
},
103102
set guid (val) {
104-
print ("set guid:", val, _guid);
105103
if (_guid == val) return;
106104
_guid = val;
107105
this.set_string (PROFILE_ID_KEY, _guid);
@@ -162,7 +160,6 @@ var Settings = new Lang.Class({
162160
return true;
163161
},
164162
set turbo (val) {
165-
print ("set turbo");
166163
if (!current || (current.turbo == val)) return;
167164
current.turbo = val;
168165
this.update_user_profile ();
@@ -173,7 +170,6 @@ var Settings = new Lang.Class({
173170
return 1;
174171
},
175172
set cpu_cores (val) {
176-
print ("set cores online");
177173
if (!current || (current.cpu == val)) return;
178174
current.cpu = val;
179175
this.update_user_profile ();
@@ -185,7 +181,6 @@ var Settings = new Lang.Class({
185181
return 0;
186182
},
187183
set min_freq (val) {
188-
print ("set min_freq");
189184
if (!current) return;
190185
var equal = true;
191186
for (let i = 0; i < current.cpu; i++) {
@@ -201,7 +196,6 @@ var Settings = new Lang.Class({
201196
return 0;
202197
},
203198
set max_freq (val) {
204-
print ("set max_freq");
205199
if (!current) return;
206200
var equal = true;
207201
for (let i = 0; i < current.cpu; i++) {
@@ -212,13 +206,11 @@ var Settings = new Lang.Class({
212206
},
213207

214208
get governor () {
215-
print ("get governor");
216209
if (current && current.core[0])
217210
return current.core[0].g;
218211
return "";
219212
},
220213
set governor (val) {
221-
print ("set governor");
222214
if (!current) return;
223215
var equal = true;
224216
for (let i = 0; i < current.cpu; i++) {

common/ui/ControlPanel.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,7 @@ var ControlPanel = new Lang.Class({
234234
}
235235
});
236236
this.add_submenu (this.activeg);
237-
//this.pack_start (this.activeg, true, true, 0);
238237
if (this.userspace && (cpu.frequencies.length > 0)) this.add_submenu (this.userspace);
239-
// this.pack_start (this.userspace, true, true, 0);
240238
},
241239

242240
on_governor: function (o) {
@@ -273,7 +271,6 @@ var ControlPanel = new Lang.Class({
273271
this.sliders_build ();
274272
if (this.activeg.label.indexOf ("Powersave") > -1) {
275273
this.slider_max.sensitive = false;
276-
//debug (this.activeg.label);
277274
} else if (this.activeg.label.indexOf ("Performance") > -1) {
278275
this.slider_min.sensitive = false;
279276
}

common/ui/InfoPanel.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ var InfoPanel = new Lang.Class({
187187
dis.close (null);
188188
if (model) {
189189
model = model.substring (model.indexOf (":") + 1).trim ();
190-
//if (model.lastIndexOf ("@") > -1) model = model.substring (0, model.lastIndexOf ("@")).trim ();
191190
if (model.toLowerCase().lastIndexOf ("amd") > -1) this.amd = true;
192191
model = model.replace ("(R)", "®");
193192
model = model.replace ("(TM)", "™");
@@ -199,7 +198,7 @@ var InfoPanel = new Lang.Class({
199198
return model.trim ().toString ();
200199
}
201200
} catch (e) {
202-
print ("Get CPU Error:", e.message);
201+
Logger.error ("cpu_name", e.message);
203202
}
204203
}
205204
return "unknown processor";
@@ -235,7 +234,7 @@ var InfoPanel = new Lang.Class({
235234
distro = model;
236235
}
237236
} catch (e) {
238-
print ("Get Release Error:", e.message);
237+
Logger.error ("linux_kernel", e.message);
239238
}
240239
}
241240
let kernel_version = Helper.get_command_line_string ("uname -r");

common/ui/MainWindow.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const Lang = imports.lang;
1717

1818
var APPDIR = getCurrentFile ()[1];
1919

20+
const Logger = imports.common.Logger;
2021
const cpu = imports.common.HelperCPUFreq;
2122
const InfoPanel = imports.common.ui.InfoPanel;
2223
const ControlPanel = imports.common.ui.ControlPanel;
@@ -39,7 +40,7 @@ var MainWindow = new Lang.Class ({
3940
if (!this.icon) try {
4041
this.icon = Gtk.Image.new_from_file (APPDIR + "/data/icons/cpufreq.svg").pixbuf;
4142
} catch (e) {
42-
error (e.message);
43+
Logger.error (e.message);
4344
}
4445
if (!cpu.installed) this.install ();
4546
else if (!cpu.updated) this.install (true);
@@ -99,8 +100,6 @@ var MainWindow = new Lang.Class ({
99100

100101
this.prefs_button = new Gtk.Button ({always_show_image: true, tooltip_text:"Preferences"});
101102
this.prefs_button.image = Gtk.Image.new_from_icon_name ("application-menu-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
102-
//this.prefs_button.image = Gtk.Image.new_from_gicon (new Gio.ThemedIcon({name: "cpufreq"}), Gtk.IconSize.SMALL_TOOLBAR);
103-
//Gtk.Image.new_from_file (APPDIR + "/data/icons/application-menu-symbolic.svg");
104103
this.prefs_button.get_style_context ().add_class ("hb-button");
105104
this.prefs_button.set_relief (Gtk.ReliefStyle.NONE);
106105
this.hb.pack_end (this.prefs_button);
@@ -190,7 +189,7 @@ function get_css_provider () {
190189
try {
191190
cssp.load_from_file (css_file);
192191
} catch (e) {
193-
print (e);
192+
Logger.error (e);
194193
cssp = null;
195194
}
196195
return cssp;

common/ui/Switch.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ var Switch = new Lang.Class({
1919
this.parent ({orientation:Gtk.Orientation.HORIZONTAL,margin:8});
2020
state = state || false;
2121
this.margin_left = 16;
22-
//this.margin_bottom = 8;
2322
this.get_style_context ().add_class ("switch");
2423
this.tooltip_text = tooltip;
2524

prefs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ var PageMonitorCPUFreq = new Lang.Class({
272272
this.pack_start (hbox, false, false, 0);
273273
this.cb_color = Gtk.CheckButton.new_with_label (_("Use color"));
274274
this.cb_color.tooltip_text = _("Colorful Monitor's title depending on warning state");
275-
//this.cb_color.margin = 6;
276275
this.cb_color.active = color_show;
277276
hbox.pack_start (this.cb_color, true, true, 0);
278277
this.cb_color.connect ('toggled', Lang.bind (this, (o)=>{

0 commit comments

Comments
 (0)