/home/fernape/Projects/lkmonitor/src/callbacks.c

Go to the documentation of this file.
00001 /*
00002         lkmonitor (Linux Kernel Monitor)
00003 
00004         Application for monitoring and tuning a Linux kernel.
00005 
00006         Copyright (C) 2005-2008  Fernando ApesteguĂ­a
00007 
00008         This program is free software; you can redistribute it and/or
00009         modify it under the terms of the GNU General Public License
00010         as published by the Free Software Foundation; either version 2
00011         of the License, or (at your option) any later version.
00012 
00013         This program is distributed in the hope that it will be useful,
00014         but WITHOUT ANY WARRANTY; without even the implied warranty of
00015         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016         GNU General Public License for more details.
00017 
00018         You should have received a copy of the GNU General Public License
00019         along with this program; if not, write to the Free Software
00020         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021 */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #  include <config.h>
00025 #endif
00026 
00027 #include <gtk/gtk.h>
00028 
00029 #include "callbacks.h"
00030 #include "interface.h"
00031 #include "support.h"
00032 #include "lkmonitor.h"
00033 #include "lininfo.h"
00034 #include "others.h"
00035 #include "update.h"
00036 #include "procupdate.h"
00037 
00038 
00039 void
00040 on_about1_activate                     (GtkMenuItem     *menuitem,
00041                                         gpointer         user_data)
00042 {
00043         gtk_widget_show(create_about());
00044 }
00045 
00046 
00047 void
00048 on_quit1_activate                      (GtkMenuItem     *menuitem,
00049                                         gpointer         user_data)
00050 {
00051   lkmonitor_exit();
00052   gtk_main_quit();
00053   
00054 }
00055 
00056 gboolean
00057 on_window1_delete_event                (GtkWidget       *widget,
00058                                         GdkEvent        *event,
00059                                         gpointer         user_data)
00060 {
00061         extern gboolean is_icon;
00062         
00063         is_icon=TRUE;
00064         gtk_widget_hide(widget);
00065         return TRUE; //With TRUE the signal is not propagated up.  
00066         
00067 }
00068 
00069 void
00070 on_btn_load_clicked                    (GtkButton       *button,
00071                                         gpointer         user_data)
00072 {
00073         update_settings();
00074 
00075 }
00076 
00077 void
00078 on_btn_write_clicked                   (GtkButton       *button,
00079                                         gpointer         user_data)
00080 {
00081   lkmonitor_write_settings();
00082   //Now, we should read settings again to properly update the data.
00083 update_settings();
00084 }
00085 
00086 void
00087 on_btn_dev_load_clicked                (GtkButton       *button,
00088                                         gpointer         user_data)
00089 {
00090   update_devs();
00091 }
00092 
00093 void
00094 on_btn_comm_reload_clicked             (GtkButton       *button,
00095                                         gpointer         user_data)
00096 {
00097         update_channels();
00098 }
00099 
00100 
00101 void
00102 on_gtv_processes_row_activated         (GtkTreeView     *treeview,
00103                                         GtkTreePath     *path,
00104                                         GtkTreeViewColumn *column,
00105                                         gpointer         user_data)
00106 {
00107 
00108   GtkWindow *window;
00109   GtkTreeModel *model;
00110   GtkTreeIter iter;
00111   int pid;
00112   gchar *name=NULL;
00113 
00114   window=GTK_WINDOW(create_window2());
00115 
00116   model=GTK_TREE_MODEL(gtk_tree_view_get_model(treeview));
00117   if(gtk_tree_model_get_iter(model,&iter,path)){
00118           gtk_tree_model_get(model,&iter,0,&pid,1,&name,-1);
00119 
00120           /* Call the function to collect the process information */
00121                 update_process_window(pid,name,window);
00122 
00123         gtk_widget_show(GTK_WIDGET(window));
00124   }
00125 
00126 }
00127 
00128 
00129 
00130 void
00131 on_tv_maps_row_activated               (GtkTreeView     *treeview,
00132                                         GtkTreePath     *path,
00133                                         GtkTreeViewColumn *column,
00134                                         gpointer         user_data)
00135 {
00136         GtkWindow *window;
00137         GtkTreeModel *model;
00138         GtkTreeIter iter;
00139         GString *title=g_string_new("");
00140         gchar *address;
00141         char *p;
00142         int pid;
00143 
00144         /* Get the address interval */
00145         model=GTK_TREE_MODEL(gtk_tree_view_get_model(treeview));
00146         if(gtk_tree_model_get_iter(model,&iter,path)){
00147                 gtk_tree_model_get(model,&iter,0,&address,-1);
00148 
00149                 /* Get the PID from the window title... 
00150                 * This is a bit dirty, I guess we can do it
00151                 * in a better way...
00152                 * */
00153                 window=GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(treeview)));
00154                 g_string_printf(title,"%s",gtk_window_get_title(window));
00155 
00156                 if((p=strstr(title->str, "PID"))!=NULL){
00157                         sscanf(p,"PID: %d",&pid);
00158                         /* Get details for the selected memory region */
00159                         update_mm_details(address,window,pid);
00160                 }
00161         }
00162         /* Free the GString */
00163         g_string_free(title,TRUE);
00164 }
00165 
00166 
00167 void
00168 on_modules_refresh_clicked             (GtkButton       *button,
00169                                         gpointer         user_data)
00170 {
00171 
00172         update_modules_info();
00173 
00174 }
00175 

Generated on Tue Apr 1 22:52:51 2008 for lkmonitor by  doxygen 1.5.1