Commit 8f8f8a9e authored by Benoît Dejean's avatar Benoît Dejean

Synced with my local monotone repository.

parent a6b4bd02
......@@ -3,3 +3,4 @@ Erik Johnsson <zaphod@linux.nu> - icon support
Jorgen Scheibengruber
Benoît Dejean <benoit@placenet.org> - maintainer
Paolo Borelli <pborelli@katamail.com>
Baptiste Mille-Mathias - artwork
\ No newline at end of file
2006-11-05 Benoît Dejean <benoit@placenet.org>
* NEW:
* AUTHORS:
Released 2.17.2.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/procdialogs.c:
Fixed preferences dialog tab selection.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/interface.c:
Fixed harmless typo.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/util.c:
* src/util.h:
* src/openfiles.c:
* src/memmaps.c:
Dropped over-complicated code about i18n.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/callbacks.c:
* src/interface.c:
* src/interface.h:
* src/proctable.c:
More work on sensitivity.
Fixed "Show Hidden processes" sensitivity.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/callbacks.c:
* src/interface.c:
Fixed sensitivity of the view menu which has to be
totally disabled when current_tab is not Processes.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/callbacks.c:
* src/gnome-system-monitor.schemas.in:
* src/procdialogs.c:
* src/procman.c:
* src/procman.h:
New enum type to handle tab number (current_tab).
Extended schema documentation and fixed default current_tab
which is Resources by request #324968.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/lsof.cpp:
* src/lsof.h:
Moved enum declaration to lsof.cpp as it doesn't need to be
public.
2006-11-04 Benoît Dejean <benoit@placenet.org>
* src/gnome-system-monitor.schemas.in:
Fixed typo.
Closes #358365.
2006-11-03 Benoît Dejean <benoit@placenet.org>
* pixmaps/:
* Makefile.am:
* configure.in:
* src/Makefile.am:
* src/callbacks.c:
* src/interface.c:
* src/procdialogs.c:
* src/procman.c:
* src/sysinfo.cpp:
* src/sysinfo.h:
New system info tab. Initial work from OpenSuse.
2006-11-01 Benoît Dejean <benoit@placenet.org>
* configure.in: Temporarily requires older pcre 6.6.
......
## Process this file with automake to produce Makefile.in
SUBDIRS = po src help
SUBDIRS = pixmaps po src help
EXTRA_DIST = \
gnome-system-monitor.desktop.in \
......
New in 2.17.2 - 5 november 2006
* This is the first 2.17.x release.
* New lsof feature. Temporarily requires pcre, see #367827.
* New SysInfo tab from OpenSuse. Artwork by Baptiste Mille-Mathias.
* Some code cleanups.
* Fixed sensitivity of the View menu.
* New features have been developed in C++, old C code will be soon compiled
as C++.
New in 2.16.1 - 2 october 2006
* Fixed locales dir initialization.
* Fixed memory maps for 64bits kernel running a 32bits system-monitor.
......
......@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT([gnome-system-monitor], [2.17.1],
AC_INIT([gnome-system-monitor], [2.17.2],
[http://bugzilla.gnome.org/enter_bug.cgi?product=system-monitor])
AC_CONFIG_SRCDIR(configure.in)
AC_CONFIG_HEADERS(config.h)
......@@ -75,6 +75,7 @@ GLIB_DEFINE_LOCALEDIR(PACKAGE_LOCALE_DIR)
AC_CONFIG_FILES([
Makefile
src/Makefile
pixmaps/Makefile
po/Makefile.in
help/Makefile
help/bg/Makefile
......
This diff is collapsed.
Makefile
Makefile.in
imagesdir = $(datadir)/pixmaps/gnome-system-monitor
images_DATA = side.png
EXTRA_DIST = $(image_DATA)
\ No newline at end of file
......@@ -27,6 +27,7 @@ gnome_system_monitor_SOURCES = \
selinux.h selinux.c \
procman_gnomesu.h procman_gnomesu.c \
procman_gksu.h procman_gksu.c \
sysinfo.cpp sysinfo.h \
lsof.cpp lsof.h \
e_date.c e_date.h
......
......@@ -167,6 +167,11 @@ cb_about (GtkAction *action, gpointer data)
NULL
};
const gchar * const artists[] = {
"Baptiste Mille-Mathias",
NULL
};
gtk_show_about_dialog (
NULL,
"name", _("System Monitor"),
......@@ -177,6 +182,7 @@ cb_about (GtkAction *action, gpointer data)
"Copyright \xc2\xa9 2005-2006 Benoît Dejean",
"logo-icon-name", "utilities-system-monitor",
"authors", authors,
"artists", artists,
"documenters", documenters,
"translator-credits", _("translator-credits"),
"license", "GPL 2+",
......@@ -331,12 +337,7 @@ cb_row_selected (GtkTreeSelection *selection, gpointer data)
gtk_tree_selection_selected_foreach (procdata->selection, get_last_selected,
&procdata->selected_process);
if (procdata->selected_process) {
update_sensitivity (procdata, TRUE);
}
else {
update_sensitivity (procdata, FALSE);
}
update_sensitivity(procdata);
}
......@@ -380,7 +381,7 @@ cb_change_current_page (GtkNotebook *nb, gint num, gpointer data)
procdata->config.current_tab = num;
if (num == 0) {
if (num == PROCMAN_TAB_PROCESSES) {
cb_timeout (procdata);
......@@ -389,8 +390,7 @@ cb_change_current_page (GtkNotebook *nb, gint num, gpointer data)
procdata->config.update_interval,
cb_timeout, procdata);
if (procdata->selected_process)
update_sensitivity (procdata, TRUE);
update_sensitivity(procdata);
}
else {
if (procdata->timeout) {
......@@ -398,11 +398,11 @@ cb_change_current_page (GtkNotebook *nb, gint num, gpointer data)
procdata->timeout = 0;
}
update_sensitivity (procdata, FALSE);
update_sensitivity(procdata);
}
if (num == 1) {
if (num == PROCMAN_TAB_RESOURCES) {
load_graph_start (procdata->cpu_graph);
load_graph_start (procdata->mem_graph);
load_graph_start (procdata->net_graph);
......@@ -414,7 +414,7 @@ cb_change_current_page (GtkNotebook *nb, gint num, gpointer data)
}
if (num == 2) {
if (num == PROCMAN_TAB_DISKS) {
cb_update_disks (procdata);
......
......@@ -163,10 +163,10 @@
<applyto>/apps/procman/current_tab</applyto>
<owner>procman</owner>
<type>int</type>
<default>1</default>
<default>2</default>
<locale name="C">
<short>Saves the currently viewed tab</short>
<long></long>
<long>0 for the System Info, 1 for the processes list, 2 for the resources and 3 for the disks list</long>
</locale>
</schema>
......@@ -459,7 +459,7 @@
<type>int</type>
<default>0</default>
<locale name="C">
<short>Show process writable memory column saved width</short>
<short>Process writable memory column saved width</short>
<long></long>
</locale>
</schema>
......
......@@ -38,6 +38,7 @@
#include "load-graph.h"
#include "util.h"
#include "disks.h"
#include "sysinfo.h"
static void cb_toggle_tree (GtkAction *action, gpointer data);
......@@ -65,7 +66,7 @@ static const GtkActionEntry menu_entries[] =
N_("Force process to finish immediately"), G_CALLBACK (cb_kill_process) },
{ "ChangePriority", NULL, N_("_Change Priority..."), "<control>R",
N_("Change the order of priority of process"), G_CALLBACK (cb_renice) },
{ "Preferencies", GTK_STOCK_PREFERENCES, N_("Prefere_nces"), NULL,
{ "Preferences", GTK_STOCK_PREFERENCES, N_("Prefere_nces"), NULL,
N_("Configure the application"), G_CALLBACK (cb_edit_preferences) },
{ "HideProcess", NULL, N_("_Hide Process"), "<control>H",
......@@ -117,7 +118,7 @@ static const char ui_info[] =
" <separator />"
" <menuitem name=\"EditChangePriorityMenu\" action=\"ChangePriority\" />"
" <separator />"
" <menuitem name=\"EditPreferenciesMenu\" action=\"Preferencies\" />"
" <menuitem name=\"EditPreferencesMenu\" action=\"Preferences\" />"
" </menu>"
" <menu name=\"ViewMenu\" action=\"View\">"
" <menuitem name=\"ViewActiveProcesses\" action=\"ShowActiveProcesses\" />"
......@@ -665,6 +666,7 @@ create_main_window (ProcData *procdata)
GtkWidget *tab_label1, *tab_label2, *tab_label3;
GtkWidget *vbox1;
GtkWidget *sys_box, *devices_box;
GtkWidget *sysinfo_box, *sysinfo_label;
app = gnome_app_new ("procman", _("System Monitor"));
......@@ -731,6 +733,12 @@ create_main_window (ProcData *procdata)
0);
gtk_widget_show (notebook);
sysinfo_box = procman_create_sysinfo_view();
gtk_widget_show_all(sysinfo_box);
sysinfo_label = gtk_label_new(_("System"));
gtk_widget_show(sysinfo_label);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sysinfo_box, sysinfo_label);
vbox1 = create_proc_view (procdata);
gtk_widget_show (vbox1);
tab_label1 = gtk_label_new (_("Processes"));
......@@ -795,35 +803,47 @@ do_popup_menu (ProcData *procdata, GdkEventButton *event)
}
void
update_sensitivity (ProcData *data, gboolean sensitivity)
update_sensitivity(ProcData *data)
{
const char * const selected_actions[] = { "StopProcess",
"ContProcess",
"EndProcess",
"KillProcess",
"ChangePriority",
"HideProcess",
"MemoryMaps",
"OpenFiles" };
const char * const processes_actions[] = { "ShowActiveProcesses",
"ShowAllProcesses",
"ShowMyProcesses",
"ShowDependencies",
"HiddenProcesses" };
size_t i;
gboolean processes_sensitivity, selected_sensitivity;
GtkAction *action;
processes_sensitivity = (data->config.current_tab == PROCMAN_TAB_PROCESSES);
selected_sensitivity = (processes_sensitivity && data->selected_process != NULL);
if(data->endprocessbutton) {
/* avoid error on startup if endprocessbutton
has not been built yet */
gtk_widget_set_sensitive (data->endprocessbutton, sensitivity);
gtk_widget_set_sensitive(data->endprocessbutton, selected_sensitivity);
}
action = gtk_action_group_get_action (data->action_group, "StopProcess");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "ContProcess");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "EndProcess");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "KillProcess");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "ChangePriority");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "HideProcess");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "HiddenProcesses");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "MemoryMaps");
gtk_action_set_sensitive (action, sensitivity);
action = gtk_action_group_get_action (data->action_group, "OpenFiles");
gtk_action_set_sensitive (action, sensitivity);
for (i = 0; i != G_N_ELEMENTS(processes_actions); ++i) {
action = gtk_action_group_get_action(data->action_group,
processes_actions[i]);
gtk_action_set_sensitive(action, processes_sensitivity);
}
for (i = 0; i != G_N_ELEMENTS(selected_actions); ++i) {
action = gtk_action_group_get_action(data->action_group,
selected_actions[i]);
gtk_action_set_sensitive(action, selected_sensitivity);
}
}
static void
......
......@@ -26,7 +26,7 @@
void create_main_window (ProcData *data) G_GNUC_INTERNAL;
void update_sensitivity (ProcData *data, gboolean sensitivity) G_GNUC_INTERNAL;
void update_sensitivity (ProcData *data) G_GNUC_INTERNAL;
void do_popup_menu(ProcData *data, GdkEventButton *event) G_GNUC_INTERNAL;
GtkWidget * make_title_label (const char *text) G_GNUC_INTERNAL;
......
......@@ -110,6 +110,15 @@ namespace
// GUI Stuff
enum ProcmanLsof {
PROCMAN_LSOF_COL_PIXBUF,
PROCMAN_LSOF_COL_PROCESS,
PROCMAN_LSOF_COL_PID,
PROCMAN_LSOF_COL_FILENAME,
PROCMAN_LSOF_NCOLS
};
struct GUI {
GtkListStore *model;
......
......@@ -6,14 +6,6 @@
G_BEGIN_DECLS
enum ProcmanLsof {
PROCMAN_LSOF_COL_PIXBUF,
PROCMAN_LSOF_COL_PROCESS,
PROCMAN_LSOF_COL_PID,
PROCMAN_LSOF_COL_FILENAME,
PROCMAN_LSOF_NCOLS
};
void procman_lsof(ProcData *data);
G_END_DECLS
......
......@@ -318,7 +318,7 @@ create_memmapsdata (ProcData *procdata)
GtkListStore *model;
guint i;
static const gchar *titles[] = {
const gchar * const titles[] = {
N_("Filename"),
N_("VM Start"),
N_("VM End"),
......@@ -329,8 +329,6 @@ create_memmapsdata (ProcData *procdata)
N_("Inode")
};
PROCMAN_GETTEXT_ARRAY_INIT(titles);
model = gtk_list_store_new (MMAP_COL_MAX,
G_TYPE_STRING, /* MMAP_COL_FILENAME */
G_TYPE_STRING, /* MMAP_COL_VMSTART */
......@@ -372,7 +370,7 @@ create_memmapsdata (ProcData *procdata)
break;
}
column = gtk_tree_view_column_new_with_attributes (titles[i],
column = gtk_tree_view_column_new_with_attributes (_(titles[i]),
cell,
"text", i,
NULL);
......
......@@ -224,7 +224,7 @@ create_openfiles_tree (ProcData *procdata)
GtkCellRenderer *cell;
gint i;
static const gchar *title[] = {
const gchar * const titles[] = {
/* Translators: "FD" here means "File Descriptor". Please use
a very short translation if possible, and at most
2-3 characters for it to be able to fit in the UI. */
......@@ -233,8 +233,6 @@ create_openfiles_tree (ProcData *procdata)
N_("Object")
};
PROCMAN_GETTEXT_ARRAY_INIT(title);
model = gtk_list_store_new (NUM_OPENFILES_COL,
G_TYPE_INT, /* FD */
G_TYPE_STRING, /* Type */
......@@ -255,7 +253,7 @@ create_openfiles_tree (ProcData *procdata)
break;
}
column = gtk_tree_view_column_new_with_attributes (title[i],
column = gtk_tree_view_column_new_with_attributes (_(titles[i]),
cell,
"text", i,
NULL);
......
......@@ -822,10 +822,19 @@ procdialog_create_preferences_dialog (ProcData *procdata)
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (prefs_dialog_button_pressed), procdata);
if (procdata->config.current_tab == 0)
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
else
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1);
switch (procdata->config.current_tab) {
case PROCMAN_TAB_SYSINFO:
case PROCMAN_TAB_PROCESSES:
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
break;
case PROCMAN_TAB_RESOURCES:
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 1);
break;
case PROCMAN_TAB_DISKS:
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 2);
break;
}
}
......
......@@ -359,7 +359,9 @@ procman_data_new (GConfClient *client)
pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250);
pd->config.disks_update_interval = MAX (pd->config.disks_update_interval, 1000);
pd->config.whose_process = CLAMP (pd->config.whose_process, 0, 2);
pd->config.current_tab = CLAMP (pd->config.current_tab, 0, 2);
pd->config.current_tab = CLAMP(pd->config.current_tab,
PROCMAN_TAB_SYSINFO,
PROCMAN_TAB_DISKS);
/* Determinie number of cpus since libgtop doesn't really tell you*/
pd->config.num_cpus = 0;
......
......@@ -50,6 +50,15 @@ enum
};
enum ProcmanTab
{
PROCMAN_TAB_SYSINFO,
PROCMAN_TAB_PROCESSES,
PROCMAN_TAB_RESOURCES,
PROCMAN_TAB_DISKS
};
struct _ProcConfig
{
gint width;
......
......@@ -1067,7 +1067,7 @@ proctable_clear_tree (ProcData * const procdata)
proctable_free_table (procdata);
update_sensitivity (procdata, FALSE);
update_sensitivity(procdata);
}
......
#include <config.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glibtop/fsusage.h>
#include <glibtop/mountlist.h>
#include <glibtop/mem.h>
#include <glibtop/sysinfo.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <string>
#include <vector>
#include <fstream>
extern "C" {
#include "sysinfo.h"
#include "util.h"
}
using std::string;
using std::vector;
namespace {
class SysInfo
{
public:
string hostname;
string distro_name;
string distro_version;
string distro_release;
guint64 memory_bytes;
guint64 free_space_bytes;
guint n_processors;
vector<string> processors;
SysInfo(const string &name)
: distro_name(name),
distro_version(_("Unknown version"))
{
this->load_hostname();
this->load_processors_info();
this->load_memory_info();
this->load_disk_info();
}
virtual ~SysInfo()
{ }
private:
void load_hostname()
{
char buf[256];
if (gethostname(buf, sizeof buf) == 0)
if (struct hostent *h = gethostbyname(buf))
this->hostname = h->h_name;
}
void load_memory_info()
{
glibtop_mem mem;
glibtop_get_mem(&mem);
this->memory_bytes = mem.total;
}
void load_processors_info()
{
const glibtop_sysinfo *info = glibtop_get_sysinfo();
for (guint i = 0; i != info->ncpu; ++i) {
const char * const keys[] = { "model name", "cpu" };
gchar *model = 0;
for (guint j = 0; !model && j != G_N_ELEMENTS(keys); ++j)
model = static_cast<char*>(g_hash_table_lookup(info->cpuinfo[i].values,
keys[j]));
if (!model)
model = _("Unknown CPU model");
this->processors.push_back(model);
}
}
void load_disk_info()
{
glibtop_mountentry *entries;
glibtop_mountlist mountlist;
entries = glibtop_get_mountlist(&mountlist, 0);
this->free_space_bytes = 0;
for (guint i = 0; i != mountlist.number; ++i) {
glibtop_fsusage usage;
glibtop_get_fsusage(&usage, entries[i].mountdir);
this->free_space_bytes += usage.bfree * usage.block_size;
}
g_free(entries);
}
};
class DebianSysInfo
: public SysInfo
{
public:
DebianSysInfo()
: SysInfo("Debian")
{
this->load_debian_info();
}
private:
void load_debian_info()
{
std::ifstream input("/etc/debian_version");
if (input)
std::getline(input, this->distro_version);
else
this->distro_version = _("Unknown version");
}
};
SysInfo* get_sysinfo()
{
if (g_file_test("/etc/debian_version", G_FILE_TEST_EXISTS))
return new DebianSysInfo;
else
return new SysInfo(_("Unknown distro"));
}
}
GtkWidget *
procman_create_sysinfo_view(void)
{
GtkWidget *hbox;
GtkWidget *vbox;
SysInfo *data = get_sysinfo();;
GtkWidget *logo;
GtkWidget *distro_frame;
GtkWidget *distro_version_label;
GtkWidget *hardware_frame;
GtkWidget *hardware_table;
GtkWidget *memory_label;
GtkWidget *processor_label;
GtkWidget *disk_space_frame;
GtkWidget *disk_space_table;
GtkWidget *disk_space_label;
GtkWidget *header;
GtkWidget *alignment;
gchar *markup;
hbox = gtk_hbox_new(FALSE, 12);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
/* left-side logo */
logo = gtk_image_new_from_file(DATADIR "/pixmaps/gnome-system-monitor/side.png");
gtk_misc_set_alignment(GTK_MISC(logo), 0.5, 0.0);
gtk_misc_set_padding(GTK_MISC(logo), 5, 12);
gtk_box_pack_start(GTK_BOX(hbox), logo, FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, 12);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
// hostname
markup = g_strdup_printf("<big><big><b><u>%s</u></b></big></big>",
data->hostname.c_str());
GtkWidget *hostname_frame = gtk_frame_new(markup);
g_free(markup);
gtk_frame_set_label_align(GTK_FRAME(hostname_frame), 0.0, 0.5);
gtk_label_set_use_markup(
GTK_LABEL(gtk_frame_get_label_widget(GTK_FRAME(hostname_frame))),
TRUE
);
gtk_frame_set_shadow_type(GTK_FRAME(hostname_frame), GTK_SHADOW_NONE);
gtk_box_pack_start(GTK_BOX(vbox), hostname_frame, FALSE, FALSE, 0);
/* distro section */
markup = g_strdup_printf("<big><big><b>%s</b></big></big>",
data->distro_name.c_str());
distro_frame = gtk_frame_new(markup);
g_free(markup);
gtk_frame_set_label_align(GTK_FRAME(distro_frame), 0.0, 0.5);
gtk_label_set_use_markup(
GTK_LABEL(gtk_frame_get_label_widget(GTK_FRAME(distro_frame))),
TRUE
);
gtk_frame_set_shadow_type(GTK_FRAME(distro_frame), GTK_SHADOW_NONE);
gtk_box_pack_start(GTK_BOX(vbox), distro_frame, FALSE, FALSE, 0);
alignment = gtk_alignment_new(0.5, 0.5, 1.0, 1.0);
gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 12, 0);
gtk_container_add(GTK_CONTAINER(distro_frame), alignment);
if (data->distro_release != "")
markup = g_strdup_printf(
_("Version %s (Release %s)"),