Use portable function to get the pagesize; Use a bigger "Information" icon in the menu
* src/xfce-taskmanager-linux.c, src/xfce-taskmanager-linux.h, src/interface.c(fill_list_item): - Use portale function to get the pagesize, and fallback to 4K * src/interface.c(create_infomenu): - Use a bigger "Information" icon in the menu (Old svn revision: 4824)
This commit is contained in:
@@ -325,6 +325,7 @@ GtkWidget* create_infomenu (void)
|
||||
{
|
||||
GtkWidget *infomenu;
|
||||
GtkWidget *title;
|
||||
GtkWidget *title_image;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *col_items[N_COLUMNS] = { 0 };
|
||||
gint i;
|
||||
@@ -332,6 +333,8 @@ GtkWidget* create_infomenu (void)
|
||||
infomenu = gtk_menu_new ();
|
||||
|
||||
title = gtk_image_menu_item_new_from_stock("gtk-info", NULL);
|
||||
title_image = gtk_image_new_from_stock ("gtk-info", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (title), title_image);
|
||||
gtk_widget_show(title);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(infomenu), title);
|
||||
gtk_widget_set_sensitive(title, FALSE);
|
||||
@@ -416,10 +419,6 @@ void change_list_store_view(void)
|
||||
|
||||
void fill_list_item(gint i, GtkTreeIter *iter)
|
||||
{
|
||||
static gint pagesize = 0;
|
||||
if (pagesize == 0)
|
||||
pagesize = getpagesize();
|
||||
|
||||
if(iter != NULL)
|
||||
{
|
||||
struct task *task = &g_array_index(task_array, struct task, i);
|
||||
@@ -428,7 +427,7 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
||||
gchar *ppid = g_strdup_printf("%i", task->ppid);
|
||||
gchar *state = g_strdup_printf("%s", task->state);
|
||||
gchar *vsize = g_strdup_printf("%i MB", task->vsize/1024/1024);
|
||||
gchar *rss = g_strdup_printf("%i MB", task->rss*pagesize/1024/1024);
|
||||
gchar *rss = g_strdup_printf("%i MB", task->rss/1024/1024);
|
||||
gchar *name = g_strdup_printf("%s", task->name);
|
||||
gchar *uname = g_strdup_printf("%s", task->uname);
|
||||
gchar *time = g_strdup_printf("%0d%%", (guint)task->time_percentage);
|
||||
|
||||
@@ -41,6 +41,14 @@ struct task get_task_details(gint pid)
|
||||
task.pid = -1;
|
||||
task.checked = FALSE;
|
||||
|
||||
if (pagesize == 0)
|
||||
{
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
if (pagesize == 0)
|
||||
pagesize = 4*1024;
|
||||
}
|
||||
|
||||
|
||||
if((task_file = fopen(filename,"r")) != NULL)
|
||||
{
|
||||
while(fgets(buffer_status, sizeof(buffer_status), task_file) != NULL)
|
||||
@@ -102,6 +110,7 @@ struct task get_task_details(gint pid)
|
||||
task.old_time = task.time;
|
||||
task.time = stime + utime;
|
||||
task.time_percentage = 0;
|
||||
task.rss *= pagesize;
|
||||
}
|
||||
task.uid = status.st_uid;
|
||||
passwdp = getpwuid(task.uid);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
@@ -38,6 +39,8 @@
|
||||
#define SIGNAL_CONT SIGCONT
|
||||
#define SIGNAL_STOP SIGSTOP
|
||||
|
||||
static gint pagesize = 0;
|
||||
|
||||
struct task get_task_details(gint pid);
|
||||
GArray *get_task_list(void);
|
||||
gboolean get_system_status(system_status *sys_stat);
|
||||
|
||||
Reference in New Issue
Block a user