A new CPUFreq Applet

Yes, I’ve just rewritten the cpufreq applet. There were some things that I wanted for the applet and I hadn’t done yet because it was necessary to change the current code design.

Some of them are:

  • The applet should be independent of the data access method. The applet should behave as a simple viewer, and it shouldn’t know the data access details. My solution is a monitor that will do the data access work and will give these data to the applet
  • The current applet is updated every second, even when there aren’t changes. I think it’s an error because most of the time, the cpu keeps the same frequency. With the new monitor it’s not the applet who is running every second, but the monitor. The monitor will get the data every second and will emit a signal when there are changes. The applet only has to listen for the signal for doing the update

I think that the advantages are evident . . .

I thought that the best way to do these things, it was an object oriented design. The monitor is an abstract class (CPUFreqMonitor) that has a child class for every possible monitor (CPUFreqMonitorProcs, CPUFreqMonitorSysfs, . . .). The applet only knows the CPUFreqMonitor class, so the methods for getting the data are virtual methods, polymorphic entities. In this way, we can add new monitors in the future (based on libcpufreq, HAL or whatever) by only writing a new class and without changing any line of code in the applet. We can even decide which monitor will be used at run time.

CPUFreq Applet UML
CPUFreq Applet new code design in UML

We have now an applet more efficient and extensible.

While I rewrote the code I also migrated from gnome_about to gtk_about and I did some code cleanups.

I haven’t committed yet, because I want to test it a little more. I think I will commit with the new icons, since nobody has said anything bad of them.

Mortal Kombat II

I’ve never been an enthusiast of the computer games, but if there is a computer game of my childhood, it’s Mortal Kombat II. I’ve wasted many hours of my life playing it.

The first time I tried dosbox, MK2 was not supported, but when the other day steve-o talked to me about dosbox, I thought I had to take a look at the list of supported games again. God! MK2 is perfectly supported since dosbox 0.61!!

I was remembering my childhood playing for a while. I had forgotten all of the fatalities and the Shang Tsung morphs, so I was googling a bit.

Mortal Kombat II
Shang Tsung Wins!