[gitg/wip/simplify-arch: 1/7] Make extensions more specific
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/simplify-arch: 1/7] Make extensions more specific
- Date: Mon, 1 Jul 2013 07:32:14 +0000 (UTC)
commit 470f2bf3c2dea08daf5267591ba8acd02449f7bf
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Mon Jul 1 09:24:42 2013 +0200
Make extensions more specific
libgitg-ext/Makefile.am | 4 +-
...-ext-panel.vala => gitg-ext-history-panel.vala} | 23 +++----
...object-selection.vala => gitg-ext-history.vala} | 17 +++--
libgitg-ext/gitg-ext-ui-element.vala | 14 ++++-
libgitg-ext/gitg-ext-view.vala | 64 +-------------------
5 files changed, 36 insertions(+), 86 deletions(-)
---
diff --git a/libgitg-ext/Makefile.am b/libgitg-ext/Makefile.am
index cde4977..9c807e9 100644
--- a/libgitg-ext/Makefile.am
+++ b/libgitg-ext/Makefile.am
@@ -41,12 +41,12 @@ VALA_FILES = \
gitg-ext-assembly-info.vala \
gitg-ext-application.vala \
gitg-ext-ui-element.vala \
- gitg-ext-panel.vala \
gitg-ext-view.vala \
gitg-ext-message-id.vala \
gitg-ext-message.vala \
gitg-ext-message-bus.vala \
- gitg-ext-object-selection.vala \
+ gitg-ext-history.vala \
+ gitg-ext-history-panel.vala \
gitg-ext-command-line.vala \
gitg-ext-preferences.vala \
gitg-ext-ui.vala
diff --git a/libgitg-ext/gitg-ext-panel.vala b/libgitg-ext/gitg-ext-history-panel.vala
similarity index 71%
rename from libgitg-ext/gitg-ext-panel.vala
rename to libgitg-ext/gitg-ext-history-panel.vala
index 23e857d..8bc3547 100644
--- a/libgitg-ext/gitg-ext-panel.vala
+++ b/libgitg-ext/gitg-ext-history-panel.vala
@@ -21,30 +21,27 @@ namespace GitgExt
{
/**
- * Panel interfaces implemented to show additional details of a particular view.
+ * Panel interfaces implemented to show additional details of selections in
+ * the history.
*
- * The panel interface can be implemented to show additional details of a
- * { link View}. The panel will be shown in a split view below the main view
+ * The panel interface can be implemented to show additional details of the
+ * history view. The panel will be shown in a split view below the history
* when activated. Panels should implement the { link UIElement.available} property to
- * indicate for which state of the application the panel is active. This usually
- * involves checking which view is currently active using
- * { link Application.current_view}.
+ * indicate for which state of the application the panel is active.
*
* Each panel should have a unique id, a display name and an icon which will
* be used in the interface to activate the panel. The { link UIElement.widget} is
* displayed when the panel is activated.
*
*/
-public interface Panel : Object, UIElement
+public interface HistoryPanel : Object, UIElement
{
/**
- * Give the panel itself a chance to perform some actions after being
- * activated.
- *
- * @return void
- *
+ * The history to which the panel belongs. This property is a construct
+ * property and will be automatically set when an instance of the panel
+ * is created.
*/
- public abstract void on_panel_activated();
+ public abstract GitgExt.History? history { owned get; construct set; }
}
}
diff --git a/libgitg-ext/gitg-ext-object-selection.vala b/libgitg-ext/gitg-ext-history.vala
similarity index 71%
rename from libgitg-ext/gitg-ext-object-selection.vala
rename to libgitg-ext/gitg-ext-history.vala
index 6c5790b..b72811b 100644
--- a/libgitg-ext/gitg-ext-object-selection.vala
+++ b/libgitg-ext/gitg-ext-history.vala
@@ -1,7 +1,7 @@
/*
* This file is part of gitg
*
- * Copyright (C) 2012 - Jesse van den Kieboom
+ * Copyright (C) 2013 - Jesse van den Kieboom
*
* gitg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,13 +19,16 @@
namespace GitgExt
{
- public delegate bool ForeachObjectSelectionFunc(Ggit.Object? object);
- public interface ObjectSelection : Object
- {
- public abstract void foreach_selected(ForeachObjectSelectionFunc func);
- public signal void selection_changed();
- }
+public delegate bool ForeachCommitSelectionFunc(Ggit.Commit object);
+
+public interface History : Object, View
+{
+
+ public signal void selection_changed();
+ public abstract void foreach_selected(ForeachCommitSelectionFunc func);
+}
+
}
// ex: ts=4 noet
diff --git a/libgitg-ext/gitg-ext-ui-element.vala b/libgitg-ext/gitg-ext-ui-element.vala
index 3211084..cb793f6 100644
--- a/libgitg-ext/gitg-ext-ui-element.vala
+++ b/libgitg-ext/gitg-ext-ui-element.vala
@@ -77,7 +77,8 @@ public interface UIElement : Object
* Check whether the ui element is available in the current application state.
*
* This method is used by gitg to verify whether or not a particular ui
- * element is available given the current state of the application.
+ * element is available given the current state of the application. If the
+ * element is not available, it will not be shown.
*
*/
public abstract bool available { get; }
@@ -103,6 +104,17 @@ public interface UIElement : Object
*
*/
public abstract int negotiate_order(UIElement other);
+
+ /**
+ * Activate the UIELement.
+ *
+ * This signal is emitted when the UIElement has been activated.
+ * Implementations can override the default handler to do any necessary
+ * setup when the ui element is activated.
+ */
+ public virtual signal void activate()
+ {
+ }
}
}
diff --git a/libgitg-ext/gitg-ext-view.vala b/libgitg-ext/gitg-ext-view.vala
index 0264add..5975804 100644
--- a/libgitg-ext/gitg-ext-view.vala
+++ b/libgitg-ext/gitg-ext-view.vala
@@ -21,81 +21,19 @@ namespace GitgExt
{
/**
- * A view action.
- *
- * A view action indicates a user preference to open gitg in a particular view.
- */
-public enum ViewAction
-{
- /**
- * Open gitg in the History view.
- */
- HISTORY,
-
- /**
- * Open gitg in the Commit view.
- */
- COMMIT,
-
- /**
- * Open gitg in the default view.
- */
- DEFAULT = HISTORY
-}
-
-/**
* gitg View interface.
*
* The View interface can be implemented to provide a main view in
- * gitg. An example of such views are the builtin Dashboard, History and
+ * gitg. An example of such views are the builtin History and
* Commit views.
- *
- * Implementations of the GitgExtView interface will be integrated
- * automatically in the gitg interface according to the various interface
- * methods and properties that need to be implemented.
*/
public interface View : Object, UIElement
{
/**
* Method called to reload the view.
*
- * @return void
- *
*/
public abstract void reload();
-
- /**
- * Give the view itself a chance to perform some actions after being
- * activated.
- *
- * @return void
- *
- */
- public abstract void on_view_activated();
-
- /**
- * Check whether the view is the default view for a particular action.
- *
- * Implement this method when a view should be the preferred default view
- * for a particular action. The first available view indicating to be
- * a default view will be used as the default activated view when launching
- * gitg (or when opening a repository).
- *
- * @param action the action
- *
- * @return ``true`` if the view is a default for @action, ``false`` otherwise.
- *
- */
- public abstract bool is_default_for(string action);
-
- /**
- * A Gtk Builder element that the panel plugins will be
- * populated into.
- *
- * @return Gtk.Stack?
- *
- */
- public abstract Gtk.Stack? stack_panel { get; }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]