[gitg/wip/actions: 118/134] Rename GitgExt.RefAction to GitgExt.Action
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/actions: 118/134] Rename GitgExt.RefAction to GitgExt.Action
- Date: Fri, 11 Jul 2014 22:50:59 +0000 (UTC)
commit b8bb3723c2e736714d359ac576bb5bc711829fe7
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Jan 18 13:20:16 2014 +0100
Rename GitgExt.RefAction to GitgExt.Action
gitg/gitg-ref-action-delete.vala | 2 +-
gitg/gitg-ref-action-rename.vala | 2 +-
libgitg-ext/gitg-ext-action.vala | 24 +++++++++++++++++++++++-
3 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/gitg/gitg-ref-action-delete.vala b/gitg/gitg-ref-action-delete.vala
index e70ae87..a892f38 100644
--- a/gitg/gitg-ref-action-delete.vala
+++ b/gitg/gitg-ref-action-delete.vala
@@ -20,7 +20,7 @@
namespace Gitg
{
-class RefActionDelete : GitgExt.RefAction, GitgExt.Action, Object
+class RefActionDelete : GitgExt.Action, GitgExt.RefAction, Object
{
public Ggit.Ref reference { get; construct set; }
public GitgExt.ActionInterface action_interface { get; construct set; }
diff --git a/gitg/gitg-ref-action-rename.vala b/gitg/gitg-ref-action-rename.vala
index 4362b35..f914021 100644
--- a/gitg/gitg-ref-action-rename.vala
+++ b/gitg/gitg-ref-action-rename.vala
@@ -20,7 +20,7 @@
namespace Gitg
{
-class RefActionRename : GitgExt.RefAction, GitgExt.Action, Object
+class RefActionRename : GitgExt.Action, GitgExt.RefAction, Object
{
public Ggit.Ref reference { get; construct set; }
public GitgExt.ActionInterface action_interface { get; construct set; }
diff --git a/libgitg-ext/gitg-ext-action.vala b/libgitg-ext/gitg-ext-action.vala
index a1dcc27..d89a1a9 100644
--- a/libgitg-ext/gitg-ext-action.vala
+++ b/libgitg-ext/gitg-ext-action.vala
@@ -26,8 +26,30 @@ public interface Action : Object
public abstract string label { get; }
public abstract bool enabled { get; }
+ public abstract bool visible { get; }
- public abstract void activate();
+ public virtual signal void activated()
+ {
+ }
+
+ public virtual void populate_menu(Gtk.Menu menu)
+ {
+ var item = new Gtk.MenuItem.with_label(label);
+
+ if (enabled)
+ {
+ item.activate.connect(() => {
+ activated();
+ });
+ }
+ else
+ {
+ item.sensitive = false;
+ }
+
+ item.show();
+ menu.append(item);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]