ccadeptic23 / Multi-Core-System-Monitor

Multi-Core System Monitor is an applet that displays in realtime the CPU usage for each core/cpu, Memory, Swap, Network usage, and Hard Disk (still in beta) information. It allows you to see at a glance how your system resources are being utilized. The goal for this applet is to display system resources in an elegant non-distracting way.
GNU General Public License v3.0
18 stars 4 forks source link

multiple "Preferences" item in context menu #9

Open hyOzd opened 8 years ago

hyOzd commented 8 years ago

I've noticed each time you move this applet around in your panel, a new duplicate "Preferences" item appears in context menu. I believe the problem is caused by this piece of code:

https://github.com/ccadeptic23/Multi-Core-System-Monitor/blob/master/applet.js#L141

on_orientation_changed: function (orientation) {
    this._initContextMenu();
},

I did some debugging, and it seems that; when you move an applet in the panel on_orientation_changed() method is called even if the orientation of the applet is the same. And this causes duplicate items in context menu.

ralphys commented 8 years ago

I fork'd the current version and made some small improvements to the UI.

https://github.com/ralphys/Multi-Core-System-Monitor/commit/8f531155665eee64c7ac964b8a764ffa951e6568#commitcomment-15498760

I also commented the function cos' it doesn't seem to need initialization of the menu on each orientation adjustment. Seems to work well here.