AccountPlugin

AccountPlugin — manage account items.

Synopsis

                    AccountPlugin;
                    AccountPluginClass;
#define             ACCOUNT_DEFINE_PLUGIN               (TN, t_n, T_P)
#define             ACCOUNT_DEFINE_TYPE_MODULE_EXTENDED (TypeName, type_name, TYPE_PARENT, flags, CODE)
#define             ACCOUNT_PLUGIN_SYMBOLS              (t_n)
gboolean            account_plugin_setup                (AccountPlugin *plugin,
                                                         AccountsList *accounts_list);
const gchar*        account_plugin_get_name             (AccountPlugin *plugin);
const gchar*        account_plugin_get_display_name     (AccountPlugin *plugin);
GList*              account_plugin_list_services        (AccountPlugin *plugin);
AccountEditContext* account_plugin_begin_new            (AccountPlugin *plugin,
                                                         AccountService *service);
AccountEditContext* account_plugin_begin_edit           (AccountPlugin *plugin,
                                                         AccountItem *account_item);

Object Hierarchy

  GObject
   +----AccountPlugin

Properties

  "accounts-list"            AccountsList*         : Read
  "initialized"              gboolean              : Read

Description

An AccountPlugin is an object used to create and manage accounts. Use the account_plugin_begin_new() method to create an AccountItem for accessing the given AccountService (see account_plugin_list_services() for knowing what services are provided by the plugin) and account_plugin_begin_edit() to edit an existing AccountItem. Both methods return an AccountEditContext object, which provides methods for performing the actual editing (so far a wizard-like interface has been implemented, AccountWizardContext).

Account plugins report about the accounts they know of to an AccountsList object (actually, AccountsList is an interface), which is typically the user interface, and which will be bound to the account when the AccountPluginManager will setup the plugin (by calling account_plugin_setup()).

Plugin implementations must derive from AccountPlugin (using the ACCOUNT_DEFINE_PLUGIN() macro, which in fact registers a GTypeModule) and implement all the virtual methods of the AccountPluginClass.

Plugins are created in the AccountPluginManager.

Details

AccountPlugin

typedef struct _AccountPlugin AccountPlugin;


AccountPluginClass

typedef struct {
    GObjectClass parent_class;

    /* Virtual methods */
    gboolean (*setup) (AccountPlugin *plugin, AccountsList *accounts_list);
    
    const gchar* (*get_name) (AccountPlugin *plugin);
    const gchar* (*get_display_name) (AccountPlugin *plugin);
    
    AccountEditContext* (*begin_new) (AccountPlugin *plugin,
                                      AccountService *service);
    AccountEditContext* (*begin_edit) (AccountPlugin *plugin,
                                       AccountItem *account_item);
    GList* (*list_services) (AccountPlugin *plugin);
    void (*deleted) (AccountPlugin *plugin, AccountItem *account_item);
} AccountPluginClass;


ACCOUNT_DEFINE_PLUGIN()

#define             ACCOUNT_DEFINE_PLUGIN(TN, t_n, T_P)

TN :
t_n :
T_P :

ACCOUNT_DEFINE_TYPE_MODULE_EXTENDED()

#define             ACCOUNT_DEFINE_TYPE_MODULE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE)

TypeName :
type_name :
TYPE_PARENT :
flags :
CODE :

ACCOUNT_PLUGIN_SYMBOLS()

#define             ACCOUNT_PLUGIN_SYMBOLS(t_n)

t_n :

account_plugin_setup ()

gboolean            account_plugin_setup                (AccountPlugin *plugin,
                                                         AccountsList *accounts_list);

Activates the plugin, and binds it to an AccountsList object. The plugin will report to it all the AccountItem object being created/deleted.

plugin : the AccountPlugin.
accounts_list : an object implementing the AccountsList interface.
Returns : TRUE on success, FALSE on error.

account_plugin_get_name ()

const gchar*        account_plugin_get_name             (AccountPlugin *plugin);

Get the name of plugin.

plugin : the AccountPlugin.
Returns : a constant string with the name of the plugin.

account_plugin_get_display_name ()

const gchar*        account_plugin_get_display_name     (AccountPlugin *plugin);

Get the display name of this plugin.

plugin : the AccountPlugin.
Returns : a constant string with the plugin name.

account_plugin_list_services ()

GList*              account_plugin_list_services        (AccountPlugin *plugin);

List the services handled by this plugin.

plugin : the AccountPlugin.
Returns : a GList of AccountService objects; the objects' reference count is not incremented.

account_plugin_begin_new ()

AccountEditContext* account_plugin_begin_new            (AccountPlugin *plugin,
                                                         AccountService *service);

Starts the procedure of creation of a new accont based on service.

plugin : an AccountPlugin.
service : an AccountService.
Returns : an AccountEditContext.

account_plugin_begin_edit ()

AccountEditContext* account_plugin_begin_edit           (AccountPlugin *plugin,
                                                         AccountItem *account_item);

Starts the procedure of editing account.

plugin : an AccountPlugin.
account_item : an AccountItem.
Returns : an AccountEditContext.

Property Details

The "accounts-list" property

  "accounts-list"            AccountsList*         : Read

AccountsList to be notified of account creations/deletions.


The "initialized" property

  "initialized"              gboolean              : Read

Whether plugin has been initialized.

Default value: FALSE