[Xfce4-commits] r25247 - squeeze/trunk/libsqueeze
Stephan Arts
stephan at xfce.org
Wed Mar 21 19:55:22 CET 2007
Author: stephan
Date: 2007-03-21 18:55:22 +0000 (Wed, 21 Mar 2007)
New Revision: 25247
Modified:
squeeze/trunk/libsqueeze/archive-command.c
squeeze/trunk/libsqueeze/archive.c
squeeze/trunk/libsqueeze/spawn-command.c
Log:
fixed archive-command termination
Modified: squeeze/trunk/libsqueeze/archive-command.c
===================================================================
--- squeeze/trunk/libsqueeze/archive-command.c 2007-03-21 17:07:50 UTC (rev 25246)
+++ squeeze/trunk/libsqueeze/archive-command.c 2007-03-21 18:55:22 UTC (rev 25247)
@@ -42,6 +42,14 @@
static GObjectClass *parent_class;
+enum
+{
+ LSQ_ARCHIVE_COMMAND_SIGNAL_TERMINATED = 0,
+ LSQ_ARCHIVE_COMMAND_SIGNAL_COUNT
+};
+
+static gint lsq_archive_command_signals[LSQ_ARCHIVE_COMMAND_SIGNAL_COUNT];
+
GType
lsq_archive_command_get_type ()
{
@@ -78,6 +86,17 @@
parent_class = g_type_class_peek(G_TYPE_OBJECT);
+ lsq_archive_command_signals[LSQ_ARCHIVE_COMMAND_SIGNAL_TERMINATED] = g_signal_new("terminated",
+ G_TYPE_FROM_CLASS(archive_command_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_POINTER,
+ NULL);
}
static void
@@ -95,7 +114,8 @@
static void
lsq_archive_command_dispose(GObject *object)
{
-
+ LSQArchiveCommand *command = LSQ_ARCHIVE_COMMAND(object);
+ g_signal_emit(object, lsq_archive_command_signals[LSQ_ARCHIVE_COMMAND_SIGNAL_TERMINATED], 0, command->error, NULL);
parent_class->dispose(object);
}
Modified: squeeze/trunk/libsqueeze/archive.c
===================================================================
--- squeeze/trunk/libsqueeze/archive.c 2007-03-21 17:07:50 UTC (rev 25246)
+++ squeeze/trunk/libsqueeze/archive.c 2007-03-21 18:55:22 UTC (rev 25247)
@@ -59,6 +59,9 @@
static void
lsq_archive_finalize(GObject *object);
+static void
+cb_archive_archive_command_terminated(LSQArchiveCommand *command, GError *error, LSQArchive *archive);
+
enum
{
LSQ_ARCHIVE_SIGNAL_COMMAND_STARTED = 0,
@@ -519,8 +522,14 @@
return FALSE;
archive->command = builder->build_add(builder, archive, files);
-
- lsq_archive_command_execute(archive->command);
+ g_signal_connect(archive->command, "terminated", G_CALLBACK(cb_archive_archive_command_terminated), archive);
+ if(!lsq_archive_command_execute(archive->command))
+ {
+ g_object_unref(archive->command);
+ archive->command = NULL;
+ }
+ else
+ g_object_unref(archive->command);
return FALSE;
}
@@ -533,7 +542,14 @@
return FALSE;
archive->command = builder->build_extract(builder, archive, dest_path, files);
- lsq_archive_command_execute(archive->command);
+ g_signal_connect(archive->command, "terminated", G_CALLBACK(cb_archive_archive_command_terminated), archive);
+ if(!lsq_archive_command_execute(archive->command))
+ {
+ g_object_unref(archive->command);
+ archive->command = NULL;
+ }
+ else
+ g_object_unref(archive->command);
return FALSE;
}
@@ -546,7 +562,14 @@
return FALSE;
archive->command = builder->build_remove(builder, archive, files);
- lsq_archive_command_execute(archive->command);
+ g_signal_connect(archive->command, "terminated", G_CALLBACK(cb_archive_archive_command_terminated), archive);
+ if(!lsq_archive_command_execute(archive->command))
+ {
+ g_object_unref(archive->command);
+ archive->command = NULL;
+ }
+ else
+ g_object_unref(archive->command);
return FALSE;
}
@@ -559,7 +582,14 @@
return FALSE;
archive->command = builder->build_refresh(builder, archive);
- lsq_archive_command_execute(archive->command);
+ g_signal_connect(archive->command, "terminated", G_CALLBACK(cb_archive_archive_command_terminated), archive);
+ if(!lsq_archive_command_execute(archive->command))
+ {
+ g_object_unref(archive->command);
+ archive->command = NULL;
+ }
+ else
+ g_object_unref(archive->command);
return FALSE;
}
@@ -572,6 +602,22 @@
return FALSE;
archive->command = builder->build_open(builder, archive, files);
- lsq_archive_command_execute(archive->command);
+ g_signal_connect(archive->command, "terminated", G_CALLBACK(cb_archive_archive_command_terminated), archive);
+ if(!lsq_archive_command_execute(archive->command))
+ {
+ g_object_unref(archive->command);
+ archive->command = NULL;
+ }
+ else
+ g_object_unref(archive->command);
return FALSE;
}
+
+static void
+cb_archive_archive_command_terminated(LSQArchiveCommand *command, GError *error, LSQArchive *archive)
+{
+ archive->command = NULL;
+#ifdef DEBUG
+ g_debug("COMMAND TERMINATED");
+#endif
+}
Modified: squeeze/trunk/libsqueeze/spawn-command.c
===================================================================
--- squeeze/trunk/libsqueeze/spawn-command.c 2007-03-21 17:07:50 UTC (rev 25246)
+++ squeeze/trunk/libsqueeze/spawn-command.c 2007-03-21 18:55:22 UTC (rev 25247)
@@ -206,12 +206,12 @@
&fd_err,
NULL) )
{
- g_object_unref(spawn_command);
return FALSE;
}
LSQ_ARCHIVE_COMMAND(command)->running = TRUE;
g_child_watch_add(spawn_command->child_pid, lsq_spawn_command_child_watch_func, spawn_command);
+ g_object_ref(spawn_command);
if(spawn_command->parse_stdout != NULL)
{
More information about the Xfce4-commits
mailing list