Add a GIcon implementation that can add an emblem to another icon.
[glib.git] / gio / gioerror.c
blobf06e0cf2045461e61d5dc78b3754cd4b896b2adc
1 /* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #include "config.h"
24 #include <errno.h>
25 #include "gioerror.h"
27 #include "gioalias.h"
29 /**
30 * SECTION:gioerror
31 * @short_description: Error helper functions
32 * @include: gio/gio.h
34 * Contains helper functions for reporting errors to the user.
35 **/
37 /**
38 * g_io_error_quark:
40 * Gets the GIO Error Quark.
42 * Return value: a #GQuark.
43 **/
44 GQuark
45 g_io_error_quark (void)
47 return g_quark_from_static_string ("g-io-error-quark");
50 /**
51 * g_io_error_from_errno:
52 * @err_no: Error number as defined in errno.h.
54 * Converts errno.h error codes into GIO error codes.
56 * Returns: #GIOErrorEnum value for the given errno.h error number.
57 **/
58 GIOErrorEnum
59 g_io_error_from_errno (gint err_no)
61 switch (err_no)
63 #ifdef EEXIST
64 case EEXIST:
65 return G_IO_ERROR_EXISTS;
66 break;
67 #endif
69 #ifdef EISDIR
70 case EISDIR:
71 return G_IO_ERROR_IS_DIRECTORY;
72 break;
73 #endif
75 #ifdef EACCES
76 case EACCES:
77 return G_IO_ERROR_PERMISSION_DENIED;
78 break;
79 #endif
81 #ifdef ENAMETOOLONG
82 case ENAMETOOLONG:
83 return G_IO_ERROR_FILENAME_TOO_LONG;
84 break;
85 #endif
87 #ifdef ENOENT
88 case ENOENT:
89 return G_IO_ERROR_NOT_FOUND;
90 break;
91 #endif
93 #ifdef ENOTDIR
94 case ENOTDIR:
95 return G_IO_ERROR_NOT_DIRECTORY;
96 break;
97 #endif
99 #ifdef EROFS
100 case EROFS:
101 return G_IO_ERROR_READ_ONLY;
102 break;
103 #endif
105 #ifdef ELOOP
106 case ELOOP:
107 return G_IO_ERROR_TOO_MANY_LINKS;
108 break;
109 #endif
111 #ifdef ENOSPC
112 case ENOSPC:
113 return G_IO_ERROR_NO_SPACE;
114 break;
115 #endif
117 #ifdef ENOMEM
118 case ENOMEM:
119 return G_IO_ERROR_NO_SPACE;
120 break;
121 #endif
123 #ifdef EINVAL
124 case EINVAL:
125 return G_IO_ERROR_INVALID_ARGUMENT;
126 break;
127 #endif
129 #ifdef EPERM
130 case EPERM:
131 return G_IO_ERROR_PERMISSION_DENIED;
132 break;
133 #endif
135 #ifdef ECANCELED
136 case ECANCELED:
137 return G_IO_ERROR_CANCELLED;
138 break;
139 #endif
141 #ifdef ENOTEMPTY
142 case ENOTEMPTY:
143 return G_IO_ERROR_NOT_EMPTY;
144 break;
145 #endif
147 #ifdef ENOTSUP
148 case ENOTSUP:
149 return G_IO_ERROR_NOT_SUPPORTED;
150 break;
151 #endif
153 #ifdef ETIMEDOUT
154 case ETIMEDOUT:
155 return G_IO_ERROR_TIMED_OUT;
156 break;
157 #endif
159 #ifdef EBUSY
160 case EBUSY:
161 return G_IO_ERROR_BUSY;
162 break;
163 #endif
165 #ifdef EWOULDBLOCK
166 case EWOULDBLOCK:
167 return G_IO_ERROR_WOULD_BLOCK;
168 break;
169 #endif
171 default:
172 return G_IO_ERROR_FAILED;
173 break;
177 #define __G_IO_ERROR_C__
178 #include "gioaliasdef.c"