aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ephy-location-action.c34
-rwxr-xr-xsrc/toolbar.c50
2 files changed, 80 insertions, 4 deletions
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 2bc07c414..25bfb1e5a 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -34,6 +34,7 @@ struct _EphyLocationActionPrivate
{
GList *actions;
char *address;
+ gboolean editable;
EphyNode *smart_bmks;
EphyBookmarks *bookmarks;
};
@@ -50,7 +51,8 @@ static void sync_address (GtkAction *action,
enum
{
PROP_0,
- PROP_ADDRESS
+ PROP_ADDRESS,
+ PROP_EDITABLE
};
enum
@@ -165,6 +167,16 @@ sync_address (GtkAction *act, GParamSpec *pspec, GtkWidget *proxy)
}
static void
+sync_editable (GtkAction *act, GParamSpec *pspec, GtkWidget *proxy)
+{
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (act);
+ GtkWidget *entry;
+
+ entry = GTK_BIN (proxy)->child;
+ gtk_entry_set_editable (GTK_ENTRY (entry), action->priv->editable);
+}
+
+static void
remove_completion_actions (GtkAction *action, GtkWidget *proxy)
{
GtkWidget *entry;
@@ -234,6 +246,9 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
sync_address (action, NULL, proxy);
g_signal_connect_object (action, "notify::address",
G_CALLBACK (sync_address), proxy, 0);
+ sync_editable (action, NULL, proxy);
+ g_signal_connect_object (action, "notify::editable",
+ G_CALLBACK (sync_editable), proxy, 0);
entry = GTK_BIN (proxy)->child;
g_signal_connect_object (entry, "activate",
@@ -279,6 +294,10 @@ ephy_location_action_set_property (GObject *object,
case PROP_ADDRESS:
ephy_location_action_set_address (action, g_value_get_string (value));
break;
+ case PROP_EDITABLE:
+ action->priv->editable = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (action), "editable");
+ break;
}
}
@@ -295,6 +314,9 @@ ephy_location_action_get_property (GObject *object,
case PROP_ADDRESS:
g_value_set_string (value, ephy_location_action_get_address (action));
break;
+ case PROP_EDITABLE:
+ g_value_set_boolean (value, action->priv->editable);
+ break;
}
}
@@ -347,6 +369,14 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
"The address",
"",
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ "Editable",
+ "Editable",
+ TRUE,
+ G_PARAM_READWRITE));
+
g_type_class_add_private (object_class, sizeof (EphyLocationActionPrivate));
}
@@ -425,7 +455,7 @@ ephy_location_action_init (EphyLocationAction *action)
action->priv->address = g_strdup ("");
action->priv->actions = NULL;
-
+ action->priv->editable = TRUE;
action->priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell);
action->priv->smart_bmks = ephy_bookmarks_get_smart_bookmarks
(action->priv->bookmarks);
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")
}