diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/fr-archive.c | 9 | ||||
-rw-r--r-- | src/fr-command.c | 11 | ||||
-rw-r--r-- | src/fr-marshal.list | 3 | ||||
-rw-r--r-- | src/fr-proc-error.c | 55 | ||||
-rw-r--r-- | src/fr-proc-error.h | 31 | ||||
-rw-r--r-- | src/fr-process.c | 18 | ||||
-rw-r--r-- | src/fr-process.h | 3 |
8 files changed, 116 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index ef11ec3..450214f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -127,6 +127,8 @@ engrampa_SOURCES = \ fr-list-model.h \ fr-stock.c \ fr-stock.h \ + fr-proc-error.c \ + fr-proc-error.h \ fr-process.c \ fr-process.h \ fr-window.c \ diff --git a/src/fr-archive.c b/src/fr-archive.c index b466134..fcd50f6 100644 --- a/src/fr-archive.c +++ b/src/fr-archive.c @@ -38,6 +38,7 @@ #include "fr-command.h" #include "fr-error.h" #include "fr-marshal.h" +#include "fr-proc-error.h" #include "fr-process.h" #include "main.h" @@ -247,10 +248,10 @@ fr_archive_class_init (FrArchiveClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (FrArchiveClass, done), NULL, NULL, - fr_marshal_VOID__INT_POINTER, + fr_marshal_VOID__INT_BOXED, G_TYPE_NONE, 2, G_TYPE_INT, - G_TYPE_POINTER); + FR_TYPE_PROC_ERROR); fr_archive_signals[PROGRESS] = g_signal_new ("progress", G_TYPE_FROM_CLASS (class), @@ -1603,7 +1604,7 @@ fr_archive_add (FrArchive *archive, archive->process->error.type = FR_PROC_ERROR_NONE; g_signal_emit_by_name (G_OBJECT (archive->process), "done", - FR_ACTION_ADDING_FILES); + &archive->process->error); return; } @@ -1690,7 +1691,7 @@ fr_archive_add (FrArchive *archive, archive->process->error.gerror = g_error_copy (error); g_signal_emit_by_name (G_OBJECT (archive->process), "done", - FR_ACTION_ADDING_FILES); + &archive->process->error); g_clear_error (&error); error_occurred = TRUE; } diff --git a/src/fr-command.c b/src/fr-command.c index 1f00d84..5cf667e 100644 --- a/src/fr-command.c +++ b/src/fr-command.c @@ -29,6 +29,7 @@ #include "fr-command.h" #include "fr-enum-types.h" #include "fr-marshal.h" +#include "fr-proc-error.h" #include "fr-process.h" #include "glib-utils.h" @@ -219,12 +220,14 @@ fr_command_start (FrProcess *process, static void fr_command_done (FrProcess *process, + FrProcError *error, gpointer data) { FrCommand *comm = FR_COMMAND (data); comm->process->restart = FALSE; - fr_command_handle_error (comm, &process->error); + if (error->type != FR_PROC_ERROR_STOPPED) + fr_command_handle_error (comm, error); if (comm->process->restart) { fr_process_start (comm->process); @@ -240,7 +243,7 @@ fr_command_done (FrProcess *process, fr_command_signals[DONE], 0, comm->action, - &process->error); + error); } @@ -402,10 +405,10 @@ fr_command_class_init (FrCommandClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (FrCommandClass, done), NULL, NULL, - fr_marshal_VOID__INT_POINTER, + fr_marshal_VOID__INT_BOXED, G_TYPE_NONE, 2, G_TYPE_INT, - G_TYPE_POINTER); + FR_TYPE_PROC_ERROR); fr_command_signals[PROGRESS] = g_signal_new ("progress", G_TYPE_FROM_CLASS (class), diff --git a/src/fr-marshal.list b/src/fr-marshal.list index d3fcc1a..1629043 100644 --- a/src/fr-marshal.list +++ b/src/fr-marshal.list @@ -1,8 +1,9 @@ VOID:INT VOID:INT,INT -VOID:INT,POINTER +VOID:INT,BOXED VOID:POINTER VOID:VOID VOID:DOUBLE VOID:STRING VOID:BOOL +VOID:BOXED diff --git a/src/fr-proc-error.c b/src/fr-proc-error.c new file mode 100644 index 0000000..1f61613 --- /dev/null +++ b/src/fr-proc-error.c @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * File-Roller + * + * Copyright (C) 2001 The Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include "fr-proc-error.h" + + +static gpointer +fr_proc_error_copy (gpointer boxed) +{ + FrProcError *old_error = boxed; + FrProcError *new_error; + + new_error = g_new (FrProcError, 1); + new_error->type = old_error->type; + new_error->status = old_error->status; + new_error->gerror = (old_error->gerror != NULL) ? g_error_copy (old_error->gerror) : NULL; + + return new_error; +} + + +static void +fr_proc_error_free (gpointer boxed) +{ + FrProcError *error = boxed; + + if (error->gerror != NULL) + g_error_free (error->gerror); + g_free (error); +} + + +G_DEFINE_BOXED_TYPE (FrProcError, + fr_proc_error, + fr_proc_error_copy, + fr_proc_error_free) diff --git a/src/fr-proc-error.h b/src/fr-proc-error.h new file mode 100644 index 0000000..d7e4924 --- /dev/null +++ b/src/fr-proc-error.h @@ -0,0 +1,31 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * File-Roller + * + * Copyright (C) 2001 The Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef FR_PROC_ERROR_H +#define FR_PROC_ERROR_H + +#include "typedefs.h" + +#define FR_TYPE_PROC_ERROR (fr_proc_error_get_type ()) + +GType fr_proc_error_get_type (void); + +#endif /* FR_PROC_ERROR_H */ diff --git a/src/fr-process.c b/src/fr-process.c index 61ed636..01f04e0 100644 --- a/src/fr-process.c +++ b/src/fr-process.c @@ -30,6 +30,7 @@ #include <sys/wait.h> #include <unistd.h> #include <glib.h> +#include "fr-proc-error.h" #include "fr-process.h" #include "fr-marshal.h" #include "glib-utils.h" @@ -276,8 +277,9 @@ fr_process_class_init (FrProcessClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (FrProcessClass, done), NULL, NULL, - fr_marshal_VOID__VOID, - G_TYPE_NONE, 0); + fr_marshal_VOID__BOXED, + G_TYPE_NONE, 1, + FR_TYPE_PROC_ERROR); fr_process_signals[STICKY_ONLY] = g_signal_new ("sticky_only", G_TYPE_FROM_CLASS (class), @@ -720,7 +722,8 @@ start_current_command (FrProcess *process) process->error.type = FR_PROC_ERROR_SPAWN; g_signal_emit (G_OBJECT (process), fr_process_signals[DONE], - 0); + 0, + &process->error); g_free (argv); return; } @@ -933,7 +936,8 @@ check_child (gpointer data) g_signal_emit (G_OBJECT (process), fr_process_signals[DONE], - 0); + 0, + &process->error); return FALSE; } @@ -976,7 +980,8 @@ fr_process_start (FrProcess *process) process->priv->running = FALSE; g_signal_emit (G_OBJECT (process), fr_process_signals[DONE], - 0); + 0, + &process->error); } else { process->priv->running = TRUE; @@ -1021,7 +1026,8 @@ fr_process_stop_priv (FrProcess *process, if (emit_signal) g_signal_emit (G_OBJECT (process), fr_process_signals[DONE], - 0); + 0, + &process->error); } } diff --git a/src/fr-process.h b/src/fr-process.h index e8fcfc1..8c907bd 100644 --- a/src/fr-process.h +++ b/src/fr-process.h @@ -81,7 +81,8 @@ struct _FrProcessClass { /* -- Signals -- */ void (* start) (FrProcess *fr_proc); - void (* done) (FrProcess *fr_proc); + void (* done) (FrProcess *fr_proc, + FrProcError *error); void (* sticky_only) (FrProcess *fr_proc); }; |