Make extensions more specific

This commit is contained in:
Jesse van den Kieboom 2013-07-01 09:24:42 +02:00
parent 306ef8bfa4
commit 777cabc7ff
5 changed files with 36 additions and 86 deletions

View file

@ -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

View file

@ -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; }
}
}

View file

@ -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

View file

@ -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()
{
}
}
}

View file

@ -20,82 +20,20 @@
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; }
}
}