aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-11-16 00:06:16 +0800
committerXan Lopez <xlopez@igalia.com>2011-11-16 00:06:16 +0800
commit1e8f2bd6fdf325a412343b475d89d7afc0ba394b (patch)
treecbd2c52f1157db317a345d4f9946ea0aa0d39e9b
parent4b9f2d366db4eba0449f032f821d1ecc6345e2c3 (diff)
downloadgsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.tar
gsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.tar.gz
gsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.tar.bz2
gsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.tar.lz
gsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.tar.xz
gsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.tar.zst
gsoc2013-epiphany-1e8f2bd6fdf325a412343b475d89d7afc0ba394b.zip
Use GNetworkMonitor to monitor network status
We can now get rid of the NetworkManager custom code. https://bugzilla.gnome.org/show_bug.cgi?id=664096
-rw-r--r--data/Makefile.am1
-rw-r--r--data/ephy-network-manager.xml9
-rw-r--r--lib/Makefile.am1
-rw-r--r--lib/ephy-network-manager-defines.h54
-rw-r--r--src/Makefile.am15
-rw-r--r--src/ephy-shell.c37
6 files changed, 14 insertions, 103 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 4d9cf6a36..6fcfa8144 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -72,7 +72,6 @@ EXTRA_DIST = \
$(gsettings_files) \
$(convert_DATA) \
epiphany-service.xml \
- ephy-network-manager.xml \
check-mime.py
DISTCLEANFILES = \
diff --git a/data/ephy-network-manager.xml b/data/ephy-network-manager.xml
deleted file mode 100644
index 90fcd7011..000000000
--- a/data/ephy-network-manager.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<node>
- <interface name='org.freedesktop.NetworkManager'>
- <signal name='StateChanged'>
- <arg name='state' type='u' />
- </signal>
- <property name='State' type='u' access='read'/>
- <property name='Version' type='s' access='read'/>
- </interface>
-</node>
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 972eaf048..2a1ec7556 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -17,7 +17,6 @@ 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
deleted file mode 100644
index 31439a5f3..000000000
--- a/lib/ephy-network-manager-defines.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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;
-
-#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index c46160c93..f4914505b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,21 +113,6 @@ libephymain_la_CFLAGS = \
BUILT_SOURCES = \
$(TYPES_SOURCE)
-nodist_libephymain_la_SOURCES += \
- ephy-network-manager.c \
- ephy-network-manager.h
-
-BUILT_SOURCES += \
- ephy-network-manager.h \
- ephy-network-manager.c
-
-ephy-network-manager.c ephy-network-manager.h: $(top_srcdir)/data/ephy-network-manager.xml
- $(AM_V_GEN) $(GDBUS_CODEGEN) \
- --c-namespace Ephy \
- --generate-c-code ephy-network-manager \
- --interface-prefix org.freedesktop. \
- $<
-
if ENABLE_SEED
NOINST_H_FILES += \
ephy-seed-extension.h \
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index c436da139..fe6b04c23 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -37,8 +37,6 @@
#include "ephy-gui.h"
#include "ephy-history-window.h"
#include "ephy-lockdown.h"
-#include "ephy-network-manager-defines.h"
-#include "ephy-network-manager.h"
#include "ephy-prefs.h"
#include "ephy-profile-utils.h"
#include "ephy-session.h"
@@ -63,7 +61,7 @@ struct _EphyShellPrivate {
EggToolbarsModel *toolbars_model;
EggToolbarsModel *fs_toolbars_model;
EphyExtensionsManager *extensions_manager;
- EphyNetworkManager *nm_proxy;
+ GNetworkMonitor *network_monitor;
GtkWidget *bme;
GtkWidget *history_window;
GObject *pdm_dialog;
@@ -436,20 +434,18 @@ ephy_shell_new_window_cb (EphyEmbedSingle *single,
}
static void
-ephy_shell_sync_network_status (EphyNetworkManager *nm_proxy,
- NMState state,
+ephy_shell_sync_network_status (GNetworkMonitor *monitor,
+ gboolean available,
EphyShell *shell)
{
EphyShellPrivate *priv = shell->priv;
EphyEmbedSingle *single;
- gboolean net_status;
if (!priv->embed_single_connected) return;
single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (shell)));
- net_status = state == NM_STATE_CONNECTED_GLOBAL;
- ephy_embed_single_set_network_status (single, net_status);
+ ephy_embed_single_set_network_status (single, available);
}
static GObject*
@@ -471,8 +467,8 @@ impl_get_embed_single (EphyEmbedShell *embed_shell)
/* Now we need the net monitor */
if (ephy_shell_get_net_monitor (shell)) {
- ephy_shell_sync_network_status (priv->nm_proxy,
- ephy_network_manager_get_state (priv->nm_proxy),
+ ephy_shell_sync_network_status (priv->network_monitor,
+ g_network_monitor_get_network_available (priv->network_monitor),
shell);
}
}
@@ -563,12 +559,12 @@ ephy_shell_dispose (GObject *object)
priv->bookmarks = NULL;
}
- if (priv->nm_proxy != NULL) {
+ if (priv->network_monitor != NULL) {
LOG ("Unref net monitor ");
g_signal_handlers_disconnect_by_func
- (priv->nm_proxy, G_CALLBACK (ephy_shell_sync_network_status), shell);
- g_object_unref (priv->nm_proxy);
- priv->nm_proxy = NULL;
+ (priv->network_monitor, G_CALLBACK (ephy_shell_sync_network_status), shell);
+ g_object_unref (priv->network_monitor);
+ priv->network_monitor = NULL;
}
G_OBJECT_CLASS (ephy_shell_parent_class)->dispose (object);
@@ -917,18 +913,13 @@ ephy_shell_get_net_monitor (EphyShell *shell)
{
EphyShellPrivate *priv = shell->priv;
- if (priv->nm_proxy == NULL) {
- priv->nm_proxy = ephy_network_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NULL,
- NULL);
- g_signal_connect (priv->nm_proxy, "state-changed",
+ if (priv->network_monitor == NULL) {
+ priv->network_monitor = g_network_monitor_get_default ();
+ g_signal_connect (priv->network_monitor, "network-changed",
G_CALLBACK (ephy_shell_sync_network_status), shell);
}
- return G_OBJECT (priv->nm_proxy);
+ return G_OBJECT (priv->network_monitor);
}
static void