[Xfce4-commits] [apps/xfce4-taskmanager] 10/21: minor string usage fixes

noreply at xfce.org noreply at xfce.org
Thu Jan 26 22:59:14 CET 2017


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

ochosi pushed a commit to branch master
in repository apps/xfce4-taskmanager.

commit dfb2deaaca038aba778b8faa4837b0954a0b94cf
Author: Florian Schüller <florian.schueller at gmail.com>
Date:   Tue Jan 24 22:22:59 2017 +0100

    minor string usage fixes
---
 src/process-tree-view.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/process-tree-view.c b/src/process-tree-view.c
index baeef13..23b6127 100644
--- a/src/process-tree-view.c
+++ b/src/process-tree-view.c
@@ -777,27 +777,37 @@ xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, guint pid) {
 	GtkTreePath	*path;
 	GtkTreeIter  iter;
 	gboolean     valid;
-	GValue			*row_pid;
-	gchar				*pid_string;
+	GValue	row_pid = G_VALUE_INIT;
+	gchar	pid_string[15];
+	const gchar	*cur_pid;
 
 	g_return_if_fail (treeview->model != NULL);
 
 	/* Get first row in list store */
 	valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (treeview->model), &iter);
-	g_sprintf (pid_string, "%d", pid);
+	g_snprintf (pid_string, 15, "%d", pid);
+	g_warning("search %s", pid_string);
 	while (valid)
 	{
 		/* ... do something with that row using the iter ...          */
-		gtk_tree_model_get_value (GTK_TREE_MODEL (treeview->model), &iter, COLUMN_PID, row_pid);
-		if (pid_string == g_value_get_string (row_pid))
+		gtk_tree_model_get_value (GTK_TREE_MODEL (treeview->model), &iter, COLUMN_PID, &row_pid);
+		cur_pid = g_value_get_string (&row_pid);
+		if ((cur_pid != NULL) && (g_strstr_len(pid_string, 15, cur_pid)  == 0))
 		{
+
+			g_warning("Got it");
 			path = gtk_tree_model_get_path (GTK_TREE_MODEL (treeview->model), &iter);
 			gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), path);
 			gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (treeview), path, NULL, TRUE, 0.5, 0);
 			gtk_tree_path_free (path);
+			valid = FALSE;
 		}
 		else
+		{
+			g_warning("Next... %s", cur_pid);
 			valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(treeview->model), &iter);
+		}
+		g_value_unset(&row_pid);
 	}
 
 }

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


More information about the Xfce4-commits mailing list