After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703648 - Only 1 tab/window setting
Only 1 tab/window setting
Status: RESOLVED OBSOLETE
Product: epiphany
Classification: Core
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks: 702432
 
 
Reported: 2013-07-05 12:13 UTC by Manuel Rego Casasnovas
Modified: 2018-08-03 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Introduced support for only 1 tab/window behaviour (6.68 KB, patch)
2013-07-30 23:03 UTC, Lorenzo Tilve
needs-work Details | Review
Introduced support for only 1 tab/window behaviour (8.35 KB, patch)
2013-08-01 16:17 UTC, Lorenzo Tilve
committed Details | Review
Introduced support for only 1 tab/window behaviour (6.75 KB, patch)
2014-02-03 01:18 UTC, Lorenzo Tilve
needs-work Details | Review

Description Manuel Rego Casasnovas 2013-07-05 12:13:55 UTC
In some use cases of kiosk mode, the users will only have 1 tab/window full-screen. Everything will be opened in the same view.

For these situations we should add a new setting as part of the lockdown settings that allow to set this behavior.
Comment 1 Lorenzo Tilve 2013-07-30 23:03:50 UTC
Created attachment 250509 [details] [review]
Introduced support for only 1 tab/window behaviour
Comment 2 Manuel Rego Casasnovas 2013-07-31 08:53:58 UTC
Review of attachment 250509 [details] [review]:

LGTM, but we also need to disable new window commands like (Ctrl+N).

You can do it with the following code:

diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 548f117..f7994ac 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -95,6 +95,9 @@ typedef struct {
 } BindAction;
 
 static const BindAction window_actions[] = {
+  { EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS, "FileNewWindow", "sensitive" },
+  { EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS, "FileNewWindowIncognito", "sensitive" },
+
   { EPHY_PREFS_LOCKDOWN_PRINTING, "FilePrint", "sensitive" },
 
   { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "FileBookmarkPage", "sensitive" },
@@ -199,6 +202,7 @@ window_added_cb (GtkApplication *application,
   GtkUIManager *manager;
   GtkActionGroup *action_group;
   GtkAction *action;
+  GAction *gaction;
   GSettings *settings;
   EphyLocationController *location_controller;
 
@@ -225,6 +229,22 @@ window_added_cb (GtkApplication *application,
                              action_group, window_actions,
                              G_N_ELEMENTS (window_actions));
 
+  gaction = g_action_map_lookup_action (G_ACTION_MAP (application),
+                                        "new");
+  g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+                   EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS,
+                   gaction, "enabled",
+                   G_SETTINGS_BIND_GET |
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+
+  gaction = g_action_map_lookup_action (G_ACTION_MAP (application),
+                                        "new-incognito");
+  g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+                   EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS,
+                   gaction, "enabled",
+                   G_SETTINGS_BIND_GET |
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+
   action_group = find_action_group (manager, "PopupsActions");
   bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
                              action_group, popup_actions,

Please review it and merge it with your patch.
Comment 3 Lorenzo Tilve 2013-08-01 16:17:50 UTC
Created attachment 250641 [details] [review]
Introduced support for only 1 tab/window behaviour

Applied comments suggested.

However, the changes suggested to disable the CTRL+N functionality have been finally applied at ephy-shell.c, as they will need to be removed too for the application mode, as it's already reported at https://bugzilla.gnome.org/show_bug.cgi?id=703929.
Comment 4 Manuel Rego Casasnovas 2013-08-28 07:03:46 UTC
Review of attachment 250641 [details] [review]:

Thanks for the new patch I've just applied it to kiosk-mode branch.

We should provide a new patch rebased against master too.
Comment 5 Lorenzo Tilve 2014-02-03 01:18:25 UTC
Created attachment 267902 [details] [review]
Introduced support for only 1 tab/window behaviour

I have updated the patch to make it work with the last master version.
Comment 6 Michael Catanzaro 2015-09-11 03:36:30 UTC
Review of attachment 267902 [details] [review]:

This will need to be rebased, since it's been so long. :(

::: src/ephy-window.c
@@ +2208,3 @@
+		if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS)) {
+			return TRUE;
+		};

Omit the braces around a single-line conditional statement. And certainly omit the semicolon. :)

::: src/window-commands.c
@@ +975,1 @@
 window_cmd_file_new_window (GtkAction *action,

Hm, I am not sure it makes sense to modify the implementation of these commands to make them fail. Wouldn't it be better to check the value of these settings before triggering the commands, to prevent them from ever being run in the first place? On the one hand, it's generally better to do such checks at the lowest possible level to prevent future code from forgetting to add checks in all the right places, but in this case I think it semantically makes more sense that the actions do the actions, and checks occur up higher.

I don't mind too much either way, but please consider this.

@@ +976,3 @@
 			    EphyWindow *window)
 {
+	if ( !g_settings_get_boolean(EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS) ) {

No extra spaces after the opening parenthesis and before the closing parenthesis, please. And don't forget the space before the opening parenthesis in the function call:

if (!g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS)) {

@@ +980,3 @@
+				NULL, NULL, NULL,
+				EPHY_NEW_TAB_IN_NEW_WINDOW |
+				EPHY_NEW_TAB_HOME_PAGE);

These lines should be re-indented.

@@ +988,3 @@
 				      EphyWindow *window)
 {
+	if ( !g_settings_get_boolean(EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS) ) {

if (!g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_MULTIPLE_TABS)) {
Comment 7 GNOME Infrastructure Team 2018-08-03 19:58:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/epiphany/issues/200.