[epiphany] Copy&paste a few NM defines/enums we need at compile time



commit 64ff9f8650277fdf849917a01dde4b18e67b046d
Author: Xan Lopez <xlopez igalia com>
Date:   Fri Jun 24 16:12:18 2011 +0200

    Copy&paste a few NM defines/enums we need at compile time
    
    This way we don't need a compile-time dependency on NetworkManager,
    since we use it through the DBus APIs.

 configure.ac                       |    2 -
 lib/Makefile.am                    |    1 +
 lib/ephy-network-manager-defines.h |   57 ++++++++++++++++++++++++++++++++++++
 src/ephy-shell.c                   |    2 +-
 4 files changed, 59 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a875396..f799aa2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,7 +93,6 @@ WEBKIT_GTK_REQUIRED=1.5.1
 LIBSOUP_GNOME_REQUIRED=2.33.1
 GNOME_KEYRING_REQUIRED=2.26.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1
-NETWORK_MANAGER_REQUIRED=0.8.9997
 
 # Tests
 
@@ -122,7 +121,6 @@ PKG_CHECK_MODULES([DEPENDENCIES], [
 		  libsoup-gnome-2.4 >= $LIBSOUP_GNOME_REQUIRED
 		  gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED
 		  gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
-		  NetworkManager >= $NETWORK_MANAGER_REQUIRED
 		  ])
 
 # ****
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a75896b..0f8dd5c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -17,6 +17,7 @@ NOINST_H_FILES = \
 	ephy-module.h				\
 	ephy-node-filter.h			\
 	ephy-node-common.h			\
+	ephy-network-manager-defines.h		\
 	ephy-object-helpers.h			\
 	ephy-prefs.h				\
 	ephy-profile-utils.h			\
diff --git a/lib/ephy-network-manager-defines.h b/lib/ephy-network-manager-defines.h
new file mode 100644
index 0000000..01a4263
--- /dev/null
+++ b/lib/ephy-network-manager-defines.h
@@ -0,0 +1,57 @@
+/*
+ *  Copyright  2011 Igalia S.L.
+ *
+ *  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, 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.
+ *
+ */
+
+#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
+#error "Only <epiphany/epiphany.h> can be included directly."
+#endif
+
+#ifndef EPHY_NETWORK_MANAGER_DEFINES_H
+#define EPHY_NETWORK_MANAGER_DEFINES_H
+
+#define NM_DBUS_SERVICE                     "org.freedesktop.NetworkManager"
+#define NM_DBUS_PATH                        "/org/freedesktop/NetworkManager"
+
+/**
+ * NMState:
+ * @NM_STATE_UNKNOWN: networking state is unknown
+ * @NM_STATE_ASLEEP: networking is not enabled
+ * @NM_STATE_DISCONNECTED: there is no active network connection
+ * @NM_STATE_DISCONNECTING: network connections are being cleaned up
+ * @NM_STATE_CONNECTING: a network connection is being started
+ * @NM_STATE_CONNECTED_LOCAL: there is only local IPv4 and/or IPv6 connectivity
+ * @NM_STATE_CONNECTED_SITE: there is only site-wide IPv4 and/or IPv6 connectivity
+ * @NM_STATE_CONNECTED_GLOBAL: there is global IPv4 and/or IPv6 Internet connectivity
+ *
+ * #NMState values indicate the current overall networking state.
+ */
+typedef enum {
+        NM_STATE_UNKNOWN          = 0,
+        NM_STATE_ASLEEP           = 10,
+        NM_STATE_DISCONNECTED     = 20,
+        NM_STATE_DISCONNECTING    = 30,
+        NM_STATE_CONNECTING       = 40,
+        NM_STATE_CONNECTED_LOCAL  = 50,
+        NM_STATE_CONNECTED_SITE   = 60,
+        NM_STATE_CONNECTED_GLOBAL = 70
+} NMState;
+
+/* For backwards compat */
+#define NM_STATE_CONNECTED NM_STATE_CONNECTED_GLOBAL
+
+#endif
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index edfd870..95e0f86 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -21,7 +21,6 @@
 
 #include "config.h"
 
-#include <NetworkManager.h>
 #include <string.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
@@ -58,6 +57,7 @@
 #include "ephy-stock-icons.h"
 #include "ephy-web-view.h"
 #include "ephy-network-manager.h"
+#include "ephy-network-manager-defines.h"
 
 #define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate))
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]