mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-10-01 05:33:49 +00:00
Added reference action to create branch
This commit is contained in:
parent
2ba756e7cc
commit
6359ee3eec
|
@ -38,7 +38,7 @@ class CommitActionCreateBranch : GitgExt.UIElement, GitgExt.Action, GitgExt.Comm
|
|||
commit: commit);
|
||||
}
|
||||
|
||||
public string id
|
||||
public virtual string id
|
||||
{
|
||||
owned get { return "/org/gnome/gitg/commit-actions/create-branch"; }
|
||||
}
|
||||
|
@ -48,12 +48,12 @@ class CommitActionCreateBranch : GitgExt.UIElement, GitgExt.Action, GitgExt.Comm
|
|||
owned get { return _("Create branch"); }
|
||||
}
|
||||
|
||||
public string description
|
||||
public virtual string description
|
||||
{
|
||||
owned get { return _("Create a new branch at the selected commit"); }
|
||||
}
|
||||
|
||||
public void activate()
|
||||
public virtual void activate()
|
||||
{
|
||||
var dlg = new CreateBranchDialog((Gtk.Window)application);
|
||||
|
||||
|
|
68
gitg/gitg-ref-action-create-branch.vala
Normal file
68
gitg/gitg-ref-action-create-branch.vala
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* This file is part of gitg
|
||||
*
|
||||
* Copyright (C) 2022 - Adwait Rawat
|
||||
*
|
||||
* gitg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gitg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Gitg
|
||||
{
|
||||
|
||||
class RefActionCreateBranch : CommitActionCreateBranch, GitgExt.RefAction
|
||||
{
|
||||
// Do this to pull in config.h before glib.h (for gettext...)
|
||||
private const string version = Gitg.Config.VERSION;
|
||||
|
||||
public Gitg.Ref reference { get; construct set; }
|
||||
|
||||
public RefActionCreateBranch(GitgExt.Application application,
|
||||
GitgExt.RefActionInterface action_interface,
|
||||
Gitg.Ref reference)
|
||||
{
|
||||
Object(application: application,
|
||||
action_interface: action_interface,
|
||||
reference: reference);
|
||||
}
|
||||
|
||||
public override string id
|
||||
{
|
||||
owned get { return "/org/gnome/gitg/ref-actions/create-branch"; }
|
||||
}
|
||||
|
||||
public override string description
|
||||
{
|
||||
owned get { return _("Create a new branch at the selected reference"); }
|
||||
}
|
||||
|
||||
public override void activate()
|
||||
{
|
||||
try
|
||||
{
|
||||
commit = reference.resolve().lookup() as Gitg.Commit;
|
||||
base.activate();
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
application.show_infobar (_("Failed to lookup reference"),
|
||||
e.message,
|
||||
Gtk.MessageType.ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ex:set ts=4 noet
|
|
@ -866,6 +866,7 @@ namespace GitgHistory
|
|||
d_ignore_external = true;
|
||||
});
|
||||
|
||||
add_ref_action(actions, new Gitg.RefActionCreateBranch(application, af, reference));
|
||||
add_ref_action(actions, new Gitg.RefActionCheckout(application, af, reference));
|
||||
add_ref_action(actions, new Gitg.RefActionRename(application, af, reference));
|
||||
add_ref_action(actions, new Gitg.RefActionDelete(application, af, reference));
|
||||
|
|
|
@ -44,6 +44,7 @@ sources = gitg_sources + files(
|
|||
'gitg-recursive-monitor.vala',
|
||||
'gitg-recursive-scanner.vala',
|
||||
'gitg-ref-action-copy-name.vala',
|
||||
'gitg-ref-action-create-branch.vala',
|
||||
'gitg-ref-action-delete.vala',
|
||||
'gitg-ref-action-fetch.vala',
|
||||
'gitg-ref-action-push.vala',
|
||||
|
|
|
@ -24,6 +24,7 @@ public interface RefAction : Action
|
|||
{
|
||||
public abstract RefActionInterface action_interface { get; construct set; }
|
||||
public abstract Gitg.Ref reference { get; construct set; }
|
||||
public signal void finished();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue