From 033fbc6383b4fb466619092cb4cdda53fa92052b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enner=20Pe=CC=81rez?= Date: Wed, 19 Jun 2024 13:24:33 -0500 Subject: [PATCH 1/2] OpenSubmodule Method --- src/ViewModels/Repository.cs | 39 ++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index ee6cd223..5fb1b858 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -1538,6 +1538,27 @@ namespace SourceGit.ViewModels return menu; } + public void OpenSubmodule(string submodule) + { + var root = Path.GetFullPath(Path.Combine(_fullpath, submodule)); + var gitDir = new Commands.QueryGitDir(root).Result(); + var repo = Preference.AddRepository(root, gitDir); + + var node = new RepositoryNode() + { + Id = repo.FullPath, + Name = Path.GetFileName(repo.FullPath), + Bookmark = 0, + IsRepository = true, + }; + + var launcher = App.GetTopLevel().DataContext as Launcher; + if (launcher != null) + { + launcher.OpenRepositoryInTab(node, null); + } + } + public ContextMenu CreateContextMenuForSubmodule(string submodule) { var open = new MenuItem(); @@ -1545,23 +1566,7 @@ namespace SourceGit.ViewModels open.Icon = App.CreateMenuIcon("Icons.Folder.Open"); open.Click += (o, ev) => { - var root = Path.GetFullPath(Path.Combine(_fullpath, submodule)); - var gitDir = new Commands.QueryGitDir(root).Result(); - var repo = Preference.AddRepository(root, gitDir); - var node = new RepositoryNode() - { - Id = repo.FullPath, - Name = Path.GetFileName(repo.FullPath), - Bookmark = 0, - IsRepository = true, - }; - - var launcher = App.GetTopLevel().DataContext as Launcher; - if (launcher != null) - { - launcher.OpenRepositoryInTab(node, null); - } - + OpenSubmodule(submodule); ev.Handled = true; }; From 46b1fc1831550166563fc8ac00d551d381b2561b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enner=20Pe=CC=81rez?= Date: Wed, 19 Jun 2024 13:24:54 -0500 Subject: [PATCH 2/2] DoubleTab Open Submodule --- src/Views/Repository.axaml | 1 + src/Views/Repository.axaml.cs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 0e48186a..5e8d45d3 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -457,6 +457,7 @@ HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" ContextRequested="OnSubmoduleContextRequested" + DoubleTapped="OnDoubleTappedSubmodule" IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">