#include <glib.h>
#include <gtk/gtk.h>
#include <sys/types.h>
#include <signal.h>
#include "interface.h"
#include "support.h"
#include "lininfo.h"
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
Go to the source code of this file.
Functions | |
void * | refresh (void *nothing) |
int | main (int argc, char *argv[]) |
Variables | |
GtkWidget * | window1 |
cpu_info | cpu |
mem_info | mem |
pthread_t | thread_id |
|
Program entry point
Definition at line 92 of file main.c. References create_window1(), refresh(), thread_id, update_cpu(), and window1. 00093 { 00094 //Added manually by fernape. 00095 gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, 00096 argc, argv, 00097 GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR, 00098 NULL); 00099 00100 #ifdef ENABLE_NLS 00101 bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); 00102 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); 00103 textdomain (GETTEXT_PACKAGE); 00104 #endif 00105 00106 00107 gdk_threads_init (); 00108 00109 gtk_set_locale (); 00110 gtk_init (&argc, &argv); 00111 00112 /* 00113 * The following code was added by Glade to create one of each component 00114 * (except popup menus), just so that you see something after building 00115 * the project. Delete any crefresh);omponents that you don't want shown initially. 00116 */ 00117 window1 = create_window1 (); 00118 gtk_widget_show (window1); 00119 00120 //First calls to avoid 'cold start' effects. 00121 update_cpu (); 00122 00123 00124 gdk_threads_enter (); //Begin of critial section 00125 00126 //Launch thread 00127 if(pthread_create(&thread_id,NULL,&refresh,NULL)==0) 00128 g_message("Collector thread created"); 00129 else 00130 //Error creating thread 00131 g_critical("Could not create thread!"); 00132 00133 00134 00135 gtk_main (); //Run inside event main loop 00136 00137 00138 gdk_threads_leave(); //Marks end of critical section 00139 00140 00141 return 0; 00142 }
|
|
Function that represent the collector thread behaviour Collector thread runs into an infinite loop, scanning window and refreshing information if required.
Definition at line 62 of file main.c. References lookup_widget(), update_mem(), and window1. Referenced by main(). 00063 { 00064 int page; 00065 GtkNotebook *nb; 00066 //Get current page from the notebook 00067 for(;;){ 00068 nb = (GtkNotebook *) (lookup_widget (window1, "nb_main")); 00069 page = (int) gtk_notebook_get_current_page (nb); 00070 00071 switch (page) 00072 { 00073 case 1: 00074 update_mem (); 00075 break; 00076 case 4: 00077 break; 00078 case 5: 00079 break; 00080 } 00081 00082 sleep(1); 00083 } 00084 }
|
|
Definition at line 50 of file main.c. Referenced by get_cpu_info(), and update_cpu(). |
|
Definition at line 51 of file main.c. Referenced by get_mem_info(), and update_mem(). |
|
Definition at line 53 of file main.c. Referenced by lkmonitor_exit(), and main(). |
|
Update data functions Show updated data to user Definition at line 47 of file main.c. Referenced by create_window1(), main(), refresh(), update_cpu(), and update_mem(). |