Plugin: Add new Button class to allow plugins to create buttons

This commit is contained in:
Michael Gratton 2020-03-20 15:17:23 +11:00 committed by Michael James Gratton
parent a872c70a42
commit 0c5c204d31
3 changed files with 38 additions and 0 deletions

View file

@ -89,6 +89,7 @@ src/client/folder-list/folder-list-special-grouping.vala
src/client/folder-list/folder-list-tree.vala
src/client/plugin/plugin-account.vala
src/client/plugin/plugin-application.vala
src/client/plugin/plugin-button.vala
src/client/plugin/plugin-contact-store.vala
src/client/plugin/plugin-email-store.vala
src/client/plugin/plugin-email.vala

View file

@ -98,6 +98,7 @@ geary_client_vala_sources = files(
'plugin/plugin-account.vala',
'plugin/plugin-application.vala',
'plugin/plugin-button.vala',
'plugin/plugin-contact-store.vala',
'plugin/plugin-email-store.vala',
'plugin/plugin-email.vala',

View file

@ -0,0 +1,36 @@
/*
* Copyright © 2020 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
/**
* Enables plugins to add buttons to the user interface.
*/
public class Plugin.Button : Geary.BaseObject {
/**
* A short human-readable button label.
*
* This should ideally be less than 10 characters long.
*/
public string label { get; private set; }
/** The action to be invoked when the button is clicked. */
public GLib.Action action { get; private set; }
/** The parameter value for the action, if any. */
public GLib.Variant? action_target { get; private set; }
/** Constructs a new button with a text label. */
public Button(string label,
GLib.Action action,
GLib.Variant? action_target = null) {
this.label = label;
this.action = action;
this.action_target = action_target;
}
}