diff --git a/ChangeLog b/ChangeLog index e8460f4..bd54bc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-02 Mike Massonnet + + * Display memory less than 1 MB with two decimals like 0.00 MB + * Quick clean up + * Update TODO + 2008-07-31 Mike Massonnet * Apply patch for BSD support from Landry Breuil diff --git a/README b/README index c799d3d..090a906 100644 --- a/README +++ b/README @@ -2,18 +2,18 @@ ************ xfce4-taskmanager ************ ********************************************* -xfce4-taskmanager is a small taskmanager based on the Xfce 4 libraries. +xfce4-taskmanager is a small taskmanager for the Xfce 4 desktop. ** Retrieving ** The latest version of xfce4-taskmanager can always be obtained from -http://developer.berlios.de/projects/xfce-goodies/. Please check to +http://goodies.xfce.org/releases/xfce4-taskmanager/. Please check to see if there is a newer version available before reporting bugs. ** Requirements ** xfce4-taskmanager needs the Xfce 4's GUI library libxfcegui4. -Xfce's core libraries can be obtained from http://xfce.org/. +Xfce's core libraries can be obtained from http://www.xfce.org/. ** Building ** diff --git a/TODO b/TODO index d6ddcf8..b2cd58b 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,9 @@ -+ menu to check the columns to display instead of normal/more info ++ drop old gtk_tooltips ++ display mem < 0MB (we can't show in KB unless we rewrite the sort function + which I think is not worth the effort) ++ support multi core (show cpu usage per process) ++ move get_cpu_usage() out from functions.c, it is an os-dependant function + + *BSD support with the 'kvm' files + ability to switch to a tree-store + sending custom signals diff --git a/po/POTFILES.in b/po/POTFILES.in index e31e763..edf9a4e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,6 +2,6 @@ xfce4-taskmanager.desktop.in src/callbacks.c src/functions.c src/interface.c -src/taskmanager-linux.c src/taskmanager-bsd.c +src/taskmanager-linux.c src/main.c diff --git a/po/POTFILES.skip b/po/POTFILES.skip index b79e8b5..1f710d0 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -1,2 +1 @@ src/menu-positions.c -src/xfce-taskmanager-linux.c diff --git a/src/callbacks.h b/src/callbacks.h index 75853de..3cbf43d 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -31,9 +31,19 @@ #include "functions.h" #include "interface.h" - #include "taskmanager.h" +#ifdef HAVE_SIGNAL_H +#include +#define SIGNAL_NO 0 +#define SIGNAL_KILL SIGKILL +#define SIGNAL_TERM SIGINT +#define SIGNAL_CONT SIGCONT +#define SIGNAL_STOP SIGSTOP +#else +/* FIXME */ +#endif + void on_preferences(GtkButton *button); void on_information(GtkButton *button); void on_show_info_toggled(GtkCheckMenuItem *menuitem, gint uid); diff --git a/src/interface.c b/src/interface.c index b70d0ba..a5b209a 100644 --- a/src/interface.c +++ b/src/interface.c @@ -20,13 +20,6 @@ #include "interface.h" -#define GLADE_HOOKUP_OBJECT(component,widget,name) \ - g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) - -#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ - g_object_set_data (G_OBJECT (component), name, widget) - GtkWidget* create_main_window (void) { GtkWidget *window; @@ -79,7 +72,7 @@ GtkWidget* create_main_window (void) gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN); treeview = gtk_tree_view_new (); - gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (treeview), FALSE); + gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (treeview), FALSE); gtk_widget_show (treeview); gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview); @@ -379,23 +372,29 @@ void show_about_dialog(void) NULL }; about_dialog = gtk_about_dialog_new(); - gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(about_dialog), - PACKAGE_NAME); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_version( + GTK_ABOUT_DIALOG(about_dialog), PACKAGE_VERSION); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_comments( + GTK_ABOUT_DIALOG(about_dialog), _("Xfce4-Taskmanager is an easy to use taskmanager")); - gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_website( + GTK_ABOUT_DIALOG(about_dialog), "http://goodies.xfce.org/projects/applications/xfce4-taskmanager"); - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_logo_icon_name( + GTK_ABOUT_DIALOG(about_dialog), "xfce-system"); - gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_authors( + GTK_ABOUT_DIALOG(about_dialog), authors); - gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_translator_credits( + GTK_ABOUT_DIALOG(about_dialog), _("translator-credits")); - gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_license( + GTK_ABOUT_DIALOG(about_dialog), xfce_get_license_text(XFCE_LICENSE_TEXT_GPL)); - gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(about_dialog), + gtk_about_dialog_set_copyright( + GTK_ABOUT_DIALOG(about_dialog), "Copyright \302\251 2005-2008 Johannes Zellner"); gtk_window_set_icon_name(GTK_WINDOW(about_dialog), GTK_STOCK_ABOUT); @@ -419,19 +418,32 @@ void change_list_store_view(void) void fill_list_item(gint i, GtkTreeIter *iter) { + struct task *task; + gchar *pid; + gchar *ppid; + gchar *state; + gchar *vsize; + gchar *rss; + gchar *name; + gchar *uname; + gchar *time; + gchar *prio; + if(iter != NULL) { - struct task *task = &g_array_index(task_array, struct task, i); + task = &g_array_index(task_array, struct task, i); - gchar *pid = g_strdup_printf("%i", task->pid); - gchar *ppid = g_strdup_printf("%i", task->ppid); - gchar *state = g_strdup_printf("%s", task->state); - gchar *vsize = g_strdup_printf("%i MB", task->vsize/1024/1024); - gchar *rss = g_strdup_printf("%i MB", task->rss/1024/1024); - gchar *name = g_strdup_printf("%s", task->name); - gchar *uname = g_strdup_printf("%s", task->uname); - gchar *time = g_strdup_printf("%0d%%", (guint)task->time_percentage); - gchar *prio = g_strdup_printf("%i", task->prio); /* my change */ + pid = g_strdup_printf("%i", task->pid); + ppid = g_strdup_printf("%i", task->ppid); + state = g_strdup_printf("%s", task->state); + vsize = g_strdup_printf((task->vsize/1024/1024 > 0) ? "%.0f MB" : "%.2f MB", + (gdouble)(task->vsize)/1024/1024); + rss = g_strdup_printf((task->rss/1024/1024 > 0) ? "%.0f MB" : "%.2f MB", + (gdouble)(task->rss)/1024/1024); + name = g_strdup_printf("%s", task->name); + uname = g_strdup_printf("%s", task->uname); + time = g_strdup_printf("%0d%%", (guint)task->time_percentage); + prio = g_strdup_printf("%i", task->prio); /* my change */ gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_NAME, name, -1); gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PID, pid, -1); diff --git a/src/taskmanager-linux.c b/src/taskmanager-linux.c index d1c7fdb..64e17e3 100644 --- a/src/taskmanager-linux.c +++ b/src/taskmanager-linux.c @@ -18,20 +18,29 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include +#include +#include +#include +#include +#include + #include "taskmanager.h" -struct task get_task_details(gint pid) +static gint pagesize = 0; + +static struct task get_task_details(gint pid) { - FILE *task_file; - FILE *cmdline_file; - gchar dummy[255]; - gint idummy; - gchar buffer_status[1024]; - struct task task; - struct passwd *passwdp; - struct stat status; - gchar filename[255]; - gchar cmdline_filename[255]; + FILE *task_file; + FILE *cmdline_file; + gchar dummy[255]; + gint idummy; + gchar buffer_status[1024]; + struct task task; + struct passwd *passwdp; + struct stat status; + gchar filename[255]; + gchar cmdline_filename[255]; sprintf(filename, "/proc/%i/stat", pid); sprintf(cmdline_filename, "/proc/%i/cmdline", pid); @@ -116,7 +125,7 @@ struct task get_task_details(gint pid) task.uid = status.st_uid; passwdp = getpwuid(task.uid); if(passwdp != NULL && passwdp->pw_name != NULL) - g_strlcpy(task.uname, passwdp->pw_name, sizeof task.uname); + g_strlcpy(task.uname, passwdp->pw_name, sizeof(task.uname)); } diff --git a/src/taskmanager.h b/src/taskmanager.h index ba60463..f47fced 100644 --- a/src/taskmanager.h +++ b/src/taskmanager.h @@ -17,37 +17,19 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef XFCE4_TASKMANAGER_LINUX_H -#define XFCE4_TASKMANAGER_LINUX_H +#ifndef TASKMANAGER_H +#define TASKMANAGER_H #include #include -#ifdef __linux -#include -#include -#include -#include -#include -#include -#include -#endif - #include "types.h" -#define SIGNAL_NO 0 -#define SIGNAL_KILL SIGKILL -#define SIGNAL_TERM SIGINT -#define SIGNAL_CONT SIGCONT -#define SIGNAL_STOP SIGSTOP - -static gint pagesize = 0; - -struct task get_task_details(gint pid); -GArray *get_task_list(void); -gboolean get_system_status(system_status *sys_stat); -gboolean get_cpu_usage_from_proc(system_status *sys_stat); -void send_signal_to_task(gint task_id, gint signal); -void set_priority_to_task(gint task_id, gint prio); +GArray *get_task_list(void); +gboolean get_system_status(system_status *sys_stat); +gboolean get_cpu_usage_from_proc(system_status *sys_stat); +void send_signal_to_task(gint task_id, gint signal); +void set_priority_to_task(gint task_id, gint prio); #endif +