diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-04-19 17:37:13 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-04-19 17:37:13 +0800 |
commit | 033f0ac34a64aebbfb42878d0243b08c631e8042 (patch) | |
tree | c9e41430b221714311cc1155d97520b86cc49a28 | |
parent | 4811c10fff061605fbb8b99a2b535250530eea9f (diff) | |
download | gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.tar gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.tar.gz gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.tar.bz2 gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.tar.lz gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.tar.xz gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.tar.zst gsoc2013-epiphany-033f0ac34a64aebbfb42878d0243b08c631e8042.zip |
A src/ephy-action-helper.c: A src/ephy-action-helper.h: A
2005-04-19 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-prefs.h:
* src/Makefile.am:
A src/ephy-action-helper.c:
A src/ephy-action-helper.h:
A src/ephy-lockdown.c:
A src/ephy-lockdown.h:
* src/ephy-shell.c: (ephy_shell_finalize),
(ephy_shell_get_lockdown), (ephy_shell_get_extensions_manager):
* src/ephy-tab.c: (ephy_tab_set_location):
* src/ephy-toolbar.c: (ephy_toolbar_set_window),
(ephy_toolbar_set_navigation_actions), (ephy_toolbar_finalize):
* src/ephy-window.c: (sync_tab_document_type),
(sync_tab_navigation), (sync_tab_load_status), (show_embed_popup),
(update_tabs_menu_sensitivity), (ephy_window_set_is_popup),
(ephy_window_dispose), (ephy_window_state_event),
(ephy_window_class_init), (ephy_window_init),
(ephy_window_constructor):
* src/popup-commands.c:
Move lockdown from EphyWindow into an internal extension.
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | lib/ephy-prefs.h | 2 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/ephy-action-helper.c | 55 | ||||
-rw-r--r-- | src/ephy-action-helper.h | 34 | ||||
-rw-r--r-- | src/ephy-lockdown.c | 358 | ||||
-rw-r--r-- | src/ephy-lockdown.h | 58 | ||||
-rw-r--r-- | src/ephy-shell.c | 39 | ||||
-rw-r--r-- | src/ephy-tab.c | 2 | ||||
-rwxr-xr-x | src/ephy-toolbar.c | 64 | ||||
-rw-r--r-- | src/ephy-window.c | 267 | ||||
-rw-r--r-- | src/popup-commands.c | 2 |
12 files changed, 644 insertions, 264 deletions
@@ -1,3 +1,26 @@ +2005-04-19 Christian Persch <chpe@cvs.gnome.org> + + * lib/ephy-prefs.h: + * src/Makefile.am: + A src/ephy-action-helper.c: + A src/ephy-action-helper.h: + A src/ephy-lockdown.c: + A src/ephy-lockdown.h: + * src/ephy-shell.c: (ephy_shell_finalize), + (ephy_shell_get_lockdown), (ephy_shell_get_extensions_manager): + * src/ephy-tab.c: (ephy_tab_set_location): + * src/ephy-toolbar.c: (ephy_toolbar_set_window), + (ephy_toolbar_set_navigation_actions), (ephy_toolbar_finalize): + * src/ephy-window.c: (sync_tab_document_type), + (sync_tab_navigation), (sync_tab_load_status), (show_embed_popup), + (update_tabs_menu_sensitivity), (ephy_window_set_is_popup), + (ephy_window_dispose), (ephy_window_state_event), + (ephy_window_class_init), (ephy_window_init), + (ephy_window_constructor): + * src/popup-commands.c: + + Move lockdown from EphyWindow into an internal extension. + 2005-04-18 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/mozilla-embed-persist.cpp: diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index 53a3ee8d7..cba9bb996 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -61,6 +61,8 @@ G_BEGIN_DECLS /* System prefs */ #define CONF_DESKTOP_FTP_HANDLER "/desktop/gnome/url-handlers/ftp/command" #define CONF_DESKTOP_TOOLBAR_STYLE "/desktop/gnome/interface/toolbar_style" +#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename" +#define CONF_DESKTOP_BG_TYPE "/desktop/gnome/background/picture_options" G_END_DECLS diff --git a/src/Makefile.am b/src/Makefile.am index 19be85917..d3e362758 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,6 +26,7 @@ header_DATA = \ $(INST_H_FILES) NOINST_H_FILES = \ + ephy-action-helper.h \ ephy-automation.h \ ephy-encoding-dialog.h \ ephy-encoding-menu.h \ @@ -34,6 +35,7 @@ NOINST_H_FILES = \ ephy-history-window.h \ ephy-home-action.h \ ephy-link-action.h \ + ephy-lockdown.h \ ephy-location-action.h \ ephy-navigation-action.h \ ephy-tabs-menu.h \ @@ -59,6 +61,7 @@ INST_H_FILES = \ libephymain_la_SOURCES = \ $(BUILT_SOURCES) \ + ephy-action-helper.c \ ephy-automation.c \ ephy-completion-model.c \ ephy-completion-model.h \ @@ -73,6 +76,7 @@ libephymain_la_SOURCES = \ ephy-link.c \ ephy-link-action.c \ ephy-location-action.c \ + ephy-lockdown.c \ ephy-navigation-action.c \ ephy-notebook.c \ ephy-session.c \ diff --git a/src/ephy-action-helper.c b/src/ephy-action-helper.c new file mode 100644 index 000000000..4dfc90002 --- /dev/null +++ b/src/ephy-action-helper.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2005 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-action-helper.h" + +#define SENSITIVITY_KEY "EphyAction::Sensitivity" + +void +ephy_action_change_sensitivity_flags (GtkAction *action, + guint flags, + gboolean set) +{ + static GQuark sensitivity_quark = 0; + GObject *object = (GObject *) action; + guint value; + + if (G_UNLIKELY (sensitivity_quark == 0)) + { + sensitivity_quark = g_quark_from_static_string (SENSITIVITY_KEY); + } + + value = GPOINTER_TO_UINT (g_object_get_qdata (object, sensitivity_quark)); + + if (set) + { + value |= flags; + } + else + { + value &= ~flags; + } + + g_object_set_qdata (object, sensitivity_quark, GUINT_TO_POINTER (value)); + + gtk_action_set_sensitive (GTK_ACTION (action), value == 0); +} diff --git a/src/ephy-action-helper.h b/src/ephy-action-helper.h new file mode 100644 index 000000000..9184e9df5 --- /dev/null +++ b/src/ephy-action-helper.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2005 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +#ifndef EPHY_ACTION_HELPER_H +#define EPHY_ACTION_HELPER_H + +#include <gtk/gtkaction.h> + +G_BEGIN_DECLS + +void ephy_action_change_sensitivity_flags (GtkAction *action, + guint flags, + gboolean set); + +G_END_DECLS + +#endif /* !EPHY_ACTION_HELPER_H */ diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c new file mode 100644 index 000000000..67feea4fd --- /dev/null +++ b/src/ephy-lockdown.c @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2000, 2001, 2002, 2003, 2004 Marco Pesenti Gritti + * Copyright (C) 2003, 2004, 2005 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-lockdown.h" +#include "ephy-extension.h" +#include "ephy-action-helper.h" +#include "ephy-toolbar.h" +#include "ephy-prefs.h" +#include "eel-gconf-extensions.h" +#include "ephy-debug.h" + +#include <gtk/gtkactiongroup.h> +#include <gtk/gtkuimanager.h> + +#include <string.h> + +/* Make sure these don't overlap with those in ephy-window.c and ephy-toolbar.c */ +enum +{ + LOCKDOWN_FLAG = 1 << 31 +}; + +static const char *keys [] = +{ + CONF_LOCKDOWN_DISABLE_ARBITRARY_URL, + CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING, + CONF_LOCKDOWN_DISABLE_COMMAND_LINE, + CONF_LOCKDOWN_DISABLE_HISTORY, + CONF_LOCKDOWN_DISABLE_PRINTING, + CONF_LOCKDOWN_DISABLE_PRINT_SETUP, + CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK, + CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING, + CONF_LOCKDOWN_FULLSCREEN +}; + +#define EPHY_LOCKDOWN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LOCKDOWN, EphyLockdownPrivate)) + +struct _EphyLockdownPrivate +{ + guint notifier_id[G_N_ELEMENTS (keys)]; + GList *windows; +}; + +static GObjectClass *parent_class = NULL; + +static int +find_name (GtkActionGroup *action_group, + const char *name) +{ + return strcmp (gtk_action_group_get_name (action_group), name); +} + +static GtkActionGroup * +find_action_group (GtkUIManager *manager, + const char *name) +{ + GList *list, *element; + + list = gtk_ui_manager_get_action_groups (manager); + element = g_list_find_custom (list, name, (GCompareFunc) find_name); + g_return_val_if_fail (element != NULL, NULL); + + return GTK_ACTION_GROUP (element->data); +} + +static void +update_location_editable (EphyWindow *window, + GtkAction *action, + gboolean editable) +{ + EphyTab *tab; + EphyEmbed *embed; + GtkWidget *toolbar; + char *address; + + g_object_set (action, "editable", editable, NULL); + + /* Restore the real web page address when disabling entry */ + if (editable == FALSE) + { + toolbar = ephy_window_get_toolbar (window); + tab = ephy_window_get_active_tab (window); + /* embed is NULL on startup */ + if (tab != NULL) + { + embed = ephy_tab_get_embed (tab); + g_return_if_fail (embed != NULL); + + address = ephy_embed_get_location (embed, TRUE); + ephy_toolbar_set_location (EPHY_TOOLBAR (toolbar), address); + ephy_tab_set_location (tab, address, EPHY_TAB_ADDRESS_EXPIRE_CURRENT); + g_free (address); + } + } +} + +/* NOTE: If you bring more actions under lockdown control, make sure + * that all sensitivity updates on them are done using the helpers! + */ +static void +update_window (EphyWindow *window, + EphyLockdown *lockdown) +{ + GtkUIManager *manager; + GtkActionGroup *action_group, *popups_action_group, *toolbar_action_group; + GtkAction *action; + gboolean disabled, fullscreen, print_setup_disabled, writable; + + LOG ("Updating window %p", window); + + manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); + action_group = find_action_group (manager, "WindowActions"); + popups_action_group = find_action_group (manager, "PopupsActions"); + toolbar_action_group = find_action_group (manager, "SpecialToolbarActions"); + g_return_if_fail (action_group != NULL && popups_action_group != NULL && toolbar_action_group != NULL); + + disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING); + print_setup_disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) || + eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE); + action = gtk_action_group_get_action (action_group, "FilePrintSetup"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled || print_setup_disabled); + action = gtk_action_group_get_action (action_group, "FilePrintPreview"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (action_group, "FilePrint"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + + writable = eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS); + action = gtk_action_group_get_action (action_group, "ViewToolbar"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, !writable); + + writable = eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_BOOKMARKS_BAR); + action = gtk_action_group_get_action (action_group, "ViewBookmarksBar"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, !writable); + + writable = eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR); + action = gtk_action_group_get_action (action_group, "ViewStatusbar"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, !writable); + + disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL); + action = gtk_action_group_get_action (action_group, "GoLocation"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (toolbar_action_group, "Location"); + update_location_editable (window, action, !disabled); + action = gtk_action_group_get_action (action_group, "GoUp"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (toolbar_action_group, "NavigationUp"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + + disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY); + action = gtk_action_group_get_action (action_group, "GoHistory"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (action_group, "GoBack"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (toolbar_action_group, "NavigationBack"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (action_group, "GoForward"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (toolbar_action_group, "NavigationForward"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + + disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING); + action = gtk_action_group_get_action (action_group, "GoBookmarks"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (action_group, "FileBookmarkPage"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (popups_action_group, "ContextBookmarkPage"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (popups_action_group, "BookmarkLink"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + + disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK); + action = gtk_action_group_get_action (action_group, "FileSaveAs"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (action_group, "FileSave"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (popups_action_group, "DownloadLink"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (popups_action_group, "DownloadLinkAs"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (popups_action_group, "SaveBackgroundAs"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + action = gtk_action_group_get_action (popups_action_group, "SaveImageAs"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + writable = eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE); + action = gtk_action_group_get_action (popups_action_group, "SetImageAsBackground"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled || !writable); + + disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING); + action = gtk_action_group_get_action (action_group, "EditToolbar"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled); + + fullscreen = eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN); + action = gtk_action_group_get_action (action_group, "FileNewWindow"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen); + action = gtk_action_group_get_action (action_group, "ViewFullscreen"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen); + action = gtk_action_group_get_action (action_group, "TabsDetach"); + ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen); + + if (fullscreen) + { + gtk_window_fullscreen (GTK_WINDOW (window)); + } +} + +static void +notifier (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + EphyLockdown *lockdown) +{ + EphyLockdownPrivate *priv = lockdown->priv; + + LOG ("Key %s changed", entry->key); + + g_list_foreach (priv->windows, (GFunc) update_window, lockdown); +} + +static void +ephy_lockdown_init (EphyLockdown *lockdown) +{ + EphyLockdownPrivate *priv; + guint i; + + lockdown->priv = priv = EPHY_LOCKDOWN_GET_PRIVATE (lockdown); + + LOG ("EphyLockdown initialising"); + + /* lockdown pref notifiers */ + for (i = 0; i < G_N_ELEMENTS (keys); i++) + { + priv->notifier_id[i] =eel_gconf_notification_add + (keys[i], (GConfClientNotifyFunc) notifier, lockdown); + } + + /* We know that no windows are open yet, + * so we don't need to do anything else here. + */ +} + +static void +ephy_lockdown_finalize (GObject *object) +{ + EphyLockdown *lockdown = EPHY_LOCKDOWN (object); + EphyLockdownPrivate *priv = lockdown->priv; + guint i; + + LOG ("EphyLockdown finalising"); + + for (i = 0; i < G_N_ELEMENTS (keys); i++) + { + eel_gconf_notification_remove (priv->notifier_id[i]); + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +impl_attach_window (EphyExtension *extension, + EphyWindow *window) +{ + EphyLockdown *lockdown = EPHY_LOCKDOWN (extension); + EphyLockdownPrivate *priv = lockdown->priv; + + priv->windows = g_list_prepend (priv->windows, window); + + update_window (window, lockdown); +} + +static void +impl_detach_window (EphyExtension *extension, + EphyWindow *window) +{ + EphyLockdown *lockdown = EPHY_LOCKDOWN (extension); + EphyLockdownPrivate *priv = lockdown->priv; + + priv->windows = g_list_remove (priv->windows, window); + + /* Since we know that the window closes now, we don't have to + * undo anything. + */ +} + +static void +ephy_lockdown_iface_init (EphyExtensionIface *iface) +{ + iface->attach_window = impl_attach_window; + iface->detach_window = impl_detach_window; +} + +static void +ephy_lockdown_class_init (EphyLockdownClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + + object_class->finalize = ephy_lockdown_finalize; + + g_type_class_add_private (object_class, sizeof (EphyLockdownPrivate)); +} + +GType +ephy_lockdown_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GTypeInfo our_info = + { + sizeof (EphyLockdownClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ephy_lockdown_class_init, + NULL, + NULL, /* class_data */ + sizeof (EphyLockdown), + 0, /* n_preallocs */ + (GInstanceInitFunc) ephy_lockdown_init + }; + static const GInterfaceInfo extension_info = + { + (GInterfaceInitFunc) ephy_lockdown_iface_init, + NULL, + NULL + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "EphyLockdown", + &our_info, 0); + g_type_add_interface_static (type, + EPHY_TYPE_EXTENSION, + &extension_info); + } + + return type; +} diff --git a/src/ephy-lockdown.h b/src/ephy-lockdown.h new file mode 100644 index 000000000..c2a71c585 --- /dev/null +++ b/src/ephy-lockdown.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2003, 2004 Marco Pesenti Gritti + * Copyright (C) 2003, 2004, 2005 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +#ifndef EPHY_LOCKDOWN_H +#define EPHY_LOCKDOWN_H + +#include <glib.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define EPHY_TYPE_LOCKDOWN (ephy_lockdown_get_type ()) +#define EPHY_LOCKDOWN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_LOCKDOWN, EphyLockdown)) +#define EPHY_LOCKDOWN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_LOCKDOWN, EphyLockdownClass)) +#define EPHY_IS_LOCKDOWN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_LOCKDOWN)) +#define EPHY_IS_LOCKDOWN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_LOCKDOWN)) +#define EPHY_LOCKDOWN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_LOCKDOWN, EphyLockdownClass)) + +typedef struct _EphyLockdownClass EphyLockdownClass; +typedef struct _EphyLockdown EphyLockdown; +typedef struct _EphyLockdownPrivate EphyLockdownPrivate; + +struct _EphyLockdownClass +{ + GObjectClass parent_class; +}; + +struct _EphyLockdown +{ + GObject parent_instance; + + /*< private >*/ + EphyLockdownPrivate *priv; +}; + +GType ephy_lockdown_get_type (void); + +G_END_DECLS + +#endif diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 807faff3b..6d3c57969 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -38,6 +38,7 @@ #include "ephy-debug.h" #include "ephy-extensions-manager.h" #include "ephy-session.h" +#include "ephy-lockdown.h" #include "downloader-view.h" #include "egg-toolbars-model.h" #include "ephy-toolbars-model.h" @@ -70,6 +71,7 @@ struct _EphyShellPrivate { BonoboGenericFactory *automation_factory; EphySession *session; + GObject *lockdown; EphyBookmarks *bookmarks; EggToolbarsModel *toolbars_model; EggToolbarsModel *fs_toolbars_model; @@ -543,6 +545,12 @@ ephy_shell_finalize (GObject *object) g_object_unref (shell->priv->session); } + LOG ("Unref lockdown controller"); + if (shell->priv->lockdown) + { + g_object_unref (shell->priv->lockdown); + } + LOG ("Unref toolbars model"); if (shell->priv->toolbars_model) { @@ -798,6 +806,34 @@ ephy_shell_get_session (EphyShell *shell) return G_OBJECT (shell->priv->session); } +/** + * ephy_shell_get_lockdown: + * @shell: the #EphyShell + * + * Returns the lockdown controller. + * + * Return value: the lockdown controller + **/ +static GObject * +ephy_shell_get_lockdown (EphyShell *shell) +{ + g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL); + + if (shell->priv->lockdown == NULL) + { + EphyExtensionsManager *manager; + + shell->priv->lockdown = g_object_new (EPHY_TYPE_LOCKDOWN, NULL); + + manager = EPHY_EXTENSIONS_MANAGER + (ephy_shell_get_extensions_manager (shell)); + ephy_extensions_manager_register (manager, + G_OBJECT (shell->priv->lockdown)); + } + + return G_OBJECT (shell->priv->session); +} + EphyBookmarks * ephy_shell_get_bookmarks (EphyShell *shell) { @@ -869,6 +905,9 @@ ephy_shell_get_extensions_manager (EphyShell *es) g_object_new (EPHY_TYPE_EXTENSIONS_MANAGER, NULL); ephy_extensions_manager_startup (es->priv->extensions_manager); + + /* FIXME */ + ephy_shell_get_lockdown (es); } return G_OBJECT (es->priv->extensions_manager); diff --git a/src/ephy-tab.c b/src/ephy-tab.c index db7a005c2..075fd744f 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -1916,7 +1916,7 @@ ephy_tab_set_location (EphyTab *tab, { g_return_if_fail (EPHY_IS_TAB (tab)); - if (tab->priv->address) g_free (tab->priv->address); + g_free (tab->priv->address); tab->priv->address = g_strdup (address); if (expire == EPHY_TAB_ADDRESS_EXPIRE_CURRENT && diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index 41368a6c4..0137a477e 100755 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -35,8 +35,8 @@ #include "ephy-dnd.h" #include "ephy-shell.h" #include "ephy-stock-icons.h" +#include "ephy-action-helper.h" #include "window-commands.h" -#include "eel-gconf-extensions.h" #include "ephy-debug.h" #include <glib/gi18n.h> @@ -58,6 +58,11 @@ enum LAST_ACTION }; +enum +{ + SENS_FLAG = 1 << 0 +}; + #define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, EphyToolbarPrivate)) struct _EphyToolbarPrivate @@ -65,29 +70,26 @@ struct _EphyToolbarPrivate EphyWindow *window; GtkActionGroup *action_group; GtkAction *actions[LAST_ACTION]; - gboolean updating_address; GtkWidget *fixed_toolbar; GtkWidget *spinner; GtkToolItem *spinner_item; GtkToolItem *sep_item; GtkToolItem *exit_button; - guint disable_arbitrary_url_notifier_id; gulong set_focus_handler; + gboolean updating_address; gboolean show_lock; gboolean lock_visible; gboolean leave_fullscreen_visible; gboolean spinning; }; -static GtkTargetEntry drag_targets[] = +static const GtkTargetEntry drag_targets [] = { { EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0 }, - { EPHY_DND_TOPIC_TYPE, 0, 1 }, + { EPHY_DND_TOPIC_TYPE, 0, 1 }, { EPHY_DND_URL_TYPE, 0, 2 } }; -#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url" - enum { PROP_0, @@ -204,32 +206,6 @@ maybe_finish_activation_cb (EphyWindow *window, } static void -update_location_editable (EphyToolbar *toolbar) -{ - EphyToolbarPrivate *priv = toolbar->priv; - EphyEmbed *embed; - char *address; - gboolean editable; - - editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL); - - g_object_set (priv->actions[LOCATION_ACTION], "editable", editable, NULL); - - /* Restore the real web page address when disabling entry */ - if (editable == FALSE) - { - embed = ephy_window_get_active_embed (priv->window); - /* embed is NULL on startup */ - if (EPHY_IS_EMBED (embed)) - { - address = ephy_embed_get_location (embed, TRUE); - ephy_toolbar_set_location (toolbar, address); - g_free (address); - } - } -} - -static void sync_user_input_cb (EphyLocationAction *action, GParamSpec *pspec, EphyToolbar *toolbar) @@ -268,15 +244,6 @@ zoom_to_level_cb (GtkAction *action, } static void -arbitrary_url_notifier (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - EphyToolbar *toolbar) -{ - update_location_editable (toolbar); -} - -static void ephy_toolbar_set_window (EphyToolbar *toolbar, EphyWindow *window) { @@ -367,7 +334,6 @@ ephy_toolbar_set_window (EphyToolbar *toolbar, g_signal_connect (action, "lock-clicked", G_CALLBACK (lock_clicked_cb), toolbar); gtk_action_group_add_action (priv->action_group, action); - update_location_editable (toolbar); g_object_unref (action); action = priv->actions[ZOOM_ACTION] = @@ -405,10 +371,6 @@ ephy_toolbar_set_window (EphyToolbar *toolbar, G_CALLBACK (ephy_link_open), toolbar); gtk_action_group_add_action_with_accel (priv->action_group, action, "<alt>Home"); g_object_unref (action); - - priv->disable_arbitrary_url_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL, - (GConfClientNotifyFunc) arbitrary_url_notifier, toolbar); } /* public functions */ @@ -500,9 +462,9 @@ ephy_toolbar_set_navigation_actions (EphyToolbar *toolbar, { EphyToolbarPrivate *priv = toolbar->priv; - g_object_set (priv->actions[BACK_ACTION], "sensitive", back, NULL); - g_object_set (priv->actions[FORWARD_ACTION], "sensitive", forward, NULL); - g_object_set (priv->actions[UP_ACTION], "sensitive", up, NULL); + ephy_action_change_sensitivity_flags (priv->actions[BACK_ACTION], SENS_FLAG, !back); + ephy_action_change_sensitivity_flags (priv->actions[FORWARD_ACTION], SENS_FLAG, !forward); + ephy_action_change_sensitivity_flags (priv->actions[UP_ACTION], SENS_FLAG, !up); } void @@ -689,8 +651,6 @@ ephy_toolbar_finalize (GObject *object) priv->set_focus_handler); } - eel_gconf_notification_remove (priv->disable_arbitrary_url_notifier_id); - g_signal_handlers_disconnect_by_func (egg_editable_toolbar_get_model (etoolbar), G_CALLBACK (toolbar_added_cb), toolbar); diff --git a/src/ephy-window.c b/src/ephy-window.c index 2f57ae5b9..9fa62e69c 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -56,6 +56,7 @@ #include "ephy-gui.h" #include "ephy-notebook.h" #include "ephy-fullscreen-popup.h" +#include "ephy-action-helper.h" #include <string.h> #include <glib/gi18n.h> @@ -417,14 +418,6 @@ struct _EphyWindowPrivate EphyEmbedChrome chrome; guint idle_resize_handler; - guint disable_arbitrary_url_notifier_id; - guint disable_bookmark_editing_notifier_id; - guint disable_toolbar_editing_notifier_id; - guint disable_history_notifier_id; - guint disable_printing_notifier_id; - guint disable_print_setup_notifier_id; - guint disable_save_to_disk_notifier_id; - guint disable_command_line_notifier_id; guint browse_with_caret_notifier_id; guint allow_popups_notifier_id; @@ -445,6 +438,16 @@ enum PROP_SINGLE_TAB_MODE }; +/* Make sure not to overlap with those in ephy-lockdown.c */ +enum +{ + SENS_FLAG_CHROME = 1 << 0, + SENS_FLAG_CONTEXT = 1 << 1, + SENS_FLAG_DOCUMENT = 1 << 2, + SENS_FLAG_LOADING = 1 << 3, + SENS_FLAG_NAVIGATION = 1 << 4 +}; + static GObjectClass *parent_class = NULL; GType @@ -993,94 +996,6 @@ update_chromes_actions (EphyWindow *window) window); } -static void -update_print_actions (EphyWindow *window, - gboolean enable) -{ - GtkActionGroup *action_group = window->priv->action_group; - GtkAction *action; - gboolean printing, print_setup; - - printing = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING); - print_setup = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) && - !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE); - - action = gtk_action_group_get_action (action_group, "FilePrintSetup"); - g_object_set (action, "sensitive", printing && print_setup, NULL); - action = gtk_action_group_get_action (action_group, "FilePrintPreview"); - g_object_set (action, "sensitive", enable && printing, NULL); - action = gtk_action_group_get_action (action_group, "FilePrint"); - g_object_set (action, "sensitive", enable && printing, NULL); - -} - -static void -update_actions_sensitivity (EphyWindow *window) -{ - EphyWindowPrivate *priv = window->priv; - GtkActionGroup *action_group = priv->action_group; - GtkActionGroup *popups_action_group = priv->popups_action_group; - GtkAction *action; - gboolean bookmarks_editable, save_to_disk, fullscreen; - - action = gtk_action_group_get_action (action_group, "FileNewTab"); - g_object_set (action, "sensitive", !priv->is_popup, NULL); - - action = gtk_action_group_get_action (action_group, "ViewToolbar"); - g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS), NULL); - - action = gtk_action_group_get_action (action_group, "ViewBookmarksBar"); - g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_BOOKMARKS_BAR), NULL); - - action = gtk_action_group_get_action (action_group, "ViewStatusbar"); - g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR), NULL); - - action = gtk_action_group_get_action (action_group, "GoLocation"); - g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL), NULL); - - action = gtk_action_group_get_action (action_group, "GoHistory"); - g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY), NULL); - - bookmarks_editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING); - action = gtk_action_group_get_action (action_group, "GoBookmarks"); - g_object_set (action, "sensitive", bookmarks_editable, NULL); - action = gtk_action_group_get_action (action_group, "FileBookmarkPage"); - g_object_set (action, "sensitive", bookmarks_editable, NULL); - action = gtk_action_group_get_action (popups_action_group, "ContextBookmarkPage"); - g_object_set (action, "sensitive", bookmarks_editable, NULL); - action = gtk_action_group_get_action (popups_action_group, "BookmarkLink"); - g_object_set (action, "sensitive", bookmarks_editable, NULL); - - save_to_disk = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK); - action = gtk_action_group_get_action (action_group, "FileSaveAs"); - g_object_set (action, "sensitive", save_to_disk, NULL); - action = gtk_action_group_get_action (action_group, "FileSave"); - g_object_set (action, "sensitive", save_to_disk, NULL); - action = gtk_action_group_get_action (popups_action_group, "DownloadLink"); - g_object_set (action, "sensitive", save_to_disk, NULL); - action = gtk_action_group_get_action (popups_action_group, "DownloadLinkAs"); - g_object_set (action, "sensitive", save_to_disk, NULL); - action = gtk_action_group_get_action (popups_action_group, "SaveBackgroundAs"); - g_object_set (action, "sensitive", save_to_disk, NULL); - action = gtk_action_group_get_action (popups_action_group, "SaveImageAs"); - g_object_set (action, "sensitive", save_to_disk, NULL); - action = gtk_action_group_get_action (popups_action_group, "SetImageAsBackground"); - g_object_set (action, "sensitive", save_to_disk && eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE), NULL); - - 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); - - update_print_actions (window, TRUE); -} - #ifdef HAVE_X11_XF86KEYSYM_H static void setup_multimedia_key_actions (EphyWindow *window) @@ -1207,26 +1122,26 @@ sync_tab_document_type (EphyTab *tab, GtkActionGroup *action_group; GtkAction *action; EphyEmbedDocumentType type; - gboolean can_find, enable; + gboolean can_find, disable; /* update zoom actions */ sync_tab_zoom (tab, NULL, window); type = ephy_tab_get_document_type (tab); can_find = (type != EPHY_EMBED_DOCUMENT_IMAGE); - enable = (type == EPHY_EMBED_DOCUMENT_HTML); + disable = (type != EPHY_EMBED_DOCUMENT_HTML); action_group = window->priv->action_group; action = gtk_action_group_get_action (action_group, "ViewEncoding"); - g_object_set (action, "sensitive", enable, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, disable); action = gtk_action_group_get_action (action_group, "ViewPageSource"); - g_object_set (action, "sensitive", enable, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, disable); action = gtk_action_group_get_action (action_group, "EditFind"); - g_object_set (action, "sensitive", can_find, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find); action = gtk_action_group_get_action (action_group, "EditFindNext"); - g_object_set (action, "sensitive", can_find, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find); action = gtk_action_group_get_action (action_group, "EditFindPrev"); - g_object_set (action, "sensitive", can_find, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find); } static void @@ -1287,13 +1202,14 @@ sync_tab_message (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) } static void -sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) +sync_tab_navigation (EphyTab *tab, + GParamSpec *pspec, + EphyWindow *window) { EphyTabNavigationFlags flags; GtkActionGroup *action_group; GtkAction *action; gboolean up = FALSE, back = FALSE, forward = FALSE; - gboolean disable_arbitrary_url, disable_history; if (window->priv->closing) return; @@ -1312,21 +1228,13 @@ sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) forward = TRUE; } - disable_arbitrary_url = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL); - disable_history = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY); - - up = up && !disable_arbitrary_url; - - back = back && !disable_history; - forward = forward && !disable_history; - action_group = window->priv->action_group; action = gtk_action_group_get_action (action_group, "GoUp"); - g_object_set (action, "sensitive", up, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_NAVIGATION, !up); action = gtk_action_group_get_action (action_group, "GoBack"); - g_object_set (action, "sensitive", back, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_NAVIGATION, !back); action = gtk_action_group_get_action (action_group, "GoForward"); - g_object_set (action, "sensitive", forward, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_NAVIGATION, !forward); ephy_toolbar_set_navigation_actions (window->priv->toolbar, back, forward, up); @@ -1469,28 +1377,35 @@ sync_tab_popups_allowed (EphyTab *tab, } static void -sync_tab_load_status (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) +sync_tab_load_status (EphyTab *tab, + GParamSpec *pspec, + EphyWindow *window) { + EphyWindowPrivate *priv = window->priv; + GtkActionGroup *action_group = priv->action_group; GtkAction *action; - gboolean status; + gboolean loading; if (window->priv->closing) return; - action = gtk_action_group_get_action (window->priv->action_group, "ViewStop"); + loading = ephy_tab_get_load_status (tab); - status = ephy_tab_get_load_status (tab); - g_object_set (action, "sensitive", status, NULL); + action = gtk_action_group_get_action (action_group, "ViewStop"); + g_object_set (action, "sensitive", loading, NULL); /* disable print while loading, see bug #116344 */ - update_print_actions (window, !status); + action = gtk_action_group_get_action (action_group, "FilePrintPreview"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading); + action = gtk_action_group_get_action (action_group, "FilePrint"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading); - ephy_toolbar_set_spinning (window->priv->toolbar, status); + ephy_toolbar_set_spinning (priv->toolbar, loading); - if (window->priv->fullscreen_popup) + if (priv->fullscreen_popup) { ephy_fullscreen_popup_set_spinning - (EPHY_FULLSCREEN_POPUP (window->priv->fullscreen_popup), - status); + (EPHY_FULLSCREEN_POPUP (priv->fullscreen_popup), + loading); } } @@ -1811,12 +1726,14 @@ show_embed_popup (EphyWindow *window, action_group = window->priv->popups_action_group; action = gtk_action_group_get_action (action_group, "SaveBackgroundAs"); - g_object_set (action, "sensitive", has_background, - "visible", has_background, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !has_background); + g_object_set (action, "visible", has_background, NULL); + action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow"); g_object_set (action, "sensitive", can_open_in_new, FALSE); + action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab"); - g_object_set (action, "sensitive", can_open_in_new && !priv->is_popup, FALSE); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !can_open_in_new); g_object_set_data_full (G_OBJECT (window), "context_event", g_object_ref (event), @@ -2074,7 +1991,7 @@ update_tabs_menu_sensitivity (EphyWindow *window) action = gtk_action_group_get_action (action_group, "TabsMoveRight"); g_object_set (action, "sensitive", move_right, NULL); action = gtk_action_group_get_action (action_group, "TabsDetach"); - g_object_set (action, "sensitive", detach, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, !detach); } static gboolean @@ -2351,13 +2268,20 @@ ephy_window_set_chrome (EphyWindow *window, EphyEmbedChrome mask) static void ephy_window_set_is_popup (EphyWindow *window, - gboolean is_popup) + gboolean is_popup) { EphyWindowPrivate *priv = window->priv; + GtkAction *action; priv->is_popup = is_popup; ephy_notebook_set_dnd_enabled (EPHY_NOTEBOOK (priv->notebook), !is_popup); + action = gtk_action_group_get_action (priv->action_group, "FileNewTab"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, is_popup); + + action = gtk_action_group_get_action (priv->popups_action_group, "OpenLinkInNewTab"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, is_popup); + g_object_notify (G_OBJECT (window), "is-popup"); } @@ -2391,14 +2315,6 @@ ephy_window_dispose (GObject *object) g_signal_handlers_disconnect_by_func (single, G_CALLBACK (network_status_changed), window); - eel_gconf_notification_remove (priv->disable_arbitrary_url_notifier_id); - eel_gconf_notification_remove (priv->disable_bookmark_editing_notifier_id); - eel_gconf_notification_remove (priv->disable_toolbar_editing_notifier_id); - eel_gconf_notification_remove (priv->disable_history_notifier_id); - eel_gconf_notification_remove (priv->disable_printing_notifier_id); - eel_gconf_notification_remove (priv->disable_print_setup_notifier_id); - eel_gconf_notification_remove (priv->disable_save_to_disk_notifier_id); - eel_gconf_notification_remove (priv->disable_command_line_notifier_id); eel_gconf_notification_remove (priv->browse_with_caret_notifier_id); eel_gconf_notification_remove (priv->allow_popups_notifier_id); @@ -2574,7 +2490,7 @@ ephy_window_state_event (GtkWidget *widget, (action, G_CALLBACK (window_cmd_view_fullscreen), window); action = gtk_action_group_get_action (action_group, "EditToolbar"); - g_object_set (action, "sensitive", !fullscreen, NULL); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, fullscreen); } return FALSE; @@ -2635,8 +2551,8 @@ ephy_window_class_init (EphyWindowClass *klass) g_object_class_install_property (object_class, PROP_SINGLE_TAB_MODE, g_param_spec_boolean ("is-popup", - "Single Tab Mode", - "Whether the window is in single tab mode", + "Is Popup", + "Whether the window is a popup", FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); @@ -2645,34 +2561,6 @@ ephy_window_class_init (EphyWindowClass *klass) } static void -update_navigation (EphyWindow *window) -{ - if (window->priv->active_tab) - { - sync_tab_navigation (window->priv->active_tab, NULL, window); - } -} - -static void -actions_notifier (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - EphyWindow *window) -{ - update_actions_sensitivity (window); -} - -static void -navigation_notifier (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - EphyWindow *window) -{ - update_navigation (window); - update_actions_sensitivity (window); -} - -static void browse_with_caret_notifier (GConfClient *client, guint cnxn_id, GConfEntry *entry, @@ -2882,44 +2770,6 @@ 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, - (GConfClientNotifyFunc)navigation_notifier, window); - - window->priv->disable_bookmark_editing_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING, - (GConfClientNotifyFunc)actions_notifier, window); - - window->priv->disable_toolbar_editing_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING, - (GConfClientNotifyFunc)actions_notifier, window); - - window->priv->disable_history_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_HISTORY, - (GConfClientNotifyFunc)navigation_notifier, window); - - window->priv->disable_printing_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_PRINTING, - (GConfClientNotifyFunc)actions_notifier, window); - - window->priv->disable_print_setup_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_PRINT_SETUP, - (GConfClientNotifyFunc)actions_notifier, window); - - window->priv->disable_save_to_disk_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK, - (GConfClientNotifyFunc)actions_notifier, window); - - window->priv->disable_command_line_notifier_id = eel_gconf_notification_add - (CONF_LOCKDOWN_DISABLE_COMMAND_LINE, - (GConfClientNotifyFunc)actions_notifier, window); - /* other notifiers */ browse_with_caret_notifier (NULL, 0, NULL, window); window->priv->browse_with_caret_notifier_id = eel_gconf_notification_add @@ -2957,7 +2807,6 @@ ephy_window_constructor (GType type, window = EPHY_WINDOW (object); - update_actions_sensitivity (window); sync_chromes_visibility (window); return object; diff --git a/src/popup-commands.c b/src/popup-commands.c index 16cdd8129..38b38351a 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -262,8 +262,6 @@ popup_cmd_save_image_as (GtkAction *action, window, TRUE, "image"); } -#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename" -#define CONF_DESKTOP_BG_TYPE "/desktop/gnome/background/picture_options" #define GNOME_BACKGROUND_PREFERENCES "gnome-background-properties" static void |