NetworkManager/0002-bluez-split-out-errors...

172 lines
6.2 KiB
Diff

From 616d032c62f0d02be7ec29ff012c45c284f397a8 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 16 Jun 2014 11:04:06 -0500
Subject: [PATCH 2/4] bluez: split out errors
We'll use them from more places than nm nm-bt-device.c in the future.
(cherry picked from commit 5254ac456ecd2f5ef76b0a1937f52b75e319f204)
---
src/devices/bluetooth/Makefile.am | 4 +++-
src/devices/bluetooth/nm-bt-error.c | 33 +++++++++++++++++++++++++++++++++
src/devices/bluetooth/nm-bt-error.h | 35 +++++++++++++++++++++++++++++++++++
src/devices/bluetooth/nm-device-bt.c | 13 ++-----------
src/devices/bluetooth/nm-device-bt.h | 6 ------
5 files changed, 73 insertions(+), 18 deletions(-)
create mode 100644 src/devices/bluetooth/nm-bt-error.c
create mode 100644 src/devices/bluetooth/nm-bt-error.h
diff --git a/src/devices/bluetooth/Makefile.am b/src/devices/bluetooth/Makefile.am
index 639a1ad..4342d4b 100644
--- a/src/devices/bluetooth/Makefile.am
+++ b/src/devices/bluetooth/Makefile.am
@@ -24,7 +24,7 @@ AM_CPPFLAGS = \
GLIB_GENERATED = nm-bt-enum-types.h nm-bt-enum-types.c
GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
-nm_bt_enum_types_sources = $(srcdir)/nm-device-bt.h
+nm_bt_enum_types_sources = $(srcdir)/nm-bt-error.h
nm-device-bt-glue.h: $(top_srcdir)/introspection/nm-device-bt.xml
dbus-binding-tool --prefix=nm_device_bt --mode=glib-server --output=$@ $<
@@ -47,6 +47,8 @@ libnm_device_plugin_bluetooth_la_SOURCES = \
nm-bluez4-manager.h \
nm-bluez5-manager.c \
nm-bluez5-manager.h \
+ nm-bt-error.h \
+ nm-bt-error.c \
\
nm-device-bt.c \
nm-device-bt.h \
diff --git a/src/devices/bluetooth/nm-bt-error.c b/src/devices/bluetooth/nm-bt-error.c
new file mode 100644
index 0000000..d014a10
--- /dev/null
+++ b/src/devices/bluetooth/nm-bt-error.c
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2014 Red Hat, Inc.
+ */
+
+#include <glib.h>
+#include "nm-bt-error.h"
+
+GQuark
+nm_bt_error_quark (void)
+{
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string ("nm-bt-error");
+ return quark;
+}
+
+
diff --git a/src/devices/bluetooth/nm-bt-error.h b/src/devices/bluetooth/nm-bt-error.h
new file mode 100644
index 0000000..fa3a957
--- /dev/null
+++ b/src/devices/bluetooth/nm-bt-error.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2014 Red Hat, Inc.
+ */
+
+#ifndef _NM_BLUEZ5_ERROR_H_
+#define _NM_BLUEZ5_ERROR_H_
+
+typedef enum {
+ NM_BT_ERROR_CONNECTION_NOT_BT = 0, /*< nick=ConnectionNotBt >*/
+ NM_BT_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/
+ NM_BT_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/
+ NM_BT_ERROR_DUN_CONNECT_FAILED, /*< nick=DunConnectFailed >*/
+} NMBtError;
+
+#define NM_BT_ERROR (nm_bt_error_quark ())
+GQuark nm_bt_error_quark (void);
+
+#endif /* _NM_BT_ERROR_H_ */
+
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 6e1a399..ca3deb2 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -46,6 +46,8 @@
#include "NetworkManagerUtils.h"
#include "nm-bt-enum-types.h"
#include "nm-utils.h"
+#include "nm-bt-error.h"
+#include "nm-bt-enum-types.h"
#define MM_OLD_DBUS_SERVICE "org.freedesktop.ModemManager"
#define MM_NEW_DBUS_SERVICE "org.freedesktop.ModemManager1"
@@ -94,17 +96,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-#define NM_BT_ERROR (nm_bt_error_quark ())
-
-static GQuark
-nm_bt_error_quark (void)
-{
- static GQuark quark = 0;
- if (!quark)
- quark = g_quark_from_static_string ("nm-bt-error");
- return quark;
-}
-
guint32 nm_device_bt_get_capabilities (NMDeviceBt *self)
{
g_return_val_if_fail (NM_IS_DEVICE_BT (self), NM_BT_CAPABILITY_NONE);
diff --git a/src/devices/bluetooth/nm-device-bt.h b/src/devices/bluetooth/nm-device-bt.h
index 83732bc..ac5b115 100644
--- a/src/devices/bluetooth/nm-device-bt.h
+++ b/src/devices/bluetooth/nm-device-bt.h
@@ -34,12 +34,6 @@ G_BEGIN_DECLS
#define NM_IS_DEVICE_BT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BT))
#define NM_DEVICE_BT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BT, NMDeviceBtClass))
-typedef enum {
- NM_BT_ERROR_CONNECTION_NOT_BT = 0, /*< nick=ConnectionNotBt >*/
- NM_BT_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/
- NM_BT_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/
-} NMBtError;
-
#define NM_DEVICE_BT_NAME "name"
#define NM_DEVICE_BT_CAPABILITIES "bt-capabilities"
#define NM_DEVICE_BT_DEVICE "bt-device"
--
1.9.3