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
|
/*
* Copyright (c) 2011 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <string.h>
#include <gio/gio.h>
#include "shortcut_error.h"
static const GDBusErrorEntry dbus_error_entries[] = {
{SHORTCUT_ERROR_INVALID_PARAMETER, "org.freedesktop.Shortcut.Error.INVALID_PARAMETER"},
{SHORTCUT_ERROR_OUT_OF_MEMORY, "org.freedesktop.Shortcut.Error.OUT_OF_MEMORY"},
{SHORTCUT_ERROR_IO_ERROR, "org.freedesktop.Shortcut.Error.IO_ERROR"},
{SHORTCUT_ERROR_PERMISSION_DENIED, "org.freedesktop.Shortcut.Error.PERMISSION_DENIED"},
{SHORTCUT_ERROR_NOT_SUPPORTED, "org.freedesktop.Shortcut.Error.NOT_SUPPORTED"},
{SHORTCUT_ERROR_RESOURCE_BUSY, "org.freedesktop.Shortcut.Error.RESOURCE_BUSY"},
{SHORTCUT_ERROR_NO_SPACE, "org.freedesktop.Shortcut.Error.NO_SPACE"},
{SHORTCUT_ERROR_EXIST, "org.freedesktop.Shortcut.Error.EXIST"},
{SHORTCUT_ERROR_FAULT, "org.freedesktop.Shortcut.Error.FAULT"},
{SHORTCUT_ERROR_COMM, "org.freedesktop.Shortcut.Error.COMM"},
};
#define SHORTCUT_ERROR_QUARK "shortcut-error-quark"
EXPORT_API GQuark shortcut_error_quark(void)
{
static volatile gsize quark_volatile = 0;
static char *domain_name = NULL;
/* This is for preventing crash when notification api is used in ui-gadget */
/* ui-gadget libraries can be unloaded when it is needed and the static string */
/* parameter to g_dbus_error_register_error_domain may cause crash. */
GQuark quark = g_quark_try_string(SHORTCUT_ERROR_QUARK);
if (quark == 0) {
if (domain_name == NULL)
domain_name = strdup(SHORTCUT_ERROR_QUARK);
} else {
domain_name = SHORTCUT_ERROR_QUARK;
}
g_dbus_error_register_error_domain(domain_name,
&quark_volatile,
dbus_error_entries,
G_N_ELEMENTS(dbus_error_entries));
return (GQuark) quark_volatile;
}
|