Only select first ref unless multiselect

This commit is contained in:
Jesse van den Kieboom 2014-07-12 10:34:50 +02:00
parent 9616f91afc
commit 698bffc28f
2 changed files with 25 additions and 2 deletions

View file

@ -765,6 +765,23 @@ public class RefsList : Gtk.ListBox
}
}
public bool is_all
{
get
{
var row = get_selected_row();
if (row == null)
{
return true;
}
var ref_row = get_ref_row(row);
return (ref_row != null && ref_row.reference == null);
}
}
[Notify]
public Gee.List<Gitg.Ref> selection
{

View file

@ -137,9 +137,11 @@ namespace GitgHistory
{
var commit = d_commit_list_model.commit_from_path(path);
var sel = d_main.commit_list_view.get_selection();
if (d_selected.size == 0 || d_selected.remove(commit.get_id()))
{
d_main.commit_list_view.get_selection().select_path(path);
sel.select_path(path);
if (commit.get_id().equal(d_scroll_to))
{
@ -153,8 +155,12 @@ namespace GitgHistory
}
}
if (d_selected.size == 0)
if (d_selected.size == 0 || (sel.count_selected_rows() != 0 &&
(sel.mode == Gtk.SelectionMode.SINGLE ||
sel.mode == Gtk.SelectionMode.BROWSE)))
{
d_selected.clear();
d_commit_list_model.disconnect(d_insertsig);
d_insertsig = 0;
}