diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-06-27 02:28:44 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-06-27 02:28:44 +0800 |
commit | e497b299846293f001ad98f2b7dca3e68db2bf26 (patch) | |
tree | 967f73acbdd043c9f935d8e86093d7c35718b2bf /embed/mozilla/mozilla-embed-single.cpp | |
parent | 4119e2dbc0194ff0bc2d7c903b10cd35180b32b0 (diff) | |
download | gsoc2013-epiphany-e497b299846293f001ad98f2b7dca3e68db2bf26.tar.gz 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/mozilla-embed-single.cpp')
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 62efe62de..33f14737e 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -414,11 +414,17 @@ mozilla_init_chrome (void) static void mozilla_init_observer (MozillaEmbedSingle *single) { - single->priv->mSingleObserver = new EphySingle (); + EphySingle *observer; - if (single->priv->mSingleObserver) + observer = new EphySingle (); + + if (observer) { - single->priv->mSingleObserver->Init (EPHY_EMBED_SINGLE (single)); + nsresult rv; + rv = observer->Init (EPHY_EMBED_SINGLE (single)); + if (NS_FAILED (rv)) return; + + NS_ADDREF (single->priv->mSingleObserver = observer); } } @@ -492,6 +498,19 @@ mozilla_embed_single_init (MozillaEmbedSingle *mes) } static void +mozilla_embed_single_dispose (GObject *object) +{ + MozillaEmbedSingle *single = MOZILLA_EMBED_SINGLE (object); + + if (single->priv->mSingleObserver) + { + single->priv->mSingleObserver->Detach (); + NS_RELEASE (single->priv->mSingleObserver); + single->priv->mSingleObserver = nsnull; + } +} + +static void mozilla_embed_single_finalize (GObject *object) { MozillaEmbedSingle *mes = MOZILLA_EMBED_SINGLE (object); @@ -542,6 +561,20 @@ impl_set_offline_mode (EphyEmbedSingle *shell, io->SetOffline(offline); } +static gboolean +impl_get_offline_mode (EphyEmbedSingle *shell) +{ + nsCOMPtr<nsIIOService> io = do_GetService(NS_IOSERVICE_CONTRACTID); + if (!io) return FALSE; /* no way to check the state, assume offline */ + + PRBool isOffline; + nsresult rv; + rv = io->GetOffline(&isOffline); + NS_ENSURE_SUCCESS (rv, FALSE); + + return isOffline; +} + static void impl_load_proxy_autoconf (EphyEmbedSingle *shell, const char* url) @@ -868,6 +901,7 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass) parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + object_class->dispose = mozilla_embed_single_dispose; object_class->finalize = mozilla_embed_single_finalize; g_type_class_add_private (object_class, sizeof (MozillaEmbedSinglePrivate)); @@ -879,6 +913,7 @@ ephy_embed_single_iface_init (EphyEmbedSingleIface *iface) iface->clear_cache = impl_clear_cache; iface->clear_auth_cache = impl_clear_auth_cache; iface->set_offline_mode = impl_set_offline_mode; + iface->get_offline_mode = impl_get_offline_mode; iface->load_proxy_autoconf = impl_load_proxy_autoconf; iface->get_font_list = impl_get_font_list; iface->open_window = impl_open_window; |