aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphySingle.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-06-27 02:28:44 +0800
committerChristian Persch <chpe@src.gnome.org>2004-06-27 02:28:44 +0800
commite497b299846293f001ad98f2b7dca3e68db2bf26 (patch)
tree967f73acbdd043c9f935d8e86093d7c35718b2bf /embed/mozilla/EphySingle.cpp
parent4119e2dbc0194ff0bc2d7c903b10cd35180b32b0 (diff)
downloadgsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar
gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar.gz
gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar.bz2
gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar.lz
gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar.xz
gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar.zst
gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.zip
Implement File->Work Off-Line command and backend. No DBUS/HAL/whatever
2004-06-26 Christian Persch <chpe@cvs.gnome.org> * data/ui/epiphany-ui.xml: * embed/ephy-embed-single.c: (ephy_embed_single_iface_init), (ephy_embed_single_set_offline_mode), (ephy_embed_single_get_offline_mode): * embed/ephy-embed-single.h: * embed/mozilla/EphySingle.cpp: * embed/mozilla/mozilla-embed-single.cpp: * src/ephy-window.c: (network_status_changed), (ephy_window_init), (ephy_window_finalize): * src/window-commands.c: (window_cmd_file_save_as), (window_cmd_file_work_offline): * src/window-commands.h: Implement File->Work Off-Line command and backend. No DBUS/HAL/whatever integration yet.
Diffstat (limited to 'embed/mozilla/EphySingle.cpp')
-rw-r--r--embed/mozilla/EphySingle.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/embed/mozilla/EphySingle.cpp b/embed/mozilla/EphySingle.cpp
index b667c16d1..e059b5344 100644
--- a/embed/mozilla/EphySingle.cpp
+++ b/embed/mozilla/EphySingle.cpp
@@ -37,10 +37,9 @@
NS_IMPL_ISUPPORTS1(EphySingle, nsIObserver)
EphySingle::EphySingle()
+: mOwner(nsnull)
{
- LOG ("EphySingle constructor")
-
- mOwner = nsnull;
+ LOG ("EphySingle ctor")
}
nsresult
@@ -48,14 +47,17 @@ EphySingle::Init (EphyEmbedSingle *aOwner)
{
LOG ("EphySingle::Init")
- mOwner = aOwner;
-
mObserverService = do_GetService ("@mozilla.org/observer-service;1");
NS_ENSURE_TRUE (mObserverService, NS_ERROR_FAILURE);
- mObserverService->AddObserver (this, "cookie-changed", PR_FALSE);
- mObserverService->AddObserver (this, "cookie-rejected", PR_FALSE);
- mObserverService->AddObserver (this, "perm-changed", PR_FALSE);
+ nsresult rv;
+ rv = mObserverService->AddObserver (this, "cookie-changed", PR_TRUE);
+ rv |= mObserverService->AddObserver (this, "cookie-rejected", PR_TRUE);
+ rv |= mObserverService->AddObserver (this, "perm-changed", PR_TRUE);
+ rv |= mObserverService->AddObserver (this, "network:offline-status-changed", PR_TRUE);
+ NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ mOwner = aOwner;
return NS_OK;
}
@@ -63,11 +65,14 @@ EphySingle::Init (EphyEmbedSingle *aOwner)
nsresult
EphySingle::Detach ()
{
+ LOG ("EphySingle::Detach")
+
if (mObserverService)
{
mObserverService->RemoveObserver (this, "cookie-changed");
mObserverService->RemoveObserver (this, "cookie-rejected");
mObserverService->RemoveObserver (this, "perm-changed");
+ mObserverService->RemoveObserver (this, "network:offline-status-changed");
}
return NS_OK;
@@ -75,9 +80,8 @@ EphySingle::Detach ()
EphySingle::~EphySingle()
{
- LOG ("EphySingle destructor")
+ LOG ("EphySingle dtor")
- Detach();
mOwner = nsnull;
}
@@ -202,9 +206,18 @@ NS_IMETHODIMP EphySingle::Observe(nsISupports *aSubject,
rv = NS_ERROR_FAILURE;
}
}
+ else if (strcmp (aTopic, "network:offline-status-changed") == 0)
+ {
+ /* aData is either (PRUnichar[]) "offline" or "online" */
+ gboolean offline;
+
+ offline = (aData[1] == 'f');
+
+ g_signal_emit_by_name (mOwner, "network-status", offline);
+ }
else
{
- g_warning ("EphySingle observed unknown topic!\n");
+ g_warning ("EphySingle observed unknown topic '%s'!\n", aTopic);
rv = NS_ERROR_FAILURE;
}