[anjuta] libanjuta: Add automatic start methods to AnjutaCommand



commit a7b473c3b5b1091f0b27ba700796c566b0bad024
Author: James Liggett <jrliggett cox net>
Date:   Thu Apr 1 20:51:21 2010 -0700

    libanjuta: Add automatic start methods to AnjutaCommand
    
    These virtual methods provide the opportunity for a command to monitor external
    events and start themselves automatically.

 libanjuta/anjuta-command.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 libanjuta/anjuta-command.h |    5 +++++
 2 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/libanjuta/anjuta-command.c b/libanjuta/anjuta-command.c
index b82dc48..523c032 100644
--- a/libanjuta/anjuta-command.c
+++ b/libanjuta/anjuta-command.c
@@ -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
diff --git a/libanjuta/anjuta-command.h b/libanjuta/anjuta-command.h
index fc0987b..89bbcb9 100644
--- a/libanjuta/anjuta-command.h
+++ b/libanjuta/anjuta-command.h
@@ -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_ */



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