[Xfce4-commits] [apps/xfce4-taskmanager] 09/21: Select the corresponding row (work in progress)
noreply at xfce.org
noreply at xfce.org
Thu Jan 26 22:59:13 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 166c63101d17922af96656706d259e12b66e5d8a
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Tue Jan 24 21:53:46 2017 +0100
Select the corresponding row (work in progress)
---
src/process-tree-view.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/process-tree-view.c b/src/process-tree-view.c
index 24d936d..baeef13 100644
--- a/src/process-tree-view.c
+++ b/src/process-tree-view.c
@@ -13,6 +13,7 @@
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <glib/gprintf.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "process-tree-model.h"
@@ -771,6 +772,32 @@ xtm_process_tree_view_get_model (XtmProcessTreeView *treeview)
}
void
-xtm_process_tree_view_highlight_pid(XtmProcessTreeView *treeview, guint pid) {
-//TBD: search and highlight the given pid
+xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, guint pid) {
+ //TBD: search and highlight the given pid
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gboolean valid;
+ GValue *row_pid;
+ gchar *pid_string;
+
+ 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);
+ 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))
+ {
+ 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);
+ }
+ else
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(treeview->model), &iter);
+ }
+
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list