Go to the source code of this file.
Functions | |
void | lkmonitor_exit () |
Performs program exit. | |
void | lkmonitor_create_tray_icon () |
Creates docklet. | |
void | lkmonitor_init_widgets () |
Initialize some widget properties. | |
void | lkmonitor_write_settings () |
Write settings. | |
void | lkmonitor_fill_tv () |
Fill Device Treeview with data. | |
char * | lkmonitor_itoa (int num) |
Converts from integet to char *. |
void lkmonitor_create_tray_icon | ( | ) |
Creates docklet.
Creates the tray_icon. Based on the code of jabber IM client.
Definition at line 79 of file lkmonitor.c.
References create_pixbuf(), docklet_onclick(), egg_tray_icon_new(), and window1.
Referenced by main().
00079 { 00080 00081 gint w = 0; 00082 gint h = 0; 00083 00084 docklet.eti = egg_tray_icon_new("lkmonitor"); 00085 docklet.eb = gtk_event_box_new(); 00086 docklet.image = gtk_image_new(); 00087 00088 GdkPixbuf *pb = NULL; 00089 GdkPixbuf *pb_scaled = NULL; 00090 00091 pb =create_pixbuf("lkmonitor/spider-shadow32.png"); 00092 gtk_icon_size_lookup(GTK_ICON_SIZE_LARGE_TOOLBAR, &w, &h); 00093 pb_scaled = gdk_pixbuf_scale_simple(pb, w, h, GDK_INTERP_BILINEAR); 00094 gtk_image_set_from_pixbuf(GTK_IMAGE(docklet.image), pb_scaled); 00095 00096 00097 gtk_container_add(GTK_CONTAINER(docklet.eb), docklet.image); 00098 gtk_container_add(GTK_CONTAINER(docklet.eti), docklet.eb); 00099 gtk_widget_show_all(GTK_WIDGET(docklet.eti)); 00100 00101 00102 g_signal_connect(G_OBJECT(docklet.eb), "button-press-event", G_CALLBACK(docklet_onclick), window1); 00103 00104 00105 g_object_ref(G_OBJECT(docklet.eti)); 00106 }
void lkmonitor_exit | ( | ) |
Performs program exit.
Stops collector thread and runs outside event loop.
Definition at line 56 of file lkmonitor.c.
00057 { 00058 extern gboolean collector_exit; 00059 00060 collector_exit=TRUE; 00061 gtk_main_quit(); 00062 }
void lkmonitor_fill_tv | ( | ) |
Fill Device Treeview with data.
void lkmonitor_init_widgets | ( | ) |
Initialize some widget properties.
char* lkmonitor_itoa | ( | int | num | ) |
Converts from integet to char *.
Converts an int to a string
num | Integer |
Definition at line 504 of file lkmonitor.c.
Referenced by get_process_info(), update_net_info(), and update_process_window().
00505 { 00506 GString *gs=g_string_new(""); 00507 00508 g_string_printf(gs,"%d",num); 00509 00510 return gs->str; 00511 00512 }
void lkmonitor_write_settings | ( | ) |
Write settings.
Write new settings.
Definition at line 416 of file lkmonitor.c.
References DOMAIN_NAME, FILE_MAX, HOST_NAME, INODES, lookup_widget(), P_MAX_M, P_MAX_Q, P_MAX_S, PAGE_MAX, SEG_MAX, SEG_SIZE, SEM, THREADS_MAX, window1, write_string_to_file(), and write_values_to_file().
Referenced by on_btn_write_clicked().
00417 { 00418 //This is called from a callback, so we are still running in a gtk lock. 00419 GtkEntry *ent; 00420 GtkLabel *lbl; 00421 GtkSpinButton *spb; 00422 GString *gs; 00423 int val1,val2,val3,val4; 00424 00425 /*For Identification*/ 00426 ent=GTK_ENTRY(lookup_widget(window1,"ent_hostname")); 00427 gs=g_string_new(gtk_entry_get_text(ent)); 00428 write_string_to_file(gs->str,HOST_NAME); 00429 00430 ent=GTK_ENTRY(lookup_widget(window1,"ent_domainname")); 00431 gs=g_string_new(gtk_entry_get_text(ent)); 00432 write_string_to_file(gs->str,DOMAIN_NAME); 00433 00434 /*For Files*/ 00435 00436 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_fdmax")); 00437 val1=(int)gtk_spin_button_get_value_as_int(spb); 00438 00439 write_values_to_file(3,FILE_MAX,val1); 00440 00441 /*For Inodes*/ 00442 lbl=GTK_LABEL(lookup_widget(window1,"lbl_inmax")); 00443 val1=atoi((char *)gtk_label_get_text(lbl)); 00444 00445 lbl=GTK_LABEL(lookup_widget(window1,"lbl_ina")); 00446 val2=atoi((char *)gtk_label_get_text(lbl)); 00447 00448 write_values_to_file(2,INODES,val1,val2); 00449 00450 /*For POSIX signals*/ 00451 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_mq")); 00452 val1=gtk_spin_button_get_value_as_int(spb); 00453 write_values_to_file(1,P_MAX_Q,val1); 00454 00455 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_mpq")); 00456 val1=gtk_spin_button_get_value_as_int(spb); 00457 write_values_to_file(1,P_MAX_M,val1); 00458 00459 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_ms")); 00460 val1=gtk_spin_button_get_value_as_int(spb); 00461 write_values_to_file(1,P_MAX_S,val1); 00462 00463 /*For shared memory*/ 00464 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_pages")); 00465 val1=gtk_spin_button_get_value_as_int(spb); 00466 write_values_to_file(1,PAGE_MAX,val1); 00467 00468 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_segs")); 00469 val1=gtk_spin_button_get_value_as_int(spb); 00470 write_values_to_file(1,SEG_MAX,val1); 00471 00472 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_seg_size")); 00473 val1=gtk_spin_button_get_value_as_int(spb); 00474 write_values_to_file(1,SEG_SIZE,val1); 00475 00476 /*For semaphores*/ 00477 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_sem_per_id")); 00478 val1=gtk_spin_button_get_value_as_int(spb); 00479 00480 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_sem_val")); 00481 val2=gtk_spin_button_get_value_as_int(spb); 00482 00483 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_ops")); 00484 val3=gtk_spin_button_get_value_as_int(spb); 00485 00486 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_sem_id")); 00487 val4=gtk_spin_button_get_value_as_int(spb); 00488 00489 write_values_to_file(4,SEM,val1,val2,val3,val4); 00490 00491 /*For threads*/ 00492 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_maxthreads")); 00493 val1=gtk_spin_button_get_value_as_int(spb); 00494 00495 write_values_to_file(1,THREADS_MAX,val1); 00496 }