lib: Add custom GError codes

tingping/wmclass
Alexander Larsson 2015-12-15 15:27:37 +01:00
parent be4f0d86d8
commit 856c8210a9
6 changed files with 76 additions and 2 deletions

View File

@ -40,7 +40,7 @@ xdg_app_error_quark (void)
{
static volatile gsize quark_volatile = 0;
g_dbus_error_register_error_domain ("xdg-app--error-quark",
g_dbus_error_register_error_domain ("xdg-app-portal-error-quark",
&quark_volatile,
xdg_app_error_entries,
G_N_ELEMENTS (xdg_app_error_entries));

View File

@ -5,6 +5,7 @@ noinst_PROGRAMS += test-libxdg-app
public_headers = \
lib/xdg-app.h \
lib/xdg-app-ref.h \
lib/xdg-app-error.h \
lib/xdg-app-installed-ref.h \
lib/xdg-app-remote-ref.h \
lib/xdg-app-installation.h \
@ -47,6 +48,7 @@ sources = \
lib/xdg-app-remote-ref.c \
lib/xdg-app-remote-private.h \
lib/xdg-app-remote.c \
lib/xdg-app-error.c \
lib/xdg-app-installation.c \
$(NULL)

View File

@ -1,7 +1,7 @@
/*** BEGIN file-header ***/
#include "config.h"
#include <xdg-app-utils.h>
#include <xdg-app-ref.h>
#include <xdg-app.h>
#include <xdg-app-enum-types.h>
#include <gio/gio.h>

View File

@ -0,0 +1,28 @@
/* xdg-app-error.c
*
* Copyright (C) 2015 Red Hat, Inc
*
* This file 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 file 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 program. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alexander Larsson <alexl@redhat.com>
*/
#include "config.h"
#include "xdg-app-portal-error.h"
#include <gio/gio.h>
G_DEFINE_QUARK (xdg-app-error-quark, g_io_error)

View File

@ -0,0 +1,43 @@
/* xdg-app-error.c
*
* Copyright (C) 2015 Red Hat, Inc
*
* This file 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 file 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 program. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alexander Larsson <alexl@redhat.com>
*/
#ifndef XDG_APP_ERROR_H
#define XDG_APP_ERROR_H
#include <glib.h>
G_BEGIN_DECLS
/**
* XdpErrorEnum:
*/
typedef enum {
XDG_APP_ERROR_ALREADY_INSTALLED,
XDG_APP_ERROR_NOT_INSTALLED,
} XdgAppError;
#define XDG_APP_ERROR xdg_app_error_quark()
GQuark xdg_app_error_quark (void);
G_END_DECLS
#endif /* XDG_APP_ERROR_H */

View File

@ -27,6 +27,7 @@
#include <xdg-app-version-macros.h>
#include <xdg-app-enum-types.h>
#include <xdg-app-error.h>
#include <xdg-app-ref.h>
#include <xdg-app-installed-ref.h>
#include <xdg-app-remote-ref.h>