summaryrefslogtreecommitdiff
path: root/src/polkit/polkiterror.c
blob: 3ec9cf004aea0f6b8a588682cc4a9ece0b9cbb1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */

/*
 * Copyright (C) 2008 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: David Zeuthen <davidz@redhat.com>
 */

#include "config.h"
#include <polkit/polkiterror.h>

/**
 * SECTION:polkiterror
 * @title: PolkitError
 * @short_description: Error helper functions
 * @include: polkit/polkit.h
 *
 * Contains helper functions for reporting errors to the user.
 **/

/**
 * polkit_error_quark:
 *
 * Gets the #PolkitError Quark.
 *
 * Return value: a #GQuark.
 **/
GQuark
polkit_error_quark (void)
{
        return g_quark_from_static_string ("g-polkit-error-quark");
}

#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }

GType
polkit_error_get_type (void)
{
        static GType etype = 0;

        if (etype == 0)
        {
                static const GEnumValue values[] = {
                        ENUM_ENTRY (POLKIT_ERROR_FAILED,        "Failed"),
                        ENUM_ENTRY (POLKIT_ERROR_NOT_SUPPORTED, "NotSupported"),
                        { 0, 0, 0 }
                };
                g_assert (POLKIT_ERROR_NUM_ERRORS == G_N_ELEMENTS (values) - 1);
                etype = g_enum_register_static ("PolkitErrorEnum", values);
        }
        return etype;
}