diff options
author | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-12-14 02:22:12 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-12-14 02:22:12 +0800 |
commit | 9b633f92abdd89bedd5b7bb9912bd8e78c68f021 (patch) | |
tree | 1755a1246db381d175773f9c45cf3e5234970596 /src | |
parent | 60820903a87b48f1026786ef6cec0a9a8b39a7b9 (diff) | |
download | gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.tar gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.tar.gz gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.tar.bz2 gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.tar.lz gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.tar.xz gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.tar.zst gsoc2013-epiphany-9b633f92abdd89bedd5b7bb9912bd8e78c68f021.zip |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-tab.c | 33 | ||||
-rw-r--r-- | src/ephy-window.c | 16 | ||||
-rwxr-xr-x | src/statusbar.c | 19 | ||||
-rw-r--r-- | src/statusbar.h | 3 |
4 files changed, 30 insertions, 41 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 7a987c87a..fb4c26393 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -745,11 +745,11 @@ get_host_name_from_uri (const char *uri) return result; } -static char * -build_net_state_message (const char *uri, EmbedState flags) +static void +update_net_state_message (EphyTab *tab, const char *uri, EmbedState flags) { const char *msg = NULL; - char *host, *message = NULL; + char *host; host = get_host_name_from_uri (uri); @@ -779,14 +779,22 @@ build_net_state_message (const char *uri, EmbedState flags) } } - if (msg) + if ((flags & EMBED_STATE_IS_NETWORK) && + (flags & EMBED_STATE_STOP)) + { + g_free (tab->priv->status_message); + tab->priv->status_message = NULL; + g_object_notify (G_OBJECT (tab), "message"); + + } + else if (msg) { - message = g_strdup_printf (msg, host); + g_free (tab->priv->status_message); + tab->priv->status_message = g_strdup_printf (msg, host); + g_object_notify (G_OBJECT (tab), "message"); } g_free (host); - - return message; } static void @@ -833,16 +841,7 @@ static void ephy_tab_net_state_cb (EphyEmbed *embed, const char *uri, EmbedState state, EphyTab *tab) { - char *new_msg; - - new_msg = build_net_state_message (uri, state); - if (tab->priv->status_message) - { - g_free (tab->priv->status_message); - } - tab->priv->status_message = new_msg; - - g_object_notify (G_OBJECT (tab), "message"); + update_net_state_message (tab, uri, state); if (state & EMBED_STATE_IS_NETWORK) { diff --git a/src/ephy-window.c b/src/ephy-window.c index 4bbd59014..f4054ffb3 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -318,6 +318,7 @@ struct EphyWindowPrivate gboolean is_ppview; gboolean has_size; guint num_tabs; + guint tab_message_cid; guint disable_js_chrome_notifier_id; guint show_toolbars_notifier_id; @@ -882,10 +883,19 @@ sync_tab_load_progress (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) static void sync_tab_message (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) { + GtkStatusbar *s = GTK_STATUSBAR (window->priv->statusbar); + const char *message; + if (window->priv->closing) return; - statusbar_set_message (EPHY_STATUSBAR (window->priv->statusbar), - ephy_tab_get_status_message (tab)); + message = ephy_tab_get_status_message (tab); + + gtk_statusbar_pop (s, window->priv->tab_message_cid); + + if (message) + { + gtk_statusbar_push (s, window->priv->tab_message_cid, message); + } } static void @@ -1614,6 +1624,8 @@ ephy_window_init (EphyWindow *window) gtk_box_pack_start (GTK_BOX (window->priv->main_vbox), GTK_WIDGET (window->priv->statusbar), FALSE, TRUE, 0); + window->priv->tab_message_cid = gtk_statusbar_get_context_id + (GTK_STATUSBAR (window->priv->statusbar), "tab_message"); g_object_ref (ephy_shell); diff --git a/src/statusbar.c b/src/statusbar.c index b2f299a16..22054b622 100755 --- a/src/statusbar.c +++ b/src/statusbar.c @@ -193,22 +193,3 @@ statusbar_set_progress (Statusbar *t, tmp); } } - -void -statusbar_set_message (Statusbar *s, - const char *message) -{ - char *tmp1, *tmp2; - - g_return_if_fail (message != NULL); - - tmp1 = ephy_string_strip_chr (message, '\r'); - tmp2 = ephy_string_strip_chr (tmp1, '\n'); - - gtk_statusbar_pop (GTK_STATUSBAR (s), 0); - gtk_statusbar_push (GTK_STATUSBAR (s), 0, tmp2); - - g_free (tmp1); - g_free (tmp2); -} - diff --git a/src/statusbar.h b/src/statusbar.h index ae89e4a34..38f063b6f 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -58,9 +58,6 @@ void statusbar_set_security_state (Statusbar *s, void statusbar_set_progress (Statusbar *s, int progress); -void statusbar_set_message (Statusbar *s, - const gchar *message); - G_END_DECLS #endif |