Commit 2e50a057 authored by James Liggett's avatar James Liggett

libanjuta: Add a command-started signal to AnjutaCommand

This signal is designed to be used as part of commands that are designed to
automatically run themselves. The could, for example, be used for things like
automatic refreshing and other automated tasks.
parent c2255d44
......@@ -60,6 +60,7 @@ struct _AnjutaCommandPriv
enum
{
DATA_ARRIVED,
COMMAND_STARTED,
COMMAND_FINISHED,
PROGRESS,
......@@ -90,6 +91,11 @@ anjuta_command_finalize (GObject *object)
G_OBJECT_CLASS (anjuta_command_parent_class)->finalize (object);
}
static void
anjuta_command_started (AnjutaCommand *command)
{
}
static void
anjuta_command_class_init (AnjutaCommandClass *klass)
{
......@@ -105,6 +111,7 @@ 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->command_started = anjuta_command_started;
klass->progress = NULL;
/**
......@@ -124,6 +131,23 @@ anjuta_command_class_init (AnjutaCommandClass *klass)
G_TYPE_NONE,
0);
/**
* AnjuaCommand::command-started:
* @command: Command
*
* Indicates that a command has begun executing. This signal is intended to
* be used for commands that start themselves automatically.
*/
anjuta_command_signals[COMMAND_STARTED] =
g_signal_new ("command-started",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (AnjutaCommandClass, command_started),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
/**
* AnjutaCommand::command-finished:
* @command: Command
......@@ -175,6 +199,8 @@ anjuta_command_class_init (AnjutaCommandClass *klass)
void
anjuta_command_start (AnjutaCommand *self)
{
g_signal_emit_by_name (self, "command-started");
ANJUTA_COMMAND_GET_CLASS (self)->start (self);
}
......
......@@ -55,6 +55,7 @@ struct _AnjutaCommandClass
gchar * (*get_error_message) (AnjutaCommand *self);
/* Signals */
void (*command_started) (AnjutaCommand *command);
void (*progress) (AnjutaCommand *command, gfloat progress);
};
......
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