Commit a7b473c3 authored by James Liggett's avatar James Liggett

libanjuta: Add automatic start methods to AnjutaCommand

These virtual methods provide the opportunity for a command to monitor external
events and start themselves automatically.
parent 2e50a057
......@@ -96,6 +96,17 @@ anjuta_command_started (AnjutaCommand *command)
{
}
static gboolean
start_automatic_monitor (AnjutaCommand *self)
{
return FALSE;
}
static void
stop_automatic_monitor (AnjutaCommand *self)
{
}
static void
anjuta_command_class_init (AnjutaCommandClass *klass)
{
......@@ -111,6 +122,8 @@ anjuta_command_class_init (AnjutaCommandClass *klass)
klass->notify_progress = NULL;
klass->set_error_message = anjuta_command_set_error_message;
klass->get_error_message = anjuta_command_get_error_message;
klass->start_automatic_monitor = start_automatic_monitor;
klass->stop_automatic_monitor = stop_automatic_monitor;
klass->command_started = anjuta_command_started;
klass->progress = NULL;
......@@ -291,3 +304,33 @@ anjuta_command_get_error_message (AnjutaCommand *self)
{
return g_strdup (self->priv->error_message);
}
/**
* anjuta_command_start_automatic_monitor:
* @self: Command object.
*
* Sets up any monitoring needed for commands that should start themselves
* automatically in response to some event.
*
* Return value: %TRUE if automatic starting is supported by the command and
* no errors were encountered; %FALSE if automatic starting is unsupported or on
* error.
*/
gboolean
anjuta_command_start_automatic_monitor (AnjutaCommand *self)
{
return ANJUTA_COMMAND_GET_CLASS (self)->start_automatic_monitor (self);
}
/**
* anjuta_command_stop_automatic_monitor:
* @self: Command object.
*
* Stops automatic monitoring for self executing commands. For commands that
* do not support self-starting, this function does nothing.
*/
void
anjuta_command_stop_automatic_monitor (AnjutaCommand *self)
{
ANJUTA_COMMAND_GET_CLASS (self)->stop_automatic_monitor (self);
}
\ No newline at end of file
......@@ -53,6 +53,8 @@ struct _AnjutaCommandClass
void (*notify_progress) (AnjutaCommand *self, gfloat progress);
void (*set_error_message) (AnjutaCommand *self, const gchar *error_message);
gchar * (*get_error_message) (AnjutaCommand *self);
gboolean (*start_automatic_monitor) (AnjutaCommand *self);
void (*stop_automatic_monitor) (AnjutaCommand *self);
/* Signals */
void (*command_started) (AnjutaCommand *command);
......@@ -78,6 +80,9 @@ void anjuta_command_notify_progress (AnjutaCommand *self, gfloat progress);
void anjuta_command_set_error_message (AnjutaCommand *self, const gchar *error_message);
gchar *anjuta_command_get_error_message (AnjutaCommand *self);
gboolean anjuta_command_start_automatic_monitor (AnjutaCommand *self);
void anjuta_command_stop_automatic_monitor (AnjutaCommand *self);
G_END_DECLS
#endif /* _ANJUTA_COMMAND_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment