AccountWizardContext

AccountWizardContext — Interface to provide wizard-like account editing.

Synopsis

                    AccountWizardContextIface;
                    AccountWizardContext;
gboolean            account_wizard_context_get_can_next (AccountWizardContext *context);
gboolean            account_wizard_context_get_can_back (AccountWizardContext *context);
gboolean            account_wizard_context_get_can_finish
                                                        (AccountWizardContext *context);
void                account_wizard_context_set_can_next (AccountWizardContext *context,
                                                         gboolean can_next);
void                account_wizard_context_set_can_back (AccountWizardContext *context,
                                                         gboolean can_back);
void                account_wizard_context_set_can_finish
                                                        (AccountWizardContext *context,
                                                         gboolean can_finish);
GtkWidget*          account_wizard_context_next         (AccountWizardContext *context,
                                                         GError **error);
GtkWidget*          account_wizard_context_back         (AccountWizardContext *context,
                                                         GError **error);
const gchar*        account_wizard_context_get_page_title
                                                        (AccountWizardContext *context);
gboolean            account_wizard_context_finish       (AccountWizardContext *context,
                                                         GError **error);
void                account_wizard_context_cancel       (AccountWizardContext *context);

Object Hierarchy

  GInterface
   +----AccountWizardContext

Prerequisites

AccountWizardContext requires GObject.

Properties

  "can-back"                 gboolean              : Read / Write
  "can-finish"               gboolean              : Read / Write
  "can-next"                 gboolean              : Read / Write

Signals

  "page-async"                                     : Run First

Description

The AccountWizardContext interface specifies a small set of methods and properties that an AccountEditContext subclass can implement in order to provide a wizard-like editing for AccountItem objects.

The most important functions in this interface are account_wizard_context_next() and account_wizard_context_back(): they serve to respectively retrieve the next and the previous page of the wizard, in form of a GtkWidget. The user interface application is supposed to provide the Cancel, Back, Next and Finish buttons (which therefore must not be present in the page returned by the AccountWizardContext) and listen to the "can-next", "can-back" and "can-finish" properties to determine if the buttons should be enabled or disabled.

In any case, regardless of the buttons' state, the above mentioned methods should still be called by the UI when the user presses the buttons and it's perfectly valid for these methods to return a NULL page and set the GError accordingly (see AccountErrorCode for a list of possible error codes).

The error code ACCOUNT_ERROR_PAGE_ASYNC has a special meaning: it is used when retrieving the next/previous page is an asyncronous operation (and possibly lengthy). In such cases, the page (or an error code) will be delivered through the "page-async" signal.

To terminate the editing the UI should call either account_wizard_context_cancel() to abort the account creation/editing or account_wizard_context_finish() to complete the editing process.

Details

AccountWizardContextIface

typedef struct {
    GTypeInterface g_iface;

    /* methods */
    GtkWidget * (*next) (AccountWizardContext *context, GError **error);
    GtkWidget * (*back) (AccountWizardContext *context, GError **error);
    const gchar * (*get_page_title) (AccountWizardContext *context);

    gboolean (*finish) (AccountWizardContext *context, GError **error);
    void (*cancel) (AccountWizardContext *context);
} AccountWizardContextIface;


AccountWizardContext

typedef struct _AccountWizardContext AccountWizardContext;


account_wizard_context_get_can_next ()

gboolean            account_wizard_context_get_can_next (AccountWizardContext *context);

Whether the "next" button should be enabled.

context : the AccountWizardContext.
Returns : TRUE if "next" should be enabled.

account_wizard_context_get_can_back ()

gboolean            account_wizard_context_get_can_back (AccountWizardContext *context);

Whether the "back" button should be enabled.

context : the AccountWizardContext.
Returns : TRUE if "back" should be enabled.

account_wizard_context_get_can_finish ()

gboolean            account_wizard_context_get_can_finish
                                                        (AccountWizardContext *context);

Whether the "finish" button should be enabled.

context : the AccountWizardContext.
Returns : TRUE if "finish" should be enabled.

account_wizard_context_set_can_next ()

void                account_wizard_context_set_can_next (AccountWizardContext *context,
                                                         gboolean can_next);

Sets whether the "next" button should be enabled.

context : the AccountWizardContext.
can_next :

account_wizard_context_set_can_back ()

void                account_wizard_context_set_can_back (AccountWizardContext *context,
                                                         gboolean can_back);

Sets whether the "back" button should be enabled.

context : the AccountWizardContext.
can_back :

account_wizard_context_set_can_finish ()

void                account_wizard_context_set_can_finish
                                                        (AccountWizardContext *context,
                                                         gboolean can_finish);

Sets whether the "finish" button should be enabled.

context : the AccountWizardContext.
can_finish :

account_wizard_context_next ()

GtkWidget*          account_wizard_context_next         (AccountWizardContext *context,
                                                         GError **error);

Proceeds to the next page of the wizard.

context : the AccountWizardContext.
error : a pointer to a GError.
Returns : the GtkWidget to be displayed on the next page.

account_wizard_context_back ()

GtkWidget*          account_wizard_context_back         (AccountWizardContext *context,
                                                         GError **error);

Goes back to the previous page of the wizard.

context : the AccountWizardContext.
error : a pointer to a GError.
Returns : the GtkWidget to be displayed on the previous page.

account_wizard_context_get_page_title ()

const gchar*        account_wizard_context_get_page_title
                                                        (AccountWizardContext *context);

Gets the title of the current page.

context : the AccountWizardContext.
Returns : a constant string representing the title.

account_wizard_context_finish ()

gboolean            account_wizard_context_finish       (AccountWizardContext *context,
                                                         GError **error);

Completes the account creation. If this call succeeds, the context can be destroyed and the newly created AccountItem will be added into the AccountsList.

context : the AccountWizardContext.
error : a pointer to a GError.
Returns : TRUE if account was created successfully, FALSE otherwise.

account_wizard_context_cancel ()

void                account_wizard_context_cancel       (AccountWizardContext *context);

Cancel the account creation. The context can then be destroyed.

context : the AccountWizardContext.

Property Details

The "can-back" property

  "can-back"                 gboolean              : Read / Write

Can go back page.

Default value: FALSE


The "can-finish" property

  "can-finish"               gboolean              : Read / Write

Can finish editing.

Default value: FALSE


The "can-next" property

  "can-next"                 gboolean              : Read / Write

Can go next page.

Default value: FALSE

Signal Details

The "page-async" signal

void                user_function                      (AccountWizardContext *context,
                                                        GtkWidget            *page,
                                                        gpointer              error,
                                                        gpointer              user_data)      : Run First

Emitted after a page request returned with the ACCOUNT_ERROR_PAGE_ASYNC error code.

context : The AccountWizardContext.
page : The GtkWidget page.
error : if page is NULL, a GError explaining why.
user_data : user data set when the signal handler was connected.