aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ephy-location-action.c320
-rw-r--r--src/ephy-location-action.h6
-rw-r--r--src/ephy-lockdown.c16
-rw-r--r--src/ephy-toolbar.c5
-rw-r--r--src/ephy-window.c64
-rw-r--r--src/ephy-window.h2
6 files changed, 201 insertions, 212 deletions
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 8223f38fd..7c319c335 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -46,6 +46,7 @@
struct _EphyLocationActionPrivate
{
EphyWindow *window;
+ EphyLocationEntry *location_entry;
GtkWidget *proxy;
GList *actions;
char *address;
@@ -64,7 +65,7 @@ static void ephy_location_action_class_init (EphyLocationActionClass *class);
static void ephy_location_action_finalize (GObject *object);
static void user_changed_cb (GtkWidget *proxy,
EphyLocationAction *action);
-static void sync_address (GtkAction *action,
+static void sync_address (EphyLocationAction *action,
GParamSpec *pspec,
GtkWidget *proxy);
@@ -77,7 +78,8 @@ enum
PROP_LOCK_STOCK,
PROP_LOCK_TOOLTIP,
PROP_SHOW_LOCK,
- PROP_WINDOW
+ PROP_WINDOW,
+ PROP_LOCATION_ENTRY
};
enum
@@ -87,13 +89,15 @@ enum
};
static guint signals[LAST_SIGNAL];
-G_DEFINE_TYPE (EphyLocationAction, ephy_location_action, EPHY_TYPE_LINK_ACTION)
+G_DEFINE_TYPE_WITH_CODE (EphyLocationAction, ephy_location_action, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
+ NULL))
static gboolean
match_func (GtkEntryCompletion *completion,
- const char *key,
- GtkTreeIter *iter,
- gpointer data)
+ const char *key,
+ GtkTreeIter *iter,
+ gpointer data)
{
char *item = NULL;
char *url = NULL;
@@ -177,14 +181,14 @@ action_activated_cb (GtkEntryCompletion *completion,
static void
entry_activate_cb (GtkEntry *entry,
- GtkAction *action)
+ EphyLocationAction *action)
{
EphyBookmarks *bookmarks;
const char *content;
char *address;
EphyLocationActionPrivate *priv;
- priv = EPHY_LOCATION_ACTION (action)->priv;
+ priv = action->priv;
if (priv->sync_address_is_blocked)
{
@@ -228,76 +232,70 @@ lock_clicked_cb (GtkWidget *proxy,
}
static void
-sync_address (GtkAction *gaction,
+sync_address (EphyLocationAction *action,
GParamSpec *pspec,
- GtkWidget *proxy)
+ GtkWidget *widget)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
EphyLocationActionPrivate *priv = action->priv;
- EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy);
+ EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (widget);
LOG ("sync_address %s", action->priv->address);
- g_signal_handlers_block_by_func (proxy, G_CALLBACK (user_changed_cb), action);
+ g_signal_handlers_block_by_func (widget, G_CALLBACK (user_changed_cb), action);
ephy_location_entry_set_location (lentry, priv->address);
- g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (user_changed_cb), action);
+ g_signal_handlers_unblock_by_func (widget, G_CALLBACK (user_changed_cb), action);
}
static void
-sync_editable (GtkAction *gaction,
+sync_editable (EphyLocationAction *action,
GParamSpec *pspec,
- GtkWidget *proxy)
+ GtkWidget *widget)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
- EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy);
+ EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (widget);
gtk_editable_set_editable (GTK_EDITABLE (lentry), action->priv->editable);
}
static void
-sync_icon (GtkAction *gaction,
+sync_icon (EphyLocationAction *action,
GParamSpec *pspec,
- GtkWidget *proxy)
+ GtkWidget *widget)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
EphyLocationActionPrivate *priv = action->priv;
- EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (widget);
ephy_location_entry_set_favicon (entry, priv->icon);
}
static void
-sync_lock_stock_id (GtkAction *gaction,
+sync_lock_stock_id (EphyLocationAction *action,
GParamSpec *pspec,
- GtkWidget *proxy)
+ GtkWidget *widget)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
EphyLocationActionPrivate *priv = action->priv;
- EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (widget);
ephy_location_entry_set_lock_stock (entry, priv->lock_stock_id);
}
static void
-sync_lock_tooltip (GtkAction *gaction,
+sync_lock_tooltip (EphyLocationAction *action,
GParamSpec *pspec,
- GtkWidget *proxy)
+ GtkWidget *widget)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
EphyLocationActionPrivate *priv = action->priv;
- EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (widget);
ephy_location_entry_set_lock_tooltip (entry, priv->lock_tooltip);
}
static void
-sync_show_lock (GtkAction *gaction,
+sync_show_lock (EphyLocationAction *action,
GParamSpec *pspec,
- GtkWidget *proxy)
+ GtkWidget *widget)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
EphyLocationActionPrivate *priv = action->priv;
- EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy);
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (widget);
ephy_location_entry_set_show_lock (entry, priv->show_lock);
}
@@ -328,11 +326,9 @@ get_title_cb (EphyLocationEntry *entry,
}
static void
-remove_completion_actions (GtkAction *gaction,
- GtkWidget *proxy)
+remove_completion_actions (EphyLocationAction *action,
+ EphyLocationEntry *lentry)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
- EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy);
GtkEntryCompletion *completion;
GList *l;
@@ -348,11 +344,9 @@ remove_completion_actions (GtkAction *gaction,
}
static void
-add_completion_actions (GtkAction *gaction,
- GtkWidget *proxy)
+add_completion_actions (EphyLocationAction *action,
+ EphyLocationEntry *lentry)
{
- EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction);
- EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy);
GtkEntryCompletion *completion;
GList *l;
@@ -377,11 +371,10 @@ add_completion_actions (GtkAction *gaction,
static gboolean
focus_in_event_cb (GtkWidget *entry,
GdkEventFocus *event,
- GtkAction *action)
+ EphyLocationAction *action)
{
- EphyLocationActionPrivate *priv;
+ EphyLocationActionPrivate *priv = action->priv;
- priv = EPHY_LOCATION_ACTION (action)->priv;
if (!priv->sync_address_is_blocked)
{
priv->sync_address_is_blocked = TRUE;
@@ -394,11 +387,9 @@ focus_in_event_cb (GtkWidget *entry,
static gboolean
focus_out_event_cb (GtkWidget *entry,
GdkEventFocus *event,
- GtkAction *action)
+ EphyLocationAction *action)
{
- EphyLocationActionPrivate *priv;
-
- priv = EPHY_LOCATION_ACTION (action)->priv;
+ EphyLocationActionPrivate *priv = action->priv;
if (priv->sync_address_is_blocked)
{
@@ -413,11 +404,9 @@ static void
switch_page_cb (GtkNotebook *notebook,
GtkWidget *page,
guint page_num,
- GtkAction *action)
+ EphyLocationAction *action)
{
- EphyLocationActionPrivate *priv;
-
- priv = EPHY_LOCATION_ACTION (action)->priv;
+ EphyLocationActionPrivate *priv = action->priv;
if (priv->sync_address_is_blocked == TRUE)
{
@@ -427,102 +416,74 @@ switch_page_cb (GtkNotebook *notebook,
}
static void
-connect_proxy (GtkAction *action, GtkWidget *proxy)
+ephy_location_action_constructed (GObject *object)
{
- if (EPHY_IS_LOCATION_ENTRY (proxy))
- {
- EphyCompletionModel *model;
- GtkWidget *notebook;
- EphyLocationActionPrivate *priv;
-
- priv = EPHY_LOCATION_ACTION (action)->priv;
- priv->proxy = proxy;
-
- notebook = ephy_window_get_notebook (priv->window);
-
- g_signal_connect (notebook, "switch-page",
- G_CALLBACK (switch_page_cb), action);
-
- model = ephy_completion_model_new ();
- ephy_location_entry_set_completion (EPHY_LOCATION_ENTRY (proxy),
- GTK_TREE_MODEL (model),
- EPHY_COMPLETION_TEXT_COL,
- EPHY_COMPLETION_ACTION_COL,
- EPHY_COMPLETION_KEYWORDS_COL,
- EPHY_COMPLETION_RELEVANCE_COL,
- EPHY_COMPLETION_URL_COL,
- EPHY_COMPLETION_EXTRA_COL,
- EPHY_COMPLETION_FAVICON_COL);
- g_object_unref (model);
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (object);
+ EphyLocationActionPrivate *priv = action->priv;
+ EphyCompletionModel *model;
+ GtkWidget *notebook, *widget;
+
+ G_OBJECT_CLASS (ephy_location_action_parent_class)->constructed (object);
+
+ notebook = ephy_window_get_notebook (priv->window);
+ widget = GTK_WIDGET (priv->location_entry);
+
+ g_signal_connect (notebook, "switch-page",
+ G_CALLBACK (switch_page_cb), action);
+
+ model = ephy_completion_model_new ();
+ ephy_location_entry_set_completion (priv->location_entry,
+ GTK_TREE_MODEL (model),
+ EPHY_COMPLETION_TEXT_COL,
+ EPHY_COMPLETION_ACTION_COL,
+ EPHY_COMPLETION_KEYWORDS_COL,
+ EPHY_COMPLETION_RELEVANCE_COL,
+ EPHY_COMPLETION_URL_COL,
+ EPHY_COMPLETION_EXTRA_COL,
+ EPHY_COMPLETION_FAVICON_COL);
+ g_object_unref (model);
- ephy_location_entry_set_match_func (EPHY_LOCATION_ENTRY (proxy),
- match_func,
- proxy,
- NULL);
-
- add_completion_actions (action, 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);
- sync_icon (action, NULL, proxy);
- g_signal_connect_object (action, "notify::icon",
- G_CALLBACK (sync_icon), proxy, 0);
- sync_lock_stock_id (action, NULL, proxy);
- g_signal_connect_object (action, "notify::lock-stock-id",
- G_CALLBACK (sync_lock_stock_id), proxy, 0);
- sync_lock_tooltip (action, NULL, proxy);
- g_signal_connect_object (action, "notify::lock-tooltip",
- G_CALLBACK (sync_lock_tooltip), proxy, 0);
- sync_show_lock (action, NULL, proxy);
- g_signal_connect_object (action, "notify::show-lock",
- G_CALLBACK (sync_show_lock), proxy, 0);
-
- g_signal_connect_object (proxy, "activate",
- G_CALLBACK (entry_activate_cb),
- action, 0);
- g_signal_connect_object (proxy, "user-changed",
- G_CALLBACK (user_changed_cb), action, 0);
- g_signal_connect_object (proxy, "lock-clicked",
- G_CALLBACK (lock_clicked_cb), action, 0);
- g_signal_connect_object (proxy, "get-location",
- G_CALLBACK (get_location_cb), action, 0);
- g_signal_connect_object (proxy, "get-title",
- G_CALLBACK (get_title_cb), action, 0);
- g_signal_connect_object (proxy, "focus-in-event",
- G_CALLBACK (focus_in_event_cb), action, 0);
- g_signal_connect_object (proxy, "focus-out-event",
- G_CALLBACK (focus_out_event_cb), action, 0);
- }
-
- GTK_ACTION_CLASS (ephy_location_action_parent_class)->connect_proxy (action, proxy);
-}
-
-static void
-disconnect_proxy (GtkAction *action, GtkWidget *proxy)
-{
- GTK_ACTION_CLASS (ephy_location_action_parent_class)->disconnect_proxy (action, proxy);
-
- if (EPHY_IS_LOCATION_ENTRY (proxy))
- {
- GtkWidget *notebook;
- EphyLocationActionPrivate *priv;
-
- priv = EPHY_LOCATION_ACTION (action)->priv;
- priv->proxy = NULL;
-
- notebook = ephy_window_get_notebook (priv->window);
-
- g_signal_handlers_disconnect_matched (action, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, proxy);
- g_signal_handlers_disconnect_matched (proxy, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, action);
- g_signal_handlers_disconnect_matched (notebook, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, action);
- }
+ ephy_location_entry_set_match_func (priv->location_entry,
+ match_func,
+ priv->location_entry,
+ NULL);
+
+ add_completion_actions (action, priv->location_entry);
+
+ sync_address (action, NULL, widget);
+ g_signal_connect_object (action, "notify::address",
+ G_CALLBACK (sync_address), widget, 0);
+ sync_editable (action, NULL, widget);
+ g_signal_connect_object (action, "notify::editable",
+ G_CALLBACK (sync_editable), widget, 0);
+ sync_icon (action, NULL, widget);
+ g_signal_connect_object (action, "notify::icon",
+ G_CALLBACK (sync_icon), widget, 0);
+ sync_lock_stock_id (action, NULL, widget);
+ g_signal_connect_object (action, "notify::lock-stock-id",
+ G_CALLBACK (sync_lock_stock_id), widget, 0);
+ sync_lock_tooltip (action, NULL, widget);
+ g_signal_connect_object (action, "notify::lock-tooltip",
+ G_CALLBACK (sync_lock_tooltip), widget, 0);
+ sync_show_lock (action, NULL, widget);
+ g_signal_connect_object (action, "notify::show-lock",
+ G_CALLBACK (sync_show_lock), widget, 0);
+
+ g_signal_connect_object (widget, "activate",
+ G_CALLBACK (entry_activate_cb),
+ action, 0);
+ g_signal_connect_object (widget, "user-changed",
+ G_CALLBACK (user_changed_cb), action, 0);
+ g_signal_connect_object (widget, "lock-clicked",
+ G_CALLBACK (lock_clicked_cb), action, 0);
+ g_signal_connect_object (widget, "get-location",
+ G_CALLBACK (get_location_cb), action, 0);
+ g_signal_connect_object (widget, "get-title",
+ G_CALLBACK (get_title_cb), action, 0);
+ g_signal_connect_object (widget, "focus-in-event",
+ G_CALLBACK (focus_in_event_cb), action, 0);
+ g_signal_connect_object (widget, "focus-out-event",
+ G_CALLBACK (focus_out_event_cb), action, 0);
}
static void
@@ -563,6 +524,9 @@ ephy_location_action_set_property (GObject *object,
case PROP_WINDOW:
priv->window = EPHY_WINDOW (g_value_get_object (value));
break;
+ case PROP_LOCATION_ENTRY:
+ priv->location_entry = EPHY_LOCATION_ENTRY (g_value_get_object (value));
+ break;
}
}
@@ -596,25 +560,48 @@ ephy_location_action_get_property (GObject *object,
g_value_set_boolean (value, priv->show_lock);
break;
case PROP_WINDOW:
+ case PROP_LOCATION_ENTRY:
/* not readable */
break;
}
}
static void
+ephy_location_action_dispose (GObject *object)
+{
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (object);
+ EphyLocationActionPrivate *priv = action->priv;
+ GtkWidget *notebook;
+
+ notebook = ephy_window_get_notebook (priv->window);
+
+ if (notebook == NULL ||
+ priv->location_entry == NULL) {
+ return;
+ }
+
+ g_signal_handlers_disconnect_matched (action, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, priv->location_entry);
+ g_signal_handlers_disconnect_matched (priv->location_entry, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, action);
+ g_signal_handlers_disconnect_matched (notebook, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, action);
+ priv->location_entry = NULL;
+
+ G_OBJECT_CLASS (ephy_location_action_parent_class)->dispose (object);
+}
+
+static void
ephy_location_action_class_init (EphyLocationActionClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- GtkActionClass *action_class = GTK_ACTION_CLASS (class);
object_class->finalize = ephy_location_action_finalize;
+ object_class->dispose = ephy_location_action_dispose;
+ object_class->constructed = ephy_location_action_constructed;
object_class->get_property = ephy_location_action_get_property;
object_class->set_property = ephy_location_action_set_property;
- action_class->toolbar_item_type = EPHY_TYPE_LOCATION_ENTRY;
- action_class->connect_proxy = connect_proxy;
- action_class->disconnect_proxy = disconnect_proxy;
-
/**
* EphyLocationAction::lock-clicked:
* @action: the object which received the signal.
@@ -724,6 +711,20 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
G_PARAM_CONSTRUCT_ONLY));
+ /**
+ * EphyLocationAction:location-entry:
+ *
+ * The controlled location entry.
+ */
+ g_object_class_install_property (object_class,
+ PROP_LOCATION_ENTRY,
+ g_param_spec_object ("location-entry",
+ "Location entry",
+ "The controlled location entry",
+ G_TYPE_OBJECT,
+ G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_type_class_add_private (object_class, sizeof (EphyLocationActionPrivate));
}
@@ -785,24 +786,15 @@ init_actions_list (EphyLocationAction *action)
static void
update_actions_list (EphyLocationAction *la)
{
- GSList *l;
- GtkAction *action = GTK_ACTION (la);
+ EphyLocationActionPrivate *priv = la->priv;
- l = gtk_action_get_proxies (action);
- for (; l != NULL; l = l->next)
- {
- remove_completion_actions (action, GTK_WIDGET (l->data));
- }
+ remove_completion_actions (la, priv->location_entry);
g_list_free (la->priv->actions);
la->priv->actions = NULL;
init_actions_list (la);
- l = gtk_action_get_proxies (action);
- for (; l != NULL; l = l->next)
- {
- add_completion_actions (action, l->data);
- }
+ add_completion_actions (la, priv->location_entry);
}
static void
diff --git a/src/ephy-location-action.h b/src/ephy-location-action.h
index e94931a3a..4680ef879 100644
--- a/src/ephy-location-action.h
+++ b/src/ephy-location-action.h
@@ -24,7 +24,7 @@
#ifndef EPHY_LOCATION_ACTION_H
#define EPHY_LOCATION_ACTION_H
-#include "ephy-link-action.h"
+#include <glib-object.h>
G_BEGIN_DECLS
@@ -41,7 +41,7 @@ typedef struct _EphyLocationActionClass EphyLocationActionClass;
struct _EphyLocationAction
{
- EphyLinkAction parent;
+ GObject parent;
/*< private >*/
EphyLocationActionPrivate *priv;
@@ -49,7 +49,7 @@ struct _EphyLocationAction
struct _EphyLocationActionClass
{
- EphyLinkActionClass parent_class;
+ GObjectClass parent_class;
/* Signals */
void (* lock_clicked) (EphyLocationAction *action);
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 9186cad0a..4ffa81534 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -122,8 +122,6 @@ static const BindAction popup_actions[] = {
};
static const BindAction special_toolbar_actions[] = {
- { EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, "Location", "editable" },
-
{ EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationBack", "visible" },
{ EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationBack", "sensitive" },
{ EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationForward", "visible" },
@@ -191,6 +189,16 @@ bind_settings_and_actions (GSettings *settings,
}
static void
+bind_location_action (GSettings *settings,
+ EphyLocationAction *action)
+{
+ g_settings_bind (settings, EPHY_PREFS_LOCKDOWN_ARBITRARY_URL,
+ action, "editable",
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+}
+
+static void
impl_attach_window (EphyExtension *extension,
EphyWindow *window)
{
@@ -198,6 +206,7 @@ impl_attach_window (EphyExtension *extension,
GtkActionGroup *action_group;
GtkAction *action;
GSettings *settings;
+ EphyLocationAction *location_action;
g_signal_connect (EPHY_SETTINGS_LOCKDOWN,
"changed::" EPHY_PREFS_LOCKDOWN_FULLSCREEN,
@@ -234,6 +243,9 @@ impl_attach_window (EphyExtension *extension,
bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
action_group, special_toolbar_actions,
G_N_ELEMENTS (special_toolbar_actions));
+
+ location_action = ephy_window_get_location_action (window);
+ bind_location_action (EPHY_SETTINGS_LOCKDOWN, location_action);
}
static void
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 026363984..75f7ab520 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "ephy-toolbar.h"
+#include "ephy-location-entry.h"
#include "ephy-middle-clickable-button.h"
G_DEFINE_TYPE (EphyToolbar, ephy_toolbar, GTK_TYPE_TOOLBAR)
@@ -135,9 +136,7 @@ ephy_toolbar_constructed (GObject *object)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
/* Location */
- action = gtk_action_group_get_action (action_group, "Location");
- location = gtk_action_create_tool_item (action);
- priv->entry = location;
+ priv->entry = location = ephy_location_entry_new ();
gtk_box_pack_start (GTK_BOX (box), location,
TRUE, TRUE, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (box),
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 2492b1b93..0a897ae1a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -428,6 +428,8 @@ struct _EphyWindowPrivate
guint idle_worker;
GtkWidget *downloads_box;
+ EphyLocationAction *location_action;
+
guint clear_progress_timeout_id;
gulong set_focus_handler;
@@ -1462,21 +1464,6 @@ setup_ui_manager (EphyWindow *window)
"<alt>Right");
g_object_unref (action);
- /* FIXME: I'm still waiting for the exact term to
- * user here from the docs team.
- */
- action =
- g_object_new (EPHY_TYPE_LOCATION_ACTION,
- "name", "Location",
- "label", _("Address Entry"),
- "stock_id", EPHY_STOCK_ENTRY,
- "tooltip", _("Enter a web address to open, or a phrase to search for"),
- "visible-overflown", FALSE,
- "window", window,
- NULL);
- gtk_action_group_add_action (action_group, action);
- g_object_unref (action);
-
action =
g_object_new (EPHY_TYPE_ZOOM_ACTION,
"name", "Zoom",
@@ -1529,14 +1516,11 @@ _ephy_window_set_location (EphyWindow *window,
const char *address)
{
EphyWindowPrivate *priv = window->priv;
- EphyLocationAction *action;
if (priv->updating_address) return;
- action = EPHY_LOCATION_ACTION (gtk_action_group_get_action (priv->toolbar_action_group,
- "Location"));
priv->updating_address = TRUE;
- ephy_location_action_set_address (action, address);
+ ephy_location_action_set_address (priv->location_action, address);
priv->updating_address = FALSE;
}
@@ -1601,11 +1585,8 @@ _ephy_window_action_set_favicon (EphyWindow *window,
GdkPixbuf *icon)
{
EphyWindowPrivate *priv = window->priv;
- GtkAction *action;
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "Location");
- g_object_set (action, "icon", icon, NULL);
+ g_object_set (priv->location_action, "icon", icon, NULL);
}
static void
@@ -1723,13 +1704,10 @@ _ephy_window_set_security_state (EphyWindow *window,
const char *tooltip)
{
EphyWindowPrivate *priv = window->priv;
- GtkAction *action;
priv->show_lock = show_lock != FALSE;
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "Location");
- g_object_set (action,
+ g_object_set (priv->location_action,
"lock-stock-id", stock_id,
"lock-tooltip", tooltip,
"show-lock", priv->show_lock,
@@ -3535,13 +3513,6 @@ setup_toolbar (EphyWindow *window)
G_CALLBACK (ephy_link_open), window);
action = gtk_action_group_get_action (priv->toolbar_action_group,
- "Location");
- g_signal_connect (action, "notify::address",
- G_CALLBACK (sync_user_input_cb), window);
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), window);
-
- action = gtk_action_group_get_action (priv->toolbar_action_group,
"FileNewTab");
g_signal_connect_swapped (action, "open-link",
G_CALLBACK (ephy_link_open), window);
@@ -3620,6 +3591,15 @@ ephy_window_constructor (GType type,
/* Setup the toolbar. */
priv->toolbar = setup_toolbar (window);
+ priv->location_action =
+ g_object_new (EPHY_TYPE_LOCATION_ACTION,
+ "window", window,
+ "location-entry", ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar)),
+ NULL);
+ g_signal_connect (priv->location_action, "notify::address",
+ G_CALLBACK (sync_user_input_cb), window);
+ g_signal_connect_swapped (priv->location_action, "open-link",
+ G_CALLBACK (ephy_link_open), window);
g_signal_connect_swapped (priv->notebook, "open-link",
G_CALLBACK (ephy_link_open), window);
@@ -4178,9 +4158,7 @@ const char *
ephy_window_get_location (EphyWindow *window)
{
EphyWindowPrivate *priv = window->priv;
- GtkAction * action = gtk_action_group_get_action (priv->toolbar_action_group,
- "Location");
- return ephy_location_action_get_address (EPHY_LOCATION_ACTION (action));
+ return ephy_location_action_get_address (priv->location_action);
}
/**
@@ -4195,13 +4173,11 @@ ephy_window_set_location (EphyWindow *window,
const char *address)
{
EphyWindowPrivate *priv = window->priv;
- GtkAction *action = gtk_action_group_get_action (priv->toolbar_action_group,
- "Location");
if (priv->updating_address) return;
priv->updating_address = TRUE;
- ephy_location_action_set_address (EPHY_LOCATION_ACTION (action), address);
+ ephy_location_action_set_address (priv->location_action, address);
priv->updating_address = FALSE;
}
@@ -4221,3 +4197,11 @@ ephy_window_get_toolbar_action_group (EphyWindow *window)
return window->priv->toolbar_action_group;
}
+
+EphyLocationAction *
+ephy_window_get_location_action (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return window->priv->location_action;
+}
diff --git a/src/ephy-window.h b/src/ephy-window.h
index e9b443f21..d8251bf0e 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -25,6 +25,7 @@
#define EPHY_WINDOW_H
#include "ephy-embed.h"
+#include "ephy-location-action.h"
#include <glib-object.h>
#include <glib.h>
@@ -86,6 +87,7 @@ void ephy_window_set_downloads_box_visibility (EphyWindow *window,
gboolean show);
GtkActionGroup *ephy_window_get_toolbar_action_group (EphyWindow *window);
+EphyLocationAction *ephy_window_get_location_action (EphyWindow *window);
G_END_DECLS