- now the linux-parts are running very save

- updated the website in the "about"-dialog



(Old svn revision: 1477)
This commit is contained in:
Johannes Zellner
2006-07-09 09:22:39 +00:00
parent d15a9f259d
commit 29f3f00619
5 changed files with 43 additions and 28 deletions

View File

@@ -32,7 +32,7 @@ localedir = $(libdir)/locale
gnulocaledir = $(datadir)/locale
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
subdir = po
install_sh = /home/the_hippie/xfce4-taskmanager/trunk/install-sh
install_sh = /home/the_hippie/Projekte/xfce4-taskmanager/trunk/install-sh
mkdir_p = mkdir -p -- .
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

View File

@@ -28,13 +28,6 @@ gboolean refresh_task_list(void)
/* gets the new task list */
new_task_list = (GArray*) get_task_list();
/* markes all new_tasks to "not checked" */
for(i = 0; i < new_task_list->len; i++)
{
struct task *new_tmp = &g_array_index(new_task_list, struct task, i);
new_tmp->checked = FALSE;
}
/* check if task is new and marks the task that its checked*/
for(i = 0; i < task_array->len; i++)
{
@@ -72,7 +65,7 @@ gboolean refresh_task_list(void)
struct task *tmp = &g_array_index(task_array, struct task, i);
if(tmp->checked == FALSE)
if(!tmp->checked)
{
remove_list_item((gint)tmp->pid);
g_array_remove_index(task_array, i);
@@ -91,10 +84,10 @@ gboolean refresh_task_list(void)
if(!new_tmp->checked)
{
struct task new_task = *new_tmp;
struct task *new_task = new_tmp;
g_array_append_val(task_array, new_task);
if((show_user_tasks && new_task.uid == own_uid) || (show_root_tasks && new_task.uid == 0) || (show_other_tasks && new_task.uid != own_uid && new_task.uid != 0))
g_array_append_val(task_array, *new_task);
if((show_user_tasks && new_task->uid == own_uid) || (show_root_tasks && new_task->uid == 0) || (show_other_tasks && new_task->uid != own_uid && new_task->uid != 0))
add_new_list_item(tasks);
tasks++;
}
@@ -124,6 +117,8 @@ void load_config(void)
win_width = xfce_rc_read_int_entry(rc_file, "win_width", 500);
win_height = xfce_rc_read_int_entry(rc_file, "win_height", 400);
custom_signal_1 = xfce_rc_read_entry(rc_file, "custom_signal_1", "");
custom_signal_0 = xfce_rc_read_entry(rc_file, "custom_signal_0", "Hello");
xfce_rc_close(rc_file);
}
@@ -144,6 +139,9 @@ void save_config(void)
xfce_rc_write_int_entry(rc_file, "win_width", win_width);
xfce_rc_write_int_entry(rc_file, "win_height", win_height);
xfce_rc_write_entry(rc_file, "custom_signal_0", custom_signal_0);
xfce_rc_write_entry(rc_file, "custom_signal_1", custom_signal_1);
xfce_rc_flush(rc_file);
xfce_rc_close(rc_file);

View File

@@ -170,6 +170,14 @@ 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");
if(strcmp(custom_signal_0, "") != 0)
{
menu_item = gtk_menu_item_new_with_label (custom_signal_0);
gtk_widget_show (menu_item);
gtk_container_add (GTK_CONTAINER (taskpopup), menu_item);
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_task_menu), "OO");
}
return taskpopup;
}
@@ -227,7 +235,7 @@ void show_about_dialog(void)
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);
xfce_about_info_set_homepage(about_info, "http://developer.berlios.de/projects/xfce-goodies/");
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");
about_dialog = xfce_about_dialog_new(GTK_WINDOW(main_window), about_info, NULL);

View File

@@ -17,13 +17,16 @@ struct task get_task_details(gint pid)
stat(filename, &status);
memset(&task, 0, sizeof(task));
memset(&task, 0, sizeof(struct task));
task.pid = -1;
task.checked = FALSE;
if((task_file = fopen(filename,"r")) != NULL)
{
while(fgets(buffer_status, sizeof buffer_status, task_file) != NULL)
while(fgets(buffer_status, sizeof(buffer_status), task_file) != NULL)
{
sscanf(buffer_status, "%i (%255s %c %i %i %i %i %i %255s %255s %255s %255s %255s %255s %255s %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 (%s %c %i %i %i %i %i %s %s %s %s %s %s %s %i %i %i %i %i %i %i %i %i %s %s %s %i %s %s %s %s %s %s %s %s %s %s %i %s %s",
&task.pid, // processid
&task.name, // processname
&task.state, // processstate
@@ -75,28 +78,29 @@ struct task get_task_details(gint pid)
&dummy
);
}
task.uid = status.st_uid;
passwdp = getpwuid(task.uid);
if(passwdp != NULL && passwdp->pw_name != NULL)
g_strlcpy(task.uname, passwdp->pw_name, sizeof task.uname);
}
if(task_file != NULL)
fclose(task_file);
if((cmdline_file = fopen(cmdline_filename,"r")) != NULL)
{
*dummy = NULL;
fscanf(cmdline_file, "%s", &dummy);
if(*dummy != NULL)
gchar dummy[255];
strcpy(&dummy, "");
fscanf(cmdline_file, "%255s", &dummy);
if(strcmp(dummy, "") != 0)
{
if(g_strrstr(dummy,"/") != NULL)
g_strlcpy(task.name, g_strrstr(dummy,"/")+1, 255);
else
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, "-"))
sscanf(task.name, "-%255s", task.name);
}
@@ -125,6 +129,8 @@ GArray *get_task_list()
return NULL;
}
gint count = 0;
while((dir_entry = readdir(dir)) != NULL)
{
if(atoi(dir_entry->d_name) != 0)
@@ -133,10 +139,10 @@ GArray *get_task_list()
if(task.pid != -1)
g_array_append_val(task_list, task);
}
count++;
}
closedir(dir);
return task_list;
}

View File

@@ -55,4 +55,7 @@ gboolean full_view;
guint win_width;
guint win_height;
const gchar *custom_signal_0;
const gchar *custom_signal_1;
#endif