00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 # include <config.h>
00030 #endif
00031
00032 #include <glib.h>
00033
00034 #include <gtk/gtk.h>
00035 #include <sys/types.h>
00036 #include <signal.h>
00037
00038 #include "interface.h"
00039 #include "support.h"
00040 #include "lininfo.h"
00041 #include <unistd.h>
00042 #include <stdio.h>
00043
00044 #include <glib.h>
00045 #include <pthread.h>
00046
00047 GtkWidget *window1;
00048
00049
00050 struct cpu_info cpu;
00051 struct mem_info mem;
00052
00053 pthread_t thread_id;
00054
00055
00061 void*
00062 refresh (void* nothing)
00063 {
00064 int page;
00065 GtkNotebook *nb;
00066
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 }
00085
00091 int
00092 main (int argc, char *argv[])
00093 {
00094
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
00114
00115
00116
00117 window1 = create_window1 ();
00118 gtk_widget_show (window1);
00119
00120
00121 update_cpu ();
00122
00123
00124 gdk_threads_enter ();
00125
00126
00127 if(pthread_create(&thread_id,NULL,&refresh,NULL)==0)
00128 g_message("Collector thread created");
00129 else
00130
00131 g_critical("Could not create thread!");
00132
00133
00134
00135 gtk_main ();
00136
00137
00138 gdk_threads_leave();
00139
00140
00141 return 0;
00142 }