EShellModule

EShellModule — dynamically loaded capabilities

Synopsis


#include <shell/e-shell-module.h>

                    EShellModule;
                    EShellModuleInfo;
EShellModule *      e_shell_module_new                  (struct _EShell *shell,
                                                         const gchar *filename);
gint                e_shell_module_compare              (EShellModule *shell_module_a,
                                                         EShellModule *shell_module_b);
const gchar *       e_shell_module_get_config_dir       (EShellModule *shell_module);
const gchar *       e_shell_module_get_data_dir         (EShellModule *shell_module);
const gchar *       e_shell_module_get_filename         (EShellModule *shell_module);
struct _EShell *    e_shell_module_get_shell            (EShellModule *shell_module);
void                e_shell_module_add_activity         (EShellModule *shell_module,
                                                         EActivity *activity);
gboolean            e_shell_module_is_busy              (EShellModule *shell_module);
gboolean            e_shell_module_shutdown             (EShellModule *shell_module);
void                e_shell_module_set_info             (EShellModule *shell_module,
                                                         const EShellModuleInfo *info);

Object Hierarchy

  GObject
   +----GTypeModule
         +----EShellModule

Implemented Interfaces

EShellModule implements GTypePlugin.

Properties

  "filename"                 gchar*                : Read / Write / Construct Only
  "shell"                    EShell*               : Read / Write / Construct Only

Signals

  "activity-added"                                 : Run Last

Description

Details

EShellModule

typedef struct _EShellModule EShellModule;

Contains only private data that should be read and manipulated using the functions below.


EShellModuleInfo

typedef struct {
	const gchar *name;
	const gchar *aliases;
	const gchar *schemes;
	gint sort_order;

	gboolean	(*is_busy)		(EShellModule *shell_module);
	gboolean	(*shutdown)		(EShellModule *shell_module);
} EShellModuleInfo;

const gchar *name;

The name of the module. Also becomes the name of the corresponding EShellView subclass that the module will register.

const gchar *aliases;

Colon-separated list of aliases that can be used when referring to a module by name.

const gchar *schemes;

Colon-separated list of URI schemes. The EShell will forward command-line URIs to the appropriate module based on this list.

gint sort_order;

Used to determine the order of modules listed in the main menu and in the switcher. See e_shell_module_compare().

is_busy ()

Callback for querying whether the module has operations in progress that cannot be cancelled or finished immediately. Returning TRUE prevents the application from shutting down.

shutdown ()

Callback for notifying the module to begin shutting down. Returning FALSE indicates there are still unfinished operations and the EShell should check back shortly.

e_shell_module_new ()

EShellModule *      e_shell_module_new                  (struct _EShell *shell,
                                                         const gchar *filename);

Loads filename as a GTypeModule and tries to invoke a module function named e_shell_module_init, passing the newly loaded GTypeModule as an argument. The shell module is responsible for defining such a function to perform the appropriate initialization steps.

shell :

an EShell

filename :

the name of the file containing the shell module

Returns :

a new EShellModule

e_shell_module_compare ()

gint                e_shell_module_compare              (EShellModule *shell_module_a,
                                                         EShellModule *shell_module_b);

Using the sort_order field from both modules' EShellModuleInfo, compares shell_module_a with shell_mobule_b and returns -1, 0 or +1 if shell_module_a is found to be less than, equal to or greater than shell_module_b, respectively.

shell_module_a :

an EShellModule

shell_module_b :

an EShellModule

Returns :

-1, 0 or +1, for a less than, equal to or greater than result

e_shell_module_get_config_dir ()

const gchar *       e_shell_module_get_config_dir       (EShellModule *shell_module);

Returns the absolute path to the configuration directory for shell_module. The string is owned by shell_module and should not be modified or freed.

shell_module :

an EShellModule

Returns :

the module's configuration directory

e_shell_module_get_data_dir ()

const gchar *       e_shell_module_get_data_dir         (EShellModule *shell_module);

Returns the absolute path to the data directory for shell_module. The string is owned by shell_module and should not be modified or freed.

shell_module :

an EShellModule

Returns :

the module's data directory

e_shell_module_get_filename ()

const gchar *       e_shell_module_get_filename         (EShellModule *shell_module);

Returns the name of the file from which shell_module was loaded. The string is owned by shell_module and should not be modified or freed.

shell_module :

an EShellModule

Returns :

the module's file name

e_shell_module_get_shell ()

struct _EShell *    e_shell_module_get_shell            (EShellModule *shell_module);

Returns the EShell that was passed to e_shell_module_new().

shell_module :

an EShellModule

Returns :

the EShell

e_shell_module_add_activity ()

void                e_shell_module_add_activity         (EShellModule *shell_module,
                                                         EActivity *activity);

Emits an "activity-added" signal.

shell_module :

an EShellModule

activity :

an EActivity

e_shell_module_is_busy ()

gboolean            e_shell_module_is_busy              (EShellModule *shell_module);

Returns TRUE if shell_module is busy and cannot be shutdown at present. Each module must define what "busy" means to them and determine an appropriate response.

XXX This function is likely to change or disappear. I'm toying with the idea of just having it check whether there are any unfinished EActivity's left, so we have a consistent and easily testable definition of what "busy" means.

shell_module :

an EShellModule

Returns :

TRUE if the module is busy

e_shell_module_shutdown ()

gboolean            e_shell_module_shutdown             (EShellModule *shell_module);

Alerts shell_module to begin shutdown procedures. If the module is busy and cannot immediately shut down, the function returns FALSE. A TRUE response implies shell_module has successfully shut down.

XXX This function is likely to change or disappear. I'm toying with the idea of just having it check whether there are any unfinished EActivity's left, so we have a consistent and easily testable definition of what "busy" means.

shell_module :

an EShellModule

Returns :

TRUE if the module has shut down, FALSE if the module is busy and cannot immediately shut down

e_shell_module_set_info ()

void                e_shell_module_set_info             (EShellModule *shell_module,
                                                         const EShellModuleInfo *info);

Registers basic configuration information about shell_module that the EShell can use for processing command-line arguments.

Configuration information should be registered from shell_module's e_shell_module_init initialization function. See e_shell_module_new() for more information.

shell_module :

an EShellModule

info :

an EShellModuleInfo

Property Details

The "filename" property

  "filename"                 gchar*                : Read / Write / Construct Only

The filename of the module.

Default value: NULL


The "shell" property

  "shell"                    EShell*               : Read / Write / Construct Only

The EShell singleton.

Signal Details

The "activity-added" signal

void                user_function                      (EShellModule *shell_module,
                                                        EActivity    *activity,
                                                        gpointer      user_data)         : Run Last

Broadcasts a newly added activity.

shell_module :

the EShellModule that emitted the signal

activity :

an EActivity

user_data :

user data set when the signal handler was connected.