Commit 744d022b authored by Carlos Garcia Campos's avatar Carlos Garcia Campos Committed by Carlos Garcia Campos

Add title parameter to ephy_shell_new_tab_full to create tabs with an initial title

And use it from ephy-session so that when loading the session and not
using delayed requests, you don't see all the tabs initially with "Blank
Page" title.

https://bugzilla.gnome.org/show_bug.cgi?id=725649
parent 0d89197c
......@@ -440,6 +440,9 @@ ephy_embed_set_property (GObject *object,
case PROP_WEB_VIEW:
embed->priv->web_view = g_value_get_object (value);
break;
case PROP_TITLE:
ephy_embed_set_title (embed, g_value_dup_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -504,8 +507,9 @@ ephy_embed_class_init (EphyEmbedClass *klass)
g_param_spec_string ("title",
"Title",
"The embed's title",
EMPTY_PAGE_TITLE,
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(EphyEmbedPrivate));
}
......
......@@ -391,6 +391,7 @@ session_maybe_open_window (EphySession *session,
EphyEmbed *embed;
embed = ephy_shell_new_tab_full (shell,
NULL /* title */,
NULL /* related view */,
window, NULL /* tab */,
0,
......@@ -910,9 +911,11 @@ confirm_before_recover (EphyWindow *window, const char *url, const char *title)
{
EphyEmbed *embed;
embed = ephy_shell_new_tab (ephy_shell_get_default (),
window, NULL,
EPHY_NEW_TAB_APPEND_LAST);
embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
title, NULL,
window, NULL,
EPHY_NEW_TAB_APPEND_LAST,
0);
ephy_web_view_load_error_page (ephy_embed_get_web_view (embed), url,
EPHY_WEB_VIEW_ERROR_PAGE_CRASH, NULL);
......@@ -1061,8 +1064,10 @@ session_parse_embed (SessionParserContext *context,
flags = EPHY_NEW_TAB_APPEND_LAST;
embed = ephy_shell_new_tab (ephy_shell_get_default (),
context->window, NULL, flags);
embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
title, NULL,
context->window, NULL, flags,
0);
web_view = ephy_embed_get_web_view (embed);
if (delay_loading)
......
......@@ -657,6 +657,7 @@ ephy_shell_get_default (void)
**/
EphyEmbed *
ephy_shell_new_tab_full (EphyShell *shell,
const char *title,
WebKitWebView *related_view,
EphyWindow *window,
EphyEmbed *previous_embed,
......@@ -698,7 +699,10 @@ ephy_shell_new_tab_full (EphyShell *shell,
else
web_view = ephy_web_view_new ();
embed = EPHY_EMBED (g_object_new (EPHY_TYPE_EMBED, "web-view", web_view, NULL));
embed = EPHY_EMBED (g_object_new (EPHY_TYPE_EMBED,
"web-view", web_view,
"title", title,
NULL));
gtk_widget_show (GTK_WIDGET (embed));
ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to);
......@@ -729,7 +733,7 @@ ephy_shell_new_tab (EphyShell *shell,
EphyEmbed *previous_embed,
EphyNewTabFlags flags)
{
return ephy_shell_new_tab_full (shell, NULL, parent_window,
return ephy_shell_new_tab_full (shell, NULL, NULL, parent_window,
previous_embed, flags,
0);
}
......@@ -1044,7 +1048,7 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
if (!reusing_empty_tab) {
embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
NULL,
NULL, NULL,
data->window,
data->previous_embed,
data->flags | page_flags,
......
......@@ -115,6 +115,7 @@ EphyEmbed *ephy_shell_new_tab (EphyShell *shell,
EphyNewTabFlags flags);
EphyEmbed *ephy_shell_new_tab_full (EphyShell *shell,
const char *title,
WebKitWebView *related_view,
EphyWindow *parent_window,
EphyEmbed *previous_embed,
......
......@@ -2040,6 +2040,7 @@ create_web_view_cb (WebKitWebView *web_view,
}
embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
NULL,
web_view,
target_window,
EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
......@@ -2209,7 +2210,7 @@ decide_policy_cb (WebKitWebView *web_view,
(EPHY_EMBED_CONTAINER (window));
new_embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
NULL,
NULL, NULL,
target_window,
embed,
flags,
......
......@@ -57,6 +57,7 @@ test_ephy_shell_basic_embeds (void)
/* Embed should be created. */
embed1 = ephy_shell_new_tab_full
(ephy_shell,
NULL, /* title */
NULL, /* related view */
window,
NULL, /* embed */
......@@ -73,6 +74,7 @@ test_ephy_shell_basic_embeds (void)
/* Another embed should be created */
embed2 = ephy_shell_new_tab_full
(ephy_shell,
NULL, /* title */
NULL, /* related view */
window, /* window */
NULL, /* embed */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment