From a43be88202d423307d4612e444e984cea45f6d99 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 19 Jul 2004 08:27:06 +0000 Subject: Add disable_quit, disable_new_window, first_window_fullscreen lockdown 2004-07-19 Marco Pesenti Gritti * lib/ephy-prefs.h: * src/ephy-shell.c: (ephy_shell_new_tab): * src/ephy-window.c: (ephy_window_fullscreen), (ephy_window_unfullscreen), (update_actions_sensitivity), (tab_detached_cb), (tab_delete_cb), (ephy_window_init): * src/window-commands.c: (window_cmd_file_new_window), (window_cmd_file_close_window): Add disable_quit, disable_new_window, first_window_fullscreen lockdown options. --- ChangeLog | 13 +++++++++++++ lib/ephy-prefs.h | 2 ++ src/ephy-shell.c | 2 ++ src/ephy-window.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- src/window-commands.c | 8 +++++++- 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index dfb36cb29..fd0bc759f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-07-19 Marco Pesenti Gritti + + * lib/ephy-prefs.h: + * src/ephy-shell.c: (ephy_shell_new_tab): + * src/ephy-window.c: (ephy_window_fullscreen), + (ephy_window_unfullscreen), (update_actions_sensitivity), + (tab_detached_cb), (tab_delete_cb), (ephy_window_init): + * src/window-commands.c: (window_cmd_file_new_window), + (window_cmd_file_close_window): + + Add disable_quit, disable_new_window, first_window_fullscreen + lockdown options. + 2004-07-17 Christian Persch * embed/print-dialog.c: (ephy_print_dialog_browse_button_cb): diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index 0b0374da1..905459faa 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -44,6 +44,7 @@ G_BEGIN_DECLS #define CONF_STATE_UPLOAD_DIR "/apps/epiphany/directories/upload" /* Lockdown */ +#define CONF_LOCKDOWN_FULLSCREEN "/apps/epiphany/lockdown/fullscreen" #define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url" #define CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING "/apps/epiphany/lockdown/disable_bookmark_editing" #define CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING "/apps/epiphany/lockdown/disable_toolbar_editing" @@ -53,6 +54,7 @@ G_BEGIN_DECLS #define CONF_LOCKDOWN_DISABLE_PRINTING "/desktop/gnome/lockdown/disable_printing" #define CONF_LOCKDOWN_DISABLE_PRINT_SETUP "/desktop/gnome/lockdown/disable_print_setup" #define CONF_LOCKDOWN_DISABLE_COMMAND_LINE "/desktop/gnome/lockdown/disable_command_line" +#define CONF_LOCKDOWN_DISABLE_QUIT "/apps/epiphany/lockdown/disable_quit" /* System prefs */ #define CONF_DESKTOP_FTP_HANDLER "/desktop/gnome/url-handlers/ftp/command" diff --git a/src/ephy-shell.c b/src/ephy-shell.c index ff2a36917..1d709d9eb 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -555,6 +555,8 @@ ephy_shell_new_tab (EphyShell *shell, if (flags & EPHY_NEW_TAB_IN_NEW_WINDOW) in_new_window = TRUE; if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE; + in_new_window = in_new_window && !eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN); + jump_to = (flags & EPHY_NEW_TAB_JUMP); if (!in_new_window && parent_window != NULL) diff --git a/src/ephy-window.c b/src/ephy-window.c index 01eafb2a8..b74bb4d8f 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -536,6 +536,14 @@ ephy_window_fullscreen (EphyWindow *window) window->priv->mode = EPHY_WINDOW_MODE_FULLSCREEN; + sync_chromes_visibility (window); + + if (eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN)) + { + /* no need to show "exit fullscreen" button */ + return; + } + popup = gtk_window_new (GTK_WINDOW_POPUP); window->priv->exit_fullscreen_popup = popup; @@ -570,8 +578,6 @@ ephy_window_fullscreen (EphyWindow *window) (EGG_EDITABLE_TOOLBAR (window->priv->toolbar), EGG_TOOLBARS_MODEL ( ephy_shell_get_toolbars_model (ephy_shell, TRUE))); - - sync_chromes_visibility (window); } static void @@ -579,12 +585,15 @@ ephy_window_unfullscreen (EphyWindow *window) { window->priv->mode = EPHY_WINDOW_MODE_NORMAL; - g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_screen_get_default ()), - G_CALLBACK (size_changed_cb), - window); + if (window->priv->exit_fullscreen_popup != NULL) + { + g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_screen_get_default ()), + G_CALLBACK (size_changed_cb), + window); - gtk_widget_destroy (window->priv->exit_fullscreen_popup); - window->priv->exit_fullscreen_popup = NULL; + gtk_widget_destroy (window->priv->exit_fullscreen_popup); + window->priv->exit_fullscreen_popup = NULL; + } egg_editable_toolbar_set_model (EGG_EDITABLE_TOOLBAR (window->priv->toolbar), @@ -992,7 +1001,7 @@ update_actions_sensitivity (EphyWindow *window) GtkActionGroup *popups_action_group = GTK_ACTION_GROUP (window->priv->popups_action_group); GtkAction *action; gboolean bookmarks_editable, save_to_disk; - gboolean printing, print_setup; + gboolean printing, print_setup, fullscreen; action = gtk_action_group_get_action (action_group, "ViewToolbar"); g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS), NULL); @@ -1044,6 +1053,14 @@ update_actions_sensitivity (EphyWindow *window) action = gtk_action_group_get_action (action_group, "EditToolbar"); g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING), NULL); + + fullscreen = eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN); + action = gtk_action_group_get_action (action_group, "FileNewWindow"); + g_object_set (action, "sensitive", !fullscreen, NULL); + action = gtk_action_group_get_action (action_group, "ViewFullscreen"); + g_object_set (action, "sensitive", !fullscreen, NULL); + action = gtk_action_group_get_action (action_group, "TabsDetach"); + g_object_set (action, "sensitive", !fullscreen, NULL); } static void @@ -1829,6 +1846,11 @@ tab_detached_cb (EphyNotebook *notebook, g_return_if_fail (EPHY_IS_TAB (tab)); + if (eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN)) + { + return; + } + window = ephy_window_new (); ephy_notebook_move_tab (notebook, EPHY_NOTEBOOK (ephy_window_get_notebook (window)), @@ -1849,7 +1871,12 @@ tab_delete_cb (EphyNotebook *notebook, { g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE); - if (ephy_embed_has_modified_forms (ephy_tab_get_embed (tab))) + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_QUIT) && + gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) == 1) + { + return TRUE; + } + else if (ephy_embed_has_modified_forms (ephy_tab_get_embed (tab))) { return !confirm_close_with_modified_forms (window); } @@ -2191,6 +2218,11 @@ ephy_window_init (EphyWindow *window) G_CALLBACK (ephy_window_delete_event_cb), window); + if (eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN)) + { + gtk_window_fullscreen (GTK_WINDOW (window)); + } + /* lockdown pref notifiers */ window->priv->disable_arbitrary_url_notifier_id = eel_gconf_notification_add (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL, diff --git a/src/window-commands.c b/src/window-commands.c index 38724702f..1562d1b7f 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -286,7 +286,7 @@ window_cmd_file_new_window (GtkAction *action, tab = ephy_window_get_active_tab (window); g_return_if_fail (tab != NULL); - ephy_shell_new_tab (ephy_shell, NULL, tab, NULL, + ephy_shell_new_tab (ephy_shell, window, tab, NULL, EPHY_NEW_TAB_NEW_PAGE | EPHY_NEW_TAB_IN_NEW_WINDOW); } @@ -451,6 +451,12 @@ window_cmd_file_close_window (GtkAction *action, { EphyTab *tab; + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_QUIT) && + gtk_notebook_get_n_pages (GTK_NOTEBOOK (ephy_window_get_notebook (window))) == 1) + { + return; + } + tab = ephy_window_get_active_tab (window); g_return_if_fail (tab != NULL); -- cgit v1.2.3