More work on opensolaris...

Cleaning some warnings.
Added checks for kstat, so cpu applet can show usage via kstat api. Added tests for kstat in configure script.
This commit is contained in:
Sanel Zukan
2013-01-09 16:01:35 +00:00
parent 6495f53404
commit 0b4d9a7f26
9 changed files with 52 additions and 21 deletions

View File

@@ -55,10 +55,6 @@ static void clear_applet(AppletData *a) {
delete a;
}
AppletManager::~AppletManager() {
clear();
}
bool AppletManager::load(const char *path) {
dlerror();
const char *dl_err = NULL;
@@ -130,11 +126,12 @@ bool AppletManager::load(const char *path) {
return true;
}
void AppletManager::clear(void) {
void AppletManager::clear(Panel *p) {
E_RETURN_IF_FAIL(applet_list.size() > 0);
AListIter it = applet_list.begin(), ite = applet_list.end();
while(it != ite) {
p->remove((*it)->awidget);
clear_applet(*it);
it = applet_list.erase(it);
}

View File

@@ -36,9 +36,8 @@ class AppletManager {
private:
AList applet_list;
public:
~AppletManager();
bool load(const char *path);
void clear(void);
void clear(Panel *p);
void fill_group(Panel *p);
void unfill_group(Panel *p);

View File

@@ -30,13 +30,13 @@ rule PanelApplet
}
# append default extension
target = $(<:S=$(SUFLIB_SHARED)) ;
target = $(1:S=$(SUFLIB_SHARED)) ;
Main $(target) : $(>) ;
ObjectC++Flags $(>) : $(GLOBALFLAGS) -fPIC $(FLTKINCLUDE) -I [ FDirName $(TOP) ede-panel ] $(EDELIBINCLUDE) ;
Main $(target) : $(2) ;
ObjectC++Flags $(2) : $(GLOBALFLAGS) -fPIC $(FLTKINCLUDE) -I [ FDirName $(TOP) ede-panel ] $(EDELIBINCLUDE) ;
LinkAgainst $(target) : $(3) $(EDELIBLIB) $(EDELIB_GUI_LIB) $(FLTKLIB) $(STDLIB) ;
LINKFLAGS on $(target) = $(linker_stuff) [ on $(target) return $(LINKFLAGS) ] ;
LINKFLAGS on $(target) = $(linker_stuff) [ on $(target) return $(LINKFLAGS) ] $(3) ;
InstallProgram $(EDE_PANEL_APPLETS_DIR) : $(target) ;

View File

@@ -387,10 +387,13 @@ void Panel::hide(void) {
E_DEBUG("Panel::hide()\n");
/* strange; this is not called when panel goes out :S */
mgr.clear();
save_config();
/* clear loaded widgets */
mgr.clear(this);
/* clear whatever was left out, but was not part of applet manager */
clear();
save_config();
Fl_Window::hide();
}

View File

@@ -9,6 +9,10 @@
* For ede-panel by Sanel Zukan 2009
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <limits.h>
#include <unistd.h>
#include <stdarg.h>
@@ -26,8 +30,10 @@
# include <sys/sysinfo.h>
#endif
#ifdef HAVE_KSTAT_H
#ifdef HAVE_KSTAT
# include <kstat.h>
# include <sys/sysinfo.h>
# include <string.h> /* strncmp */
#endif
#ifdef __FreeBSD__
@@ -335,11 +341,10 @@ void CPUMonitor::get_cpu_info() {
#endif /* linux */
#ifdef HAVE_KSTAT_H
#ifdef HAVE_KSTAT
# ifdef HAVE_OLD_KSTAT
# define ui32 ul
#endif
static kstat_ctl_t *kc = NULL;
static kid_t kcid;
kid_t new_kcid;

View File

@@ -10,4 +10,4 @@
SubDir TOP ede-panel applets cpu-monitor ;
PanelApplet cpu_monitor : CpuMonitor.cpp ;
PanelApplet cpu_monitor : CpuMonitor.cpp : $(KSTAT_LIBS) ;

View File

@@ -184,9 +184,8 @@ void StartMenu::popup(void) {
pressed_menu_button = this;
redraw();
Fl_Widget *mb = this;
#if (FL_MAJOR_VERSION >= 1) && (FL_MINOR_VERSION >= 3)
Fl_Widget *mb = this;
Fl::watch_widget_pointer(mb);
#endif
@@ -287,7 +286,7 @@ bool StartMenu::can_reload(void) {
time_t c, diff;
c = time(NULL);
diff = difftime(c, last_reload);
diff = (time_t)difftime(c, last_reload);
last_reload = c;
if(diff >= MENU_UPDATE_DIFF) return true;