diff options
Diffstat (limited to 'src/selection.cpp')
-rw-r--r-- | src/selection.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/selection.cpp b/src/selection.cpp index 6f293a6..7e15a9e 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -6,38 +6,38 @@ namespace procman { - void SelectionMemento::add_to_selected(GtkTreeModel* model, GtkTreePath*, GtkTreeIter* iter, gpointer data) - { - guint pid = 0; - gtk_tree_model_get(model, iter, COL_PID, &pid, -1); - if (pid) - static_cast<SelectionMemento*>(data)->pids.push_back(pid); - } + void SelectionMemento::add_to_selected(GtkTreeModel* model, GtkTreePath*, GtkTreeIter* iter, gpointer data) + { + guint pid = 0; + gtk_tree_model_get(model, iter, COL_PID, &pid, -1); + if (pid) + static_cast<SelectionMemento*>(data)->pids.push_back(pid); + } - void SelectionMemento::save(GtkWidget* tree) - { - GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); - gtk_tree_selection_selected_foreach(selection, &SelectionMemento::add_to_selected, this); - } + void SelectionMemento::save(GtkWidget* tree) + { + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); + gtk_tree_selection_selected_foreach(selection, &SelectionMemento::add_to_selected, this); + } - void SelectionMemento::restore(GtkWidget* tree) - { - if (not this->pids.empty()) - { - GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); - typedef std::vector<pid_t>::iterator iterator; - for (iterator it(this->pids.begin()); it != this->pids.end(); ++it) - { - if (ProcInfo* proc = ProcInfo::find(*it)) - { - gtk_tree_selection_select_iter(selection, &proc->node); - procman_debug("Re-selected process %u", unsigned(*it)); - } - else - procman_debug("Could not find process %u, cannot re-select it", unsigned(*it)); - } - } - } + void SelectionMemento::restore(GtkWidget* tree) + { + if (not this->pids.empty()) + { + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); + typedef std::vector<pid_t>::iterator iterator; + for (iterator it(this->pids.begin()); it != this->pids.end(); ++it) + { + if (ProcInfo* proc = ProcInfo::find(*it)) + { + gtk_tree_selection_select_iter(selection, &proc->node); + procman_debug("Re-selected process %u", unsigned(*it)); + } + else + procman_debug("Could not find process %u, cannot re-select it", unsigned(*it)); + } + } + } } |