[gitg] Local branch checkout using double-click.



commit fe26f68567b1cd31a21c176f4d069a96ff9df525
Author: Armandas JaruĊĦauskas <jarusauskas gmail com>
Date:   Sun May 31 23:30:16 2020 +0900

    Local branch checkout using double-click.

 gitg/history/gitg-history-refs-list.vala |  2 ++
 gitg/history/gitg-history.vala           | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)
---
diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala
index 3d026bf0..94be826c 100644
--- a/gitg/history/gitg-history-refs-list.vala
+++ b/gitg/history/gitg-history-refs-list.vala
@@ -584,6 +584,8 @@ public class RefsList : Gtk.ListBox
                selection_mode = Gtk.SelectionMode.BROWSE;
                d_remotes = new Gitg.Remote[0];
 
+               set_activate_on_single_click(false);
+
                set_sort_func(sort_rows);
                set_filter_func(filter_func);
 
diff --git a/gitg/history/gitg-history.vala b/gitg/history/gitg-history.vala
index fc5d93cb..38dfdd1e 100644
--- a/gitg/history/gitg-history.vala
+++ b/gitg/history/gitg-history.vala
@@ -572,6 +572,8 @@ namespace GitgHistory
                                });
                        });
 
+                       d_main.refs_list.row_activated.connect(on_ref_list_row_activated);
+
                        var engine = Gitg.PluginsEngine.get_default();
 
                        var extset = new Peas.ExtensionSet(engine,
@@ -1092,6 +1094,20 @@ namespace GitgHistory
                        d_commit_list_model.reload();
                }
 
+               private void on_ref_list_row_activated(Gtk.ListBoxRow row)
+               {
+                       var ref_row = row as RefRow;
+                       if (ref_row == null) {
+                               return;
+                       }
+
+                       if (ref_row.reference.is_branch()) {
+                               var af = new ActionInterface(application, d_main.refs_list);
+                               var checkout = new Gitg.RefActionCheckout(application, af, ref_row.reference);
+                               checkout.activate();
+                       }
+               }
+
                public bool search_available
                {
                        get { return true; }


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