[Xfce4-commits] [apps/xfce4-taskmanager] 05/20: Stop displaying 'Running as <uid> on <hostname>' and remove corresponding code (bug 14401)

noreply at xfce.org noreply at xfce.org
Wed May 30 22:00:19 CEST 2018


This is an automated email from the git hooks/post-receive script.

l   a   n   d   r   y       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-taskmanager.

commit 0111851b4d6cdc87699a932b208ebf783491dbde
Author: rim <rozhuk.im at gmail.com>
Date:   Tue May 29 03:30:31 2018 +0300

    Stop displaying 'Running as <uid> on <hostname>' and remove corresponding code (bug 14401)
---
 src/main.c              |  1 -
 src/process-tree-view.c | 10 +++-------
 src/task-manager.c      | 50 -------------------------------------------------
 src/task-manager.h      |  4 ----
 4 files changed, 3 insertions(+), 62 deletions(-)

diff --git a/src/main.c b/src/main.c
index 945cb3a..186edc7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -237,7 +237,6 @@ int main (int argc, char *argv[])
 #endif
 
 	task_manager = xtm_task_manager_new (xtm_process_window_get_model (XTM_PROCESS_WINDOW (window)));
-	g_message ("Running as %s on %s", xtm_task_manager_get_username (task_manager), xtm_task_manager_get_hostname (task_manager));
 
 	init_timeout ();
 	g_signal_connect (settings, "notify::refresh-rate", G_CALLBACK (refresh_rate_changed), NULL);
diff --git a/src/process-tree-view.c b/src/process-tree-view.c
index 5c0c3a7..53f278e 100644
--- a/src/process-tree-view.c
+++ b/src/process-tree-view.c
@@ -11,6 +11,7 @@
 #include <config.h>
 #endif
 
+#include <unistd.h>
 #include <glib-object.h>
 #include <glib/gi18n.h>
 #include <glib/gprintf.h>
@@ -90,14 +91,9 @@ xtm_process_tree_view_init (XtmProcessTreeView *treeview)
 	gboolean tree;
 
 	treeview->settings = xtm_settings_get_default ();
+	treeview->owner_uid = getuid ();
 	g_signal_connect (treeview->settings, "notify", G_CALLBACK (settings_changed), treeview);
-
-	{
-		gchar *uid_name;
-		get_owner_uid (&treeview->owner_uid, &uid_name);
-		g_free (uid_name);
-		g_object_get (treeview->settings, "show-all-processes", &treeview->show_all_processes_cached, "process-tree", &tree, NULL);
-	}
+	g_object_get (treeview->settings, "show-all-processes", &treeview->show_all_processes_cached, "process-tree", &tree, NULL);
 
 	/* Create tree view model */
 #ifdef HAVE_WNCK
diff --git a/src/task-manager.c b/src/task-manager.c
index 243f0c1..0624aa1 100644
--- a/src/task-manager.c
+++ b/src/task-manager.c
@@ -55,9 +55,6 @@ struct _XtmTaskManager
 #endif
 	GtkTreeModel *		model;
 	GArray *		tasks;
-	guint			owner_uid;
-	gchar *			owner_uid_name;
-	gchar *			hostname;
 	gushort			cpu_count;
 	gfloat			cpu_user;
 	gfloat			cpu_system;
@@ -97,8 +94,6 @@ xtm_task_manager_init (XtmTaskManager *manager)
 	manager->app_manager = xtm_app_manager_new ();
 #endif
 	manager->tasks = g_array_new (FALSE, FALSE, sizeof (Task));
-	get_owner_uid (&(manager->owner_uid), &(manager->owner_uid_name));
-	manager->hostname = get_hostname ();
 
 	/* Listen to settings changes and force an update on the whole model */
 	settings = xtm_settings_get_default ();
@@ -113,8 +108,6 @@ xtm_task_manager_finalize (GObject *object)
 {
 	XtmTaskManager *manager = XTM_TASK_MANAGER (object);
 	g_array_free (manager->tasks, TRUE);
-	g_free (manager->owner_uid_name);
-	g_free (manager->hostname);
 #ifdef HAVE_WNCK
 	g_object_unref (manager->app_manager);
 #endif
@@ -332,20 +325,6 @@ xtm_task_manager_new (GtkTreeModel *model)
 	return manager;
 }
 
-const gchar *
-xtm_task_manager_get_username (XtmTaskManager *manager)
-{
-	g_return_val_if_fail (XTM_IS_TASK_MANAGER (manager), NULL);
-	return manager->owner_uid_name;
-}
-
-const gchar *
-xtm_task_manager_get_hostname (XtmTaskManager *manager)
-{
-	g_return_val_if_fail (XTM_IS_TASK_MANAGER (manager), NULL);
-	return manager->hostname;
-}
-
 void
 xtm_task_manager_get_system_info (XtmTaskManager *manager, guint *num_processes, gfloat *cpu,
 				  guint64 *memory_used, guint64 *memory_total,
@@ -495,35 +474,6 @@ xtm_task_manager_update_model (XtmTaskManager *manager)
 }
 
 
-
-void
-get_owner_uid (guint *owner_uid, gchar **owner_uid_name)
-{
-	uid_t uid;
-	struct passwd *pw;
-	gchar *username = NULL;
-
-	uid = getuid ();
-	pw = getpwuid (uid);
-
-	username = g_strdup ((pw != NULL) ? pw->pw_name : "nobody");
-
-	*owner_uid = (guint) uid;
-	*owner_uid_name = username;
-}
-
-gchar *
-get_hostname (void)
-{
-#ifndef HOST_NAME_MAX
-#define HOST_NAME_MAX 255
-#endif
-	char hostname[HOST_NAME_MAX];
-	if (gethostname (hostname, sizeof(hostname)))
-		return g_strdup ("(unknown)");
-	return g_strdup_printf ("%s", hostname);
-}
-
 gchar *
 get_uid_name (guint uid)
 {
diff --git a/src/task-manager.h b/src/task-manager.h
index f62f9eb..bc76f9e 100644
--- a/src/task-manager.h
+++ b/src/task-manager.h
@@ -61,8 +61,6 @@ typedef struct _XtmTaskManager XtmTaskManager;
 
 GType			xtm_task_manager_get_type			(void);
 XtmTaskManager *	xtm_task_manager_new				(GtkTreeModel *model);
-const gchar *		xtm_task_manager_get_username			(XtmTaskManager *manager);
-const gchar *		xtm_task_manager_get_hostname			(XtmTaskManager *manager);
 void			xtm_task_manager_get_system_info		(XtmTaskManager *manager, guint *num_processes, gfloat *cpu,
 									 guint64 *memory_used, guint64 *memory_total,
 									 guint64 *swap_used, guint64 *swap_total);
@@ -91,8 +89,6 @@ enum
 	XTM_PRIORITY_VERY_HIGH,
 };
 
-void		get_owner_uid		(guint *owner_uid, gchar **owner_uid_name);
-gchar *		get_hostname		(void);
 gchar *		get_uid_name		(guint uid);
 gboolean	send_signal_to_pid	(GPid pid, gint xtm_signal);
 gint		task_pid_compare_fn	(gconstpointer a, gconstpointer b);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list