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. |
void lkmonitor_create_tray_icon | ( | ) |
Creates docklet.
Creates the tray_icon. Based on the code of jabber IM client.
Definition at line 77 of file lkmonitor.c.
References create_pixbuf(), docklet_onclick(), egg_tray_icon_new(), and window1.
Referenced by main().
00077 { 00078 00079 gint w = 0; 00080 gint h = 0; 00081 00082 docklet.eti = egg_tray_icon_new("lkmonitor"); 00083 docklet.eb = gtk_event_box_new(); 00084 docklet.image = gtk_image_new(); 00085 00086 GdkPixbuf *pb = NULL; 00087 GdkPixbuf *pb_scaled = NULL; 00088 00089 pb =create_pixbuf("lkmonitor/spider-shadow32.png"); 00090 gtk_icon_size_lookup(GTK_ICON_SIZE_LARGE_TOOLBAR, &w, &h); 00091 pb_scaled = gdk_pixbuf_scale_simple(pb, w, h, GDK_INTERP_BILINEAR); 00092 gtk_image_set_from_pixbuf(GTK_IMAGE(docklet.image), pb_scaled); 00093 00094 00095 gtk_container_add(GTK_CONTAINER(docklet.eb), docklet.image); 00096 gtk_container_add(GTK_CONTAINER(docklet.eti), docklet.eb); 00097 gtk_widget_show_all(GTK_WIDGET(docklet.eti)); 00098 00099 00100 g_signal_connect(G_OBJECT(docklet.eb), "button-press-event", G_CALLBACK(docklet_onclick), window1); 00101 00102 00103 g_object_ref(G_OBJECT(docklet.eti)); 00104 }
void lkmonitor_exit | ( | ) |
Performs program exit.
Stops collector thread and runs outside event loop.
Definition at line 54 of file lkmonitor.c.
00055 { 00056 extern gboolean collector_exit; 00057 00058 collector_exit=TRUE; 00059 gtk_main_quit(); 00060 }
void lkmonitor_fill_tv | ( | ) |
Fill Device Treeview with data.
void lkmonitor_init_widgets | ( | ) |
Initialize some widget properties.
void lkmonitor_write_settings | ( | ) |
Write settings.
Write new settings.
Definition at line 204 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().
00205 { 00206 //This is called from a callback, so we are still running in a gtk lock. 00207 GtkEntry *ent; 00208 GtkLabel *lbl; 00209 GtkSpinButton *spb; 00210 GString *gs; 00211 int val1,val2,val3,val4; 00212 00213 /*For Identification*/ 00214 ent=GTK_ENTRY(lookup_widget(window1,"ent_hostname")); 00215 gs=g_string_new(gtk_entry_get_text(ent)); 00216 write_string_to_file(gs->str,HOST_NAME); 00217 00218 ent=GTK_ENTRY(lookup_widget(window1,"ent_domainname")); 00219 gs=g_string_new(gtk_entry_get_text(ent)); 00220 write_string_to_file(gs->str,DOMAIN_NAME); 00221 00222 /*For Files*/ 00223 00224 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_fdmax")); 00225 val1=(int)gtk_spin_button_get_value_as_int(spb); 00226 00227 write_values_to_file(3,FILE_MAX,val1); 00228 00229 /*For Inodes*/ 00230 lbl=GTK_LABEL(lookup_widget(window1,"lbl_inmax")); 00231 val1=atoi((char *)gtk_label_get_text(lbl)); 00232 00233 lbl=GTK_LABEL(lookup_widget(window1,"lbl_ina")); 00234 val2=atoi((char *)gtk_label_get_text(lbl)); 00235 00236 write_values_to_file(2,INODES,val1,val2); 00237 00238 /*For POSIX signals*/ 00239 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_mq")); 00240 val1=gtk_spin_button_get_value_as_int(spb); 00241 write_values_to_file(1,P_MAX_Q,val1); 00242 00243 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_mpq")); 00244 val1=gtk_spin_button_get_value_as_int(spb); 00245 write_values_to_file(1,P_MAX_M,val1); 00246 00247 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_ms")); 00248 val1=gtk_spin_button_get_value_as_int(spb); 00249 write_values_to_file(1,P_MAX_S,val1); 00250 00251 /*For shared memory*/ 00252 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_pages")); 00253 val1=gtk_spin_button_get_value_as_int(spb); 00254 write_values_to_file(1,PAGE_MAX,val1); 00255 00256 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_max_segs")); 00257 val1=gtk_spin_button_get_value_as_int(spb); 00258 write_values_to_file(1,SEG_MAX,val1); 00259 00260 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_seg_size")); 00261 val1=gtk_spin_button_get_value_as_int(spb); 00262 write_values_to_file(1,SEG_SIZE,val1); 00263 00264 /*For semaphores*/ 00265 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_sem_per_id")); 00266 val1=gtk_spin_button_get_value_as_int(spb); 00267 00268 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_sem_val")); 00269 val2=gtk_spin_button_get_value_as_int(spb); 00270 00271 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_ops")); 00272 val3=gtk_spin_button_get_value_as_int(spb); 00273 00274 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_sem_id")); 00275 val4=gtk_spin_button_get_value_as_int(spb); 00276 00277 write_values_to_file(4,SEM,val1,val2,val3,val4); 00278 00279 /*For threads*/ 00280 spb=GTK_SPIN_BUTTON(lookup_widget(window1,"spb_maxthreads")); 00281 val1=gtk_spin_button_get_value_as_int(spb); 00282 00283 write_values_to_file(1,THREADS_MAX,val1); 00284 }