Quick clean up, update TODO, and display memory less than 1 MB

(Old svn revision: 5187)
This commit is contained in:
Mike Massonnet
2008-08-02 17:41:57 +00:00
parent 8ed5af2926
commit f61e15b987
9 changed files with 96 additions and 73 deletions

View File

@@ -1,3 +1,9 @@
2008-08-02 Mike Massonnet <mmassonnet@xfce.org>
* Display memory less than 1 MB with two decimals like 0.00 MB
* Quick clean up
* Update TODO
2008-07-31 Mike Massonnet <mmassonnet@xfce.org>
* Apply patch for BSD support from Landry Breuil

6
README
View File

@@ -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 **

7
TODO
View File

@@ -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

View File

@@ -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

View File

@@ -1,2 +1 @@
src/menu-positions.c
src/xfce-taskmanager-linux.c

View File

@@ -31,9 +31,19 @@
#include "functions.h"
#include "interface.h"
#include "taskmanager.h"
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#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);

View File

@@ -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;
@@ -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);

View File

@@ -18,9 +18,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <dirent.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#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;
@@ -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));
}

View File

@@ -17,33 +17,14 @@
* 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 <glib.h>
#include <libxfcegui4/libxfcegui4.h>
#ifdef __linux
#include <dirent.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#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);
@@ -51,3 +32,4 @@ void send_signal_to_task(gint task_id, gint signal);
void set_priority_to_task(gint task_id, gint prio);
#endif