[Goodies-commits] r1477 - in xfce4-taskmanager/trunk: po src

Johannes Zellner nebulon at xfce.org
Sun Jul 9 11:22:41 CEST 2006


Author: nebulon
Date: 2006-07-09 09:22:39 +0000 (Sun, 09 Jul 2006)
New Revision: 1477

Modified:
   xfce4-taskmanager/trunk/po/Makefile.in
   xfce4-taskmanager/trunk/src/functions.c
   xfce4-taskmanager/trunk/src/interface.c
   xfce4-taskmanager/trunk/src/linux.c
   xfce4-taskmanager/trunk/src/types.h
Log:
- now the linux-parts are running very save
- updated the website in the "about"-dialog



Modified: xfce4-taskmanager/trunk/po/Makefile.in
===================================================================
--- xfce4-taskmanager/trunk/po/Makefile.in	2006-07-07 23:14:42 UTC (rev 1476)
+++ xfce4-taskmanager/trunk/po/Makefile.in	2006-07-09 09:22:39 UTC (rev 1477)
@@ -32,7 +32,7 @@
 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
 

Modified: xfce4-taskmanager/trunk/src/functions.c
===================================================================
--- xfce4-taskmanager/trunk/src/functions.c	2006-07-07 23:14:42 UTC (rev 1476)
+++ xfce4-taskmanager/trunk/src/functions.c	2006-07-09 09:22:39 UTC (rev 1477)
@@ -28,13 +28,6 @@
 	/* 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++)
 	{
@@ -53,7 +46,7 @@
 					strcpy(tmp->state, new_tmp->state);
 					tmp->size = new_tmp->size;
 					tmp->rss = new_tmp->rss;
-
+					
 					refresh_list_item(i);
 				}
 				tmp->checked = TRUE;
@@ -72,7 +65,7 @@
 
 		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 @@
 
 		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++;
 		}
@@ -123,7 +116,9 @@
 
 	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);
 }
 
@@ -143,6 +138,9 @@
 
 	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);
 

Modified: xfce4-taskmanager/trunk/src/interface.c
===================================================================
--- xfce4-taskmanager/trunk/src/interface.c	2006-07-07 23:14:42 UTC (rev 1476)
+++ xfce4-taskmanager/trunk/src/interface.c	2006-07-09 09:22:39 UTC (rev 1477)
@@ -170,6 +170,14 @@
 	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 @@
 	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 at nebulon.de", "Original Author");
     
 	about_dialog = xfce_about_dialog_new(GTK_WINDOW(main_window), about_info, NULL);

Modified: xfce4-taskmanager/trunk/src/linux.c
===================================================================
--- xfce4-taskmanager/trunk/src/linux.c	2006-07-07 23:14:42 UTC (rev 1476)
+++ xfce4-taskmanager/trunk/src/linux.c	2006-07-09 09:22:39 UTC (rev 1477)
@@ -17,13 +17,16 @@
 
 	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,36 +78,37 @@
 						&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);
 		}
 	}
-
+	
 	if(cmdline_file != NULL)
 		fclose(cmdline_file);
-
+	
 	if(g_str_has_suffix(task.name, ")"))
 		*g_strrstr(task.name, ")") = '\0';
 
@@ -118,13 +122,15 @@
 	GArray *task_list;
 
 	task_list = g_array_new (FALSE, FALSE, sizeof (struct task));
-
+	
 	if((dir = opendir("/proc/")) == NULL)
 	{
 		fprintf(stderr, "Error: couldn't load the /proc directory\n");
 		return NULL;
 	}
 
+	gint count = 0;
+	
 	while((dir_entry = readdir(dir)) != NULL)
 	{
 		if(atoi(dir_entry->d_name) != 0)
@@ -133,10 +139,10 @@
 			if(task.pid != -1)
 				g_array_append_val(task_list, task);
 		}
+		count++;
 	}
 
 	closedir(dir);
 
-
 	return task_list;
 }

Modified: xfce4-taskmanager/trunk/src/types.h
===================================================================
--- xfce4-taskmanager/trunk/src/types.h	2006-07-07 23:14:42 UTC (rev 1476)
+++ xfce4-taskmanager/trunk/src/types.h	2006-07-09 09:22:39 UTC (rev 1477)
@@ -55,4 +55,7 @@
 guint win_width;
 guint win_height;
 
+const gchar *custom_signal_0;
+const gchar *custom_signal_1;
+
 #endif




More information about the Goodies-commits mailing list