[epiphany] Set title box subtitle when opening window in app mode



commit 7189fd65c4d595866eb81d0b7292d7e586a279ce
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Sep 17 15:01:04 2016 -0500

    Set title box subtitle when opening window in app mode
    
    Previously, the title showed up too late, which looked odd. Now the
    subtitle shows up after the title, which also looks odd. Let's make sure
    they're both set when the window opens.

 src/ephy-shell.c     |   19 +++++++++++++++++--
 src/ephy-title-box.c |    3 ++-
 2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 7a5ff1e..9cf3ff5 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -29,12 +29,14 @@
 #include "ephy-embed-utils.h"
 #include "ephy-file-helpers.h"
 #include "ephy-gui.h"
+#include "ephy-header-bar.h"
 #include "ephy-history-window.h"
 #include "ephy-lockdown.h"
 #include "ephy-prefs.h"
 #include "ephy-private.h"
 #include "ephy-session.h"
 #include "ephy-settings.h"
+#include "ephy-title-box.h"
 #include "ephy-type-builtins.h"
 #include "ephy-web-view.h"
 #include "ephy-window.h"
@@ -957,10 +959,13 @@ static gboolean
 ephy_shell_open_uris_idle (OpenURIsData *data)
 {
   EphyEmbed *embed = NULL;
+  EphyEmbedShellMode mode;
   EphyNewTabFlags page_flags = 0;
   gboolean reusing_empty_tab = FALSE;
   const char *url;
 
+  mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (data->shell));
+
   if (!data->window)
     data->window = ephy_window_new ();
   else if (data->previous_embed)
@@ -973,7 +978,7 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
   }
 
   if (!reusing_empty_tab) {
-    embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
+    embed = ephy_shell_new_tab_full (data->shell,
                                      NULL, NULL,
                                      data->window,
                                      data->previous_embed,
@@ -989,13 +994,23 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
     if (reusing_empty_tab || data->flags & EPHY_NEW_TAB_JUMP)
       gtk_widget_grab_focus (GTK_WIDGET (embed));
 
-    if (data->flags & EPHY_NEW_TAB_JUMP && ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (data->shell)) != 
EPHY_EMBED_SHELL_MODE_TEST)
+    if (data->flags & EPHY_NEW_TAB_JUMP && mode != EPHY_EMBED_SHELL_MODE_TEST)
       gtk_window_present_with_time (GTK_WINDOW (data->window), data->user_time);
   } else {
     ephy_web_view_load_homepage (ephy_embed_get_web_view (embed));
     ephy_window_activate_location (data->window);
   }
 
+  /* Set the subtitle from the very beginning. Looks odd if it appears later on. */
+  if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION) {
+    EphyHeaderBar *header_bar;
+    EphyTitleBox *title_box;
+
+    header_bar = EPHY_HEADER_BAR (ephy_window_get_header_bar (data->window));
+    title_box = ephy_header_bar_get_title_box (header_bar);
+    ephy_title_box_set_address (title_box, url);
+  }
+
   data->current_uri++;
   data->previous_embed = embed;
 
diff --git a/src/ephy-title-box.c b/src/ephy-title-box.c
index c9268c3..ea7f811 100644
--- a/src/ephy-title-box.c
+++ b/src/ephy-title-box.c
@@ -208,5 +208,6 @@ ephy_title_box_set_address (EphyTitleBox *title_box,
 {
   g_return_if_fail (EPHY_IS_TITLE_BOX (title_box));
 
-  gtk_label_set_text (GTK_LABEL (title_box->subtitle), address);
+  if (address && *address)
+    gtk_label_set_text (GTK_LABEL (title_box->subtitle), address);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]