#include <gtk/gtk.h>#include <sys/types.h>#include <signal.h>#include "interface.h"#include "support.h"#include "lininfo.h"#include "update.h"#include "lkmonitor.h"#include <unistd.h>#include <stdio.h>#include <glib.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 |
| dev_info | devs |
| settings_info | settings |
| stats_info | stats |
| acpi_info | acpi |
| cmd_ver | cmdversion |
| channels_info | cn_info |
| net_dev_info | netinfo |
| fs_info | fsinfo |
| modules_info | modinfo |
| pthread_t | thread_id |
| GThread * | gt_collector = NULL |
| gboolean | is_icon = FALSE |
| gboolean | collector_exit = FALSE |
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Program entry point
| argc | Number of arguments | |
| argv | string array (for arguments) |
Definition at line 129 of file main.c.
References acpi, BATT_INFO, BATT_INFO1, acpi_info::battery, create_window1(), get_battery_info(), gt_collector, lkmonitor_create_tray_icon(), lkmonitor_init_widgets(), refresh(), update_channels(), update_cmd_ver(), update_cpu(), update_devs(), update_modules_info(), update_net_info(), update_settings(), and window1.
00130 { 00131 gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, 00132 argc, argv, 00133 GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR, 00134 NULL); 00135 00136 #ifdef ENABLE_NLS 00137 bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); 00138 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); 00139 textdomain (GETTEXT_PACKAGE); 00140 #endif 00141 00142 00143 gdk_threads_init (); 00144 00145 00146 gtk_set_locale (); 00147 gtk_init (&argc, &argv); 00148 00149 00150 /* 00151 * The following code was added by Glade to create one of each component 00152 * (except popup menus), just so that you see something after building 00153 * the project. Delete any crefresh);omponents that you don't want shown initially. 00154 */ 00155 lkmonitor_create_tray_icon(); 00156 window1 = create_window1 (); 00157 /*Set some widget properties*/ 00158 00159 lkmonitor_init_widgets(window1); 00160 00161 gtk_widget_show (window1); 00162 00163 00164 00165 /*First calls for static information*/ 00166 00167 update_cpu (); 00168 update_devs(); 00169 update_settings(); 00170 update_cmd_ver(); 00171 update_channels(); 00172 update_net_info(); 00173 update_modules_info(); 00174 00175 if(get_battery_info(&acpi.battery,BATT_INFO)==-1) 00176 get_battery_info(&acpi.battery,BATT_INFO1); 00177 00178 00179 gdk_threads_enter (); //Begin of critial section 00180 00181 /*Launch thread*/ 00182 00183 gt_collector=g_thread_create((GThreadFunc)refresh,NULL,TRUE,NULL); 00184 if(gt_collector!=NULL) 00185 g_message("Collector thread created"); 00186 else 00187 /*Error creating thread*/ 00188 g_critical("Could not create thread!"); 00189 00190 00191 gtk_main (); 00192 00193 gdk_threads_leave(); //Marks end of critical section 00194 00195 g_thread_join(gt_collector); /*Wait for collector thread to finish*/ 00196 00197 return 0; 00198 }
| void refresh | ( | void * | nothing | ) |
Function that represent the collector thread behaviour Collector thread runs into an infinite loop, scanning window and refreshing information if required.
| nothing | Required for POSIX compatibility. Not used |
Definition at line 78 of file main.c.
References collector_exit, is_icon, lookup_widget(), update_cpu_mhz(), update_fs_info(), update_mem(), update_misc(), update_net_info(), update_process(), and window1.
Referenced by main().
00079 { 00080 int page; 00081 GtkNotebook *nb; 00082 00083 nb = (GtkNotebook *) (lookup_widget (window1, "nb_main")); 00084 //Get current page from the notebook 00085 while(!collector_exit){ 00086 if(!is_icon){ 00087 page = (int) gtk_notebook_get_current_page (nb); 00088 switch (page) 00089 { 00090 case 0: 00091 update_cpu_mhz(); 00092 break; 00093 case 1: 00094 update_mem (); 00095 break; 00096 case 2: 00097 // update_devs(); 00098 break; 00099 case 3: 00100 // update_settings(); 00101 break; 00102 case 4: 00103 update_misc(); 00104 break; 00105 case 5: 00106 update_process(); 00107 break; 00108 case 6: 00109 break; 00110 case 7: 00111 update_net_info(); 00112 break; 00113 case 8: 00114 update_fs_info(); 00115 break; 00116 } 00117 } 00118 sleep(1); 00119 00120 } 00121 }
| struct cmd_ver cmdversion |
Definition at line 60 of file main.c.
Referenced by get_cmd_ver_info(), get_loadavg_info(), update_cmd_ver(), and update_process().
| struct channels_info cn_info |
| gboolean collector_exit = FALSE |
| GThread* gt_collector = NULL |
| gboolean is_icon = FALSE |
Definition at line 69 of file main.c.
Referenced by docklet_onclick(), on_window1_delete_event(), and refresh().
| struct modules_info modinfo |
| struct net_dev_info netinfo |
| struct settings_info settings |
| struct stats_info stats |
1.5.1