[gitg] Show all commits if no initial selection in ref list



commit 688d8a2d81e2412daa3de298cfcfdd14cd2d1fc6
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Tue Dec 16 08:38:34 2014 +0100

    Show all commits if no initial selection in ref list

 gitg/history/gitg-history-refs-list.vala |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala
index 8a968ac..382441e 100644
--- a/gitg/history/gitg-history-refs-list.vala
+++ b/gitg/history/gitg-history-refs-list.vala
@@ -682,7 +682,7 @@ public class RefsList : Gtk.ListBox
                        return;
                }
 
-               add_ref_row(null);
+               var all_commits = add_ref_row(null);
 
                add_header(Gitg.RefType.BRANCH, _("Branches"));
                add_header(Gitg.RefType.REMOTE, _("Remotes"));
@@ -719,10 +719,20 @@ public class RefsList : Gtk.ListBox
 
                d_selected_row = null;
 
-               if (get_selected_row() == null && head != null)
+               var sel = get_selected_row();
+
+               if (sel == null)
                {
-                       // Select default
-                       select_row(head);
+                       if (head != null)
+                       {
+                               // Select default
+                               select_row(head);
+                       }
+                       else
+                       {
+                               // Select all
+                               select_row(all_commits);
+                       }
                }
 
                thaw_notify();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]