Implement GitgExt.Action interface

This commit is contained in:
Jesse van den Kieboom 2014-01-18 13:21:39 +01:00 committed by Jesse van den Kieboom
parent 0974aac605
commit 3818eacb09
2 changed files with 43 additions and 7 deletions

View file

@ -22,20 +22,41 @@ namespace Gitg
class RefActionDelete : GitgExt.Action, GitgExt.RefAction, Object
{
public Ggit.Ref reference { get; construct set; }
// Do this to pull in config.h before glib.h (for gettext...)
private const string version = Gitg.Config.VERSION;
public GitgExt.ActionInterface action_interface { get; construct set; }
public Ggit.Ref reference { get; construct set; }
public RefActionDelete(GitgExt.ActionInterface action_interface, Ggit.Ref reference)
{
Object(action_interface: action_interface, reference: reference);
}
public string label
{
get { return "Delete"; }
get { return _("Delete"); }
}
public bool enabled
{
get
{
var r = reference as Gitg.Ref;
var rtype = r.parsed_name.rtype;
return rtype == RefType.BRANCH
|| rtype == RefType.TAG
|| rtype == RefType.REMOTE;
}
}
public bool visible
{
get { return true; }
}
public void activate()
public void activated()
{
}
}

View file

@ -22,21 +22,36 @@ namespace Gitg
class RefActionRename : GitgExt.Action, GitgExt.RefAction, Object
{
public Ggit.Ref reference { get; construct set; }
// Do this to pull in config.h before glib.h (for gettext...)
private const string version = Gitg.Config.VERSION;
public GitgExt.ActionInterface action_interface { get; construct set; }
public Ggit.Ref reference { get; construct set; }
public RefActionRename(GitgExt.ActionInterface action_interface, Ggit.Ref reference)
{
Object(action_interface: action_interface, reference: reference);
}
public string label
{
get { return "Rename"; }
get { return _("Rename"); }
}
public bool enabled
public bool visible
{
get { return true; }
}
public void activate()
public bool enabled
{
get
{
var r = reference as Gitg.Ref;
var rtype = r.parsed_name.rtype;
return rtype == RefType.BRANCH || rtype == RefType.TAG;
}
}
}