2 * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <atompub/atom.h>
35 error = g_slice_new (AtomError);
37 error->message = NULL;
42 atom_error_delete (AtomError *error)
45 g_free (error->message);
46 g_slice_free (AtomError, error);
50 atom_error_code (AtomError *error)
56 atom_error_code_set (AtomError *error, int code)
62 atom_error_message (AtomError *error)
64 return error->message;
68 atom_error_message_set (AtomError *error, char *message)
70 error->message = g_strdup (message);
74 atom_error_new_from_gerror (GError *error)
77 aerr = atom_error_new ();
78 if (error->domain == G_FILE_ERROR)
82 case G_FILE_ERROR_EXIST:
83 case G_FILE_ERROR_ACCES:
84 case G_FILE_ERROR_PERM:
87 case G_FILE_ERROR_NOENT:
95 else if (error->domain = G_IO_ERROR)
99 case G_IO_ERROR_NOT_FOUND:
111 aerr->message = g_strdup (error->message);