anjuta r4530 - in trunk: . plugins/subversion



Author: jrliggett
Date: Mon Jan  5 00:11:34 2009
New Revision: 4530
URL: http://svn.gnome.org/viewvc/anjuta?rev=4530&view=rev

Log:
	* plugins/subversion/subversion-add-dialog.c
	(on_subversion_add_response):
	* plugins/subversion/subversion-remove-dialog.c
	(on_subversion_remove_response):
	* plugins/subversion/svn-add-command.c (svn_add_command_finalize),
	(svn_add_command_run), (svn_add_command_new_path),
	(svn_add_command_new_list):
	* plugins/subversion/svn-add-command.h:
	* plugins/subversion/svn-remove-command.c
	(svn_remove_command_finalize), (svn_remove_command_run),
	(svn_remove_command_new_path), (svn_remove_command_new_list),
	(svn_remove_command_destroy):
	* plugins/subversion/svn-remove-command.h:
	
	Extend Subversion Add/Remove commands to take both individual paths and 
	path lists.

Modified:
   trunk/ChangeLog
   trunk/plugins/subversion/subversion-add-dialog.c
   trunk/plugins/subversion/subversion-remove-dialog.c
   trunk/plugins/subversion/svn-add-command.c
   trunk/plugins/subversion/svn-add-command.h
   trunk/plugins/subversion/svn-remove-command.c
   trunk/plugins/subversion/svn-remove-command.h

Modified: trunk/plugins/subversion/subversion-add-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-add-dialog.c	(original)
+++ trunk/plugins/subversion/subversion-add-dialog.c	Mon Jan  5 00:11:34 2009
@@ -65,9 +65,9 @@
 				break;
 			}
 			
-			add_command = svn_add_command_new ((gchar *) filename,
-											   gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(force)),
-											   gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recurse)));
+			add_command = svn_add_command_new_path ((gchar *) filename,
+													gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(force)),
+													gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recurse)));
 			
 			g_signal_connect (G_OBJECT (add_command), "command-finished",
 							  G_CALLBACK (on_add_command_finished),

Modified: trunk/plugins/subversion/subversion-remove-dialog.c
==============================================================================
--- trunk/plugins/subversion/subversion-remove-dialog.c	(original)
+++ trunk/plugins/subversion/subversion-remove-dialog.c	Mon Jan  5 00:11:34 2009
@@ -101,8 +101,8 @@
 			}
 			
 			
-			remove_command = svn_remove_command_new ((gchar *) filename, log,
-													 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (force)));
+			remove_command = svn_remove_command_new_path ((gchar *) filename, log,
+														  gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (force)));
 			
 			g_signal_connect (G_OBJECT (remove_command), "command-finished",
 							  G_CALLBACK (on_remove_command_finished),

Modified: trunk/plugins/subversion/svn-add-command.c
==============================================================================
--- trunk/plugins/subversion/svn-add-command.c	(original)
+++ trunk/plugins/subversion/svn-add-command.c	Mon Jan  5 00:11:34 2009
@@ -29,7 +29,7 @@
 
 struct _SvnAddCommandPriv
 {
-	gchar *path;
+	GList *paths;
 	gboolean force;
 	gboolean recursive;
 };
@@ -49,7 +49,7 @@
 	
 	self = SVN_ADD_COMMAND (object);
 	
-	g_free (self->priv->path);
+	svn_command_free_path_list (self->priv->paths);
 	g_free (self->priv);
 
 	G_OBJECT_CLASS (svn_add_command_parent_class)->finalize (object);
@@ -60,21 +60,28 @@
 {
 	SvnAddCommand *self;
 	SvnCommand *svn_command;
+	GList *current_path;
 	svn_error_t *error;
 	
 	self = SVN_ADD_COMMAND (command);
 	svn_command = SVN_COMMAND (command);
+	current_path = self->priv->paths;
 
-	error = svn_client_add2 (self->priv->path,  
-							 self->priv->force, 
-							 self->priv->recursive, 
-							 svn_command_get_client_context (svn_command), 
-							 svn_command_get_pool (svn_command));
-
-	if (error)
+	while (current_path)
 	{
-		svn_command_set_error (svn_command, error);
-		return 1;
+		error = svn_client_add2 (current_path->data,  
+								 self->priv->force, 
+								 self->priv->recursive, 
+								 svn_command_get_client_context (svn_command), 
+								 svn_command_get_pool (svn_command));
+		
+		if (error)
+		{
+			svn_command_set_error (svn_command, error);
+			return 1;
+		}
+		
+		current_path = g_list_next (current_path);
 	}
 	
 	return 0;
@@ -92,19 +99,43 @@
 
 
 SvnAddCommand *
-svn_add_command_new (const gchar *path, gboolean force, gboolean recursive)
+svn_add_command_new_path (const gchar *path, gboolean force, gboolean recursive)
 {
 	SvnAddCommand *self;
 	
 	self = g_object_new (SVN_TYPE_ADD_COMMAND, NULL);
-	self->priv->path = svn_command_make_canonical_path (SVN_COMMAND (self),
-														path);
+	self->priv->paths = g_list_append (self->priv->paths,  
+									   svn_command_make_canonical_path (SVN_COMMAND (self),
+																		path));
 	self->priv->force = force;
 	self->priv->recursive = recursive;
 	
 	return self;
 }
 
+SvnAddCommand *
+svn_add_command_new_list (GList *paths, gboolean force, gboolean recursive)
+{
+	SvnAddCommand *self;
+	GList *current_path;
+	
+	self = g_object_new (SVN_TYPE_ADD_COMMAND, NULL);
+	current_path = paths;
+	
+	while (current_path)
+	{
+		self->priv->paths = g_list_append (self->priv->paths,  
+										   svn_command_make_canonical_path (SVN_COMMAND (self),
+																			current_path->data));
+		current_path = g_list_next (current_path);
+	}
+	
+	self->priv->force = force;
+	self->priv->recursive = recursive;
+	
+	return self;	
+}
+
 void
 svn_add_command_destroy (SvnAddCommand *self)
 {

Modified: trunk/plugins/subversion/svn-add-command.h
==============================================================================
--- trunk/plugins/subversion/svn-add-command.h	(original)
+++ trunk/plugins/subversion/svn-add-command.h	Mon Jan  5 00:11:34 2009
@@ -57,7 +57,10 @@
 };
 
 GType svn_add_command_get_type (void) G_GNUC_CONST;
-SvnAddCommand * svn_add_command_new (const gchar *path, gboolean force, gboolean recursive);
+SvnAddCommand *svn_add_command_new_path (const gchar *path, gboolean force, 
+										 gboolean recursive);
+SvnAddCommand *svn_add_command_new_list (GList *paths, gboolean force, 
+										 gboolean recursive);
 void svn_add_command_destroy (SvnAddCommand *self);
 
 G_END_DECLS

Modified: trunk/plugins/subversion/svn-remove-command.c
==============================================================================
--- trunk/plugins/subversion/svn-remove-command.c	(original)
+++ trunk/plugins/subversion/svn-remove-command.c	Mon Jan  5 00:11:34 2009
@@ -29,7 +29,7 @@
 
 struct _SvnRemoveCommandPriv
 {
-	gchar *path;
+	GList *paths;
 	gchar *log_message;
 	gboolean force;
 };
@@ -73,7 +73,7 @@
 	
 	self = SVN_REMOVE_COMMAND (object);
 	
-	g_free (self->priv->path);
+	svn_command_free_path_list (self->priv->paths);
 	g_free (self->priv->log_message);
 	g_free (self->priv);
 
@@ -85,21 +85,28 @@
 {
 	SvnRemoveCommand *self;
 	SvnCommand *svn_command;
-	apr_array_header_t *path_array;
+	apr_array_header_t *remove_paths;
+	GList *current_path;
 	svn_error_t *error;
 	svn_client_commit_info_t* commit_info;
 	gchar *revision_message;
 	
 	self = SVN_REMOVE_COMMAND (command);
 	svn_command = SVN_COMMAND (command);
-	path_array = apr_array_make (svn_command_get_pool (SVN_COMMAND (command)), 
-													   1, sizeof (char *));
+	remove_paths = apr_array_make (svn_command_get_pool (SVN_COMMAND (command)), 
+								   g_list_length (self->priv->paths), 
+								   sizeof (char *));
+	current_path = self->priv->paths;
 								 
-	/* I just copied this so don't blame me... */
-	(*((const char **) apr_array_push (path_array))) = self->priv->path;
+	while (current_path)
+	{
+		/* I just copied this so don't blame me... */
+		(*((const char **) apr_array_push (remove_paths))) = current_path->data;
+		current_path = g_list_next (current_path);
+	}
 	
 	error = svn_client_delete (&commit_info, 
-							   path_array, 
+							   remove_paths, 
 							   self->priv->force,
 							   svn_command_get_client_context (svn_command), 
 							   svn_command_get_pool (svn_command));
@@ -134,27 +141,47 @@
 }
 
 SvnRemoveCommand *
-svn_remove_command_new (const gchar *path, const gchar *log_message, gboolean force)
+svn_remove_command_new_path (const gchar *path, const gchar *log_message, 
+							 gboolean force)
 {
 	SvnRemoveCommand *self;
 	
 	self = g_object_new (SVN_TYPE_REMOVE_COMMAND, NULL);
-	self->priv->path = svn_command_make_canonical_path (SVN_COMMAND (self),
-														path);
+	self->priv->paths = g_list_append (self->priv->paths,  
+									   svn_command_make_canonical_path (SVN_COMMAND (self),
+																		path));
 	self->priv->log_message = g_strdup (log_message);
 	self->priv->force = force;
 	
 	return self;
 }
 
-void
-svn_remove_command_destroy (SvnRemoveCommand *self)
+SvnRemoveCommand *
+svn_remove_command_new_list (GList *paths, const gchar *log_message, 
+							 gboolean force)
 {
-	g_object_unref (self);
+	SvnRemoveCommand *self;
+	GList *current_path;
+	
+	self = g_object_new (SVN_TYPE_REMOVE_COMMAND, NULL);
+	current_path = paths;
+	
+	while (current_path)
+	{
+		self->priv->paths = g_list_append (self->priv->paths,  
+										   svn_command_make_canonical_path (SVN_COMMAND (self),
+																			current_path->data));
+		current_path = g_list_next (current_path);
+	}
+	
+	self->priv->log_message = g_strdup (log_message);
+	self->priv->force = force;
+	
+	return self;
 }
 
-gchar *
-svn_remove_command_get_path (SvnRemoveCommand *self)
+void
+svn_remove_command_destroy (SvnRemoveCommand *self)
 {
-	return g_strdup (self->priv->path);
+	g_object_unref (self);
 }

Modified: trunk/plugins/subversion/svn-remove-command.h
==============================================================================
--- trunk/plugins/subversion/svn-remove-command.h	(original)
+++ trunk/plugins/subversion/svn-remove-command.h	Mon Jan  5 00:11:34 2009
@@ -57,10 +57,13 @@
 };
 
 GType svn_remove_command_get_type (void) G_GNUC_CONST;
-SvnRemoveCommand * svn_remove_command_new (const gchar *path, const gchar *log_message, 
-										   gboolean force);
+SvnRemoveCommand *svn_remove_command_new_path (const gchar *path, 
+											   const gchar *log_message, 
+											   gboolean force);
+SvnRemoveCommand *svn_remove_command_new_list (GList *paths, 
+											   const gchar *log_message,
+											   gboolean force);
 void svn_remove_command_destroy (SvnRemoveCommand *self);
-gchar *svn_remove_command_get_path (SvnRemoveCommand *self);
 
 G_END_DECLS
 



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