[gitg/wip/commit: 18/28] Implement defaults for some interface methods



commit dfc12858f9075d42061376332f46a4478498c72e
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Jul 3 16:38:46 2013 +0200

    Implement defaults for some interface methods

 libgitg-ext/gitg-ext-activity.vala   |    9 +++++++--
 libgitg-ext/gitg-ext-ui-element.vala |   15 ++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/libgitg-ext/gitg-ext-activity.vala b/libgitg-ext/gitg-ext-activity.vala
index 78522f4..ef94979 100644
--- a/libgitg-ext/gitg-ext-activity.vala
+++ b/libgitg-ext/gitg-ext-activity.vala
@@ -33,7 +33,9 @@ public interface Activity : Object, UIElement
         * Method called to reload the activity.
         *
         */
-       public abstract void reload();
+       public virtual void reload()
+       {
+       }
 
        /**
         * Whether the activity is the default for the specified action.
@@ -44,7 +46,10 @@ public interface Activity : Object, UIElement
         * %FALSE otherwise.
         *
         */
-       public abstract bool is_default_for(string action);
+       public virtual bool is_default_for(string action)
+       {
+               return false;
+       }
 }
 
 }
diff --git a/libgitg-ext/gitg-ext-ui-element.vala b/libgitg-ext/gitg-ext-ui-element.vala
index 14ec5d7..cf9f144 100644
--- a/libgitg-ext/gitg-ext-ui-element.vala
+++ b/libgitg-ext/gitg-ext-ui-element.vala
@@ -74,7 +74,10 @@ public interface UIElement : Object
         * element is not available, it will not be shown.
         *
         */
-       public abstract bool available { get; }
+       public virtual bool available
+       {
+               get { return true; }
+       }
 
        /**
         * Check whether the ui element is enabled in the current application state.
@@ -83,7 +86,10 @@ public interface UIElement : Object
         * element is enabled (sensitive) given the current state of the application.
         *
         */
-       public abstract bool enabled { get; }
+       public virtual bool enabled
+       {
+               get { return true; }
+       }
 
        /**
         * Negotiate the order with another UIElement.
@@ -96,7 +102,10 @@ public interface UIElement : Object
         *          unimportant.
         *
         */
-       public abstract int negotiate_order(UIElement other);
+       public virtual int negotiate_order(UIElement other)
+       {
+               return -1;
+       }
 
        /**
         * Activate the UIELement.


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