[anjuta/git-shell: 236/373] libanjuta: Add a command-started signal to AnjutaCommand



commit 0a0874a9686948c8deb631ef78ae0f90e55e34f9
Author: James Liggett <jrliggett cox net>
Date:   Sat Mar 27 23:12:08 2010 -0700

    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.

 libanjuta/anjuta-command.c |   26 ++++++++++++++++++++++++++
 libanjuta/anjuta-command.h |    1 +
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/libanjuta/anjuta-command.c b/libanjuta/anjuta-command.c
index 2bd71e4..6b7dfeb 100644
--- a/libanjuta/anjuta-command.c
+++ b/libanjuta/anjuta-command.c
@@ -60,6 +60,7 @@ struct _AnjutaCommandPriv
 enum
 {
 	DATA_ARRIVED,
+	COMMAND_STARTED,
 	COMMAND_FINISHED,
 	PROGRESS,
 
@@ -91,6 +92,11 @@ anjuta_command_finalize (GObject *object)
 }
 
 static void
+anjuta_command_started (AnjutaCommand *command)
+{
+}
+
+static void
 anjuta_command_class_init (AnjutaCommandClass *klass)
 {
 	GObjectClass* object_class = G_OBJECT_CLASS (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;
 
 	/**
@@ -125,6 +132,23 @@ anjuta_command_class_init (AnjutaCommandClass *klass)
 					  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
 	 * @return_code: The return code of the finished commmand
@@ -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);
 }
 
diff --git a/libanjuta/anjuta-command.h b/libanjuta/anjuta-command.h
index f84b8c0..d5834e0 100644
--- a/libanjuta/anjuta-command.h
+++ b/libanjuta/anjuta-command.h
@@ -55,6 +55,7 @@ struct _AnjutaCommandClass
 	gchar * (*get_error_message) (AnjutaCommand *self);
 	
 	/* Signals */
+	void (*command_started) (AnjutaCommand *command);
 	void (*progress) (AnjutaCommand *command, gfloat progress);
 
 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]