AnjutaCommand

AnjutaCommand — System for creating objects that provide a standard interface to external components (libraries, processes, etc.)

Synopsis

                    AnjutaCommandPriv;
                    AnjutaCommand;
void                anjuta_command_start                (AnjutaCommand *self);
void                anjuta_command_notify_data_arrived  (AnjutaCommand *self);
void                anjuta_command_notify_complete      (AnjutaCommand *self,
                                                         guint return_code);
void                anjuta_command_set_error_message    (AnjutaCommand *self,
                                                         gchar *error_message);
gchar*              anjuta_command_get_error_message    (AnjutaCommand *self);

Description

AnjutaCommand is the base class for objects that are designed to provide a layer of abstraction between UI code and some other component, like a library or child process. AnjutaCommand provides a simple and consistent interface for plugins to interact with these components without needing to concern themselves with the exact details of how these components work.

To create command objects, plugins derive them from an AnjutaCommand subclass like AnjutaAsyncCommand, which runs commands in another thread. These classes determine how ::run is called and how signals are emitted. ::run is responsible for actually doing the work of the command. It is the responsiblity of the command object that does a certain task to implement ::run to do its job. Everything else is normally implemented by its parent classes at this point

For an example of how to use AnjutaCommand, see the Subversion plugin.

Details

AnjutaCommandPriv

typedef struct _AnjutaCommandPriv AnjutaCommandPriv;


AnjutaCommand

typedef struct {
	GObject parent_instance;
	
	AnjutaCommandPriv *priv;
} AnjutaCommand;


anjuta_command_start ()

void                anjuta_command_start                (AnjutaCommand *self);

Starts a command. Client code can handle data from the command by connecting to the ::data-arrived signal.

AnjutaCommand subclasses should override this method to determine how they call ::run, which actually does the command's legwork.

self :

Command object to start

anjuta_command_notify_data_arrived ()

void                anjuta_command_notify_data_arrived  (AnjutaCommand *self);

Used by base classes derived from AnjutaCommand to emit the ::data-arrived signal. This method should not be used by client code or AnjutaCommand objects that are not base classes.

self :

Command object.

anjuta_command_notify_complete ()

void                anjuta_command_notify_complete      (AnjutaCommand *self,
                                                         guint return_code);

Used by base classes derived from AnjutaCommand to emit the ::command-finished signal. This method should not be used by client code or AnjutaCommand objects that are not base classes.

self :

Command object.

return_code :


anjuta_command_set_error_message ()

void                anjuta_command_set_error_message    (AnjutaCommand *self,
                                                         gchar *error_message);

Command objects use this to set error messages when they encounter some kind of failure.

self :

Command object.

error_message :

Error message.

anjuta_command_get_error_message ()

gchar*              anjuta_command_get_error_message    (AnjutaCommand *self);

Get the error message from the command, if there is one. This method is normally used from a ::command-finished handler to report errors to the user when a command finishes.

self :

Command object.

Returns :

Error message string that must be freed when no longer needed. If no error is set, return NULL.

See Also

AnjutaAsyncCommandinclude libanjuta/anjuta-command.h