- 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
|
Installation Instructions
|
||||||
Foundation, Inc.
|
*************************
|
||||||
|
|
||||||
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.
|
unlimited permission to copy, distribute and modify it.
|
||||||
|
|
||||||
Basic Installation
|
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
|
The `configure' shell script attempts to guess correct values for
|
||||||
various system-dependent variables used during compilation. It uses
|
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'
|
It can also use an optional file (typically called `config.cache'
|
||||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
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
|
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
|
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
|
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.
|
may remove or edit it.
|
||||||
|
|
||||||
The file `configure.ac' (or `configure.in') is used to create
|
The file `configure.ac' (or `configure.in') is used to create
|
||||||
`configure' by a program called `autoconf'. You only need
|
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||||
`configure.ac' if you want to change it or regenerate `configure' using
|
you want to change it or regenerate `configure' using a newer version
|
||||||
a newer version of `autoconf'.
|
of `autoconf'.
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
1. `cd' to the directory containing the package's source code and type
|
||||||
`./configure' to configure the package for your system. If you're
|
`./configure' to configure the package for your system.
|
||||||
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.
|
|
||||||
|
|
||||||
Running `configure' takes awhile. While running, it prints some
|
Running `configure' might take a while. While running, it prints
|
||||||
messages telling which features it is checking for.
|
some messages telling which features it is checking for.
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
2. Type `make' to compile the package.
|
||||||
|
|
||||||
@@ -67,51 +70,49 @@ The simplest way to compile this package is:
|
|||||||
Compilers and Options
|
Compilers and Options
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that
|
Some systems require unusual options for compilation or linking that the
|
||||||
the `configure' script does not know about. Run `./configure --help'
|
`configure' script does not know about. Run `./configure --help' for
|
||||||
for details on some of the pertinent environment variables.
|
details on some of the pertinent environment variables.
|
||||||
|
|
||||||
You can give `configure' initial values for configuration parameters
|
You can give `configure' initial values for configuration parameters
|
||||||
by setting variables in the command line or in the environment. Here
|
by setting variables in the command line or in the environment. Here
|
||||||
is an example:
|
is an example:
|
||||||
|
|
||||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||||
|
|
||||||
*Note Defining Variables::, for more details.
|
*Note Defining Variables::, for more details.
|
||||||
|
|
||||||
Compiling For Multiple Architectures
|
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
|
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
|
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
|
||||||
directory where you want the object files and executables to go and run
|
directory where you want the object files and executables to go and run
|
||||||
the `configure' script. `configure' automatically checks for the
|
the `configure' script. `configure' automatically checks for the
|
||||||
source code in the directory that `configure' is in and in `..'.
|
source code in the directory that `configure' is in and in `..'.
|
||||||
|
|
||||||
If you have to use a `make' that does not support the `VPATH'
|
With a non-GNU `make', it is safer to compile the package for one
|
||||||
variable, you have to compile the package for one architecture at a
|
architecture at a time in the source code directory. After you have
|
||||||
time in the source code directory. After you have installed the
|
installed the package for one architecture, use `make distclean' before
|
||||||
package for one architecture, use `make distclean' before reconfiguring
|
reconfiguring for another architecture.
|
||||||
for another architecture.
|
|
||||||
|
|
||||||
Installation Names
|
Installation Names
|
||||||
==================
|
==================
|
||||||
|
|
||||||
By default, `make install' will install the package's files in
|
By default, `make install' installs the package's commands under
|
||||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||||
installation prefix other than `/usr/local' by giving `configure' the
|
can specify an installation prefix other than `/usr/local' by giving
|
||||||
option `--prefix=PATH'.
|
`configure' the option `--prefix=PREFIX'.
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
You can specify separate installation prefixes for
|
||||||
architecture-specific files and architecture-independent files. If you
|
architecture-specific files and architecture-independent files. If you
|
||||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||||
PATH as the prefix for installing programs and libraries.
|
PREFIX as the prefix for installing programs and libraries.
|
||||||
Documentation and other data files will still use the regular prefix.
|
Documentation and other data files still use the regular prefix.
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
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
|
kinds of files. Run `configure --help' for a list of the directories
|
||||||
you can set and what kinds of files go in them.
|
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
|
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.
|
`configure', where FEATURE indicates an optional part of the package.
|
||||||
They may also pay attention to `--with-PACKAGE' options, where 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
|
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
|
Specifying the System Type
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
There may be some features `configure' cannot figure out
|
There may be some features `configure' cannot figure out automatically,
|
||||||
automatically, but needs to determine by the type of machine the package
|
but needs to determine by the type of machine the package will run on.
|
||||||
will run on. Usually, assuming the package is built to be run on the
|
Usually, assuming the package is built to be run on the _same_
|
||||||
_same_ architectures, `configure' can figure that out, but if it prints
|
architectures, `configure' can figure that out, but if it prints a
|
||||||
a message saying it cannot guess the machine type, give it the
|
message saying it cannot guess the machine type, give it the
|
||||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
`--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:
|
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.
|
need to know the machine type.
|
||||||
|
|
||||||
If you are _building_ compiler tools for cross-compiling, you should
|
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.
|
produce code for.
|
||||||
|
|
||||||
If you want to _use_ a cross compiler, that generates code for a
|
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
|
Sharing Defaults
|
||||||
================
|
================
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
If you want to set default values for `configure' scripts to share, you
|
||||||
you can create a site shell script called `config.site' that gives
|
can create a site shell script called `config.site' that gives default
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
values for variables like `CC', `cache_file', and `prefix'.
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
`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
|
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
|
environment passed to `configure'. However, some packages may run
|
||||||
configure again during the build, and the customized values of these
|
configure again during the build, and the customized values of these
|
||||||
variables may be lost. In order to avoid this problem, you should set
|
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
|
./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).
|
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' Invocation
|
||||||
======================
|
======================
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
`configure' recognizes the following options to control how it operates.
|
||||||
operates.
|
|
||||||
|
|
||||||
`--help'
|
`--help'
|
||||||
`-h'
|
`-h'
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
void on_button1_button_press_event(GtkButton *button, GdkEventButton *event)
|
void on_button1_button_press_event(GtkButton *button, GdkEventButton *event)
|
||||||
{
|
{
|
||||||
GdkEventButton *mouseevent = (GdkEventButton *)event;
|
GdkEventButton *mouseevent = (GdkEventButton *)event;
|
||||||
if(mainmenu == NULL)
|
if(mainmenu == NULL)
|
||||||
mainmenu = create_mainmenu ();
|
mainmenu = create_mainmenu ();
|
||||||
gtk_menu_popup(GTK_MENU(mainmenu), NULL, NULL, NULL, NULL, mouseevent->button, mouseevent->time);
|
gtk_menu_popup(GTK_MENU(mainmenu), NULL, NULL, NULL, NULL, mouseevent->button, mouseevent->time);
|
||||||
@@ -35,10 +35,10 @@ void on_button3_toggled_event(GtkButton *button, GdkEventButton *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean on_treeview1_button_press_event(GtkButton *button, GdkEventButton *event)
|
gboolean on_treeview1_button_press_event(GtkButton *button, GdkEventButton *event)
|
||||||
{
|
{
|
||||||
if(event->button == 3)
|
if(event->button == 3)
|
||||||
{
|
{
|
||||||
GdkEventButton *mouseevent = (GdkEventButton *)event;
|
GdkEventButton *mouseevent = (GdkEventButton *)event;
|
||||||
if(taskpopup == NULL)
|
if(taskpopup == NULL)
|
||||||
taskpopup = create_taskpopup ();
|
taskpopup = create_taskpopup ();
|
||||||
gtk_menu_popup(GTK_MENU(taskpopup), NULL, NULL, NULL, NULL, mouseevent->button, mouseevent->time);
|
gtk_menu_popup(GTK_MENU(taskpopup), NULL, NULL, NULL, NULL, mouseevent->button, mouseevent->time);
|
||||||
@@ -46,6 +46,7 @@ gboolean on_treeview1_button_press_event(GtkButton *button, GdkEventButton *even
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
show_about_dialog();
|
show_about_dialog();
|
||||||
@@ -55,24 +56,72 @@ void handle_task_menu(GtkWidget *widget, gchar *signal)
|
|||||||
{
|
{
|
||||||
if(signal != NULL)
|
if(signal != NULL)
|
||||||
{
|
{
|
||||||
gchar *s;
|
gint task_action = SIGNAL_NO;
|
||||||
|
|
||||||
if (strcmp(signal, "KILL") == 0) s = _("Really kill the task?");
|
switch(signal[0])
|
||||||
else s = _("Really terminate the task?");
|
{
|
||||||
|
case 'K':
|
||||||
if(strcmp(signal, "STOP") == 0 || strcmp(signal, "CONT") == 0 || xfce_confirm(s, GTK_STOCK_YES, NULL))
|
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(task_action != SIGNAL_NO)
|
||||||
{
|
{
|
||||||
gchar *task_id = "";
|
gchar *task_id = "";
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
if(gtk_tree_selection_get_selected(selection, &model, &iter))
|
if(gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||||
{
|
{
|
||||||
gtk_tree_model_get(model, &iter, 1, &task_id, -1);
|
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();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +133,7 @@ void on_show_tasks_toggled (GtkMenuItem *menuitem, gint uid)
|
|||||||
show_root_tasks = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
|
show_root_tasks = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
|
||||||
else
|
else
|
||||||
show_other_tasks = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
|
show_other_tasks = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
|
||||||
|
|
||||||
change_task_view();
|
change_task_view();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +147,6 @@ void on_quit(void)
|
|||||||
{
|
{
|
||||||
save_config();
|
save_config();
|
||||||
free(config_file);
|
free(config_file);
|
||||||
|
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,17 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "xfce-taskmanager-linux.h"
|
||||||
|
|
||||||
void on_button1_button_press_event(GtkButton *button, GdkEventButton *event);
|
void on_button1_button_press_event(GtkButton *button, GdkEventButton *event);
|
||||||
void on_button3_toggled_event(GtkButton *button, GdkEventButton *event);
|
void on_button3_toggled_event(GtkButton *button, GdkEventButton *event);
|
||||||
gboolean on_treeview1_button_press_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 on_info1_activate (GtkMenuItem *menuitem, gpointer user_data);
|
||||||
void handle_task_menu(GtkWidget *widget, gchar *signal);
|
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_tasks_toggled (GtkMenuItem *menuitem, gint uid);
|
||||||
void on_show_cached_as_free_toggled (GtkMenuItem *menuitem, gint uid);
|
void on_show_cached_as_free_toggled (GtkMenuItem *menuitem, gint uid);
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "xfce-taskmanager-linux.h"
|
|
||||||
|
|
||||||
static system_status *sys_stat =NULL;
|
static system_status *sys_stat =NULL;
|
||||||
|
|
||||||
@@ -52,17 +51,25 @@ gboolean refresh_task_list(void)
|
|||||||
if(new_tmp->pid == tmp->pid)
|
if(new_tmp->pid == tmp->pid)
|
||||||
{
|
{
|
||||||
tmp->old_time = tmp->time;
|
tmp->old_time = tmp->time;
|
||||||
|
|
||||||
tmp->time = new_tmp->time;
|
tmp->time = new_tmp->time;
|
||||||
|
|
||||||
tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (gdouble)(1000.0 / (REFRESH_INTERVAL*num_cpus));
|
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;
|
tmp->ppid = new_tmp->ppid;
|
||||||
strcpy(tmp->state, new_tmp->state);
|
strcpy(tmp->state, new_tmp->state);
|
||||||
tmp->size = new_tmp->size;
|
tmp->size = new_tmp->size;
|
||||||
tmp->rss = new_tmp->rss;
|
tmp->rss = new_tmp->rss;
|
||||||
|
tmp->prio = new_tmp->prio;
|
||||||
|
|
||||||
refresh_list_item(i);
|
refresh_list_item(i);
|
||||||
}
|
}
|
||||||
tmp->checked = TRUE;
|
tmp->checked = TRUE;
|
||||||
@@ -110,29 +117,29 @@ gboolean refresh_task_list(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_array_free(new_task_list, TRUE);
|
g_array_free(new_task_list, TRUE);
|
||||||
|
|
||||||
/* update the CPU and memory progress bars */
|
/* update the CPU and memory progress bars */
|
||||||
if (sys_stat == NULL)
|
if (sys_stat == NULL)
|
||||||
sys_stat = g_new (system_status, 1);
|
sys_stat = g_new (system_status, 1);
|
||||||
get_system_status (sys_stat);
|
get_system_status (sys_stat);
|
||||||
|
|
||||||
memory_used = sys_stat->mem_total - sys_stat->mem_free;
|
memory_used = sys_stat->mem_total - sys_stat->mem_free;
|
||||||
if ( show_cached_as_free )
|
if ( show_cached_as_free )
|
||||||
{
|
{
|
||||||
memory_used-=sys_stat->mem_cached;
|
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_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);
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (mem_usage_progress_bar), (gdouble)memory_used / sys_stat->mem_total);
|
||||||
|
|
||||||
cpu_usage = get_cpu_usage (sys_stat);
|
cpu_usage = get_cpu_usage (sys_stat);
|
||||||
cpu_tooltip = g_strdup_printf (_("%0.0f %%"), cpu_usage * 100.0);
|
cpu_tooltip = g_strdup_printf (_("%0.0f %%"), cpu_usage * 100.0);
|
||||||
gtk_tooltips_set_tip (tooltips, cpu_usage_progress_bar_box, cpu_tooltip, NULL);
|
gtk_tooltips_set_tip (tooltips, cpu_usage_progress_bar_box, cpu_tooltip, NULL);
|
||||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (cpu_usage_progress_bar), cpu_usage);
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (cpu_usage_progress_bar), cpu_usage);
|
||||||
|
|
||||||
g_free (mem_tooltip);
|
g_free (mem_tooltip);
|
||||||
g_free (cpu_tooltip);
|
g_free (cpu_tooltip);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +199,7 @@ void load_config(void)
|
|||||||
|
|
||||||
win_width = xfce_rc_read_int_entry(rc_file, "win_width", 500);
|
win_width = xfce_rc_read_int_entry(rc_file, "win_width", 500);
|
||||||
win_height = xfce_rc_read_int_entry(rc_file, "win_height", 400);
|
win_height = xfce_rc_read_int_entry(rc_file, "win_height", 400);
|
||||||
|
|
||||||
xfce_rc_close(rc_file);
|
xfce_rc_close(rc_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef __LINUX__
|
||||||
#include "xfce-taskmanager-linux.h"
|
#include "xfce-taskmanager-linux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
gboolean refresh_task_list(void);
|
gboolean refresh_task_list(void);
|
||||||
gdouble get_cpu_usage(system_status *sys_stat);
|
gdouble get_cpu_usage(system_status *sys_stat);
|
||||||
void send_signal_to_task(gchar *task_id, gchar *signal);
|
|
||||||
|
|
||||||
/* Configurationfile support */
|
/* Configurationfile support */
|
||||||
void load_config(void);
|
void load_config(void);
|
||||||
|
|||||||
165
src/interface.c
165
src/interface.c
@@ -35,12 +35,12 @@ GtkWidget* create_main_window (void)
|
|||||||
GtkWidget *button1;
|
GtkWidget *button1;
|
||||||
GtkWidget *button2;
|
GtkWidget *button2;
|
||||||
GtkWidget *button3;
|
GtkWidget *button3;
|
||||||
|
|
||||||
GtkWidget *system_info_box;
|
GtkWidget *system_info_box;
|
||||||
|
|
||||||
tooltips = gtk_tooltips_new();
|
tooltips = gtk_tooltips_new();
|
||||||
gtk_tooltips_enable(tooltips);
|
gtk_tooltips_enable(tooltips);
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_title (GTK_WINDOW (window), _("xfce4-taskmanager"));
|
gtk_window_set_title (GTK_WINDOW (window), _("xfce4-taskmanager"));
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), win_width, win_height);
|
gtk_window_set_default_size (GTK_WINDOW (window), win_width, win_height);
|
||||||
@@ -53,7 +53,7 @@ GtkWidget* create_main_window (void)
|
|||||||
system_info_box = gtk_hbox_new (FALSE, 10);
|
system_info_box = gtk_hbox_new (FALSE, 10);
|
||||||
gtk_widget_show (system_info_box);
|
gtk_widget_show (system_info_box);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox1), system_info_box, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox1), system_info_box, FALSE, TRUE, 0);
|
||||||
|
|
||||||
cpu_usage_progress_bar_box = gtk_event_box_new ();
|
cpu_usage_progress_bar_box = gtk_event_box_new ();
|
||||||
cpu_usage_progress_bar = gtk_progress_bar_new ();
|
cpu_usage_progress_bar = gtk_progress_bar_new ();
|
||||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (cpu_usage_progress_bar), _("cpu usage"));
|
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (cpu_usage_progress_bar), _("cpu usage"));
|
||||||
@@ -61,7 +61,7 @@ GtkWidget* create_main_window (void)
|
|||||||
gtk_widget_show (cpu_usage_progress_bar_box);
|
gtk_widget_show (cpu_usage_progress_bar_box);
|
||||||
gtk_container_add (GTK_CONTAINER (cpu_usage_progress_bar_box), cpu_usage_progress_bar);
|
gtk_container_add (GTK_CONTAINER (cpu_usage_progress_bar_box), cpu_usage_progress_bar);
|
||||||
gtk_box_pack_start (GTK_BOX (system_info_box), cpu_usage_progress_bar_box, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (system_info_box), cpu_usage_progress_bar_box, TRUE, TRUE, 0);
|
||||||
|
|
||||||
mem_usage_progress_bar_box = gtk_event_box_new ();
|
mem_usage_progress_bar_box = gtk_event_box_new ();
|
||||||
mem_usage_progress_bar = gtk_progress_bar_new ();
|
mem_usage_progress_bar = gtk_progress_bar_new ();
|
||||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (mem_usage_progress_bar), _("memory usage"));
|
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (mem_usage_progress_bar), _("memory usage"));
|
||||||
@@ -81,26 +81,26 @@ GtkWidget* create_main_window (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview);
|
gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview);
|
||||||
|
|
||||||
create_list_store();
|
create_list_store();
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
|
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
|
||||||
|
|
||||||
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(list_store));
|
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(list_store));
|
||||||
|
|
||||||
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list_store), 1, GTK_SORT_ASCENDING);
|
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list_store), 1, GTK_SORT_ASCENDING);
|
||||||
|
|
||||||
bbox1 = gtk_hbutton_box_new();
|
bbox1 = gtk_hbutton_box_new();
|
||||||
gtk_box_pack_start(GTK_BOX(vbox1), bbox1, FALSE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(vbox1), bbox1, FALSE, TRUE, 0);
|
||||||
gtk_widget_show (bbox1);
|
gtk_widget_show (bbox1);
|
||||||
|
|
||||||
button2 = gtk_button_new_from_stock ("gtk-preferences");
|
button2 = gtk_button_new_from_stock ("gtk-preferences");
|
||||||
gtk_widget_show (button2);
|
gtk_widget_show (button2);
|
||||||
gtk_box_pack_start (GTK_BOX (bbox1), button2, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (bbox1), button2, FALSE, FALSE, 0);
|
||||||
|
|
||||||
button3 = gtk_toggle_button_new_with_label (_("more details"));
|
button3 = gtk_toggle_button_new_with_label (_("more details"));
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button3), full_view);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button3), full_view);
|
||||||
gtk_widget_show (button3);
|
gtk_widget_show (button3);
|
||||||
gtk_box_pack_start (GTK_BOX (bbox1), button3, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (bbox1), button3, FALSE, FALSE, 0);
|
||||||
|
|
||||||
button1 = gtk_button_new_from_stock ("gtk-quit");
|
button1 = gtk_button_new_from_stock ("gtk-quit");
|
||||||
gtk_widget_show (button1);
|
gtk_widget_show (button1);
|
||||||
gtk_box_pack_start (GTK_BOX (bbox1), button1, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (bbox1), button1, FALSE, FALSE, 0);
|
||||||
@@ -110,7 +110,7 @@ GtkWidget* create_main_window (void)
|
|||||||
g_signal_connect ((gpointer) button1, "clicked", G_CALLBACK (on_quit), NULL);
|
g_signal_connect ((gpointer) button1, "clicked", G_CALLBACK (on_quit), NULL);
|
||||||
g_signal_connect ((gpointer) button2, "button_release_event", G_CALLBACK (on_button1_button_press_event), NULL);
|
g_signal_connect ((gpointer) button2, "button_release_event", G_CALLBACK (on_button1_button_press_event), NULL);
|
||||||
g_signal_connect ((gpointer) button3, "toggled", G_CALLBACK (on_button3_toggled_event), NULL);
|
g_signal_connect ((gpointer) button3, "toggled", G_CALLBACK (on_button3_toggled_event), NULL);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +118,9 @@ void create_list_store(void)
|
|||||||
{
|
{
|
||||||
GtkCellRenderer *cell_renderer;
|
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();
|
cell_renderer = gtk_cell_renderer_text_new();
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("Command"), cell_renderer, "text", 0, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("Command"), cell_renderer, "text", 0, NULL);
|
||||||
@@ -127,49 +128,57 @@ void create_list_store(void)
|
|||||||
gtk_tree_view_column_set_sort_column_id(column, 0);
|
gtk_tree_view_column_set_sort_column_id(column, 0);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 0, compare_string_list_item, (void *)0, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 0, compare_string_list_item, (void *)0, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("PID"), cell_renderer, "text", 1, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("PID"), cell_renderer, "text", 1, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 1);
|
gtk_tree_view_column_set_sort_column_id(column, 1);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 1, compare_int_list_item, (void *)1, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 1, compare_int_list_item, (void *)1, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("PPID"), cell_renderer, "text", 2, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("PPID"), cell_renderer, "text", 2, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 2);
|
gtk_tree_view_column_set_sort_column_id(column, 2);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 2, compare_string_list_item, (void *)2, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 2, compare_string_list_item, (void *)2, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("State"), cell_renderer, "text", 3, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("State"), cell_renderer, "text", 3, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 3);
|
gtk_tree_view_column_set_sort_column_id(column, 3);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 3, compare_int_list_item, (void *)3, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 3, compare_int_list_item, (void *)3, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("VM-Size"), cell_renderer, "text", 4, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("VM-Size"), cell_renderer, "text", 4, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 4);
|
gtk_tree_view_column_set_sort_column_id(column, 4);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 4, compare_int_list_item, (void *)4, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 4, compare_int_list_item, (void *)4, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("RSS"), cell_renderer, "text", 5, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("RSS"), cell_renderer, "text", 5, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 5);
|
gtk_tree_view_column_set_sort_column_id(column, 5);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 5, compare_int_list_item, (void *)5, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 5, compare_int_list_item, (void *)5, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("User"), cell_renderer, "text", 6, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("User"), cell_renderer, "text", 6, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 6);
|
gtk_tree_view_column_set_sort_column_id(column, 6);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 6, compare_string_list_item, (void *)6, NULL);
|
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 6, compare_string_list_item, (void *)6, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes(_("CPU%"), cell_renderer, "text", 7, NULL);
|
column = gtk_tree_view_column_new_with_attributes(_("CPU%"), cell_renderer, "text", 7, NULL);
|
||||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, 7);
|
gtk_tree_view_column_set_sort_column_id(column, 7);
|
||||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 7, compare_int_list_item, (void *)7, NULL);
|
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);
|
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();
|
change_list_store_view();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,10 +208,48 @@ GtkWidget* create_taskpopup (void)
|
|||||||
gtk_widget_show (menu_item);
|
gtk_widget_show (menu_item);
|
||||||
gtk_container_add (GTK_CONTAINER (taskpopup), menu_item);
|
gtk_container_add (GTK_CONTAINER (taskpopup), menu_item);
|
||||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_task_menu), "KILL");
|
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;
|
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* create_mainmenu (void)
|
||||||
{
|
{
|
||||||
GtkWidget *mainmenu;
|
GtkWidget *mainmenu;
|
||||||
@@ -262,16 +309,16 @@ void show_about_dialog(void)
|
|||||||
{
|
{
|
||||||
GtkWidget *about_dialog;
|
GtkWidget *about_dialog;
|
||||||
XfceAboutInfo *about_info;
|
XfceAboutInfo *about_info;
|
||||||
|
|
||||||
about_info = xfce_about_info_new("xfce4-taskmanager", VERSION, "Xfce4-Taskmanager is a easy to use Taskmanager.",XFCE_COPYRIGHT_TEXT("2005", "Johannes Zellner"), XFCE_LICENSE_GPL);
|
about_info = xfce_about_info_new("xfce4-taskmanager", VERSION, "Xfce4-Taskmanager is a easy to use Taskmanager.",XFCE_COPYRIGHT_TEXT("2005", "Johannes Zellner"), XFCE_LICENSE_GPL);
|
||||||
xfce_about_info_set_homepage(about_info, "http://goodies.xfce.org");
|
xfce_about_info_set_homepage(about_info, "http://goodies.xfce.org");
|
||||||
xfce_about_info_add_credit(about_info, "Johannes Zellner", "webmaster@nebulon.de", "Original Author");
|
xfce_about_info_add_credit(about_info, "Johannes Zellner", "webmaster@nebulon.de", "Original Author");
|
||||||
|
|
||||||
about_dialog = xfce_about_dialog_new_with_values(GTK_WINDOW(main_window), about_info, NULL);
|
about_dialog = xfce_about_dialog_new_with_values(GTK_WINDOW(main_window), about_info, NULL);
|
||||||
g_signal_connect(G_OBJECT(about_dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL);
|
g_signal_connect(G_OBJECT(about_dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL);
|
||||||
gtk_window_set_title (GTK_WINDOW (about_dialog), _("xfce4-taskmanager"));
|
gtk_window_set_title (GTK_WINDOW (about_dialog), _("xfce4-taskmanager"));
|
||||||
gtk_widget_show(about_dialog);
|
gtk_widget_show(about_dialog);
|
||||||
|
|
||||||
xfce_about_info_free(about_info);
|
xfce_about_info_free(about_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,16 +334,17 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
|||||||
if(iter != NULL)
|
if(iter != NULL)
|
||||||
{
|
{
|
||||||
struct task *task = &g_array_index(task_array, struct task, i);
|
struct task *task = &g_array_index(task_array, struct task, i);
|
||||||
|
|
||||||
gchar *pid = g_strdup_printf("%i", task->pid);
|
gchar *pid = g_strdup_printf("%i", task->pid);
|
||||||
gchar *ppid = g_strdup_printf("%i", task->ppid);
|
gchar *ppid = g_strdup_printf("%i", task->ppid);
|
||||||
gchar *state = g_strdup_printf("%s", task->state);
|
gchar *state = g_strdup_printf("%s", task->state);
|
||||||
gchar *size = g_strdup_printf("%i kB", task->size);
|
gchar *size = g_strdup_printf("%i kB", task->size/1024);
|
||||||
gchar *rss = g_strdup_printf("%i kB", task->rss);
|
gchar *rss = g_strdup_printf("%i kB", task->rss/1024);
|
||||||
gchar *name = g_strdup_printf("%s", task->name);
|
gchar *name = g_strdup_printf("%s", task->name);
|
||||||
gchar *uname = g_strdup_printf("%s", task->uname);
|
gchar *uname = g_strdup_printf("%s", task->uname);
|
||||||
gchar *time = g_strdup_printf("%0d%%", (guint)task->time_percentage);
|
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_NAME, name, -1);
|
||||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PID, pid, -1);
|
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PID, pid, -1);
|
||||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PPID, ppid, -1);
|
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PPID, ppid, -1);
|
||||||
@@ -305,7 +353,8 @@ 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_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_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_TIME, time, -1);
|
||||||
|
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PRIO, prio, -1); /* my change */
|
||||||
|
|
||||||
g_free(pid);
|
g_free(pid);
|
||||||
g_free(ppid);
|
g_free(ppid);
|
||||||
g_free(state);
|
g_free(state);
|
||||||
@@ -314,32 +363,16 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
|||||||
g_free(name);
|
g_free(name);
|
||||||
g_free(uname);
|
g_free(uname);
|
||||||
g_free(time);
|
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)
|
void add_new_list_item(gint i)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
gtk_tree_store_append(GTK_TREE_STORE(list_store), &iter, NULL);
|
gtk_tree_store_append(GTK_TREE_STORE(list_store), &iter, NULL);
|
||||||
|
|
||||||
fill_list_item(i, &iter);
|
fill_list_item(i, &iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +381,7 @@ void refresh_list_item(gint i)
|
|||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter);
|
gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter);
|
||||||
struct task task = g_array_index(task_array, struct task, i);
|
struct task task = g_array_index(task_array, struct task, i);
|
||||||
|
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
gchar *str_data = "";
|
gchar *str_data = "";
|
||||||
@@ -370,7 +403,7 @@ void remove_list_item(gint pid)
|
|||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter);
|
gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter);
|
||||||
|
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
gchar *str_data = "";
|
gchar *str_data = "";
|
||||||
@@ -389,10 +422,10 @@ void remove_list_item(gint pid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer column)
|
gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer column)
|
||||||
{
|
{
|
||||||
gchar *s1 = "";
|
gchar *s1 = "";
|
||||||
gchar *s2 = "";
|
gchar *s2 = "";
|
||||||
|
|
||||||
gint ret = 0;
|
gint ret = 0;
|
||||||
|
|
||||||
gtk_tree_model_get(model, iter1, column, &s1, -1);
|
gtk_tree_model_get(model, iter1, column, &s1, -1);
|
||||||
@@ -400,43 +433,43 @@ gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter
|
|||||||
|
|
||||||
gint i1 = 0;
|
gint i1 = 0;
|
||||||
gint i2 = 0;
|
gint i2 = 0;
|
||||||
|
|
||||||
if(s1 != NULL)
|
if(s1 != NULL)
|
||||||
i1 = atoi(s1);
|
i1 = atoi(s1);
|
||||||
|
|
||||||
if(s2 != NULL)
|
if(s2 != NULL)
|
||||||
i2 = atoi(s2);
|
i2 = atoi(s2);
|
||||||
|
|
||||||
ret = i1 - i2;
|
ret = i2 - i1;
|
||||||
|
|
||||||
if(s1 != NULL)
|
if(s1 != NULL)
|
||||||
g_free(s1);
|
g_free(s1);
|
||||||
if(s2 != NULL)
|
if(s2 != NULL)
|
||||||
g_free(s2);
|
g_free(s2);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint compare_string_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer column)
|
gint compare_string_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer column)
|
||||||
{
|
{
|
||||||
gchar *s1 = "";
|
gchar *s1 = "";
|
||||||
gchar *s2 = "";
|
gchar *s2 = "";
|
||||||
|
|
||||||
gint ret = 0;
|
gint ret = 0;
|
||||||
|
|
||||||
gtk_tree_model_get(model, iter1, GPOINTER_TO_INT(column), &s1, -1);
|
gtk_tree_model_get(model, iter1, GPOINTER_TO_INT(column), &s1, -1);
|
||||||
gtk_tree_model_get(model, iter2, GPOINTER_TO_INT(column), &s2, -1);
|
gtk_tree_model_get(model, iter2, GPOINTER_TO_INT(column), &s2, -1);
|
||||||
|
|
||||||
if(s1 != NULL && s2 != NULL)
|
if(s1 != NULL && s2 != NULL)
|
||||||
ret = strcmp(s1, s2);
|
ret = strcmp(s2, s1);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if(s1 != NULL)
|
if(s1 != NULL)
|
||||||
g_free(s1);
|
g_free(s1);
|
||||||
if(s2 != NULL)
|
if(s2 != NULL)
|
||||||
g_free(s2);
|
g_free(s2);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,15 +478,15 @@ void change_task_view(void)
|
|||||||
{
|
{
|
||||||
gtk_tree_store_clear(GTK_TREE_STORE(list_store));
|
gtk_tree_store_clear(GTK_TREE_STORE(list_store));
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
|
||||||
for(i = 0; i < tasks; i++)
|
for(i = 0; i < tasks; i++)
|
||||||
{
|
{
|
||||||
struct task task = g_array_index(task_array, struct task, i);
|
struct task task = g_array_index(task_array, struct task, i);
|
||||||
|
|
||||||
if((task.uid == own_uid && show_user_tasks) || (task.uid == 0 && show_root_tasks) || (task.uid != own_uid && task.uid != 0 && show_other_tasks))
|
if((task.uid == own_uid && show_user_tasks) || (task.uid == 0 && show_root_tasks) || (task.uid != own_uid && task.uid != 0 && show_other_tasks))
|
||||||
add_new_list_item(i);
|
add_new_list_item(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh_task_list();
|
refresh_task_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ GtkWidget *treeview;
|
|||||||
GtkWidget *mainmenu;
|
GtkWidget *mainmenu;
|
||||||
GtkTooltips *tooltips;
|
GtkTooltips *tooltips;
|
||||||
GtkWidget *taskpopup;
|
GtkWidget *taskpopup;
|
||||||
|
GtkWidget *priopopup;
|
||||||
GtkWidget *cpu_usage_progress_bar;
|
GtkWidget *cpu_usage_progress_bar;
|
||||||
GtkWidget *mem_usage_progress_bar;
|
GtkWidget *mem_usage_progress_bar;
|
||||||
GtkWidget *cpu_usage_progress_bar_box;
|
GtkWidget *cpu_usage_progress_bar_box;
|
||||||
@@ -59,6 +60,7 @@ GtkWidget *mem_usage_progress_bar_box;
|
|||||||
#define COLUMN_RSS 5
|
#define COLUMN_RSS 5
|
||||||
#define COLUMN_UNAME 6
|
#define COLUMN_UNAME 6
|
||||||
#define COLUMN_TIME 7
|
#define COLUMN_TIME 7
|
||||||
|
#define COLUMN_PRIO 8
|
||||||
|
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ void create_list_store(void);
|
|||||||
GtkWidget* create_main_window (void);
|
GtkWidget* create_main_window (void);
|
||||||
GtkWidget* create_taskpopup (void);
|
GtkWidget* create_taskpopup (void);
|
||||||
GtkWidget* create_mainmenu (void);
|
GtkWidget* create_mainmenu (void);
|
||||||
|
GtkWidget *create_prio_submenu(void);
|
||||||
|
|
||||||
void show_about_dialog(void);
|
void show_about_dialog(void);
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ struct task
|
|||||||
gint time;
|
gint time;
|
||||||
gint old_time;
|
gint old_time;
|
||||||
gdouble time_percentage;
|
gdouble time_percentage;
|
||||||
|
gint prio; /* my change */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ struct task get_task_details(gint pid)
|
|||||||
sprintf(cmdline_filename, "/proc/%i/cmdline", pid);
|
sprintf(cmdline_filename, "/proc/%i/cmdline", pid);
|
||||||
|
|
||||||
stat(filename, &status);
|
stat(filename, &status);
|
||||||
|
|
||||||
task.pid = -1;
|
task.pid = -1;
|
||||||
task.checked = FALSE;
|
task.checked = FALSE;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ struct task get_task_details(gint pid)
|
|||||||
{
|
{
|
||||||
gint utime = 0;
|
gint utime = 0;
|
||||||
gint stime = 0;
|
gint stime = 0;
|
||||||
|
|
||||||
sscanf(buffer_status, "%i (%255s %1s %i %i %i %i %i %255s %255s %255s %255s %255s %i %i %i %i %i %i %i %i %i %i %i %255s %255s %255s %i %255s %255s %255s %255s %255s %255s %255s %255s %255s %255s %i %255s %255s",
|
sscanf(buffer_status, "%i (%255s %1s %i %i %i %i %i %255s %255s %255s %255s %255s %i %i %i %i %i %i %i %i %i %i %i %255s %255s %255s %i %255s %255s %255s %255s %255s %255s %255s %255s %255s %255s %i %255s %255s",
|
||||||
&task.pid, // processid
|
&task.pid, // processid
|
||||||
task.name, // processname
|
task.name, // processname
|
||||||
@@ -69,7 +69,7 @@ struct task get_task_details(gint pid)
|
|||||||
&idummy, // cutime " waited for children in user
|
&idummy, // cutime " waited for children in user
|
||||||
&idummy, // cstime " kernel mode
|
&idummy, // cstime " kernel mode
|
||||||
&idummy, // priority (nice value + fifteen)
|
&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, // hardcoded 0
|
||||||
|
|
||||||
&idummy, // itrealvalue time in jiffies to next SIGALRM send to this process
|
&idummy, // itrealvalue time in jiffies to next SIGALRM send to this process
|
||||||
@@ -108,7 +108,7 @@ struct task get_task_details(gint pid)
|
|||||||
if(passwdp != NULL && passwdp->pw_name != NULL)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(task_file != NULL)
|
if(task_file != NULL)
|
||||||
fclose(task_file);
|
fclose(task_file);
|
||||||
@@ -124,16 +124,16 @@ struct task get_task_details(gint pid)
|
|||||||
g_strlcpy(task.name, g_strrstr(dummy,"/")+1, 255);
|
g_strlcpy(task.name, g_strrstr(dummy,"/")+1, 255);
|
||||||
else
|
else
|
||||||
g_strlcpy(task.name, dummy, 255);
|
g_strlcpy(task.name, dummy, 255);
|
||||||
|
|
||||||
// workaround for cmd-line entries with leading "-"
|
// workaround for cmd-line entries with leading "-"
|
||||||
if(g_str_has_prefix(task.name, "-"))
|
if(g_str_has_prefix(task.name, "-"))
|
||||||
sscanf(task.name, "-%255s", task.name);
|
sscanf(task.name, "-%255s", task.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmdline_file != NULL)
|
if(cmdline_file != NULL)
|
||||||
fclose(cmdline_file);
|
fclose(cmdline_file);
|
||||||
|
|
||||||
if(g_str_has_suffix(task.name, ")"))
|
if(g_str_has_suffix(task.name, ")"))
|
||||||
*g_strrstr(task.name, ")") = '\0';
|
*g_strrstr(task.name, ")") = '\0';
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ GArray *get_task_list(void)
|
|||||||
GArray *task_list;
|
GArray *task_list;
|
||||||
|
|
||||||
task_list = g_array_new (FALSE, FALSE, sizeof (struct task));
|
task_list = g_array_new (FALSE, FALSE, sizeof (struct task));
|
||||||
|
|
||||||
if((dir = opendir("/proc/")) == NULL)
|
if((dir = opendir("/proc/")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: couldn't load the /proc directory\n");
|
fprintf(stderr, "Error: couldn't load the /proc directory\n");
|
||||||
@@ -155,7 +155,7 @@ GArray *get_task_list(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint count = 0;
|
gint count = 0;
|
||||||
|
|
||||||
while((dir_entry = readdir(dir)) != NULL)
|
while((dir_entry = readdir(dir)) != NULL)
|
||||||
{
|
{
|
||||||
if(atoi(dir_entry->d_name) != 0)
|
if(atoi(dir_entry->d_name) != 0)
|
||||||
@@ -200,9 +200,9 @@ gboolean get_cpu_usage_from_proc(system_status *sys_stat)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
file = fopen (file_name, "r");
|
file = fopen (file_name, "r");
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if ( fgets (buffer, 100, file) != NULL )
|
if ( fgets (buffer, 100, file) != NULL )
|
||||||
@@ -228,19 +228,19 @@ gboolean get_system_status (system_status *sys_stat)
|
|||||||
FILE *file;
|
FILE *file;
|
||||||
gchar *file_name;
|
gchar *file_name;
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
|
|
||||||
buffer = g_new (gchar, 100);
|
buffer = g_new (gchar, 100);
|
||||||
|
|
||||||
file_name = g_strdup ("/proc/meminfo");
|
file_name = g_strdup ("/proc/meminfo");
|
||||||
|
|
||||||
if (!g_file_test (file_name, G_FILE_TEST_EXISTS))
|
if (!g_file_test (file_name, G_FILE_TEST_EXISTS))
|
||||||
{
|
{
|
||||||
g_free(file_name);
|
g_free(file_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = fopen (file_name, "r");
|
file = fopen (file_name, "r");
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
while (fgets (buffer, 100, file) != NULL)
|
while (fgets (buffer, 100, file) != NULL)
|
||||||
@@ -253,24 +253,24 @@ gboolean get_system_status (system_status *sys_stat)
|
|||||||
}
|
}
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
g_free (file_name);
|
g_free (file_name);
|
||||||
|
|
||||||
buffer = g_new (gchar, 100);
|
buffer = g_new (gchar, 100);
|
||||||
|
|
||||||
file_name = g_strdup ("/proc/cpuinfo");
|
file_name = g_strdup ("/proc/cpuinfo");
|
||||||
|
|
||||||
if (!g_file_test (file_name, G_FILE_TEST_EXISTS))
|
if (!g_file_test (file_name, G_FILE_TEST_EXISTS))
|
||||||
{
|
{
|
||||||
g_free(file_name);
|
g_free(file_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = fopen (file_name, "r");
|
file = fopen (file_name, "r");
|
||||||
|
|
||||||
sys_stat->cpu_count = -1;
|
sys_stat->cpu_count = -1;
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (fgets (buffer, 100, file) != NULL)
|
while (fgets (buffer, 100, file) != NULL)
|
||||||
{
|
{
|
||||||
sscanf (buffer, "processor : %i", &sys_stat->cpu_count);
|
sscanf (buffer, "processor : %i", &sys_stat->cpu_count);
|
||||||
@@ -280,6 +280,33 @@ gboolean get_system_status (system_status *sys_stat)
|
|||||||
}
|
}
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
g_free (file_name);
|
g_free (file_name);
|
||||||
|
|
||||||
return TRUE;
|
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.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LINUX_H
|
#ifndef XFCE4_TASKMANAGER_LINUX_H
|
||||||
#define LINUX_H
|
#define XFCE4_TASKMANAGER_LINUX_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <libxfcegui4/libxfcegui4.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include "types.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);
|
struct task get_task_details(gint pid);
|
||||||
GArray *get_task_list(void);
|
GArray *get_task_list(void);
|
||||||
gboolean get_system_status(system_status *sys_stat);
|
gboolean get_system_status(system_status *sys_stat);
|
||||||
gboolean get_cpu_usage_from_proc(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
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user