[anjuta: 2/3] #580013 – patch plugin doesn't handle patch-files with whitespace



commit 9c8e5f512a13be19f15ee3193cbe2f5f83600943
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Sun Apr 26 23:04:46 2009 +0200

    #580013 â?? patch plugin doesn't handle patch-files with whitespace
    
    Also fixes some memory leaks in the patch plugin
---
 plugins/patch/patch-plugin.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/plugins/patch/patch-plugin.c b/plugins/patch/patch-plugin.c
index d9dea11..153acd7 100644
--- a/plugins/patch/patch-plugin.c
+++ b/plugins/patch/patch-plugin.c
@@ -142,8 +142,9 @@ patch_show_gui (PatchPlugin *plugin)
 static void 
 on_ok_clicked (GtkButton *button, PatchPlugin* p_plugin)
 {
-	const gchar* directory;
-	const gchar* patch_file;
+	gchar* tmp;
+	gchar* directory;
+	gchar* patch_file;
 	GString* command = g_string_new (NULL);
 	gchar* message;
 	IAnjutaMessageManager *mesg_manager;
@@ -164,8 +165,13 @@ on_ok_clicked (GtkButton *button, PatchPlugin* p_plugin)
 	g_signal_connect (G_OBJECT (p_plugin->mesg_view), "buffer-flushed",
 						  G_CALLBACK (on_msg_buffer), p_plugin);
 
-	directory = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(p_plugin->file_chooser));
-	patch_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(p_plugin->patch_chooser));						
+	tmp = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(p_plugin->file_chooser));
+	directory = g_shell_quote (tmp);
+	g_free (tmp);
+	
+	tmp = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(p_plugin->patch_chooser));
+	patch_file = g_shell_quote (tmp);
+	g_free (tmp);
 	
 	if (!g_file_test (directory, G_FILE_TEST_IS_DIR))
 	{
@@ -185,6 +191,9 @@ on_ok_clicked (GtkButton *button, PatchPlugin* p_plugin)
 	message = g_strdup_printf (_("Patching %s using %s\n"), 
 			  directory, patch_file);
 
+	g_free (patch_file);
+	g_free (directory);
+	
 	ianjuta_message_view_append (p_plugin->mesg_view,
 								 IANJUTA_MESSAGE_VIEW_TYPE_NORMAL,
 								 message, "", NULL);



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