From 85939a287cbb2b9c789581ddc6d529dd24d2c870 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 12 Oct 2005 19:45:07 +0000 Subject: Remove the "network-status" signal from the embed single, and make it a 2005-10-12 Christian Persch * embed/ephy-embed-single.c: (ephy_embed_single_iface_init), (ephy_embed_single_set_network_status), (ephy_embed_single_get_network_status): * embed/ephy-embed-single.h: * embed/mozilla/EphySingle.cpp: * embed/mozilla/EphySingle.h: * embed/mozilla/mozilla-embed-single.cpp: * src/ephy-window.c: (sync_tab_icon), (sync_network_status), (ephy_window_dispose), (ephy_window_init): * src/epiphany.defs: * src/window-commands.c: (window_cmd_file_work_offline): Remove the "network-status" signal from the embed single, and make it a property instead. Keep track of the network status in EphySingle, and emit property notification when it changes. --- src/ephy-window.c | 27 ++++++++++++++------------- src/epiphany.defs | 8 ++++---- src/window-commands.c | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ephy-window.c b/src/ephy-window.c index c1d2fa02e..5493b4585 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -152,7 +152,7 @@ static const GtkActionEntry ephy_menu_entries [] = { { "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "P", N_("Print the current page"), G_CALLBACK (window_cmd_file_print) }, - { "FileSendTo", STOCK_SEND_MAIL, N_("S_end To..."), "M", + { "FileSendTo", STOCK_SEND_MAIL, N_("S_end Link by Email..."), "M", N_("Send a link of the current page"), G_CALLBACK (window_cmd_file_send_to) }, { "FileCloseTab", GTK_STOCK_CLOSE, N_("_Close"), "W", @@ -1244,7 +1244,6 @@ sync_tab_icon (EphyTab *tab, icon = ephy_tab_get_icon (tab); - gtk_window_set_icon (GTK_WINDOW (window), icon); ephy_toolbar_set_favicon (priv->toolbar, icon); } @@ -1565,17 +1564,21 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) } static void -network_status_changed (EphyEmbedSingle *single, - gboolean offline, - EphyWindow *window) +sync_network_status (EphyEmbedSingle *single, + GParamSpec *pspec, + EphyWindow *window) { + EphyWindowPrivate *priv = window->priv; GtkAction *action; + gboolean is_online; - action = gtk_action_group_get_action (window->priv->action_group, + is_online = ephy_embed_single_get_network_status (single); + + action = gtk_action_group_get_action (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); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !is_online); g_signal_handlers_unblock_by_func (action, G_CALLBACK (window_cmd_file_work_offline), window); } @@ -2512,7 +2515,7 @@ ephy_window_dispose (GObject *object) single = ephy_embed_shell_get_embed_single (embed_shell); g_signal_handlers_disconnect_by_func - (single, G_CALLBACK (network_status_changed), window); + (single, G_CALLBACK (sync_network_status), window); eel_gconf_notification_remove (priv->browse_with_caret_notifier_id); eel_gconf_notification_remove (priv->allow_popups_notifier_id); @@ -3012,11 +3015,9 @@ ephy_window_init (EphyWindow *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); + sync_network_status (single, NULL, window); + g_signal_connect (single, "notify::network-status", + G_CALLBACK (sync_network_status), window); /* ensure the UI is updated */ gtk_ui_manager_ensure_update (window->priv->manager); diff --git a/src/epiphany.defs b/src/epiphany.defs index 6d556aa7b..6ab363578 100644 --- a/src/epiphany.defs +++ b/src/epiphany.defs @@ -878,18 +878,18 @@ (return-type "none") ) -(define-method set_offline_mode +(define-method set_network_status (of-object "EphyEmbedSingle") - (c-name "ephy_embed_single_set_offline_mode") + (c-name "ephy_embed_single_set_network_status") (return-type "none") (parameters '("gboolean" "offline") ) ) -(define-method get_offline_mode +(define-method get_network_status (of-object "EphyEmbedSingle") - (c-name "ephy_embed_single_get_offline_mode") + (c-name "ephy_embed_single_get_network_status") (return-type "gboolean") ) diff --git a/src/window-commands.c b/src/window-commands.c index 79659dba9..4ec865a86 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -381,7 +381,7 @@ window_cmd_file_work_offline (GtkAction *action, 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); + ephy_embed_single_set_network_status (single, !offline); } void -- cgit v1.2.3