From b99f3f5e8080f266affd9734d4f73dac0c67215e Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 21 Nov 2014 17:12:25 +0100 Subject: use a boxed type to pass the error to the 'done' signal Based on FR commit: 4b645f57c856928c508dd74c31e1bfb2132368e1 From: Paolo Bacchilega --- src/fr-proc-error.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/fr-proc-error.c (limited to 'src/fr-proc-error.c') 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 . + */ + +#include +#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) -- cgit v1.2.1