diff --git a/ede-panel/applets/mem-monitor/MemMonitor.cpp b/ede-panel/applets/mem-monitor/MemMonitor.cpp index 547901e..530b36f 100644 --- a/ede-panel/applets/mem-monitor/MemMonitor.cpp +++ b/ede-panel/applets/mem-monitor/MemMonitor.cpp @@ -1,20 +1,54 @@ -/* assume Linux here */ -#include +/* + * $Id: Panel.cpp 3512 2013-01-09 13:45:49Z karijes $ + * + * Copyright (C) 2012-2013 Sanel Zukan + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +#include +#include "Applet.h" +#include + +#if defined(linux2) +#include #include #include #include #include #include #include -#include -#include "MemMonitor.h" EDELIB_NS_USING(color_rgb_to_fltk) #define UPDATE_INTERVAL 1.0f #define STR_CMP(first, second, n) (strncmp(first, second, n) == 0) +class MemMonitor : public Fl_Box { +private: + int mem_usedp, swap_usedp; +public: + MemMonitor() : Fl_Box(0, 0, 45, 25), mem_usedp(0), swap_usedp(0) { + box(FL_THIN_DOWN_BOX); + } + + void update_status(void); + void draw(void); + int handle(int e); +}; + inline int height_from_perc(int perc, int h) { return (perc * h) / 100; } @@ -24,10 +58,6 @@ static void mem_timeout_cb(void *d) { Fl::repeat_timeout(UPDATE_INTERVAL, mem_timeout_cb, d); } -MemMonitor::MemMonitor() : Fl_Box(0, 0, 45, 25), mem_usedp(0), swap_usedp(0) { - box(FL_THIN_DOWN_BOX); -} - void MemMonitor::update_status(void) { struct sysinfo sys; if(sysinfo(&sys) != 0) return; @@ -81,11 +111,24 @@ int MemMonitor::handle(int e) { return Fl_Box::handle(e); } +#else + +class MemMonitor : public Fl_Box { +public: + MemMonitor() : Fl_Box(0, 0, 45, 25) { + box(FL_THIN_DOWN_BOX); + label("n/a"); + tooltip(_("Memory information not available for this platform")); + } +}; + +#endif /* linux */ + EDE_PANEL_APPLET_EXPORT ( MemMonitor, EDE_PANEL_APPLET_OPTION_ALIGN_RIGHT, "Memory monitor", - "0.1", + "0.2", "empty", "Sanel Zukan" ) diff --git a/ede-panel/applets/mem-monitor/MemMonitor.h b/ede-panel/applets/mem-monitor/MemMonitor.h deleted file mode 100644 index b4e2d5b..0000000 --- a/ede-panel/applets/mem-monitor/MemMonitor.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __MEMMONITOR_H__ -#define __MEMMONITOR_H__ - -#include -#include "Applet.h" - -class MemMonitor : public Fl_Box { -private: - int mem_usedp, swap_usedp; - -public: - MemMonitor(); - void update_status(void); - void draw(void); - int handle(int e); -}; - -#endif