[epiphany] Add title parameter to ephy_shell_new_tab_full to create tabs with an initial title
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add title parameter to ephy_shell_new_tab_full to create tabs with an initial title
- Date: Mon, 10 Mar 2014 10:17:56 +0000 (UTC)
commit 744d022bb450eb65624538dab231decd99490f6e
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Mar 4 12:43:13 2014 +0100
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
embed/ephy-embed.c | 8 ++++++--
src/ephy-session.c | 15 ++++++++++-----
src/ephy-shell.c | 10 +++++++---
src/ephy-shell.h | 1 +
src/ephy-window.c | 3 ++-
tests/ephy-shell-test.c | 2 ++
6 files changed, 28 insertions(+), 11 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 9e1ba4f..798bbc4 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -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));
}
diff --git a/src/ephy-session.c b/src/ephy-session.c
index c6ee0a4..d932b63 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -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)
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 2cd4506..00f1998 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -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,
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index f11c666..8147509 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -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,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index f11e64e..4c48ace 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -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,
diff --git a/tests/ephy-shell-test.c b/tests/ephy-shell-test.c
index 8e09a6c..45c593e 100644
--- a/tests/ephy-shell-test.c
+++ b/tests/ephy-shell-test.c
@@ -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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]