diff options
author | Xan Lopez <xan@igalia.com> | 2012-03-14 21:37:22 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-03-14 21:37:22 +0800 |
commit | 990372e738219a8effebe2eb41e5ffe26b931fa7 (patch) | |
tree | c6af14dd6d94b15cc26440fc658e66fcb3122c1c | |
parent | 08956cf8cd8040f8500c40b646a52b6f03ae5275 (diff) | |
download | gsoc2013-epiphany-990372e738219a8effebe2eb41e5ffe26b931fa7.tar.gz gsoc2013-epiphany-990372e738219a8effebe2eb41e5ffe26b931fa7.tar.zst gsoc2013-epiphany-990372e738219a8effebe2eb41e5ffe26b931fa7.zip |
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.
-rw-r--r-- | src/ephy-shell.c | 29 | ||||
-rw-r--r-- | 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 a6648a356..6964cefb4 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 90d4b95cb..0636d5504 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"); |