[Xfce4-commits] r25046 - in squeeze/trunk: libsqueeze src

Peter de Ridder peter at xfce.org
Thu Mar 1 00:00:05 CET 2007


Author: peter
Date: 2007-02-28 23:00:05 +0000 (Wed, 28 Feb 2007)
New Revision: 25046

Modified:
   squeeze/trunk/libsqueeze/archive-command.c
   squeeze/trunk/libsqueeze/archive-command.h
   squeeze/trunk/libsqueeze/archive-support-gnu-tar.c
   squeeze/trunk/libsqueeze/archive-support-zip.c
   squeeze/trunk/src/archive_store.c
Log:
archive refreshed signal in archive store


Modified: squeeze/trunk/libsqueeze/archive-command.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-command.c	2007-02-28 22:45:19 UTC (rev 25045)
+++ squeeze/trunk/libsqueeze/archive-command.c	2007-02-28 23:00:05 UTC (rev 25046)
@@ -152,7 +152,7 @@
  * Returns: a new LSQArchiveCommand object
  */
 LSQArchiveCommand *
-lsq_archive_command_new(const gchar *comment, LSQArchive *archive, const gchar *command, gboolean safe)
+lsq_archive_command_new(const gchar *comment, LSQArchive *archive, const gchar *command, gboolean safe, gboolean refresh)
 {
 	LSQArchiveCommand *archive_command;
 
@@ -161,6 +161,7 @@
 	archive_command->command = g_strdup(command);
 	archive_command->archive = archive;
 	archive_command->safe = safe;
+	archive_command->refresh = refresh;
 
 	lsq_archive_enqueue_command(archive, archive_command);
 

Modified: squeeze/trunk/libsqueeze/archive-command.h
===================================================================
--- squeeze/trunk/libsqueeze/archive-command.h	2007-02-28 22:45:19 UTC (rev 25045)
+++ squeeze/trunk/libsqueeze/archive-command.h	2007-02-28 23:00:05 UTC (rev 25046)
@@ -67,7 +67,8 @@
 LSQArchiveCommand  *lsq_archive_command_new(const gchar *comment, 
                                             LSQArchive *archive,
                                             const gchar *command,
-																						gboolean safe) G_GNUC_INTERNAL;
+																						gboolean safe,
+																						gboolean change) G_GNUC_INTERNAL;
 
 gboolean            lsq_archive_command_run(LSQArchiveCommand *archive_command) G_GNUC_INTERNAL;
 

Modified: squeeze/trunk/libsqueeze/archive-support-gnu-tar.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support-gnu-tar.c	2007-02-28 22:45:19 UTC (rev 25045)
+++ squeeze/trunk/libsqueeze/archive-support-gnu-tar.c	2007-02-28 23:00:05 UTC (rev 25046)
@@ -291,7 +291,7 @@
 			if(!g_strcasecmp(thunar_vfs_mime_info_get_name(archive->mime_info), "application/x-tzo"))
 				options = "--use-compress-program=lzop";
 
-			archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE);
+			archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE, TRUE);
 			g_object_set_data(G_OBJECT(archive_command), "files", g_strdup(files));
 			g_object_set_data(G_OBJECT(archive_command), "options", g_strdup(options));
 			g_free(command_skeleton);
@@ -308,7 +308,7 @@
 				command_skeleton = g_strdup("lzop -dc %1$s");
 			if(command_skeleton)
 			{
-				archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE);
+				archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE, TRUE);
 				lsq_archive_command_set_parse_func(archive_command, 1, lsq_archive_support_gnu_tar_decompress_parse_output);
 				tmp_file = g_strconcat(lsq_tmp_dir, "/squeeze-XXXXXX.tar" , NULL);
 				g_mkstemp(tmp_file);
@@ -317,7 +317,7 @@
 			}
 
 			command_skeleton = g_strconcat(GNU_TAR_APP_NAME, " %3$s -r -f %1$s %2$s", NULL);
-			archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE);
+			archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE, TRUE);
 			if(tmp_file)
 				g_object_set_data(G_OBJECT(archive_command), "archive", g_strdup(tmp_file));
 			g_object_set_data(G_OBJECT(archive_command), "files", g_strdup(files));
@@ -335,7 +335,7 @@
 				command_skeleton = g_strdup("lzop -c %1$s");
 			if(command_skeleton)
 			{
-				archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE);
+				archive_command = lsq_archive_command_new("", archive, command_skeleton, FALSE, TRUE);
 				lsq_archive_command_set_parse_func(archive_command, 1, lsq_archive_support_gnu_tar_compress_parse_output);
 				if(tmp_file)
 					g_object_set_data(G_OBJECT(archive_command), "archive", g_strdup(tmp_file));
@@ -414,10 +414,9 @@
 		}
 
 		gchar *command_skeleton = g_strconcat(GNU_TAR_APP_NAME, " -tvvf %1$s", NULL);
-		archive_command = lsq_archive_command_new("", archive, command_skeleton, TRUE);
+		archive_command = lsq_archive_command_new("", archive, command_skeleton, TRUE, TRUE);
 		g_free(command_skeleton);
 		lsq_archive_command_set_parse_func(archive_command, 1, lsq_archive_support_gnu_tar_refresh_parse_output);
-		archive_command->refresh = TRUE;
 		lsq_archive_command_run(archive_command);
 		g_object_unref(archive_command);
 	}

Modified: squeeze/trunk/libsqueeze/archive-support-zip.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-support-zip.c	2007-02-28 22:45:19 UTC (rev 25045)
+++ squeeze/trunk/libsqueeze/archive-support-zip.c	2007-02-28 23:00:05 UTC (rev 25046)
@@ -219,7 +219,7 @@
 			gchar *files = lsq_concat_filenames(filenames);
 			gchar *options = NULL;
 
-			archive_command = lsq_archive_command_new("", archive, "zip %3$s -r %1$s %2$s", FALSE);
+			archive_command = lsq_archive_command_new("", archive, "zip %3$s -r %1$s %2$s", FALSE, TRUE);
 			g_object_set_data(G_OBJECT(archive_command), "files", g_strdup(files));
 			g_object_set_data(G_OBJECT(archive_command), "options", options);
 			g_free(files);
@@ -256,7 +256,7 @@
 
 			gchar *options = g_strconcat(" -d ", dest_path, NULL);
 
-			archive_command = lsq_archive_command_new("", archive, "unzip -o %1$s %2$s %3$s", TRUE);
+			archive_command = lsq_archive_command_new("", archive, "unzip -o %1$s %2$s %3$s", TRUE, FALSE);
 			g_object_set_data(G_OBJECT(archive_command), "files", files);
 			g_object_set_data(G_OBJECT(archive_command), "options", options);
 			lsq_archive_command_run(archive_command);
@@ -290,7 +290,7 @@
 		{
 			gchar *files = lsq_concat_filenames(filenames);
 
-			archive_command = lsq_archive_command_new("", archive, "zip -d %1$s %2$s", FALSE);
+			archive_command = lsq_archive_command_new("", archive, "zip -d %1$s %2$s", FALSE, TRUE);
 			g_object_set_data(G_OBJECT(archive_command), "files", files);
 			lsq_archive_command_run(archive_command);
 			g_object_unref(archive_command);
@@ -347,9 +347,8 @@
 			lsq_archive_set_entry_property_type(archive, i, G_TYPE_STRING, _("Checksum"));
 			i++;
 		}
-		archive_command = lsq_archive_command_new("", archive, "unzip -lv -qq %1$s", TRUE);
+		archive_command = lsq_archive_command_new("", archive, "unzip -lv -qq %1$s", TRUE, TRUE);
 		lsq_archive_command_set_parse_func(archive_command, 1, lsq_archive_support_zip_refresh_parse_output);
-		archive_command->refresh = TRUE;
 		lsq_archive_command_run(archive_command);
 		g_object_unref(archive_command);
 	}

Modified: squeeze/trunk/src/archive_store.c
===================================================================
--- squeeze/trunk/src/archive_store.c	2007-02-28 22:45:19 UTC (rev 25045)
+++ squeeze/trunk/src/archive_store.c	2007-02-28 23:00:05 UTC (rev 25046)
@@ -140,9 +140,9 @@
 static void
 sq_archive_store_check_trailing(SQArchiveStore *store);
 
+static void
+cb_sq_archive_store_archive_refreshed(LSQArchive *archive, gpointer user_data);
 /* static void                                                                                           */
-/* cb_sq_archive_store_archive_refreshed(LSQArchive *archive, gpointer user_data);                       */
-/* static void                                                                                           */
 /* cb_sq_archive_store_archive_path_changed(LSQArchive *archive, const gchar *path, gpointer user_data); */
 
 GType
@@ -1126,7 +1126,7 @@
 
 		g_return_if_fail(entry);
 
-		/* TODO Signal file-activated */
+		/* Signal file-activated */
 		if(!lsq_archive_iter_is_directory(entry))
 		{
 #ifdef DEBUG
@@ -1224,7 +1224,7 @@
 	/* disconnect from the archive */
 	if(store->archive)
 	{
-		/* g_signal_handlers_disconnect_by_func(store->archive, cb_sq_archive_store_archive_refreshed, store); */
+		g_signal_handlers_disconnect_by_func(store->archive, cb_sq_archive_store_archive_refreshed, store);
 		/* g_signal_handlers_disconnect_by_func(store->archive, cb_sq_archive_store_archive_path_changed, store); */
 		g_object_unref(store->archive);
 		store->archive = NULL;
@@ -1275,7 +1275,7 @@
 
 	/* notify all we have a new archive and connect with the archive */
 	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_NEW_ARCHIVE], 0, NULL);
-	/* g_signal_connect(store->archive, "refreshed", G_CALLBACK(cb_sq_archive_store_archive_refreshed), store); */
+	g_signal_connect(store->archive, "refreshed", G_CALLBACK(cb_sq_archive_store_archive_refreshed), store);
 	/* g_signal_connect(store->archive, "lsq_path_changed", G_CALLBACK(cb_sq_archive_store_archive_path_changed), store); */
 }
 
@@ -1613,3 +1613,22 @@
 	}
 	parent_class->dispose(object);
 }
+
+static void
+cb_sq_archive_store_archive_refreshed(LSQArchive *archive, gpointer user_data)
+{
+	SQArchiveStore *store = SQ_ARCHIVE_STORE(user_data);
+	GList *iter;
+	LSQArchiveIter *aIter;
+
+	for(iter = store->navigation.history; iter; iter = g_list_next(iter))
+	{
+		aIter = lsq_archive_iter_get_real_parent(iter->data);
+		lsq_archive_iter_unref(iter->data);
+		iter->data = aIter;
+	}
+
+	sq_archive_store_sort(store);
+	sq_archive_store_refresh(store);
+}
+



More information about the Xfce4-commits mailing list