[epiphany] Add option to load the homepage in new tabs



commit 844bf28a8f66f50be97070951b175c308fbfc2cc
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Oct 31 20:55:28 2016 -0500

    Add option to load the homepage in new tabs
    
    This has been requested for a web kiosk environment. It doesn't make
    sense for desktop users, but again, there's almost no maintenance cost,
    so why not.

 data/org.gnome.epiphany.gschema.xml |    5 +++++
 lib/ephy-prefs.h                    |    1 +
 src/window-commands.c               |   12 +++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 5913485..22127eb 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -14,6 +14,11 @@
                        <summary>Home page</summary>
                        <description>Address of the user's home page.</description>
                </key>
+               <key type="b" name="homepage-loads-in-new-tabs">
+                       <default>false</default>
+                       <summary>Whether homepage loads in new tabs</summary>
+                       <description>This key does nothing unless the homepage-url key is set. If 
homepage-url is set, then this key determines whether the homepage should be displayed in newly-created 
tabs.</description>
+               </key>
                <key type="s" name="keyword-search-url">
                        <!-- DuckDuckGo is the default search engine. Must exactly match the URL used
                             in the preferences dialog, except this string is surrounded by single quotes
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 683732b..9aa9bcd 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -87,6 +87,7 @@ typedef enum
 
 #define EPHY_PREFS_SCHEMA                         "org.gnome.Epiphany"
 #define EPHY_PREFS_HOMEPAGE_URL                   "homepage-url"
+#define EPHY_PREFS_HOMEPAGE_LOADS_IN_NEW_TABS     "homepage-loads-in-new-tabs"
 #define EPHY_PREFS_USER_AGENT                     "user-agent"
 #define EPHY_PREFS_NEW_WINDOWS_IN_TABS            "new-windows-in-tabs"
 #define EPHY_PREFS_AUTO_DOWNLOADS                 "automatic-downloads"
diff --git a/src/window-commands.c b/src/window-commands.c
index 4e36279..1bfa746 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -460,11 +460,17 @@ window_cmd_new_tab (GSimpleAction *action,
                     gpointer       user_data)
 {
   EphyWindow *window = user_data;
+  EphyLinkFlags flags = EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO;
+  gboolean load_homepage;
+
+  load_homepage = g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+                                          EPHY_PREFS_HOMEPAGE_LOADS_IN_NEW_TABS);
+  if (load_homepage)
+    flags |= EPHY_LINK_HOME_PAGE;
 
   ephy_link_open (EPHY_LINK (window),
-                  "about:overview",
-                  NULL,
-                  EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO);
+                  "about:overview", /* Ignored when EPHY_LINK_HOME_PAGE is passed */
+                  NULL, flags);
 }
 
 static void


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