aboutsummaryrefslogtreecommitdiffstats
path: root/src/toolbar.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-22 21:52:34 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-22 21:52:34 +0800
commitdaa7ef352dea475a96aa1c7534b8a874521312fd (patch)
treedbe0738810a1a5d4f2485e9ace9dc57fdb5d5b64 /src/toolbar.c
parenta0e702ef16f5e52c9c366713934c07aa3dc2ce7a (diff)
downloadgsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.tar
gsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.tar.gz
gsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.tar.bz2
gsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.tar.lz
gsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.tar.xz
gsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.tar.zst
gsoc2013-epiphany-daa7ef352dea475a96aa1c7534b8a874521312fd.zip
Implement arbitrary url lockdown pref
2003-11-22 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-location-action.c: (sync_editable), (connect_proxy), (ephy_location_action_set_property), (ephy_location_action_get_property), (ephy_location_action_class_init), (ephy_location_action_init): * src/toolbar.c: (update_location_editable), (arbitrary_url_notifier), (toolbar_setup_actions), (toolbar_set_window), (toolbar_finalize): Implement arbitrary url lockdown pref
Diffstat (limited to 'src/toolbar.c')
-rwxr-xr-xsrc/toolbar.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/toolbar.c b/src/toolbar.c
index c3ca93b75..14ff23cd7 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -42,6 +42,7 @@
#include "ephy-new-bookmark.h"
#include "ephy-stock-icons.h"
#include "ephy-toolbars-model.h"
+#include "eel-gconf-extensions.h"
#include <string.h>
#include <glib/gi18n.h>
@@ -78,6 +79,8 @@ enum
static GObjectClass *parent_class = NULL;
+#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url"
+
#define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, ToolbarPrivate))
struct ToolbarPrivate
@@ -90,6 +93,7 @@ struct ToolbarPrivate
GtkWidget *spinner;
GtkWidget *favicon;
GtkWidget *go;
+ guint disable_arbitrary_url_notifier_id;
};
GType
@@ -122,6 +126,41 @@ toolbar_get_type (void)
}
static void
+update_location_editable (Toolbar *t)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ gboolean editable;
+
+ editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL);
+
+ /* Restore the real web page address when disabling entry */
+ if (!editable)
+ {
+ EphyEmbed *embed;
+ char *address;
+
+ embed = ephy_window_get_active_embed (t->priv->window);
+ address = ephy_embed_get_location (embed, TRUE);
+ toolbar_set_location (t, address);
+ g_free (address);
+ }
+
+ action_group = t->priv->action_group;
+ action = gtk_action_group_get_action (action_group, "Location");
+ g_object_set (G_OBJECT (action), "editable", editable, NULL);
+}
+
+static void
+arbitrary_url_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ Toolbar *t)
+{
+ update_location_editable (t);
+}
+
+static void
go_location_cb (GtkAction *action, char *location, EphyWindow *window)
{
ephy_window_load_url (window, location);
@@ -339,6 +378,7 @@ toolbar_setup_actions (Toolbar *t)
g_signal_connect (action, "notify::address",
G_CALLBACK (sync_user_input_cb), t);
gtk_action_group_add_action (t->priv->action_group, action);
+ update_location_editable (t);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_ZOOM_ACTION,
@@ -515,6 +555,10 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
G_CALLBACK (window_state_event_cb),
t, 0);
+ t->priv->disable_arbitrary_url_notifier_id = eel_gconf_notification_add
+ (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL,
+ (GConfClientNotifyFunc)arbitrary_url_notifier, t);
+
g_object_set (G_OBJECT (t),
"MenuMerge", t->priv->ui_merge,
NULL);
@@ -570,11 +614,13 @@ toolbar_finalize (GObject *object)
{
Toolbar *t = EPHY_TOOLBAR (object);
- /* FIXME: why not at the end? */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ eel_gconf_notification_remove
+ (t->priv->disable_arbitrary_url_notifier_id);
g_object_unref (t->priv->action_group);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+
LOG ("Toolbar finalized")
}