From e497b299846293f001ad98f2b7dca3e68db2bf26 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 26 Jun 2004 18:28:44 +0000 Subject: Implement File->Work Off-Line command and backend. No DBUS/HAL/whatever 2004-06-26 Christian Persch * 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. --- src/ephy-window.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index 0482af01a..f003a1961 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -33,6 +33,8 @@ #include "window-commands.h" #include "find-dialog.h" #include "print-dialog.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-single.h" #include "ephy-shell.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" @@ -243,6 +245,11 @@ static guint ephy_menu_n_entries = G_N_ELEMENTS (ephy_menu_entries); static GtkToggleActionEntry ephy_menu_toggle_entries [] = { + /* File Menu */ + { "FileWorkOffline", NULL, N_("_Work Off-Line"), NULL, + N_("Toggle network status"), + G_CALLBACK (window_cmd_file_work_offline), FALSE }, + /* View Menu */ { "ViewToolbar", NULL, N_("_Toolbar"), "T", N_("Show or hide toolbar"), @@ -1367,6 +1374,22 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) g_object_set (action, "sensitive", can_zoom_normal, NULL); } +static void +network_status_changed (EphyEmbedSingle *single, + gboolean offline, + EphyWindow *window) +{ + GtkAction *action; + + action = gtk_action_group_get_action (window->priv->action_group, + "FileWorkOffline"); + g_signal_handlers_block_by_func + (action, G_CALLBACK (window_cmd_file_work_offline), window); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), offline); + g_signal_handlers_unblock_by_func + (action, G_CALLBACK (window_cmd_file_work_offline), window); +} + static void popup_menu_at_coords (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) @@ -1935,6 +1958,7 @@ static void ephy_window_init (EphyWindow *window) { EphyExtension *manager; + EphyEmbedSingle *single; LOG ("EphyWindow initialising %p", window) @@ -2057,6 +2081,14 @@ ephy_window_init (EphyWindow *window) (CONF_BROWSE_WITH_CARET, (GConfClientNotifyFunc)browse_with_caret_notifier, window); + /* network status */ + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); + network_status_changed (single, + ephy_embed_single_get_offline_mode (single), + window); + g_signal_connect (single, "network-status", + G_CALLBACK (network_status_changed), window); + /* ensure the UI is updated */ gtk_ui_manager_ensure_update (GTK_UI_MANAGER (window->ui_merge)); @@ -2067,6 +2099,11 @@ static void ephy_window_finalize (GObject *object) { EphyWindow *window = EPHY_WINDOW (object); + GObject *single; + + single = ephy_embed_shell_get_embed_single (embed_shell); + g_signal_handlers_disconnect_by_func + (single, G_CALLBACK (network_status_changed), window); eel_gconf_notification_remove (window->priv->disable_arbitrary_url_notifier_id); eel_gconf_notification_remove (window->priv->disable_bookmark_editing_notifier_id); -- cgit v1.2.3