- initial priority setting
- few bugfixes (Old svn revision: 3940)
This commit is contained in:
103
INSTALL
103
INSTALL
@@ -1,13 +1,19 @@
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
@@ -20,9 +26,9 @@ debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
@@ -32,20 +38,17 @@ some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
@@ -67,51 +70,49 @@ The simplest way to compile this package is:
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
Some systems require unusual options for compilation or linking that the
|
||||
`configure' script does not know about. Run `./configure --help' for
|
||||
details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
@@ -122,7 +123,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
@@ -137,11 +138,11 @@ you can use the `configure' options `--x-includes=DIR' and
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
There may be some features `configure' cannot figure out automatically,
|
||||
but needs to determine by the type of machine the package will run on.
|
||||
Usually, assuming the package is built to be run on the _same_
|
||||
architectures, `configure' can figure that out, but if it prints a
|
||||
message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
@@ -156,7 +157,7 @@ where SYSTEM can have one of these forms:
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
@@ -167,9 +168,9 @@ eventually be run) with `--host=TYPE'.
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
If you want to set default values for `configure' scripts to share, you
|
||||
can create a site shell script called `config.site' that gives default
|
||||
values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
@@ -178,7 +179,7 @@ A warning: not all `configure' scripts look for a site script.
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
@@ -186,14 +187,18 @@ them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
`configure' recognizes the following options to control how it operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
|
||||
@@ -46,6 +46,7 @@ gboolean on_treeview1_button_press_event(GtkButton *button, GdkEventButton *even
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
show_about_dialog();
|
||||
@@ -55,12 +56,29 @@ void handle_task_menu(GtkWidget *widget, gchar *signal)
|
||||
{
|
||||
if(signal != NULL)
|
||||
{
|
||||
gchar *s;
|
||||
gint task_action = SIGNAL_NO;
|
||||
|
||||
if (strcmp(signal, "KILL") == 0) s = _("Really kill the task?");
|
||||
else s = _("Really terminate the task?");
|
||||
switch(signal[0])
|
||||
{
|
||||
case 'K':
|
||||
if(xfce_confirm(_("Really kill the task?"), GTK_STOCK_YES, NULL))
|
||||
task_action = SIGNAL_KILL;
|
||||
break;
|
||||
case 'T':
|
||||
if(xfce_confirm(_("Really terminate the task?"), GTK_STOCK_YES, NULL))
|
||||
task_action = SIGNAL_TERM;
|
||||
break;
|
||||
case 'S':
|
||||
task_action = SIGNAL_STOP;
|
||||
break;
|
||||
case 'C':
|
||||
task_action = SIGNAL_CONT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(strcmp(signal, "STOP") == 0 || strcmp(signal, "CONT") == 0 || xfce_confirm(s, GTK_STOCK_YES, NULL))
|
||||
if(task_action != SIGNAL_NO)
|
||||
{
|
||||
gchar *task_id = "";
|
||||
GtkTreeModel *model;
|
||||
@@ -69,10 +87,41 @@ void handle_task_menu(GtkWidget *widget, gchar *signal)
|
||||
if(gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||
{
|
||||
gtk_tree_model_get(model, &iter, 1, &task_id, -1);
|
||||
send_signal_to_task(task_id, signal);
|
||||
send_signal_to_task(atoi(task_id), task_action);
|
||||
refresh_task_list();
|
||||
}
|
||||
}
|
||||
// if (strcmp(signal, "KILL") == 0) s = _("Really kill the task?");
|
||||
// else s = _("Really terminate the task?");
|
||||
//
|
||||
// if(strcmp(signal, "STOP") == 0 || strcmp(signal, "CONT") == 0 || xfce_confirm(s, GTK_STOCK_YES, NULL))
|
||||
// {
|
||||
// gchar *task_id = "";
|
||||
// GtkTreeModel *model;
|
||||
// GtkTreeIter iter;
|
||||
//
|
||||
// if(gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||
// {
|
||||
// gtk_tree_model_get(model, &iter, 1, &task_id, -1);
|
||||
// send_signal_to_task(atoi(task_id), signal);
|
||||
// refresh_task_list();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
void handle_prio_menu(GtkWidget *widget, gchar *prio)
|
||||
{
|
||||
gchar *task_id = "";
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if(gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||
{
|
||||
gtk_tree_model_get(model, &iter, 1, &task_id, -1);
|
||||
|
||||
set_priority_to_task(atoi(task_id), atoi(prio));
|
||||
refresh_task_list();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,15 @@
|
||||
#include "functions.h"
|
||||
#include "interface.h"
|
||||
|
||||
|
||||
#include "xfce-taskmanager-linux.h"
|
||||
|
||||
void on_button1_button_press_event(GtkButton *button, GdkEventButton *event);
|
||||
void on_button3_toggled_event(GtkButton *button, GdkEventButton *event);
|
||||
gboolean on_treeview1_button_press_event(GtkButton *button, GdkEventButton *event);
|
||||
void on_info1_activate (GtkMenuItem *menuitem, gpointer user_data);
|
||||
void handle_task_menu(GtkWidget *widget, gchar *signal);
|
||||
void handle_prio_menu(GtkWidget *widget, gchar *prio);
|
||||
void on_show_tasks_toggled (GtkMenuItem *menuitem, gint uid);
|
||||
void on_show_cached_as_free_toggled (GtkMenuItem *menuitem, gint uid);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include "functions.h"
|
||||
#include "xfce-taskmanager-linux.h"
|
||||
|
||||
static system_status *sys_stat =NULL;
|
||||
|
||||
@@ -56,12 +55,20 @@ gboolean refresh_task_list(void)
|
||||
tmp->time = new_tmp->time;
|
||||
|
||||
tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (gdouble)(1000.0 / (REFRESH_INTERVAL*num_cpus));
|
||||
if((gint)tmp->ppid != (gint)new_tmp->ppid || strcmp(tmp->state,new_tmp->state) || (unsigned int)tmp->size != (unsigned int)new_tmp->size || (unsigned int)tmp->rss != (unsigned int)new_tmp->rss || (unsigned int)tmp->time != (unsigned int)tmp->old_time)
|
||||
if(
|
||||
(gint)tmp->ppid != (gint)new_tmp->ppid ||
|
||||
strcmp(tmp->state,new_tmp->state) ||
|
||||
(unsigned int)tmp->size != (unsigned int)new_tmp->size ||
|
||||
(unsigned int)tmp->rss != (unsigned int)new_tmp->rss ||
|
||||
(unsigned int)tmp->time != (unsigned int)tmp->old_time ||
|
||||
tmp->prio != new_tmp->prio
|
||||
)
|
||||
{
|
||||
tmp->ppid = new_tmp->ppid;
|
||||
strcpy(tmp->state, new_tmp->state);
|
||||
tmp->size = new_tmp->size;
|
||||
tmp->rss = new_tmp->rss;
|
||||
tmp->prio = new_tmp->prio;
|
||||
|
||||
refresh_list_item(i);
|
||||
}
|
||||
@@ -121,7 +128,7 @@ gboolean refresh_task_list(void)
|
||||
{
|
||||
memory_used-=sys_stat->mem_cached;
|
||||
}
|
||||
mem_tooltip = g_strdup_printf (_("%d kB of %d kB used"), memory_used, sys_stat->mem_total);
|
||||
mem_tooltip = g_strdup_printf (_("%d kB of %d kB used"), memory_used / 1024, sys_stat->mem_total / 1024);
|
||||
gtk_tooltips_set_tip (tooltips, mem_usage_progress_bar_box, mem_tooltip, NULL);
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (mem_usage_progress_bar), (gdouble)memory_used / sys_stat->mem_total);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "types.h"
|
||||
#include "interface.h"
|
||||
|
||||
#ifdef LINUX
|
||||
#ifdef __LINUX__
|
||||
#include "xfce-taskmanager-linux.h"
|
||||
#endif
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
|
||||
gboolean refresh_task_list(void);
|
||||
gdouble get_cpu_usage(system_status *sys_stat);
|
||||
void send_signal_to_task(gchar *task_id, gchar *signal);
|
||||
|
||||
/* Configurationfile support */
|
||||
void load_config(void);
|
||||
|
||||
@@ -118,7 +118,8 @@ void create_list_store(void)
|
||||
{
|
||||
GtkCellRenderer *cell_renderer;
|
||||
|
||||
list_store = gtk_tree_store_new(8, G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING);
|
||||
/* my change 8->9 */
|
||||
list_store = gtk_tree_store_new(9, G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING);
|
||||
|
||||
cell_renderer = gtk_cell_renderer_text_new();
|
||||
|
||||
@@ -170,6 +171,14 @@ void create_list_store(void)
|
||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 7, compare_int_list_item, (void *)7, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||
|
||||
/* my change */
|
||||
column = gtk_tree_view_column_new_with_attributes(_("Prio"), cell_renderer, "text", 8, NULL);
|
||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||
gtk_tree_view_column_set_sort_column_id(column, 8);
|
||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 8, compare_int_list_item, (void *)8, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||
/* /my change */
|
||||
|
||||
change_list_store_view();
|
||||
}
|
||||
|
||||
@@ -200,9 +209,47 @@ GtkWidget* create_taskpopup (void)
|
||||
gtk_container_add (GTK_CONTAINER (taskpopup), menu_item);
|
||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_task_menu), "KILL");
|
||||
|
||||
menu_item = gtk_menu_item_new_with_mnemonic ( _("Priority") );
|
||||
gtk_menu_item_set_submenu((gpointer) menu_item, create_prio_submenu());
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_container_add (GTK_CONTAINER (taskpopup), menu_item);
|
||||
|
||||
return taskpopup;
|
||||
}
|
||||
|
||||
GtkWidget *create_prio_submenu(void)
|
||||
{
|
||||
GtkWidget *prio_submenu = gtk_menu_new ();
|
||||
GtkWidget *menu_item;
|
||||
|
||||
menu_item = gtk_menu_item_new_with_mnemonic (_(" -10"));
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "-10");
|
||||
|
||||
menu_item = gtk_menu_item_new_with_mnemonic (_(" -5"));
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "-5");
|
||||
|
||||
menu_item = gtk_menu_item_new_with_mnemonic (_(" 0"));
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "0");
|
||||
|
||||
menu_item = gtk_menu_item_new_with_mnemonic (_(" 5"));
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "5");
|
||||
|
||||
menu_item = gtk_menu_item_new_with_mnemonic (_(" 10"));
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "10");
|
||||
|
||||
return prio_submenu;
|
||||
}
|
||||
|
||||
GtkWidget* create_mainmenu (void)
|
||||
{
|
||||
GtkWidget *mainmenu;
|
||||
@@ -291,11 +338,12 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
||||
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 *size = g_strdup_printf("%i kB", task->size);
|
||||
gchar *rss = g_strdup_printf("%i kB", task->rss);
|
||||
gchar *size = g_strdup_printf("%i kB", task->size/1024);
|
||||
gchar *rss = g_strdup_printf("%i kB", task->rss/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 */
|
||||
|
||||
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);
|
||||
@@ -305,6 +353,7 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_RSS, rss, -1);
|
||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_UNAME, uname, -1);
|
||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_TIME, time, -1);
|
||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PRIO, prio, -1); /* my change */
|
||||
|
||||
g_free(pid);
|
||||
g_free(ppid);
|
||||
@@ -314,26 +363,10 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
||||
g_free(name);
|
||||
g_free(uname);
|
||||
g_free(time);
|
||||
g_free(prio); /* my change */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void send_signal_to_task(gchar *task_id, gchar *signal)
|
||||
{
|
||||
if(task_id != "" && signal != NULL)
|
||||
{
|
||||
gchar command[64] = "kill -";
|
||||
g_strlcat(command,signal, sizeof command);
|
||||
g_strlcat(command," ", sizeof command);
|
||||
g_strlcat(command,task_id, sizeof command);
|
||||
|
||||
if(system(command) != 0)
|
||||
xfce_err("Couldn't %s the task with ID %s", signal, task_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void add_new_list_item(gint i)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
@@ -407,7 +440,7 @@ gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter
|
||||
if(s2 != NULL)
|
||||
i2 = atoi(s2);
|
||||
|
||||
ret = i1 - i2;
|
||||
ret = i2 - i1;
|
||||
|
||||
if(s1 != NULL)
|
||||
g_free(s1);
|
||||
@@ -428,7 +461,7 @@ gint compare_string_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIt
|
||||
gtk_tree_model_get(model, iter2, GPOINTER_TO_INT(column), &s2, -1);
|
||||
|
||||
if(s1 != NULL && s2 != NULL)
|
||||
ret = strcmp(s1, s2);
|
||||
ret = strcmp(s2, s1);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ GtkWidget *treeview;
|
||||
GtkWidget *mainmenu;
|
||||
GtkTooltips *tooltips;
|
||||
GtkWidget *taskpopup;
|
||||
GtkWidget *priopopup;
|
||||
GtkWidget *cpu_usage_progress_bar;
|
||||
GtkWidget *mem_usage_progress_bar;
|
||||
GtkWidget *cpu_usage_progress_bar_box;
|
||||
@@ -59,6 +60,7 @@ GtkWidget *mem_usage_progress_bar_box;
|
||||
#define COLUMN_RSS 5
|
||||
#define COLUMN_UNAME 6
|
||||
#define COLUMN_TIME 7
|
||||
#define COLUMN_PRIO 8
|
||||
|
||||
GtkTreeViewColumn *column;
|
||||
|
||||
@@ -68,6 +70,7 @@ void create_list_store(void);
|
||||
GtkWidget* create_main_window (void);
|
||||
GtkWidget* create_taskpopup (void);
|
||||
GtkWidget* create_mainmenu (void);
|
||||
GtkWidget *create_prio_submenu(void);
|
||||
|
||||
void show_about_dialog(void);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ struct task
|
||||
gint time;
|
||||
gint old_time;
|
||||
gdouble time_percentage;
|
||||
gint prio; /* my change */
|
||||
};
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -69,7 +69,7 @@ struct task get_task_details(gint pid)
|
||||
&idummy, // cutime " waited for children in user
|
||||
&idummy, // cstime " kernel mode
|
||||
&idummy, // priority (nice value + fifteen)
|
||||
&idummy, // nice range from 19 to -19
|
||||
&task.prio, // nice range from 19 to -19 /* my change */
|
||||
&idummy, // hardcoded 0
|
||||
|
||||
&idummy, // itrealvalue time in jiffies to next SIGALRM send to this process
|
||||
@@ -283,3 +283,30 @@ gboolean get_system_status (system_status *sys_stat)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void send_signal_to_task(gint task_id, gint signal)
|
||||
{
|
||||
if(task_id > 0 && signal != 0)
|
||||
{
|
||||
gint ret = 0;
|
||||
|
||||
ret = kill(task_id, signal);
|
||||
|
||||
if(ret != 0)
|
||||
xfce_err(_("Couldn't send signal to the task with ID %d"), signal, task_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_priority_to_task(gint task_id, gint prio)
|
||||
{
|
||||
if(task_id > 0)
|
||||
{
|
||||
gchar command[128] = "";
|
||||
g_sprintf(command, "renice %d %d > /dev/null", prio, task_id);
|
||||
|
||||
if(system(command) != 0)
|
||||
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,22 +17,32 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef LINUX_H
|
||||
#define LINUX_H
|
||||
#ifndef XFCE4_TASKMANAGER_LINUX_H
|
||||
#define XFCE4_TASKMANAGER_LINUX_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <libxfcegui4/libxfcegui4.h>
|
||||
#include <dirent.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define SIGNAL_NO 0
|
||||
#define SIGNAL_KILL SIGKILL
|
||||
#define SIGNAL_TERM SIGINT
|
||||
#define SIGNAL_CONT SIGCONT
|
||||
#define SIGNAL_STOP SIGSTOP
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user