summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-19 19:18:28 +0000
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-19 19:18:28 +0000
commit8cb42068b147d05e0ac55a2d6c2b72c8a4ecf395 (patch)
tree3ce24c73ae1fc098783779a0e23fac32b50b06b9
parent9ff6468da9a94e4a0e6c1a61408a27ee25f925cd (diff)
downloadepiphany-8cb42068b147d05e0ac55a2d6c2b72c8a4ecf395.tar.gz
Complete toolbar implementation.
2003-01-19 Marco Pesenti Gritti <marco@it.gnome.org> * lib/widgets/ephy-spinner.c: (ephy_spinner_expose): * src/ephy-favicon-action.c: (create_tool_item), (each_url_get_data_binder), (favicon_drag_data_get_cb), (ephy_favicon_action_sync_icon), (connect_proxy), (ephy_favicon_action_set_property), (ephy_favicon_action_get_property), (ephy_favicon_action_class_init), (ephy_favicon_action_init): * src/ephy-favicon-action.h: * src/ephy-location-action.c: (ephy_location_action_get_widget): * src/ephy-location-action.h: * src/ephy-navigation-action.c: * src/ephy-spinner-action.c: (ephy_spinner_action_sync_throbbing), (create_tool_item), (connect_proxy), (ephy_spinner_action_set_property), (ephy_spinner_action_get_property), (ephy_spinner_action_class_init), (ephy_spinner_action_init): * src/ephy-spinner-action.h: * src/ephy-window.c: (setup_window), (update_nav_control): * src/toolbar.c: (toolbar_setup_actions), (toolbar_activate_location), (toolbar_spinner_start), (toolbar_spinner_stop), (toolbar_set_location), (toolbar_update_favicon), (toolbar_get_location), (toolbar_update_navigation_actions): * src/toolbar.h: Complete toolbar implementation.
-rw-r--r--ChangeLog29
-rw-r--r--lib/widgets/ephy-spinner.c4
-rw-r--r--src/ephy-favicon-action.c163
-rw-r--r--src/ephy-favicon-action.h6
-rw-r--r--src/ephy-location-action.c18
-rw-r--r--src/ephy-location-action.h4
-rw-r--r--src/ephy-navigation-action.c1
-rw-r--r--src/ephy-spinner-action.c91
-rw-r--r--src/ephy-spinner-action.h6
-rw-r--r--src/ephy-window.c21
-rwxr-xr-xsrc/toolbar.c129
-rw-r--r--src/toolbar.h16
12 files changed, 399 insertions, 89 deletions
diff --git a/ChangeLog b/ChangeLog
index 004fdd13a..e1b06e079 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2003-01-19 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/widgets/ephy-spinner.c: (ephy_spinner_expose):
+ * src/ephy-favicon-action.c: (create_tool_item),
+ (each_url_get_data_binder), (favicon_drag_data_get_cb),
+ (ephy_favicon_action_sync_icon), (connect_proxy),
+ (ephy_favicon_action_set_property),
+ (ephy_favicon_action_get_property),
+ (ephy_favicon_action_class_init), (ephy_favicon_action_init):
+ * src/ephy-favicon-action.h:
+ * src/ephy-location-action.c: (ephy_location_action_get_widget):
+ * src/ephy-location-action.h:
+ * src/ephy-navigation-action.c:
+ * src/ephy-spinner-action.c: (ephy_spinner_action_sync_throbbing),
+ (create_tool_item), (connect_proxy),
+ (ephy_spinner_action_set_property),
+ (ephy_spinner_action_get_property),
+ (ephy_spinner_action_class_init), (ephy_spinner_action_init):
+ * src/ephy-spinner-action.h:
+ * src/ephy-window.c: (setup_window), (update_nav_control):
+ * src/toolbar.c: (toolbar_setup_actions),
+ (toolbar_activate_location), (toolbar_spinner_start),
+ (toolbar_spinner_stop), (toolbar_set_location),
+ (toolbar_update_favicon), (toolbar_get_location),
+ (toolbar_update_navigation_actions):
+ * src/toolbar.h:
+
+ Complete toolbar implementation.
+
2003-01-18 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/ephy-gui.c: (ephy_gui_menu_position_under_widget):
diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c
index e4462f889..d1caf8fba 100644
--- a/lib/widgets/ephy-spinner.c
+++ b/lib/widgets/ephy-spinner.c
@@ -396,8 +396,8 @@ ephy_spinner_expose (GtkWidget *widget, GdkEventExpose *event)
height = gdk_pixbuf_get_height (pixbuf);
/* Compute the offsets for the image centered on our allocation */
- x_offset = widget->allocation.x + (widget->allocation.width - width) / 2;
- y_offset = widget->allocation.y + (widget->allocation.height - height) / 2;
+ x_offset = (widget->allocation.width - width) / 2;
+ y_offset = (widget->allocation.height - height) / 2;
pix_area.x = x_offset;
pix_area.y = y_offset;
diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c
index 645354587..9fa68acf2 100644
--- a/src/ephy-favicon-action.c
+++ b/src/ephy-favicon-action.c
@@ -18,6 +18,24 @@
#include "ephy-favicon-action.h"
#include "eggtoolitem.h"
+#include "ephy-window.h"
+#include "ephy-tab.h"
+#include "ephy-dnd.h"
+#include "ephy-favicon-cache.h"
+#include "ephy-shell.h"
+
+struct EphyFaviconActionPrivate
+{
+ EphyWindow *window;
+ char *icon;
+};
+
+enum
+{
+ PROP_0,
+ PROP_WINDOW,
+ PROP_ICON
+};
static void ephy_favicon_action_init (EphyFaviconAction *action);
static void ephy_favicon_action_class_init (EphyFaviconActionClass *class);
@@ -68,22 +86,167 @@ create_tool_item (EggAction *action)
gtk_widget_show (image);
gtk_widget_show (ebox);
+ g_object_set_data (G_OBJECT (item), "image", image);
+
return item;
}
static void
+each_url_get_data_binder (EphyDragEachSelectedItemDataGet iteratee,
+ gpointer iterator_context, gpointer data)
+{
+ const char *location;
+ EphyTab *tab;
+ EphyWindow *window = EPHY_WINDOW(iterator_context);
+
+ tab = ephy_window_get_active_tab (window);
+ location = ephy_tab_get_location (tab);
+
+ iteratee (location, -1, -1, -1, -1, data);
+}
+
+static void
+favicon_drag_data_get_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint32 time,
+ EphyWindow *window)
+{
+ g_assert (widget != NULL);
+ g_return_if_fail (context != NULL);
+
+ ephy_dnd_drag_data_get (widget, context, selection_data,
+ info, time, window, each_url_get_data_binder);
+}
+
+static void
+ephy_favicon_action_sync_icon (EggAction *action, GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ EphyFaviconAction *fav_action = EPHY_FAVICON_ACTION (action);
+ char *url;
+ GtkWidget *image;
+ GdkPixbuf *pixbuf = NULL;
+ EphyFaviconCache *cache;
+
+ cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell));
+
+ url = fav_action->priv->icon;
+ image = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "image"));
+
+ if (url)
+ {
+ pixbuf = ephy_favicon_cache_get (cache, url);
+ }
+
+ if (pixbuf)
+ {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
+ }
+ else
+ {
+ gtk_image_set_from_stock (GTK_IMAGE (image),
+ GTK_STOCK_JUMP_TO,
+ GTK_ICON_SIZE_MENU);
+ }
+}
+
+static void
+connect_proxy (EggAction *action, GtkWidget *proxy)
+{
+ ephy_dnd_url_drag_source_set (proxy);
+
+ g_signal_connect (proxy,
+ "drag_data_get",
+ G_CALLBACK (favicon_drag_data_get_cb),
+ EPHY_FAVICON_ACTION (action)->priv->window);
+ g_signal_connect_object (action, "notify::icon",
+ G_CALLBACK (ephy_favicon_action_sync_icon),
+ proxy, 0);
+
+ (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+}
+
+static void
+ephy_favicon_action_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFaviconAction *fav;
+
+ fav = EPHY_FAVICON_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_WINDOW:
+ fav->priv->window = EPHY_WINDOW (g_value_get_object (value));
+ break;
+ case PROP_ICON:
+ g_free (fav->priv->icon);
+ fav->priv->icon = g_strdup (g_value_get_string (value));
+ g_object_notify(object, "icon");
+ break;
+ }
+}
+
+static void
+ephy_favicon_action_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFaviconAction *fav;
+
+ fav = EPHY_FAVICON_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_WINDOW:
+ g_value_set_object (value, fav->priv->window);
+ break;
+ case PROP_ICON:
+ g_value_set_object (value, fav->priv->icon);
+ break;
+ }
+}
+
+static void
ephy_favicon_action_class_init (EphyFaviconActionClass *class)
{
EggActionClass *action_class;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ object_class->set_property = ephy_favicon_action_set_property;
+ object_class->get_property = ephy_favicon_action_get_property;
parent_class = g_type_class_peek_parent (class);
action_class = EGG_ACTION_CLASS (class);
action_class->toolbar_item_type = EGG_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
+ action_class->connect_proxy = connect_proxy;
+
+ g_object_class_install_property (object_class,
+ PROP_WINDOW,
+ g_param_spec_object ("window",
+ "Window",
+ "The window",
+ G_TYPE_OBJECT,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_ICON,
+ g_param_spec_string ("icon",
+ "Icon",
+ "The icon",
+ NULL,
+ G_PARAM_READWRITE));
}
static void
ephy_favicon_action_init (EphyFaviconAction *action)
{
+ action->priv = g_new0 (EphyFaviconActionPrivate, 1);
+ action->priv->icon = NULL;
}
diff --git a/src/ephy-favicon-action.h b/src/ephy-favicon-action.h
index b582736fb..31f6c3d82 100644
--- a/src/ephy-favicon-action.h
+++ b/src/ephy-favicon-action.h
@@ -31,15 +31,17 @@
typedef struct _EphyFaviconAction EphyFaviconAction;
typedef struct _EphyFaviconActionClass EphyFaviconActionClass;
+typedef struct EphyFaviconActionPrivate EphyFaviconActionPrivate;
struct _EphyFaviconAction
{
- EggAction parent;
+ EggAction parent;
+ EphyFaviconActionPrivate *priv;
};
struct _EphyFaviconActionClass
{
- EggActionClass parent_class;
+ EggActionClass parent_class;
};
GType ephy_favicon_action_get_type (void);
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 51f57ce99..07f7e6c2b 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -161,3 +161,21 @@ static void
ephy_location_action_init (EphyLocationAction *action)
{
}
+
+GtkWidget *
+ephy_location_action_get_widget (EphyLocationAction *action)
+{
+ GSList *slist;
+
+ slist = EGG_ACTION (action)->proxies;
+
+ if (slist)
+ {
+ return GTK_BIN (slist->data)->child;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
diff --git a/src/ephy-location-action.h b/src/ephy-location-action.h
index 308638dca..daa609aee 100644
--- a/src/ephy-location-action.h
+++ b/src/ephy-location-action.h
@@ -44,6 +44,8 @@ struct _EphyLocationActionClass
void (*go_location) (EphyLocationAction *action, char *location);
};
-GType ephy_location_action_get_type (void);
+GType ephy_location_action_get_type (void);
+
+GtkWidget *ephy_location_action_get_widget (EphyLocationAction *action);
#endif
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c
index 622da5b65..3aeaef386 100644
--- a/src/ephy-navigation-action.c
+++ b/src/ephy-navigation-action.c
@@ -292,6 +292,7 @@ ephy_navigation_action_get_property (GObject *object,
break;
}
}
+
static void
ephy_navigation_action_class_init (EphyNavigationActionClass *class)
{
diff --git a/src/ephy-spinner-action.c b/src/ephy-spinner-action.c
index f9eec60bd..2d7db2dae 100644
--- a/src/ephy-spinner-action.c
+++ b/src/ephy-spinner-action.c
@@ -23,6 +23,17 @@
static void ephy_spinner_action_init (EphySpinnerAction *action);
static void ephy_spinner_action_class_init (EphySpinnerActionClass *class);
+struct EphySpinnerActionPrivate
+{
+ gboolean throbbing;
+};
+
+enum
+{
+ PROP_0,
+ PROP_THROBBING
+};
+
static GObjectClass *parent_class = NULL;
GType
@@ -52,6 +63,24 @@ ephy_spinner_action_get_type (void)
return type;
}
+static void
+ephy_spinner_action_sync_throbbing (EggAction *action, GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ EphySpinner *spinner;
+
+ spinner = EPHY_SPINNER (g_object_get_data (G_OBJECT (proxy), "spinner"));
+
+ if (EPHY_SPINNER_ACTION (action)->priv->throbbing)
+ {
+ ephy_spinner_start (spinner);
+ }
+ else
+ {
+ ephy_spinner_stop (spinner);
+ }
+}
+
static GtkWidget *
create_tool_item (EggAction *action)
{
@@ -62,6 +91,7 @@ create_tool_item (EggAction *action)
item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (item), button);
spinner = ephy_spinner_new ();
@@ -69,23 +99,84 @@ create_tool_item (EggAction *action)
gtk_container_add (GTK_CONTAINER (button), spinner);
egg_tool_item_set_pack_end (EGG_TOOL_ITEM (item), TRUE);
gtk_widget_show (spinner);
+ g_object_set_data (G_OBJECT (item), "spinner", spinner);
return item;
}
static void
+connect_proxy (EggAction *action, GtkWidget *proxy)
+{
+ g_signal_connect_object (action, "notify::throbbing",
+ G_CALLBACK (ephy_spinner_action_sync_throbbing),
+ proxy, 0);
+
+ (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+}
+static void
+ephy_spinner_action_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphySpinnerAction *spin;
+
+ spin = EPHY_SPINNER_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_THROBBING:
+ spin->priv->throbbing = g_value_get_boolean (value);
+ g_object_notify(object, "throbbing");
+ break;
+ }
+}
+
+static void
+ephy_spinner_action_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphySpinnerAction *spin;
+
+ spin = EPHY_SPINNER_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_THROBBING:
+ g_value_set_boolean (value, spin->priv->throbbing);
+ break;
+ }
+}
+
+static void
ephy_spinner_action_class_init (EphySpinnerActionClass *class)
{
EggActionClass *action_class;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
action_class = EGG_ACTION_CLASS (class);
action_class->toolbar_item_type = EGG_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
+ action_class->connect_proxy = connect_proxy;
+
+ object_class->set_property = ephy_spinner_action_set_property;
+ object_class->get_property = ephy_spinner_action_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_THROBBING,
+ g_param_spec_boolean ("throbbing",
+ "Throbbing",
+ "Throbbing",
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
ephy_spinner_action_init (EphySpinnerAction *action)
{
+ action->priv = g_new0 (EphySpinnerActionPrivate, 1);
}
diff --git a/src/ephy-spinner-action.h b/src/ephy-spinner-action.h
index 12c780ad9..adb9d76c2 100644
--- a/src/ephy-spinner-action.h
+++ b/src/ephy-spinner-action.h
@@ -31,15 +31,17 @@
typedef struct _EphySpinnerAction EphySpinnerAction;
typedef struct _EphySpinnerActionClass EphySpinnerActionClass;
+typedef struct EphySpinnerActionPrivate EphySpinnerActionPrivate;
struct _EphySpinnerAction
{
- EggAction parent;
+ EggAction parent;
+ EphySpinnerActionPrivate *priv;
};
struct _EphySpinnerActionClass
{
- EggActionClass parent_class;
+ EggActionClass parent_class;
};
GType ephy_spinner_action_get_type (void);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index d1166f35e..538834878 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -211,6 +211,7 @@ struct EphyWindowPrivate
GtkWidget *menubar;
Toolbar *toolbar;
GtkWidget *statusbar;
+ EggActionGroup *action_group;
EphyFavoritesMenu *fav_menu;
PPViewToolbar *ppview_toolbar;
GtkNotebook *notebook;
@@ -397,6 +398,7 @@ setup_window (EphyWindow *window)
egg_action_group_add_actions (action_group, ephy_menu_entries,
ephy_menu_n_entries);
egg_menu_merge_insert_action_group (merge, action_group, 0);
+ window->priv->action_group = action_group;
window->ui_merge = G_OBJECT (merge);
g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), window);
@@ -988,6 +990,8 @@ update_nav_control (EphyWindow *window)
gresult back, forward, up, stop;
EphyEmbed *embed;
EphyTab *tab;
+ EggActionGroup *action_group;
+ EggAction *action;
g_return_if_fail (window != NULL);
@@ -1002,13 +1006,16 @@ update_nav_control (EphyWindow *window)
up = ephy_embed_can_go_up (embed);
stop = ephy_tab_get_load_status (tab) & TAB_LOAD_STARTED;
- /*
- ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
- GO_BACK_CMD_PATH, !back);
- ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
- GO_FORWARD_CMD_PATH, !forward);
- ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
- GO_UP_CMD_PATH, !up);*/
+ action_group = window->priv->action_group;
+ action = egg_action_group_get_action (action_group, "GoBack");
+ g_object_set (action, "sensitive", !back, NULL);
+ action = egg_action_group_get_action (action_group, "GoForward");
+ g_object_set (action, "sensitive", !forward, NULL);
+ action = egg_action_group_get_action (action_group, "GoUp");
+ g_object_set (action, "sensitive", !up, NULL);
+
+ toolbar_update_navigation_actions (window->priv->toolbar,
+ back, forward, up);
}
static void
diff --git a/src/toolbar.c b/src/toolbar.c
index 5ecf6f582..51cf64b5f 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -230,6 +230,7 @@ toolbar_setup_actions (Toolbar *t)
action = g_object_new (EPHY_TYPE_FAVICON_ACTION,
"name", "Favicon",
+ "window", t->priv->window,
NULL);
egg_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
@@ -304,101 +305,101 @@ toolbar_set_visibility (Toolbar *t, gboolean visibility)
void
toolbar_activate_location (Toolbar *t)
{
- if (t->priv->location_entry)
- {
- ephy_location_entry_activate
- (EPHY_LOCATION_ENTRY(t->priv->location_entry));
- }
+ EggAction *action;
+ GtkWidget *location;
+
+ action = egg_action_group_get_action
+ (t->priv->action_group, "Location");
+ location = ephy_location_action_get_widget
+ (EPHY_LOCATION_ACTION (action));
+ g_return_if_fail (location != NULL);
+
+ ephy_location_entry_activate
+ (EPHY_LOCATION_ENTRY(location));
}
void
toolbar_spinner_start (Toolbar *t)
{
- if (t->priv->spinner)
- {
- ephy_spinner_start (EPHY_SPINNER(t->priv->spinner));
- }
+ EggActionGroup *action_group;
+ EggAction *action;
+
+ action_group = t->priv->action_group;
+ action = egg_action_group_get_action (action_group, "Spinner");
+ g_object_set (action, "throbbing", TRUE, NULL);
}
void
toolbar_spinner_stop (Toolbar *t)
{
- if (t->priv->spinner)
- {
- ephy_spinner_stop (EPHY_SPINNER(t->priv->spinner));
- }
-}
+ EggActionGroup *action_group;
+ EggAction *action;
-void
-toolbar_button_set_sensitive (Toolbar *t,
- ToolbarButtonID id,
- gboolean sensitivity)
-{
- switch (id)
- {
- case TOOLBAR_BACK_BUTTON:
- break;
- case TOOLBAR_FORWARD_BUTTON:
- break;
- case TOOLBAR_UP_BUTTON:
- break;
- }
+ action_group = t->priv->action_group;
+ action = egg_action_group_get_action (action_group, "Spinner");
+ g_object_set (action, "throbbing", FALSE, NULL);
}
void
toolbar_set_location (Toolbar *t,
- const char *location)
+ const char *alocation)
{
+ EggAction *action;
+ GtkWidget *location;
+
+ action = egg_action_group_get_action
+ (t->priv->action_group, "Location");
+ location = ephy_location_action_get_widget
+ (EPHY_LOCATION_ACTION (action));
g_return_if_fail (location != NULL);
- if (t->priv->location_entry)
- {
- ephy_location_entry_set_location
- (EPHY_LOCATION_ENTRY (t->priv->location_entry), location);
- }
+ ephy_location_entry_set_location
+ (EPHY_LOCATION_ENTRY (location), alocation);
}
void
toolbar_update_favicon (Toolbar *t)
{
- GdkPixbuf *pixbuf = NULL;
- EphyFaviconCache *cache;
EphyTab *tab;
const char *url;
+ EggActionGroup *action_group;
+ EggAction *action;
- cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell));
tab = ephy_window_get_active_tab (t->priv->window);
url = ephy_tab_get_favicon_url (tab);
-
- if (url)
- {
- pixbuf = ephy_favicon_cache_get (cache, url);
- }
-
- if (pixbuf)
- {
- gtk_image_set_from_pixbuf (GTK_IMAGE (t->priv->favicon), pixbuf);
- }
- else
- {
- gtk_image_set_from_stock (GTK_IMAGE (t->priv->favicon),
- GTK_STOCK_JUMP_TO,
- GTK_ICON_SIZE_MENU);
- }
+ action_group = t->priv->action_group;
+ action = egg_action_group_get_action (action_group, "Favicon");
+ g_object_set (action, "icon", url, NULL);
}
char *
toolbar_get_location (Toolbar *t)
{
- gchar *location;
- if (t->priv->location_entry)
- {
- location = ephy_location_entry_get_location
- (EPHY_LOCATION_ENTRY (t->priv->location_entry));
- }
- else
- {
- location = g_strdup ("");
- }
- return location;
+ EggAction *action;
+ GtkWidget *location;
+
+ action = egg_action_group_get_action
+ (t->priv->action_group, "Location");
+ location = ephy_location_action_get_widget
+ (EPHY_LOCATION_ACTION (action));
+ g_return_val_if_fail (location != NULL, NULL);
+
+ return ephy_location_entry_get_location
+ (EPHY_LOCATION_ENTRY (location));
+}
+
+void
+toolbar_update_navigation_actions (Toolbar *t, gboolean back, gboolean forward, gboolean up)
+{
+ EggActionGroup *action_group;
+ EggAction *action;
+
+ action_group = t->priv->action_group;
+ action = egg_action_group_get_action (action_group, "NavigationBack");
+ g_object_set (action, "sensitive", !back, NULL);
+ action = egg_action_group_get_action (action_group, "NavigationForward");
+ g_object_set (action, "sensitive", !forward, NULL);
+ action = egg_action_group_get_action (action_group, "NavigationUp");
+ g_object_set (action, "sensitive", !up, NULL);
}
+
diff --git a/src/toolbar.h b/src/toolbar.h
index 3a5a1294b..63ebff824 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -35,13 +35,6 @@ typedef struct ToolbarClass ToolbarClass;
typedef struct ToolbarPrivate ToolbarPrivate;
-typedef enum
-{
- TOOLBAR_BACK_BUTTON,
- TOOLBAR_FORWARD_BUTTON,
- TOOLBAR_UP_BUTTON
-} ToolbarButtonID;
-
struct Toolbar
{
GObject parent_object;
@@ -60,10 +53,6 @@ Toolbar *toolbar_new (EphyWindow *window);
void toolbar_set_visibility (Toolbar *t,
gboolean visibility);
-void toolbar_button_set_sensitive (Toolbar *t,
- ToolbarButtonID id,
- gboolean sensitivity);
-
void toolbar_spinner_start (Toolbar *t);
void toolbar_spinner_stop (Toolbar *t);
@@ -77,6 +66,11 @@ void toolbar_activate_location (Toolbar *t);
void toolbar_update_favicon (Toolbar *t);
+void toolbar_update_navigation_actions (Toolbar *t,
+ gboolean back,
+ gboolean forward,
+ gboolean up);
+
G_END_DECLS
#endif