Add Support For Multiple Selections in The Commit List View

We can now easily select multiple commits in the commit list view, considering
that we only can select at maximum 2 commits at a time.

Signed-off-by: MahmoudKhalil <mahmoudkhalil11@gmail.com>
This commit is contained in:
MahmoudKhalil 2020-06-27 22:51:56 +02:00
parent 9a7323e736
commit dfd3f3b61e

View file

@ -582,9 +582,18 @@ namespace GitgHistory
d_main.commit_list_view.model = d_commit_list_model;
d_main.commit_list_view.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE);
d_main.commit_list_view.get_selection().changed.connect((sel) => {
selection_changed();
Gtk.TreePath commit_cursor_path;
d_main.commit_list_view.get_cursor(out commit_cursor_path, null);
var selected_commits_count = sel.count_selected_rows();
if(selected_commits_count > 2)
{
sel.unselect_all();
sel.select_path(commit_cursor_path);
}
// Set primary selection to sha1 of first selected commit
var clip = ((Gtk.Widget)application).get_clipboard(Gdk.SELECTION_PRIMARY);