aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-rw-r--r--src/ephy-window.c37
-rw-r--r--src/window-commands.c15
-rw-r--r--src/window-commands.h3
3 files changed, 55 insertions, 0 deletions
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"), "<shift><control>T",
N_("Show or hide toolbar"),
@@ -1368,6 +1375,22 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
}
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);
diff --git a/src/window-commands.c b/src/window-commands.c
index 4139b6932..38724702f 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -22,6 +22,8 @@
#include "config.h"
#endif
+#include "ephy-embed-shell.h"
+#include "ephy-embed-single.h"
#include "ephy-shell.h"
#include "ephy-embed-factory.h"
#include "ephy-embed-persist.h"
@@ -430,6 +432,19 @@ window_cmd_file_save_as (GtkAction *action,
g_object_unref (G_OBJECT(persist));
}
+
+void
+window_cmd_file_work_offline (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedSingle *single;
+ gboolean offline;
+
+ single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell));
+ offline = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ ephy_embed_single_set_offline_mode (single, offline);
+}
+
void
window_cmd_file_close_window (GtkAction *action,
EphyWindow *window)
diff --git a/src/window-commands.h b/src/window-commands.h
index 59238d257..6284108c8 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -85,6 +85,9 @@ void window_cmd_file_print (GtkAction *action,
void window_cmd_file_send_to (GtkAction *action,
EphyWindow *window);
+void window_cmd_file_work_offline (GtkAction *action,
+ EphyWindow *window);
+
void window_cmd_file_close_window (GtkAction *action,
EphyWindow *window);