[epiphany] Don't go to EphyEmbedSingle just to get the network status
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Don't go to EphyEmbedSingle just to get the network status
- Date: Wed, 14 Mar 2012 13:45:37 +0000 (UTC)
commit 990372e738219a8effebe2eb41e5ffe26b931fa7
Author: Xan Lopez <xan igalia com>
Date: Wed Mar 14 14:37:22 2012 +0100
Don't go to EphyEmbedSingle just to get the network status
The new GNetworkMonitor class is really a good enough abstraction,
don't overdo it.
src/ephy-shell.c | 29 +----------------------------
src/ephy-window.c | 3 ++-
2 files changed, 3 insertions(+), 29 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index a6648a3..6964cef 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -550,21 +550,6 @@ ephy_shell_new_window_cb (EphyEmbedSingle *single,
NULL, NULL, flags, chromemask, is_popup, 0);
}
-static void
-ephy_shell_sync_network_status (GNetworkMonitor *monitor,
- gboolean available,
- EphyShell *shell)
-{
- EphyShellPrivate *priv = shell->priv;
- EphyEmbedSingle *single;
-
- if (!priv->embed_single_connected) return;
-
- single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (shell)));
-
- ephy_embed_single_set_network_status (single, available);
-}
-
static GObject*
impl_get_embed_single (EphyEmbedShell *embed_shell)
{
@@ -581,13 +566,6 @@ impl_get_embed_single (EphyEmbedShell *embed_shell)
shell, G_CONNECT_AFTER);
priv->embed_single_connected = TRUE;
-
- /* Now we need the net monitor */
- if (ephy_shell_get_net_monitor (shell)) {
- ephy_shell_sync_network_status (priv->network_monitor,
- g_network_monitor_get_network_available (priv->network_monitor),
- shell);
- }
}
return embed_single;
@@ -666,8 +644,6 @@ ephy_shell_dispose (GObject *object)
if (priv->network_monitor != NULL) {
LOG ("Unref net monitor ");
- g_signal_handlers_disconnect_by_func
- (priv->network_monitor, G_CALLBACK (ephy_shell_sync_network_status), shell);
g_object_unref (priv->network_monitor);
priv->network_monitor = NULL;
}
@@ -972,11 +948,8 @@ ephy_shell_get_net_monitor (EphyShell *shell)
{
EphyShellPrivate *priv = shell->priv;
- if (priv->network_monitor == NULL) {
+ 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->network_monitor);
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 90d4b95..0636d55 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1647,7 +1647,8 @@ sync_network_status (EphyEmbedSingle *single,
GtkAction *action;
gboolean is_online;
- is_online = ephy_embed_single_get_network_status (single);
+ GNetworkMonitor *monitor = G_NETWORK_MONITOR (ephy_shell_get_net_monitor (ephy_shell));
+ is_online = g_network_monitor_get_network_available (monitor);
action = gtk_action_group_get_action (priv->action_group,
"FileWorkOffline");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]