2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "notification-ex/common.h"
25 #define LOG_TAG "NOTIFICATION_EX"
26 #define NOTIFICATION_EX_ERROR_QUARK "notification-ex-error-quark"
28 namespace notification {
30 static const GDBusErrorEntry dbus_error_entries[] = {
31 {ERROR_INVALID_PARAMETER, "org.freedesktop.Notification-ex.Error.INVALID_PARAMETER"},
32 {ERROR_OUT_OF_MEMORY, "org.freedesktop.Notification-ex.Error.OUT_OF_MEMORY"},
33 {ERROR_IO_ERROR, "org.freedesktop.Notification-ex.Error.IO_ERROR"},
34 {ERROR_PERMISSION_DENIED, "org.freedesktop.Notification-ex.Error.PERMISSION_DENIED"},
35 {ERROR_FROM_DB, "org.freedesktop.Notification-ex.Error.FROM_DB"},
36 {ERROR_ALREADY_EXIST_ID, "org.freedesktop.Notification-ex.Error.ALREADY_EXIST_ID"},
37 {ERROR_FROM_DBUS, "org.freedesktop.Notification-ex.Error.FROM_DBUS"},
38 {ERROR_NOT_EXIST_ID, "org.freedesktop.Notification-ex.Error.NOT_EXIST_ID"},
39 {ERROR_SERVICE_NOT_READY, "org.freedesktop.Notification-ex.Error.SERVICE_NOT_READY"},
42 GQuark noti_ex_error_quark(void) {
43 static volatile gsize quark_volatile = 0;
44 static const char *domain_name = NULL;
46 GQuark quark = g_quark_try_string(NOTIFICATION_EX_ERROR_QUARK);
48 if (domain_name == NULL)
49 domain_name = strdup(NOTIFICATION_EX_ERROR_QUARK);
51 domain_name = NOTIFICATION_EX_ERROR_QUARK;
54 g_dbus_error_register_error_domain(domain_name, &quark_volatile,
55 dbus_error_entries, G_N_ELEMENTS(dbus_error_entries));
56 return (GQuark)quark_volatile;
59 } // namespace notification