[Xfce4-commits] r24980 - in squeeze/trunk: libsqueeze po tests/zip tests/zip/data

Stephan Arts stephan at xfce.org
Thu Feb 15 00:41:54 CET 2007


Author: stephan
Date: 2007-02-14 23:41:54 +0000 (Wed, 14 Feb 2007)
New Revision: 24980

Added:
   squeeze/trunk/tests/zip/data/1.txt
Modified:
   squeeze/trunk/libsqueeze/archive-command.c
   squeeze/trunk/libsqueeze/archive-support-zip.c
   squeeze/trunk/libsqueeze/archive.c
   squeeze/trunk/po/squeeze.pot
   squeeze/trunk/tests/zip/test-zip-add.c
Log:
add command-terminated signal to archive and changed stuff to zip-add test-suite

Modified: squeeze/trunk/libsqueeze/archive-command.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-command.c	2007-02-14 15:42:48 UTC (rev 24979)
+++ squeeze/trunk/libsqueeze/archive-command.c	2007-02-14 23:41:54 UTC (rev 24980)
@@ -99,11 +99,17 @@
 lsq_archive_command_dispose(GObject *object)
 {
 	LSQArchiveCommand *archive_command = LSQ_ARCHIVE_COMMAND(object);
-	lsq_archive_dequeue_command(archive_command->archive, archive_command);
+	LSQArchiveCommand *next_archive_command = NULL;
+	if(archive_command->archive)
+	{
+		lsq_archive_dequeue_command(archive_command->archive, archive_command);
 
-	LSQArchiveCommand *next_archive_command = lsq_archive_get_front_command(archive_command->archive);
-	if(next_archive_command)
-		lsq_archive_command_run(next_archive_command);
+		next_archive_command = lsq_archive_get_front_command(archive_command->archive);
+		if(next_archive_command)
+			lsq_archive_command_run(next_archive_command);
+
+		archive_command->archive = NULL;
+	}
 }
 
 /**
@@ -163,7 +169,7 @@
 	gchar *archive_path = g_shell_quote(archive_command->archive->path);
 	gchar *command = g_strdup_printf(archive_command->command, archive_path, files, options);
 
-
+	g_debug("%s\n", command);
 	g_shell_parse_argv(command, &argcp, &argvp, NULL);
 	if ( ! g_spawn_async_with_pipes (
 			NULL,

Modified: squeeze/trunk/libsqueeze/archive-support-zip.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support-zip.c	2007-02-14 15:42:48 UTC (rev 24979)
+++ squeeze/trunk/libsqueeze/archive-support-zip.c	2007-02-14 23:41:54 UTC (rev 24980)
@@ -219,7 +219,7 @@
 			gchar *files = lsq_concat_filenames(filenames);
 
 			archive_command = lsq_archive_command_new("", archive, "zip -r %1$s %2$s", FALSE);
-			g_object_set_data(G_OBJECT(archive_command), "files", files);
+			g_object_set_data(G_OBJECT(archive_command), "files", g_strdup(files));
 			g_free(files);
 			lsq_archive_command_run(archive_command);
 			g_object_unref(archive_command);

Modified: squeeze/trunk/libsqueeze/archive.c
===================================================================
--- squeeze/trunk/libsqueeze/archive.c	2007-02-14 15:42:48 UTC (rev 24979)
+++ squeeze/trunk/libsqueeze/archive.c	2007-02-14 23:41:54 UTC (rev 24980)
@@ -59,9 +59,7 @@
 
 enum
 {
-	LSQ_ARCHIVE_SIGNAL_STATUS_CHANGED = 0,
-	LSQ_ARCHIVE_SIGNAL_REFRESHED,
-	LSQ_ARCHIVE_SIGNAL_PATH_CHANGED,
+	LSQ_ARCHIVE_SIGNAL_COMMAND_TERMINATED = 0,
 	LSQ_ARCHIVE_SIGNAL_COUNT
 };
 
@@ -100,7 +98,7 @@
 
 	object_class->finalize = lsq_archive_finalize;
 	
-	lsq_archive_signals[LSQ_ARCHIVE_SIGNAL_STATUS_CHANGED] = g_signal_new("lsq_status_changed",
+	lsq_archive_signals[LSQ_ARCHIVE_SIGNAL_COMMAND_TERMINATED] = g_signal_new("command-terminated",
 			G_TYPE_FROM_CLASS(archive_class),
 			G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
 			0,
@@ -110,29 +108,6 @@
 			G_TYPE_NONE,
 			0,
 			NULL);
-
-	lsq_archive_signals[LSQ_ARCHIVE_SIGNAL_REFRESHED] = g_signal_new("lsq_refreshed",
-			G_TYPE_FROM_CLASS(archive_class),
-			G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-			0,
-			NULL,
-			NULL,
-			g_cclosure_marshal_VOID__VOID,
-			G_TYPE_NONE,
-			0,
-			NULL);
-
-	lsq_archive_signals[LSQ_ARCHIVE_SIGNAL_PATH_CHANGED] = g_signal_new("lsq_path_changed",
-			G_TYPE_FROM_CLASS(archive_class),
-			G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-			0,
-			NULL,
-			NULL,
-			g_cclosure_marshal_VOID__STRING,
-			G_TYPE_NONE,
-			1,
-			G_TYPE_STRING,
-			NULL);
 }
 
 static void
@@ -449,6 +424,8 @@
 {
 	g_return_if_fail(archive->command_queue->data == command);
 	archive->command_queue = g_slist_remove(archive->command_queue, command);
+	if(archive->command_queue == NULL)
+		g_signal_emit(G_OBJECT(archive), lsq_archive_signals[LSQ_ARCHIVE_SIGNAL_COMMAND_TERMINATED], 0, archive, NULL);
 }
 
 LSQArchiveCommand *

Modified: squeeze/trunk/po/squeeze.pot
===================================================================
--- squeeze/trunk/po/squeeze.pot	2007-02-14 15:42:48 UTC (rev 24979)
+++ squeeze/trunk/po/squeeze.pot	2007-02-14 23:41:54 UTC (rev 24980)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: stephan at xfce.org\n"
-"POT-Creation-Date: 2007-02-14 16:35+0100\n"
+"POT-Creation-Date: 2007-02-15 00:38+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,11 +16,11 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: ../libsqueeze/archive.c:317
+#: ../libsqueeze/archive.c:292
 msgid "Name"
 msgstr ""
 
-#: ../libsqueeze/archive.c:319
+#: ../libsqueeze/archive.c:294
 msgid "Mime type"
 msgstr ""
 

Added: squeeze/trunk/tests/zip/data/1.txt
===================================================================

Modified: squeeze/trunk/tests/zip/test-zip-add.c
===================================================================
--- squeeze/trunk/tests/zip/test-zip-add.c	2007-02-14 15:42:48 UTC (rev 24979)
+++ squeeze/trunk/tests/zip/test-zip-add.c	2007-02-14 23:41:54 UTC (rev 24980)
@@ -19,18 +19,28 @@
 #include <glib-object.h>
 #include <thunar-vfs/thunar-vfs.h>
 #include <libsqueeze/libsqueeze.h>
-/* FIXME: HACK */
-//#include <libsqueeze/archive-support.h>
 
+GMainLoop *loop = NULL;
+gint ret_val = 0;
+
+void
+cb_command_terminated(LSQArchive *archive)
+{
+	if(loop)
+		g_main_loop_quit(loop);
+	else
+		ret_val = 1;
+}
+
 int main()
 {
 	g_type_init();
 
-	gint ret_val = 0;
 	LSQArchive *archive = NULL;
 	LSQArchiveSupport *archive_support = NULL;
 	gchar *current_dir = g_get_current_dir();
 	gchar *path = g_strconcat(current_dir, "/data/test.zip", NULL);
+	GSList *files = g_slist_prepend(NULL, "data/1.txt");
 
 	thunar_vfs_init();
 	lsq_init();
@@ -38,10 +48,17 @@
 	lsq_new_archive(path, TRUE, "application/zip", &archive);
 	archive_support = lsq_get_support_for_mimetype(lsq_archive_get_mimetype(archive));
 
+	g_signal_connect(G_OBJECT(archive), "command-terminated", G_CALLBACK(cb_command_terminated), NULL);
+
 	
-	if(lsq_archive_support_add(archive_support, archive, NULL))
+	if(lsq_archive_support_add(archive_support, archive, files))
 		ret_val = 1;
 
+	if(ret_val == 0)
+	{
+		loop = g_main_loop_new(NULL, FALSE);
+		g_main_loop_run(loop);
+	}
 
 	lsq_close_archive(archive);
 



More information about the Xfce4-commits mailing list