aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am12
-rw-r--r--src/ephy-favicon-action.c252
-rw-r--r--src/ephy-favicon-action.h49
-rw-r--r--src/ephy-favorites-menu.c104
-rw-r--r--src/ephy-favorites-menu.h3
-rw-r--r--src/ephy-location-action.c181
-rw-r--r--src/ephy-location-action.h51
-rw-r--r--src/ephy-navigation-action.c336
-rw-r--r--src/ephy-navigation-action.h56
-rw-r--r--src/ephy-navigation-button.c612
-rw-r--r--src/ephy-navigation-button.h79
-rw-r--r--src/ephy-shell.c3
-rw-r--r--src/ephy-spinner-action.c183
-rw-r--r--src/ephy-spinner-action.h49
-rw-r--r--src/ephy-tab.c77
-rw-r--r--src/ephy-tab.h2
-rw-r--r--src/ephy-tbi.c191
-rw-r--r--src/ephy-tbi.h70
-rw-r--r--src/ephy-window.c667
-rw-r--r--src/ephy-window.h12
-rw-r--r--src/popup-commands.c364
-rw-r--r--src/popup-commands.h86
-rwxr-xr-xsrc/ppview-toolbar.c169
-rw-r--r--src/ppview-toolbar.h6
-rwxr-xr-xsrc/statusbar.c159
-rw-r--r--src/statusbar.h14
-rwxr-xr-xsrc/toolbar.c636
-rw-r--r--src/toolbar.h26
-rw-r--r--src/window-commands.c377
-rw-r--r--src/window-commands.h233
30 files changed, 2447 insertions, 2612 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e2b4a65e2..875926c3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = bookmarks
INCLUDES = \
-I$(top_srcdir)/embed \
-I$(top_srcdir)/lib \
+ -I$(top_srcdir)/lib/egg \
-I$(top_srcdir)/lib/widgets \
-I$(top_srcdir)/lib/toolbar \
-I$(top_srcdir)/src/bookmarks \
@@ -45,19 +46,22 @@ epiphany_SOURCES = \
appearance-prefs.h \
ephy-automation.c \
ephy-automation.h \
+ ephy-favicon-action.c \
+ ephy-favicon-action.h \
ephy-favorites-menu.c \
ephy-favorites-menu.h \
ephy-history-model.c \
ephy-history-model.h \
+ ephy-location-action.c \
+ ephy-location-action.h \
ephy-main.c \
- ephy-navigation-button.c \
- ephy-navigation-button.h \
+ ephy-navigation-action.c \
ephy-shell.c \
ephy-shell.h \
+ ephy-spinner-action.c \
+ ephy-spinner-action.h \
ephy-tab.c \
ephy-tab.h \
- ephy-tbi.c \
- ephy-tbi.h \
ephy-window.c \
ephy-window.h \
general-prefs.c \
diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c
new file mode 100644
index 000000000..9fa68acf2
--- /dev/null
+++ b/src/ephy-favicon-action.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#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);
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_favicon_action_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type)
+ {
+ static const GTypeInfo type_info =
+ {
+ sizeof (EphyFaviconActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) ephy_favicon_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (EphyFaviconAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_favicon_action_init,
+ };
+
+ type = g_type_register_static (EGG_TYPE_ACTION,
+ "EphyFaviconAction",
+ &type_info, 0);
+ }
+ return type;
+}
+
+static GtkWidget *
+create_tool_item (EggAction *action)
+{
+ GtkWidget *image;
+ GtkWidget *ebox;
+ GtkWidget *item;
+
+ item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
+
+ ebox = gtk_event_box_new ();
+ image = gtk_image_new ();
+ gtk_container_add (GTK_CONTAINER (ebox), image);
+ gtk_container_set_border_width (GTK_CONTAINER (ebox), 2);
+ gtk_container_add (GTK_CONTAINER (item), ebox);
+ 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
new file mode 100644
index 000000000..31f6c3d82
--- /dev/null
+++ b/src/ephy-favicon-action.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#ifndef EPHY_FAVICON_ACTION_H
+#define EPHY_FAVICON_ACTION_H
+
+#include <gtk/gtk.h>
+#include <egg-action.h>
+
+#define EPHY_TYPE_FAVICON_ACTION (ephy_favicon_action_get_type ())
+#define EPHY_FAVICON_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_FAVICON_ACTION, EphyFaviconAction))
+#define EPHY_FAVICON_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_FAVICON_ACTION, EphyFaviconActionClass))
+#define EPHY_IS_FAVICON_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_FAVICON_ACTION))
+#define EPHY_IS_FAVICON_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_FAVICON_ACTION))
+#define EPHY_FAVICON_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_FAVICON_ACTION, EphyFaviconActionClass))
+
+typedef struct _EphyFaviconAction EphyFaviconAction;
+typedef struct _EphyFaviconActionClass EphyFaviconActionClass;
+typedef struct EphyFaviconActionPrivate EphyFaviconActionPrivate;
+
+struct _EphyFaviconAction
+{
+ EggAction parent;
+ EphyFaviconActionPrivate *priv;
+};
+
+struct _EphyFaviconActionClass
+{
+ EggActionClass parent_class;
+};
+
+GType ephy_favicon_action_get_type (void);
+
+#endif
diff --git a/src/ephy-favorites-menu.c b/src/ephy-favorites-menu.c
index b463663c2..8a557a7ad 100644
--- a/src/ephy-favorites-menu.c
+++ b/src/ephy-favorites-menu.c
@@ -23,7 +23,7 @@
#include "ephy-favorites-menu.h"
#include "ephy-gobject-misc.h"
#include "ephy-string.h"
-#include "ephy-bonobo-extensions.h"
+#include "egg-menu-merge.h"
#include "ephy-marshal.h"
#include "ephy-shell.h"
#include "ephy-debug.h"
@@ -39,9 +39,10 @@
*/
struct _EphyFavoritesMenuPrivate
{
- gchar *path;
EphyWindow *window;
EphyBookmarks *bookmarks;
+ EggActionGroup *action_group;
+ guint ui_id;
};
typedef struct
@@ -109,18 +110,35 @@ ephy_favorites_menu_init (EphyFavoritesMenu *wrhm)
wrhm->priv = p;
wrhm->priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ wrhm->priv->ui_id = -1;
+ wrhm->priv->action_group = NULL;
}
static void
-ephy_favorites_menu_finalize_impl (GObject *o)
+ephy_favorites_menu_clean (EphyFavoritesMenu *wrhm)
{
- EphyFavoritesMenu *wrhm = EPHY_FAVORITES_MENU (o);
EphyFavoritesMenuPrivate *p = wrhm->priv;
+ EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+
+ if (p->ui_id >= 0)
+ {
+ egg_menu_merge_remove_ui (merge, p->ui_id);
+ }
- if (p->path)
+ if (p->action_group != NULL)
{
- g_free (p->path);
+ egg_menu_merge_remove_action_group (merge, p->action_group);
+ g_object_unref (p->action_group);
}
+}
+
+static void
+ephy_favorites_menu_finalize_impl (GObject *o)
+{
+ EphyFavoritesMenu *wrhm = EPHY_FAVORITES_MENU (o);
+ EphyFavoritesMenuPrivate *p = wrhm->priv;
+
+ ephy_favorites_menu_clean (wrhm);
g_free (p);
@@ -139,6 +157,7 @@ ephy_favorites_menu_set_property (GObject *object,
{
case PROP_EPHY_WINDOW:
m->priv->window = g_value_get_object (value);
+ ephy_favorites_menu_rebuild (m);
break;
}
}
@@ -168,26 +187,6 @@ ephy_favorites_menu_new (EphyWindow *window)
return ret;
}
-void
-ephy_favorites_menu_set_path (EphyFavoritesMenu *wrhm,
- const gchar *path)
-{
- EphyFavoritesMenuPrivate *p;
-
- g_return_if_fail (EPHY_IS_FAVORITES_MENU (wrhm));
- g_return_if_fail (path != NULL);
-
- p = wrhm->priv;
-
- if (p->path)
- {
- g_free (p->path);
- }
- p->path = g_strdup (path);
-
- ephy_favorites_menu_update (wrhm);
-}
-
static void
ephy_favorites_menu_verb_cb (BonoboUIComponent *uic,
FavoriteData *data,
@@ -204,11 +203,7 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
gint i;
EphyNode *fav;
GPtrArray *children;
- BonoboUIComponent *uic = BONOBO_UI_COMPONENT (p->window->ui_component);
-
- if (!p->path) return;
-
- ephy_bonobo_clear_path (uic, p->path);
+ EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
LOG ("Rebuilding recent history menu")
@@ -216,17 +211,22 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
children = ephy_node_get_children (fav);
xml = g_string_new (NULL);
- g_string_append_printf (xml, "<placeholder name=\"wrhm%x\">\n", (guint) wrhm);
+ g_string_append (xml, "<Root><menu><submenu name=\"GoMenu\">"
+ "<placeholder name=\"GoFavorites\">");
+
+ p->action_group = egg_action_group_new ("FavoritesActions");
+ egg_menu_merge_insert_action_group (merge, p->action_group, 0);
for (i = 0; i < children->len; i++)
{
- char *verb = g_strdup_printf ("Wrhm%xn%d", (guint) wrhm, i);
+ char *verb = g_strdup_printf ("GoFav%d", i);
char *title_s;
const char *title;
const char *url;
xmlChar *label_x;
EphyNode *child;
FavoriteData *data;
+ EggAction *action;
child = g_ptr_array_index (children, i);
title = ephy_node_get_property_string (child, EPHY_NODE_BMK_PROP_TITLE);
@@ -234,21 +234,32 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
title_s = ephy_string_shorten (title, MAX_LABEL_LENGTH);
label_x = xmlEncodeSpecialChars (NULL, title_s);
+ data = g_new0 (FavoriteData, 1);
+ data->window = wrhm->priv->window;
+ data->url = url;
+
+ action = g_object_new (EGG_TYPE_ACTION,
+ "name", verb,
+ "label", label_x,
+ "tooltip", "Hello",
+ "stock_id", NULL,
+ NULL);
+ g_signal_connect_closure
+ (action, "activate",
+ g_cclosure_new (G_CALLBACK (ephy_favorites_menu_verb_cb),
+ data,
+ (GClosureNotify)g_free),
+ FALSE);
+ egg_action_group_add_action (p->action_group, action);
+ g_object_unref (action);
+
g_string_append (xml, "<menuitem name=\"");
g_string_append (xml, verb);
- g_string_append (xml, "\" label=\"");
- g_string_append (xml, label_x);
+ g_string_append (xml, "Menu");
g_string_append (xml, "\" verb=\"");
g_string_append (xml, verb);
g_string_append (xml, "\"/>\n");
- data = g_new0 (FavoriteData, 1);
- data->window = wrhm->priv->window;
- data->url = url;
- bonobo_ui_component_add_verb_full (uic, verb, g_cclosure_new
- (G_CALLBACK (ephy_favorites_menu_verb_cb), data,
- (GClosureNotify)g_free));
-
xmlFree (label_x);
g_free (title_s);
g_free (verb);
@@ -256,13 +267,16 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
ephy_node_thaw (fav);
- g_string_append (xml, "</placeholder>\n");
+ g_string_append (xml, "</placeholder></submenu></menu></Root>");
if (children->len > 0)
{
- bonobo_ui_component_set (uic, p->path,
- xml->str, NULL);
+ GError *error = NULL;
+
+ p->ui_id = egg_menu_merge_add_ui_from_string
+ (merge, xml->str, -1, &error);
}
+
g_string_free (xml, TRUE);
}
diff --git a/src/ephy-favorites-menu.h b/src/ephy-favorites-menu.h
index b76e8d2d8..228cbcef8 100644
--- a/src/ephy-favorites-menu.h
+++ b/src/ephy-favorites-menu.h
@@ -59,8 +59,5 @@ EphyFavoritesMenu *ephy_favorites_menu_new (EphyWindow *window);
void ephy_favorites_menu_update (EphyFavoritesMenu *wrhm);
-void ephy_favorites_menu_set_path (EphyFavoritesMenu *wrhm,
- const gchar *path);
-
#endif
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
new file mode 100644
index 000000000..07f7e6c2b
--- /dev/null
+++ b/src/ephy-location-action.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#include "ephy-location-action.h"
+#include "ephy-location-entry.h"
+#include "ephy-shell.h"
+#include "ephy-debug.h"
+#include "eggtoolitem.h"
+
+static void ephy_location_action_init (EphyLocationAction *action);
+static void ephy_location_action_class_init (EphyLocationActionClass *class);
+
+enum
+{
+ GO_LOCATION,
+ LAST_SIGNAL
+};
+
+static GObjectClass *parent_class = NULL;
+
+static guint ephy_location_action_signals[LAST_SIGNAL] = { 0 };
+
+GType
+ephy_location_action_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type)
+ {
+ static const GTypeInfo type_info =
+ {
+ sizeof (EphyLocationActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) ephy_location_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (EphyLocationAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_location_action_init,
+ };
+
+ type = g_type_register_static (EGG_TYPE_ACTION,
+ "EphyLocationAction",
+ &type_info, 0);
+ }
+ return type;
+}
+
+static GtkWidget *
+create_tool_item (EggAction *action)
+{
+ GtkWidget *item;
+ GtkWidget *location;
+
+ LOG ("Create location toolitem")
+
+ item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
+
+ location = ephy_location_entry_new ();
+ gtk_container_add (GTK_CONTAINER (item), location);
+ egg_tool_item_set_expandable (EGG_TOOL_ITEM (item), TRUE);
+ gtk_widget_show (location);
+
+ LOG ("Create location toolitem: Done.")
+
+ return item;
+}
+
+static void
+location_url_activate_cb (EphyLocationEntry *entry,
+ const char *content,
+ const char *target,
+ EphyLocationAction *action)
+{
+ EphyBookmarks *bookmarks;
+ LOG ("Location url activated")
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+
+ if (!content)
+ {
+ LOG ("Go to %s", target);
+ g_signal_emit (action,
+ ephy_location_action_signals[GO_LOCATION],
+ 0, target);
+ }
+ else
+ {
+ char *url;
+
+ url = ephy_bookmarks_solve_smart_url
+ (bookmarks, target, content);
+ g_return_if_fail (url != NULL);
+ LOG ("Go to %s", url);
+ g_signal_emit (action,
+ ephy_location_action_signals[GO_LOCATION],
+ 0, url);
+ g_free (url);
+ }
+}
+
+static void
+connect_proxy (EggAction *action, GtkWidget *proxy)
+{
+ EphyAutocompletion *ac = ephy_shell_get_autocompletion (ephy_shell);
+ EphyLocationEntry *e;
+
+ LOG ("Connect location proxy")
+
+ e = EPHY_LOCATION_ENTRY (GTK_BIN (proxy)->child);
+ ephy_location_entry_set_autocompletion (e, ac);
+
+ g_signal_connect (e, "activated",
+ GTK_SIGNAL_FUNC(location_url_activate_cb),
+ action);
+
+ (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+}
+
+static void
+ephy_location_action_class_init (EphyLocationActionClass *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;
+
+ ephy_location_action_signals[GO_LOCATION] =
+ g_signal_new ("go_location",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EphyLocationActionClass, go_location),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+}
+
+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
new file mode 100644
index 000000000..daa609aee
--- /dev/null
+++ b/src/ephy-location-action.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#ifndef EPHY_LOCATION_ACTION_H
+#define EPHY_LOCATION_ACTION_H
+
+#include <gtk/gtk.h>
+#include <egg-action.h>
+
+#define EPHY_TYPE_LOCATION_ACTION (ephy_location_action_get_type ())
+#define EPHY_LOCATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_LOCATION_ACTION, EphyLocationAction))
+#define EPHY_LOCATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_LOCATION_ACTION, EphyLocationActionClass))
+#define EPHY_IS_LOCATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_LOCATION_ACTION))
+#define EPHY_IS_LOCATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_LOCATION_ACTION))
+#define EPHY_LOCATION_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_LOCATION_ACTION, EphyLocationActionClass))
+
+typedef struct _EphyLocationAction EphyLocationAction;
+typedef struct _EphyLocationActionClass EphyLocationActionClass;
+
+struct _EphyLocationAction
+{
+ EggAction parent;
+};
+
+struct _EphyLocationActionClass
+{
+ EggActionClass parent_class;
+
+ void (*go_location) (EphyLocationAction *action, char *location);
+};
+
+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
new file mode 100644
index 000000000..3aeaef386
--- /dev/null
+++ b/src/ephy-navigation-action.c
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#include "ephy-navigation-action.h"
+#include "ephy-arrow-toolbutton.h"
+#include "ephy-window.h"
+#include "ephy-debug.h"
+
+static void ephy_navigation_action_init (EphyNavigationAction *action);
+static void ephy_navigation_action_class_init (EphyNavigationActionClass *class);
+
+static GObjectClass *parent_class = NULL;
+
+struct EphyNavigationActionPrivate
+{
+ EphyWindow *window;
+ EphyNavigationDirection direction;
+};
+
+enum
+{
+ PROP_0,
+ PROP_DIRECTION,
+ PROP_WINDOW
+};
+
+GType
+ephy_navigation_action_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type)
+ {
+ static const GTypeInfo type_info =
+ {
+ sizeof (EphyNavigationActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) ephy_navigation_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (EphyNavigationAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_navigation_action_init,
+ };
+
+ type = g_type_register_static (EGG_TYPE_ACTION,
+ "EphyNavigationAction",
+ &type_info, 0);
+ }
+ return type;
+}
+
+static GtkWidget *
+new_history_menu_item (gchar *origtext,
+ const GdkPixbuf *ico)
+{
+ GtkWidget *item = gtk_image_menu_item_new ();
+ GtkWidget *hb = gtk_hbox_new (FALSE, 0);
+ GtkWidget *label = gtk_label_new (origtext);
+
+ gtk_box_pack_start (GTK_BOX (hb), label, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (item), hb);
+
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+ gtk_image_new_from_pixbuf ((GdkPixbuf *) ico));
+
+ gtk_widget_show_all (item);
+
+ return item;
+}
+
+static void
+activate_back_or_forward_menu_item_cb (GtkWidget *menu, EphyWindow *window)
+{
+ EphyEmbed *embed;
+ int go_nth;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ go_nth = (int)g_object_get_data (G_OBJECT(menu), "go_nth");
+
+ ephy_embed_shistory_go_nth (embed, go_nth);
+}
+
+static void
+activate_up_menu_item_cb (GtkWidget *menu, EphyWindow *window)
+{
+ EphyEmbed *embed;
+ int go_nth;
+ GSList *l;
+ gchar *url;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ go_nth = (int)g_object_get_data (G_OBJECT(menu), "go_nth");
+
+ ephy_embed_get_go_up_list (embed, &l);
+
+ url = g_slist_nth_data (l, go_nth);
+ if (url)
+ {
+ ephy_embed_load_url (embed, url);
+ }
+
+ g_slist_foreach (l, (GFunc) g_free, NULL);
+ g_slist_free (l);
+}
+
+static void
+setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigationDirection dir)
+{
+ int pos, count;
+ EphyEmbed *embed;
+ int start, end;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_shistory_get_pos (embed, &pos);
+ ephy_embed_shistory_count (embed, &count);
+
+ if (count == 0) return;
+
+ if (dir == EPHY_NAVIGATION_DIRECTION_BACK)
+ {
+ start = pos - 1;
+ end = -1;
+ }
+ else
+ {
+ start = pos + 1;
+ end = count;
+ }
+
+ while (start != end)
+ {
+ char *title, *url;
+ GtkWidget *item;
+ ephy_embed_shistory_get_nth (embed, start, FALSE, &url, &title);
+ item = new_history_menu_item (title ? title : url, NULL);
+ gtk_menu_shell_append (ms, item);
+ g_object_set_data (G_OBJECT (item), "go_nth", GINT_TO_POINTER (start));
+ g_signal_connect (item, "activate",
+ G_CALLBACK (activate_back_or_forward_menu_item_cb), window);
+ gtk_widget_show_all (item);
+
+ g_free (url);
+ g_free (title);
+
+ if (start < end)
+ {
+ start++;
+ }
+ else
+ {
+ start--;
+ }
+ }
+}
+
+static void
+setup_up_menu (EphyWindow *window, GtkMenuShell *ms)
+{
+ EphyEmbed *embed;
+ GSList *l;
+ GSList *li;
+ int count = 0;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_get_go_up_list (embed, &l);
+
+ for (li = l; li; li = li->next)
+ {
+ char *url = li->data;
+ GtkWidget *item;
+
+ item = new_history_menu_item (url, NULL);
+ gtk_menu_shell_append (ms, item);
+ g_object_set_data (G_OBJECT(item), "go_nth", GINT_TO_POINTER (count));
+ g_signal_connect (item, "activate",
+ G_CALLBACK (activate_up_menu_item_cb), window);
+ gtk_widget_show_all (item);
+ count ++;
+ }
+
+ g_slist_foreach (l, (GFunc) g_free, NULL);
+ g_slist_free (l);
+}
+
+static void
+menu_activated_cb (EphyArrowToolButton *w, EphyNavigationAction *b)
+{
+ EphyNavigationActionPrivate *p = b->priv;
+ GtkMenuShell *ms = ephy_arrow_toolbutton_get_menu (w);
+ EphyWindow *win = b->priv->window;
+ GList *children;
+ GList *li;
+
+ LOG ("Show navigation menu")
+
+ children = gtk_container_get_children (GTK_CONTAINER (ms));
+ for (li = children; li; li = li->next)
+ {
+ gtk_container_remove (GTK_CONTAINER (ms), li->data);
+ }
+ g_list_free (children);
+
+ switch (p->direction)
+ {
+ case EPHY_NAVIGATION_DIRECTION_UP:
+ setup_up_menu (win, ms);
+ break;
+ case EPHY_NAVIGATION_DIRECTION_FORWARD:
+ case EPHY_NAVIGATION_DIRECTION_BACK:
+ setup_back_or_forward_menu (win, ms, p->direction);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+}
+
+static void
+connect_proxy (EggAction *action, GtkWidget *proxy)
+{
+ LOG ("Connect navigation action proxy")
+
+ g_signal_connect (proxy, "menu-activated",
+ G_CALLBACK (menu_activated_cb), action);
+
+ (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+}
+
+static void
+ephy_navigation_action_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyNavigationAction *nav;
+
+ nav = EPHY_NAVIGATION_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_DIRECTION:
+ nav->priv->direction = g_value_get_int (value);
+ break;
+ case PROP_WINDOW:
+ nav->priv->window = EPHY_WINDOW (g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+ephy_navigation_action_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyNavigationAction *nav;
+
+ nav = EPHY_NAVIGATION_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_DIRECTION:
+ g_value_set_int (value, nav->priv->direction);
+ break;
+ case PROP_WINDOW:
+ g_value_set_object (value, nav->priv->window);
+ break;
+ }
+}
+
+static void
+ephy_navigation_action_class_init (EphyNavigationActionClass *class)
+{
+ EggActionClass *action_class;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ object_class->set_property = ephy_navigation_action_set_property;
+ object_class->get_property = ephy_navigation_action_get_property;
+
+ parent_class = g_type_class_peek_parent (class);
+ action_class = EGG_ACTION_CLASS (class);
+
+ action_class->toolbar_item_type = EPHY_ARROW_TOOLBUTTON_TYPE;
+ action_class->connect_proxy = connect_proxy;
+
+ g_object_class_install_property (object_class,
+ PROP_DIRECTION,
+ g_param_spec_int ("direction",
+ "Direction",
+ "Direction",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_WINDOW,
+ g_param_spec_object ("window",
+ "Window",
+ "The navigation window",
+ G_TYPE_OBJECT,
+ G_PARAM_READWRITE));
+
+}
+
+static void
+ephy_navigation_action_init (EphyNavigationAction *action)
+{
+ action->priv = g_new0 (EphyNavigationActionPrivate, 1);
+}
+
+
diff --git a/src/ephy-navigation-action.h b/src/ephy-navigation-action.h
new file mode 100644
index 000000000..0e6c23dbe
--- /dev/null
+++ b/src/ephy-navigation-action.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#ifndef EPHY_NAVIGATION_ACTION_H
+#define EPHY_NAVIGATION_ACTION_H
+
+#include <gtk/gtk.h>
+#include <egg-action.h>
+
+#define EPHY_TYPE_NAVIGATION_ACTION (ephy_navigation_action_get_type ())
+#define EPHY_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationAction))
+#define EPHY_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionClass))
+#define EPHY_IS_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_NAVIGATION_ACTION))
+#define EPHY_IS_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_NAVIGATION_ACTION))
+#define EPHY_NAVIGATION_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionClass))
+
+typedef struct _EphyNavigationAction EphyNavigationAction;
+typedef struct _EphyNavigationActionClass EphyNavigationActionClass;
+typedef struct EphyNavigationActionPrivate EphyNavigationActionPrivate;
+
+typedef enum
+{
+ EPHY_NAVIGATION_DIRECTION_UP,
+ EPHY_NAVIGATION_DIRECTION_BACK,
+ EPHY_NAVIGATION_DIRECTION_FORWARD
+} EphyNavigationDirection;
+
+struct _EphyNavigationAction
+{
+ EggAction parent;
+ EphyNavigationActionPrivate *priv;
+};
+
+struct _EphyNavigationActionClass
+{
+ EggActionClass parent_class;
+};
+
+GType ephy_navigation_action_get_type (void);
+
+#endif
diff --git a/src/ephy-navigation-button.c b/src/ephy-navigation-button.c
deleted file mode 100644
index d0d80af7f..000000000
--- a/src/ephy-navigation-button.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- * Copyright (C) 2002 Ricardo Fernández Pascual
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ephy-gobject-misc.h"
-#include "ephy-marshal.h"
-#include "ephy-tb-button.h"
-#include "ephy-gui.h"
-#include "ephy-string.h"
-#include "ephy-navigation-button.h"
-#include "ephy-debug.h"
-
-#include <gtk/gtkstock.h>
-#include <string.h>
-#include <libgnome/gnome-i18n.h>
-
-/**
- * Private data
- */
-struct _EphyNavigationButtonPrivate
-{
- EphyTbButton *widget;
- EphyNavigationDirection direction;
- gboolean show_arrow;
- gboolean sensitive;
-};
-
-enum
-{
- TOOLBAR_ITEM_STYLE_PROP,
- TOOLBAR_ITEM_ORIENTATION_PROP,
- TOOLBAR_ITEM_WANT_LABEL_PROP
-};
-
-/**
- * Private functions, only availble from this file
- */
-static void ephy_navigation_button_class_init (EphyNavigationButtonClass *klass);
-static void ephy_navigation_button_init (EphyNavigationButton *tb);
-static void ephy_navigation_button_finalize_impl (GObject *o);
-static GtkWidget * ephy_navigation_button_get_widget_impl (EphyTbItem *i);
-static GdkPixbuf * ephy_navigation_button_get_icon_impl (EphyTbItem *i);
-static gchar * ephy_navigation_button_get_name_human_impl (EphyTbItem *i);
-static gchar * ephy_navigation_button_to_string_impl (EphyTbItem *i);
-static EphyTbItem * ephy_navigation_button_clone_impl (EphyTbItem *i);
-static void ephy_navigation_button_parse_properties_impl (EphyTbItem *i, const gchar *props);
-static void ephy_navigation_button_menu_activated_cb (EphyTbButton *w, EphyNavigationButton *b);
-static void ephy_navigation_button_clicked_cb (GtkWidget *w, EphyNavigationButton *b);
-
-
-static gpointer ephy_tb_item_class;
-
-/**
- * TbiZoom object
- */
-
-MAKE_GET_TYPE (ephy_navigation_button, "EphyNavigationButton", EphyNavigationButton,
- ephy_navigation_button_class_init,
- ephy_navigation_button_init, EPHY_TYPE_TBI);
-
-static void
-ephy_navigation_button_class_init (EphyNavigationButtonClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = ephy_navigation_button_finalize_impl;
-
- EPHY_TB_ITEM_CLASS (klass)->get_widget = ephy_navigation_button_get_widget_impl;
- EPHY_TB_ITEM_CLASS (klass)->get_icon = ephy_navigation_button_get_icon_impl;
- EPHY_TB_ITEM_CLASS (klass)->get_name_human = ephy_navigation_button_get_name_human_impl;
- EPHY_TB_ITEM_CLASS (klass)->to_string = ephy_navigation_button_to_string_impl;
- EPHY_TB_ITEM_CLASS (klass)->clone = ephy_navigation_button_clone_impl;
- EPHY_TB_ITEM_CLASS (klass)->parse_properties = ephy_navigation_button_parse_properties_impl;
-
- ephy_tb_item_class = g_type_class_peek_parent (klass);
-}
-
-static void
-ephy_navigation_button_init (EphyNavigationButton *tbi)
-{
- EphyNavigationButtonPrivate *p = g_new0 (EphyNavigationButtonPrivate, 1);
- tbi->priv = p;
-
- p->direction = EPHY_NAVIGATION_DIRECTION_UP;
- p->show_arrow = TRUE;
- p->sensitive = TRUE;
-}
-
-EphyNavigationButton *
-ephy_navigation_button_new (void)
-{
- EphyNavigationButton *ret = g_object_new (EPHY_TYPE_NAVIGATION_BUTTON, NULL);
- return ret;
-}
-
-static void
-ephy_navigation_button_finalize_impl (GObject *o)
-{
- EphyNavigationButton *it = EPHY_NAVIGATION_BUTTON (o);
- EphyNavigationButtonPrivate *p = it->priv;
-
- if (p->widget)
- {
- g_object_unref (p->widget);
- }
-
- g_free (p);
-
- LOG ("EphyNavigationButton finalized")
-
- G_OBJECT_CLASS (ephy_tb_item_class)->finalize (o);
-}
-
-static void
-ephy_navigation_button_setup_widget (EphyNavigationButton *b)
-{
- EphyNavigationButtonPrivate *p = b->priv;
- const gchar *label;
- const gchar *tip;
- gboolean prio;
-
- if (!p->widget)
- {
- ephy_navigation_button_get_widget_impl (EPHY_TB_ITEM (b));
- }
- g_assert (EPHY_IS_TB_BUTTON (p->widget));
-
- switch (p->direction)
- {
- case EPHY_NAVIGATION_DIRECTION_UP:
- label = "gtk-go-up";
- tip = _("Go up");
- prio = FALSE;
- break;
- case EPHY_NAVIGATION_DIRECTION_BACK:
- label = "gtk-go-back";
- tip = _("Go back");
- prio = TRUE;
- break;
- case EPHY_NAVIGATION_DIRECTION_FORWARD:
- label = "gtk-go-forward";
- tip = _("Go forward");
- prio = FALSE;
- break;
- default:
- g_assert_not_reached ();
- label = NULL;
- tip = NULL;
- prio = FALSE;
- break;
- }
-
- ephy_tb_button_set_label (p->widget, label);
- ephy_tb_button_set_tooltip_text (p->widget, tip);
- ephy_tb_button_set_priority (p->widget, prio);
- ephy_tb_button_set_show_arrow (p->widget, p->show_arrow);
- ephy_tb_button_set_sensitivity (p->widget, p->sensitive);
-}
-
-static GtkWidget *
-ephy_navigation_button_get_widget_impl (EphyTbItem *i)
-{
- EphyNavigationButton *iz = EPHY_NAVIGATION_BUTTON (i);
- EphyNavigationButtonPrivate *p = iz->priv;
-
- if (!p->widget)
- {
- p->widget = ephy_tb_button_new ();
- g_object_ref (p->widget);
- ephy_tb_button_set_use_stock (p->widget, TRUE);
- ephy_tb_button_set_enable_menu (p->widget, TRUE);
-
- ephy_navigation_button_setup_widget (iz);
-
- gtk_widget_show (GTK_WIDGET (p->widget));
-
- g_signal_connect (p->widget, "menu-activated",
- G_CALLBACK (ephy_navigation_button_menu_activated_cb), i);
- g_signal_connect (ephy_tb_button_get_button (p->widget), "clicked",
- G_CALLBACK (ephy_navigation_button_clicked_cb), i);
- }
-
- return GTK_WIDGET (p->widget);
-}
-
-static GdkPixbuf *
-ephy_navigation_button_get_icon_impl (EphyTbItem *i)
-{
- EphyNavigationButtonPrivate *p = EPHY_NAVIGATION_BUTTON (i)->priv;
-
- static GdkPixbuf *pb_up = NULL;
- static GdkPixbuf *pb_back = NULL;
- static GdkPixbuf *pb_forward = NULL;
-
- if (!pb_up)
- {
- /* what's the easier way? */
- GtkWidget *b = gtk_button_new ();
- pb_up = gtk_widget_render_icon (b,
- GTK_STOCK_GO_UP,
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- NULL);
- pb_back = gtk_widget_render_icon (b,
- GTK_STOCK_GO_BACK,
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- NULL);
- pb_forward = gtk_widget_render_icon (b,
- GTK_STOCK_GO_FORWARD,
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- NULL);
- gtk_widget_destroy (b);
- }
-
- switch (p->direction)
- {
- case EPHY_NAVIGATION_DIRECTION_BACK:
- return g_object_ref (pb_back);
- break;
- case EPHY_NAVIGATION_DIRECTION_FORWARD:
- return g_object_ref (pb_forward);
- break;
- case EPHY_NAVIGATION_DIRECTION_UP:
- return g_object_ref (pb_up);
- break;
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static gchar *
-ephy_navigation_button_get_name_human_impl (EphyTbItem *i)
-{
- EphyNavigationButtonPrivate *p = EPHY_NAVIGATION_BUTTON (i)->priv;
- const gchar *ret;
-
- switch (p->direction)
- {
- case EPHY_NAVIGATION_DIRECTION_BACK:
- ret = p->show_arrow
- ? _("Back (with menu)")
- : _("Back");
- break;
- case EPHY_NAVIGATION_DIRECTION_FORWARD:
- ret = p->show_arrow
- ? _("Forward (with menu)")
- : _("Forward");
- break;
- case EPHY_NAVIGATION_DIRECTION_UP:
- ret = p->show_arrow
- ? _("Up (with menu)")
- : _("Up");
- break;
- default:
- g_assert_not_reached ();
- ret = "Error: unexpected direction";
- break;
- }
-
- return g_strdup (ret);
-}
-
-static gchar *
-ephy_navigation_button_to_string_impl (EphyTbItem *i)
-{
- EphyNavigationButtonPrivate *p = EPHY_NAVIGATION_BUTTON (i)->priv;
-
- /* if it had any properties, the string should include them */
- const char *sdir;
-
- switch (p->direction)
- {
- case EPHY_NAVIGATION_DIRECTION_BACK:
- sdir = "back";
- break;
- case EPHY_NAVIGATION_DIRECTION_FORWARD:
- sdir = "forward";
- break;
- case EPHY_NAVIGATION_DIRECTION_UP:
- sdir = "up";
- break;
- default:
- g_assert_not_reached ();
- sdir = "unknown";
- }
-
- return g_strdup_printf ("%s=navigation_button(direction=%s,arrow=%s)",
- i->id, sdir, p->show_arrow ? "TRUE" : "FALSE");
-}
-
-static EphyTbItem *
-ephy_navigation_button_clone_impl (EphyTbItem *i)
-{
- EphyTbItem *ret = EPHY_TB_ITEM (ephy_navigation_button_new ());
- EphyNavigationButtonPrivate *p = EPHY_NAVIGATION_BUTTON (i)->priv;
-
- ephy_tb_item_set_id (ret, i->id);
-
- ephy_navigation_button_set_direction (EPHY_NAVIGATION_BUTTON (ret), p->direction);
- ephy_navigation_button_set_show_arrow (EPHY_NAVIGATION_BUTTON (ret), p->show_arrow);
-
- return ret;
-}
-
-static void
-ephy_navigation_button_parse_properties_impl (EphyTbItem *it, const gchar *props)
-{
- EphyNavigationButton *b = EPHY_NAVIGATION_BUTTON (it);
-
- /* we have two properties, the direction and the arrow */
- const gchar *direc_prop;
- const gchar *show_arrow_prop;
-
- direc_prop = strstr (props, "direction=");
- if (direc_prop)
- {
- direc_prop += strlen ("direction=");
- if (!strncmp (direc_prop, "back", 4))
- {
- ephy_navigation_button_set_direction (b, EPHY_NAVIGATION_DIRECTION_BACK);
- }
- else if (!strncmp (direc_prop, "forward", 4))
- {
- ephy_navigation_button_set_direction (b, EPHY_NAVIGATION_DIRECTION_FORWARD);
- }
- else if (!strncmp (direc_prop, "up", 2))
- {
- ephy_navigation_button_set_direction (b, EPHY_NAVIGATION_DIRECTION_UP);
- }
- }
-
- show_arrow_prop = strstr (props, "arrow=");
- if (show_arrow_prop)
- {
- show_arrow_prop += strlen ("arrow=");
- if (show_arrow_prop[0] == 'T')
- {
- ephy_navigation_button_set_show_arrow (b, TRUE);
- }
- else
- {
- ephy_navigation_button_set_show_arrow (b, FALSE);
- }
- }
-}
-
-
-void
-ephy_navigation_button_set_direction (EphyNavigationButton *b,
- EphyNavigationDirection d)
-{
- EphyNavigationButtonPrivate *p = b->priv;
- p->direction = d;
- ephy_navigation_button_setup_widget (b);
-}
-
-void
-ephy_navigation_button_set_show_arrow (EphyNavigationButton *b,
- gboolean value)
-{
- EphyNavigationButtonPrivate *p = b->priv;
- p->show_arrow = value;
- if (p->widget)
- {
- ephy_tb_button_set_show_arrow (p->widget, p->show_arrow);
- }
- else
- {
- ephy_navigation_button_get_widget_impl (EPHY_TB_ITEM (b));
- }
-}
-
-EphyNavigationDirection
-ephy_navigation_button_get_direction (EphyNavigationButton *b)
-{
- return b->priv->direction;
-}
-
-void
-ephy_navigation_button_set_sensitive (EphyNavigationButton *b, gboolean s)
-{
- EphyNavigationButtonPrivate *p = b->priv;
- p->sensitive = s;
- if (p->widget)
- {
- ephy_tb_button_set_sensitivity (p->widget, s);
- }
- else
- {
- ephy_navigation_button_get_widget_impl (EPHY_TB_ITEM (b));
- }
-}
-
-static void
-ephy_navigation_button_clicked_cb (GtkWidget *w, EphyNavigationButton *b)
-{
- EphyNavigationButtonPrivate *p = b->priv;
- EphyWindow *window;
- EphyEmbed *embed;
-
- window = ephy_tbi_get_window (EPHY_TBI (b));
- g_return_if_fail (window != NULL);
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- switch (p->direction)
- {
- case EPHY_NAVIGATION_DIRECTION_UP:
- ephy_embed_go_up (embed);
- break;
- case EPHY_NAVIGATION_DIRECTION_BACK:
- ephy_embed_go_back (embed);
- break;
- case EPHY_NAVIGATION_DIRECTION_FORWARD:
- ephy_embed_go_forward (embed);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-/* TODO: clean all this, it came from toolbar.c and is messy */
-
-static GtkWidget *
-new_history_menu_item (gchar *origtext,
- const GdkPixbuf *ico)
-{
- GtkWidget *item = gtk_image_menu_item_new ();
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
- GtkWidget *label = gtk_label_new (origtext);
-
- gtk_box_pack_start (GTK_BOX (hb), label, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (item), hb);
-
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
- gtk_image_new_from_pixbuf ((GdkPixbuf *) ico));
-
- gtk_widget_show_all (item);
-
- return item;
-}
-
-static void
-activate_back_or_forward_menu_item_cb (GtkWidget *menu, EphyWindow *window)
-{
- EphyEmbed *embed;
- int go_nth;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- go_nth = (int)g_object_get_data (G_OBJECT(menu), "go_nth");
-
- ephy_embed_shistory_go_nth (embed, go_nth);
-}
-
-static void
-activate_up_menu_item_cb (GtkWidget *menu, EphyWindow *window)
-{
- EphyEmbed *embed;
- int go_nth;
- GSList *l;
- gchar *url;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- go_nth = (int)g_object_get_data (G_OBJECT(menu), "go_nth");
-
- ephy_embed_get_go_up_list (embed, &l);
-
- url = g_slist_nth_data (l, go_nth);
- if (url)
- {
- ephy_embed_load_url (embed, url);
- }
-
- g_slist_foreach (l, (GFunc) g_free, NULL);
- g_slist_free (l);
-}
-
-static void
-setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigationDirection dir)
-{
- int pos, count;
- EphyEmbed *embed;
- int start, end;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- ephy_embed_shistory_get_pos (embed, &pos);
- ephy_embed_shistory_count (embed, &count);
-
- if (count == 0) return;
-
- if (dir == EPHY_NAVIGATION_DIRECTION_BACK)
- {
- start = pos - 1;
- end = -1;
- }
- else
- {
- start = pos + 1;
- end = count;
- }
-
- while (start != end)
- {
- char *title, *url;
- GtkWidget *item;
- ephy_embed_shistory_get_nth (embed, start, FALSE, &url, &title);
- item = new_history_menu_item (title ? title : url, NULL);
- gtk_menu_shell_append (ms, item);
- g_object_set_data (G_OBJECT (item), "go_nth", GINT_TO_POINTER (start));
- g_signal_connect (item, "activate",
- G_CALLBACK (activate_back_or_forward_menu_item_cb), window);
- gtk_widget_show_all (item);
-
- g_free (url);
- g_free (title);
-
- if (start < end)
- {
- start++;
- }
- else
- {
- start--;
- }
- }
-}
-
-static void
-setup_up_menu (EphyWindow *window, GtkMenuShell *ms)
-{
- EphyEmbed *embed;
- GSList *l;
- GSList *li;
- int count = 0;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- ephy_embed_get_go_up_list (embed, &l);
-
- for (li = l; li; li = li->next)
- {
- char *url = li->data;
- GtkWidget *item;
-
- item = new_history_menu_item (url, NULL);
- gtk_menu_shell_append (ms, item);
- g_object_set_data (G_OBJECT(item), "go_nth", GINT_TO_POINTER (count));
- g_signal_connect (item, "activate",
- G_CALLBACK (activate_up_menu_item_cb), window);
- gtk_widget_show_all (item);
- count ++;
- }
-
- g_slist_foreach (l, (GFunc) g_free, NULL);
- g_slist_free (l);
-}
-
-static void
-ephy_navigation_button_menu_activated_cb (EphyTbButton *w, EphyNavigationButton *b)
-{
- EphyNavigationButtonPrivate *p = b->priv;
- GtkMenuShell *ms = ephy_tb_button_get_menu (p->widget);
- EphyWindow *win = ephy_tbi_get_window (EPHY_TBI (b));
- GList *children;
- GList *li;
-
- children = gtk_container_get_children (GTK_CONTAINER (ms));
- for (li = children; li; li = li->next)
- {
- gtk_container_remove (GTK_CONTAINER (ms), li->data);
- }
- g_list_free (children);
-
- switch (p->direction)
- {
- case EPHY_NAVIGATION_DIRECTION_UP:
- setup_up_menu (win, ms);
- break;
- case EPHY_NAVIGATION_DIRECTION_FORWARD:
- case EPHY_NAVIGATION_DIRECTION_BACK:
- setup_back_or_forward_menu (win, ms, p->direction);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
diff --git a/src/ephy-navigation-button.h b/src/ephy-navigation-button.h
deleted file mode 100644
index 036ec6d7e..000000000
--- a/src/ephy-navigation-button.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2002 Ricardo Fernández Pascual
- *
- * 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.
- */
-
-#ifndef EPHY_NAVIGATION_BUTTON_H
-#define EPHY_NAVIGATION_BUTTON_H
-
-#include "ephy-tbi.h"
-
-G_BEGIN_DECLS
-
-/* object forward declarations */
-
-typedef struct _EphyNavigationButton EphyNavigationButton;
-typedef struct _EphyNavigationButtonClass EphyNavigationButtonClass;
-typedef struct _EphyNavigationButtonPrivate EphyNavigationButtonPrivate;
-
-/**
- * TbiZoom object
- */
-
-#define EPHY_TYPE_NAVIGATION_BUTTON (ephy_navigation_button_get_type())
-#define EPHY_NAVIGATION_BUTTON(object) (G_TYPE_CHECK_INSTANCE_CAST((object), \
- EPHY_TYPE_NAVIGATION_BUTTON, EphyNavigationButton))
-#define EPHY_NAVIGATION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_NAVIGATION_BUTTON,\
- EphyNavigationButtonClass))
-#define EPHY_IS_NAVIGATION_BUTTON(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), \
- EPHY_TYPE_NAVIGATION_BUTTON))
-#define EPHY_IS_NAVIGATION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_NAVIGATION_BUTTON))
-#define EPHY_NAVIGATION_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_NAVIGATION_BUTTON,\
- EphyNavigationButtonClass))
-
-typedef enum
-{
- EPHY_NAVIGATION_DIRECTION_UP,
- EPHY_NAVIGATION_DIRECTION_BACK,
- EPHY_NAVIGATION_DIRECTION_FORWARD
-} EphyNavigationDirection;
-
-struct _EphyNavigationButtonClass
-{
- EphyTbiClass parent_class;
-};
-
-/* Remember: fields are public read-only */
-struct _EphyNavigationButton
-{
- EphyTbi parent_object;
- EphyNavigationButtonPrivate *priv;
-};
-
-/* this class is abstract */
-
-GType ephy_navigation_button_get_type (void);
-EphyNavigationButton * ephy_navigation_button_new (void);
-void ephy_navigation_button_set_direction (EphyNavigationButton *a,
- EphyNavigationDirection d);
-void ephy_navigation_button_set_show_arrow (EphyNavigationButton *b,
- gboolean value);
-EphyNavigationDirection ephy_navigation_button_get_direction (EphyNavigationButton *b);
-void ephy_navigation_button_set_sensitive (EphyNavigationButton *b, gboolean s);
-
-G_END_DECLS
-
-#endif
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index feeb4d388..11954632d 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -509,6 +509,7 @@ ephy_shell_get_autocompletion (EphyShell *gs)
};
EphyHistory *gh = ephy_embed_shell_get_global_history (EPHY_EMBED_SHELL (gs));
+ EphyBookmarks *bmk = ephy_shell_get_bookmarks (gs);
EphyFilesystemAutocompletion *fa = ephy_filesystem_autocompletion_new ();
p->autocompletion = ephy_autocompletion_new ();
ephy_autocompletion_set_prefixes (p->autocompletion, prefixes);
@@ -518,7 +519,7 @@ ephy_shell_get_autocompletion (EphyShell *gs)
ephy_autocompletion_add_source (p->autocompletion,
EPHY_AUTOCOMPLETION_SOURCE (fa));
ephy_autocompletion_add_source (p->autocompletion,
- EPHY_AUTOCOMPLETION_SOURCE (gs->priv->bookmarks));
+ EPHY_AUTOCOMPLETION_SOURCE (bmk));
g_object_unref (gh);
g_object_unref (fa);
diff --git a/src/ephy-spinner-action.c b/src/ephy-spinner-action.c
new file mode 100644
index 000000000..3e990f49b
--- /dev/null
+++ b/src/ephy-spinner-action.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#include "ephy-spinner-action.h"
+#include "ephy-spinner.h"
+#include "eggtoolitem.h"
+
+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
+ephy_spinner_action_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type)
+ {
+ static const GTypeInfo type_info =
+ {
+ sizeof (EphySpinnerActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) ephy_spinner_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (EphySpinnerAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_spinner_action_init,
+ };
+
+ type = g_type_register_static (EGG_TYPE_ACTION,
+ "EphySpinnerAction",
+ &type_info, 0);
+ }
+ 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)
+{
+ GtkWidget *item;
+ GtkWidget *spinner;
+ GtkWidget *button;
+
+ 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 ();
+ ephy_spinner_set_small_mode (EPHY_SPINNER (spinner), TRUE);
+ gtk_container_add (GTK_CONTAINER (button), spinner);
+ egg_tool_item_set_pack_end (EGG_TOOL_ITEM (item), TRUE);
+ egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (item), FALSE);
+ 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
new file mode 100644
index 000000000..adb9d76c2
--- /dev/null
+++ b/src/ephy-spinner-action.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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.
+ */
+
+#ifndef EPHY_SPINNER_ACTION_H
+#define EPHY_SPINNER_ACTION_H
+
+#include <gtk/gtk.h>
+#include <egg-action.h>
+
+#define EPHY_TYPE_SPINNER_ACTION (ephy_spinner_action_get_type ())
+#define EPHY_SPINNER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_SPINNER_ACTION, EphySpinnerAction))
+#define EPHY_SPINNER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_SPINNER_ACTION, EphySpinnerActionClass))
+#define EPHY_IS_SPINNER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_SPINNER_ACTION))
+#define EPHY_IS_SPINNER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_SPINNER_ACTION))
+#define EPHY_SPINNER_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_SPINNER_ACTION, EphySpinnerActionClass))
+
+typedef struct _EphySpinnerAction EphySpinnerAction;
+typedef struct _EphySpinnerActionClass EphySpinnerActionClass;
+typedef struct EphySpinnerActionPrivate EphySpinnerActionPrivate;
+
+struct _EphySpinnerAction
+{
+ EggAction parent;
+ EphySpinnerActionPrivate *priv;
+};
+
+struct _EphySpinnerActionClass
+{
+ EggActionClass parent_class;
+};
+
+GType ephy_spinner_action_get_type (void);
+
+#endif
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 7561bb476..98f04fad1 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -22,11 +22,11 @@
#include "ephy-tab.h"
#include "ephy-shell.h"
-#include "ephy-embed-popup-bw.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
#include "ephy-embed-prefs.h"
#include "ephy-debug.h"
+#include "egg-menu-merge.h"
#include <bonobo/bonobo-i18n.h>
#include <libgnomevfs/gnome-vfs-uri.h>
@@ -39,12 +39,15 @@
#include <gtk/gtkiconfactory.h>
#include <gtk/gtkstyle.h>
#include <gtk/gtkselection.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkmenu.h>
#include <string.h>
struct EphyTabPrivate
{
EphyEmbed *embed;
EphyWindow *window;
+ EphyEmbedEvent *event;
gboolean is_active;
TabLoadStatus load_status;
char status_message[255];
@@ -195,6 +198,7 @@ ephy_tab_init (EphyTab *tab)
tab->priv->embed = ephy_embed_new (G_OBJECT(shell));
tab->priv->window = NULL;
+ tab->priv->event = NULL;
tab->priv->is_active = FALSE;
*tab->priv->status_message = '\0';
*tab->priv->link_message = '\0';
@@ -280,6 +284,11 @@ ephy_tab_finalize (GObject *object)
g_idle_remove_by_data (tab->priv->embed);
+ if (tab->priv->event)
+ {
+ g_object_unref (tab->priv->event);
+ }
+
g_free (tab->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -346,6 +355,12 @@ ephy_tab_get_window (EphyTab *tab)
return tab->priv->window;
}
+EphyEmbedEvent *
+ephy_tab_get_event (EphyTab *tab)
+{
+ return tab->priv->event;
+}
+
static void
ephy_tab_update_color (EphyTab *tab)
{
@@ -813,24 +828,68 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
}
static void
+ephy_tab_set_event (EphyTab *tab,
+ EphyEmbedEvent *event)
+{
+ if (tab->priv->event) g_object_unref (tab->priv->event);
+ g_object_ref (event);
+ tab->priv->event = event;
+}
+
+static void
ephy_tab_show_embed_popup (EphyTab *tab, EphyEmbedEvent *event)
{
- EphyEmbedPopup *popup;
+ EmbedEventContext context;
+ const char *popup;
+ const GValue *value;
+ gboolean framed;
EphyWindow *window;
- EphyEmbed *embed;
+ char *path;
+ GtkWidget *widget;
window = ephy_tab_get_window (tab);
- embed = ephy_tab_get_embed (tab);
- popup = EPHY_EMBED_POPUP (ephy_window_get_popup_factory (window));
- ephy_embed_popup_set_event (popup, event);
- ephy_embed_popup_show (popup, embed);
+ ephy_embed_event_get_property (event, "framed_page", &value);
+ framed = g_value_get_int (value);
+
+ ephy_embed_event_get_context (event, &context);
+
+ if ((context & EMBED_CONTEXT_LINK) &&
+ (context & EMBED_CONTEXT_IMAGE))
+ {
+ popup = "EphyImageLinkPopup";
+ }
+ else if (context & EMBED_CONTEXT_LINK)
+ {
+ popup = "EphyLinkPopup";
+ }
+ else if (context & EMBED_CONTEXT_IMAGE)
+ {
+ popup = "EphyImagePopup";
+ }
+ else
+ {
+ popup = framed ? "EphyFramedDocumentPopup" :
+ "EphyDocumentPopup";
+ }
+
+ path = g_strconcat ("/popups/", popup, NULL);
+ g_print (path);
+ widget = egg_menu_merge_get_widget (EGG_MENU_MERGE (window->ui_merge),
+ path);
+ g_free (path);
+
+ g_return_if_fail (widget != NULL);
+
+ ephy_tab_set_event (tab, event);
+ gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
+ gtk_get_current_event_time ());
}
static gint
ephy_tab_dom_mouse_down_cb (EphyEmbed *embed,
- EphyEmbedEvent *event,
- EphyTab *tab)
+ EphyEmbedEvent *event,
+ EphyTab *tab)
{
EphyWindow *window;
int button;
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index fe679f553..82f6d16a6 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -102,6 +102,8 @@ void ephy_tab_get_size (EphyTab *tab,
void ephy_tab_update_control (EphyTab *tab,
TabControlID id);
+EphyEmbedEvent *ephy_tab_get_event (EphyTab *tab);
+
G_END_DECLS
#endif
diff --git a/src/ephy-tbi.c b/src/ephy-tbi.c
deleted file mode 100644
index 4a8993c46..000000000
--- a/src/ephy-tbi.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2002 Ricardo Fernández Pascual
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ephy-gobject-misc.h"
-#include "ephy-marshal.h"
-#include "ephy-bonobo-extensions.h"
-#include "ephy-tbi.h"
-#include "ephy-debug.h"
-
-#include <string.h>
-#include <libgnome/gnome-i18n.h>
-
-/**
- * Private data
- */
-struct _EphyTbiPrivate
-{
-};
-
-/**
- * Private functions, only availble from this file
- */
-static void ephy_tbi_class_init (EphyTbiClass *klass);
-static void ephy_tbi_init (EphyTbi *tb);
-static void ephy_tbi_finalize_impl (GObject *o);
-static GtkWidget * ephy_tbi_get_widget_impl (EphyTbItem *i);
-static GdkPixbuf * ephy_tbi_get_icon_impl (EphyTbItem *i);
-static gchar * ephy_tbi_get_name_human_impl (EphyTbItem *i);
-static gchar * ephy_tbi_to_string_impl (EphyTbItem *i);
-static gboolean ephy_tbi_is_unique_impl (EphyTbItem *i);
-static EphyTbItem * ephy_tbi_clone_impl (EphyTbItem *i);
-static void ephy_tbi_parse_properties_impl (EphyTbItem *i, const gchar *props);
-static void ephy_tbi_add_to_bonobo_tb_impl (EphyTbItem *i,
- BonoboUIComponent *ui,
- const char *container_path,
- guint index);
-
-
-static gpointer ephy_tb_item_class;
-
-/**
- * EphyTbi object
- */
-
-MAKE_GET_TYPE (ephy_tbi, "EphyTbi", EphyTbi, ephy_tbi_class_init,
- ephy_tbi_init, EPHY_TYPE_TB_ITEM);
-
-static void
-ephy_tbi_class_init (EphyTbiClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = ephy_tbi_finalize_impl;
-
- EPHY_TB_ITEM_CLASS (klass)->get_widget = ephy_tbi_get_widget_impl;
- EPHY_TB_ITEM_CLASS (klass)->get_icon = ephy_tbi_get_icon_impl;
- EPHY_TB_ITEM_CLASS (klass)->get_name_human = ephy_tbi_get_name_human_impl;
- EPHY_TB_ITEM_CLASS (klass)->to_string = ephy_tbi_to_string_impl;
- EPHY_TB_ITEM_CLASS (klass)->is_unique = ephy_tbi_is_unique_impl;
- EPHY_TB_ITEM_CLASS (klass)->clone = ephy_tbi_clone_impl;
- EPHY_TB_ITEM_CLASS (klass)->parse_properties = ephy_tbi_parse_properties_impl;
- EPHY_TB_ITEM_CLASS (klass)->add_to_bonobo_tb = ephy_tbi_add_to_bonobo_tb_impl;
-
- ephy_tb_item_class = g_type_class_peek_parent (klass);
-}
-
-static void
-ephy_tbi_init (EphyTbi *tbi)
-{
- tbi->window = NULL;
-}
-
-static void
-ephy_tbi_finalize_impl (GObject *o)
-{
- EphyTbi *it = EPHY_TBI (o);
-
- if (it->window)
- {
- g_object_remove_weak_pointer (G_OBJECT (it->window),
- (gpointer *) &it->window);
- }
-
- LOG ("EphyTbi finalized")
-
- G_OBJECT_CLASS (ephy_tb_item_class)->finalize (o);
-}
-
-static GtkWidget *
-ephy_tbi_get_widget_impl (EphyTbItem *i)
-{
- /* this class is abstract */
- g_assert_not_reached ();
-
- return NULL;
-}
-
-static GdkPixbuf *
-ephy_tbi_get_icon_impl (EphyTbItem *i)
-{
- return NULL;
-}
-
-static gchar *
-ephy_tbi_get_name_human_impl (EphyTbItem *i)
-{
- /* this class is abstract */
- g_assert_not_reached ();
-
- return NULL;
-}
-
-static gchar *
-ephy_tbi_to_string_impl (EphyTbItem *i)
-{
- /* this class is abstract */
- g_assert_not_reached ();
-
- return NULL;
-}
-
-static gboolean
-ephy_tbi_is_unique_impl (EphyTbItem *i)
-{
- return TRUE;
-}
-
-static EphyTbItem *
-ephy_tbi_clone_impl (EphyTbItem *i)
-{
- /* you can't clone this directly because this class is abstract */
- g_assert_not_reached ();
- return NULL;
-}
-
-static void
-ephy_tbi_add_to_bonobo_tb_impl (EphyTbItem *i, BonoboUIComponent *ui,
- const char *container_path, guint index)
-{
- GtkWidget *w = ephy_tb_item_get_widget (i);
- gtk_widget_show (w);
- ephy_bonobo_add_numbered_widget (ui, w, index, container_path);
-}
-
-static void
-ephy_tbi_parse_properties_impl (EphyTbItem *it, const gchar *props)
-{
- /* we have no properties */
-}
-
-void
-ephy_tbi_set_window (EphyTbi *it, EphyWindow *w)
-{
- if (it->window)
- {
- g_object_remove_weak_pointer (G_OBJECT (it->window),
- (gpointer *) &it->window);
- }
-
- it->window = w;
-
- if (it->window)
- {
- g_object_add_weak_pointer (G_OBJECT (it->window),
- (gpointer *) &it->window);
- }
-}
-
-EphyWindow *
-ephy_tbi_get_window (EphyTbi *tbi)
-{
- return tbi->window;
-}
-
diff --git a/src/ephy-tbi.h b/src/ephy-tbi.h
deleted file mode 100644
index 2296a144f..000000000
--- a/src/ephy-tbi.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2002 Ricardo Fernández Pascual
- *
- * 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.
- */
-
-#ifndef EPHY_TBI_H
-#define EPHY_TBI_H
-
-#include "ephy-toolbar-item.h"
-#include "ephy-window.h"
-
-G_BEGIN_DECLS
-
-/* object forward declarations */
-
-typedef struct _EphyTbi EphyTbi;
-typedef struct _EphyTbiClass EphyTbiClass;
-typedef struct _EphyTbiPrivate EphyTbiPrivate;
-
-/**
- * Tbi object
- */
-
-#define EPHY_TYPE_TBI (ephy_tbi_get_type())
-#define EPHY_TBI(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_TBI,\
- EphyTbi))
-#define EPHY_TBI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_TBI,\
- EphyTbiClass))
-#define EPHY_IS_TBI_(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_TBI))
-#define EPHY_IS_TBI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_TBI))
-#define EPHY_TBI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_TBI,\
- EphyTbiClass))
-
-struct _EphyTbiClass
-{
- EphyTbItemClass parent_class;
-
-};
-
-/* Remember: fields are public read-only */
-struct _EphyTbi
-{
- EphyTbItem parent_object;
-
- EphyWindow *window;
-};
-
-/* this class is abstract */
-
-GType ephy_tbi_get_type (void);
-EphyTbi * ephy_tbi_new (void);
-void ephy_tbi_set_window (EphyTbi *tbi, EphyWindow *w);
-EphyWindow * ephy_tbi_get_window (EphyTbi *tbi);
-
-G_END_DECLS
-
-#endif
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 455602244..8cca7ba26 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -24,123 +24,250 @@
#include "ephy-favorites-menu.h"
#include "ephy-state.h"
#include "ephy-gobject-misc.h"
-#include "statusbar.h"
-#include "toolbar.h"
#include "ppview-toolbar.h"
#include "window-commands.h"
#include "find-dialog.h"
#include "history-dialog.h"
-#include "popup-commands.h"
#include "ephy-shell.h"
-#include "ephy-bonobo-extensions.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
#include "ephy-embed-utils.h"
#include "ephy-debug.h"
+#include "ephy-file-helpers.h"
+#include "statusbar.h"
+#include "toolbar.h"
+#include "popup-commands.h"
#include <string.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-ui-component.h>
+#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <gtk/gtk.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
+#include "egg-action-group.h"
+#include "egg-menu-merge.h"
#define CHARSET_MENU_PATH "/menu/View/EncodingMenuPlaceholder"
#define GO_FAVORITES_PATH "/menu/Go/Favorites"
-#define GO_BACK_CMD_PATH "/commands/GoBack"
-#define GO_FORWARD_CMD_PATH "/commands/GoForward"
-#define GO_UP_CMD_PATH "/commands/GoUp"
-#define EDIT_FIND_NEXT_CMD_PATH "/commands/EditFindNext"
-#define EDIT_FIND_PREV_CMD_PATH "/commands/EditFindPrev"
-#define VIEW_MENUBAR_PATH "/commands/View Menubar"
-#define VIEW_STATUSBAR_PATH "/commands/View Statusbar"
-#define VIEW_TOOLBAR_PATH "/commands/View Toolbar"
-#define VIEW_BOOKMARKSBAR_PATH "/commands/View BookmarksBar"
-#define VIEW_FULLSCREEN_PATH "/commands/View Fullscreen"
-
-#define ID_VIEW_MENUBAR "View Menubar"
-#define ID_VIEW_STATUSBAR "View Statusbar"
-#define ID_VIEW_TOOLBAR "View Toolbar"
-#define ID_VIEW_BOOKMARKSBAR "View BookmarksBar"
-#define ID_VIEW_FULLSCREEN "View Fullscreen"
-
-static BonoboUIVerb ephy_verbs [] = {
- BONOBO_UI_VERB ("EditFind", (BonoboUIVerbFn)window_cmd_edit_find),
- BONOBO_UI_VERB ("FilePrint", (BonoboUIVerbFn)window_cmd_file_print),
- BONOBO_UI_VERB ("GoStop", (BonoboUIVerbFn)window_cmd_go_stop),
- BONOBO_UI_VERB ("GoReload", (BonoboUIVerbFn)window_cmd_go_reload),
- BONOBO_UI_VERB ("GoBack", (BonoboUIVerbFn)window_cmd_go_back),
- BONOBO_UI_VERB ("GoForward", (BonoboUIVerbFn)window_cmd_go_forward),
- BONOBO_UI_VERB ("GoGo", (BonoboUIVerbFn)window_cmd_go_go),
- BONOBO_UI_VERB ("GoUp", (BonoboUIVerbFn)window_cmd_go_up),
- BONOBO_UI_VERB ("GoHome", (BonoboUIVerbFn)window_cmd_go_home),
- BONOBO_UI_VERB ("GoMyportal", (BonoboUIVerbFn)window_cmd_go_myportal),
- BONOBO_UI_VERB ("GoLocation", (BonoboUIVerbFn)window_cmd_go_location),
- BONOBO_UI_VERB ("FileNew", (BonoboUIVerbFn)window_cmd_new),
- BONOBO_UI_VERB ("FileNewWindow", (BonoboUIVerbFn)window_cmd_new_window),
- BONOBO_UI_VERB ("FileNewTab", (BonoboUIVerbFn)window_cmd_new_tab),
- BONOBO_UI_VERB ("FileOpen", (BonoboUIVerbFn)window_cmd_file_open),
- BONOBO_UI_VERB ("FileSaveAs", (BonoboUIVerbFn)window_cmd_file_save_as),
- BONOBO_UI_VERB ("FileCloseTab", (BonoboUIVerbFn)window_cmd_file_close_tab),
- BONOBO_UI_VERB ("FileCloseWindow", (BonoboUIVerbFn)window_cmd_file_close_window),
- BONOBO_UI_VERB ("FileSendTo", (BonoboUIVerbFn)window_cmd_file_send_to),
- BONOBO_UI_VERB ("EditCut", (BonoboUIVerbFn)window_cmd_edit_cut),
- BONOBO_UI_VERB ("EditCopy", (BonoboUIVerbFn)window_cmd_edit_copy),
- BONOBO_UI_VERB ("EditPaste", (BonoboUIVerbFn)window_cmd_edit_paste),
- BONOBO_UI_VERB ("EditSelectAll", (BonoboUIVerbFn)window_cmd_edit_select_all),
- BONOBO_UI_VERB ("EditPrefs", (BonoboUIVerbFn)window_cmd_edit_prefs),
- BONOBO_UI_VERB ("SettingsToolbarEditor", (BonoboUIVerbFn)window_cmd_settings_toolbar_editor),
- BONOBO_UI_VERB ("Zoom In", (BonoboUIVerbFn)window_cmd_view_zoom_in),
- BONOBO_UI_VERB ("EditFindNext", (BonoboUIVerbFn)window_cmd_edit_find_next),
- BONOBO_UI_VERB ("EditFindPrev", (BonoboUIVerbFn)window_cmd_edit_find_prev),
- BONOBO_UI_VERB ("Zoom Out", (BonoboUIVerbFn)window_cmd_view_zoom_out),
- BONOBO_UI_VERB ("Zoom Normal", (BonoboUIVerbFn)window_cmd_view_zoom_normal),
- BONOBO_UI_VERB ("ViewPageSource", (BonoboUIVerbFn)window_cmd_view_page_source),
- BONOBO_UI_VERB ("BookmarksAddDefault", (BonoboUIVerbFn)window_cmd_bookmarks_add_default),
- BONOBO_UI_VERB ("BookmarksEdit", (BonoboUIVerbFn)window_cmd_bookmarks_edit),
- BONOBO_UI_VERB ("ToolsHistory", (BonoboUIVerbFn)window_cmd_tools_history),
- BONOBO_UI_VERB ("ToolsPDM", (BonoboUIVerbFn)window_cmd_tools_pdm),
- BONOBO_UI_VERB ("TabsNext", (BonoboUIVerbFn)window_cmd_tabs_next),
- BONOBO_UI_VERB ("TabsPrevious", (BonoboUIVerbFn)window_cmd_tabs_previous),
- BONOBO_UI_VERB ("TabsMoveLeft", (BonoboUIVerbFn)window_cmd_tabs_move_left),
- BONOBO_UI_VERB ("TabsMoveRight", (BonoboUIVerbFn)window_cmd_tabs_move_right),
- BONOBO_UI_VERB ("TabsDetach", (BonoboUIVerbFn)window_cmd_tabs_detach),
- BONOBO_UI_VERB ("HelpContents", (BonoboUIVerbFn)window_cmd_help_manual),
- BONOBO_UI_VERB ("About", (BonoboUIVerbFn)window_cmd_help_about),
-
- BONOBO_UI_VERB_END
+#define GO_BACK_ACTION "GoBack"
+#define GO_FORWARD_ACTION "GoForward"
+#define GO_UP_ACTION "GoUp"
+#define EDIT_FIND_NEXT_ACTION "EditFindNext"
+#define EDIT_FIND_PREV_ACTION "EditFindPrev"
+#define VIEW_STATUSBAR_ACTION "ViewStatusbar"
+#define VIEW_TOOLBAR_ACTION "ViewToolbar"
+#define VIEW_FULLSCREEN_ACTION "ViewFullscreen"
+
+static EggActionGroupEntry ephy_menu_entries [] = {
+
+ /* Toplevel */
+ { "File", N_("_File"), NULL, NULL, NULL, NULL, NULL },
+ { "Edit", N_("_Edit"), NULL, NULL, NULL, NULL, NULL },
+ { "View", N_("_View"), NULL, NULL, NULL, NULL, NULL },
+ { "Go", N_("_Go"), NULL, NULL, NULL, NULL, NULL },
+ { "Tabs", N_("_Tabs"), NULL, NULL, NULL, NULL, NULL },
+ { "Help", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
+
+ /* File menu */
+ { "FileNewWindow", N_("_New Window"), GTK_STOCK_NEW, "<control>N",
+ N_("Create a new window"),
+ G_CALLBACK (window_cmd_file_new_window), NULL },
+ { "FileNewTab", N_("New _Tab"), NULL, "<shift><control>N",
+ N_("Create a new tab"),
+ G_CALLBACK (window_cmd_file_new_tab), NULL },
+ { "FileOpen", N_("_Open..."), GTK_STOCK_OPEN, "<control>O",
+ N_("Open a file"),
+ G_CALLBACK (window_cmd_file_open), NULL },
+ { "FileSaveAs", N_("Save _As..."), GTK_STOCK_SAVE, "<shift><control>S",
+ N_("Save the current page"),
+ G_CALLBACK (window_cmd_file_save_as), NULL },
+ { "FilePrint", N_("_Print..."), GTK_STOCK_PRINT, "<control>P",
+ N_("Print the current page"),
+ G_CALLBACK (window_cmd_file_print), NULL },
+ { "FileSendTo", N_("S_end To..."), NULL, NULL,
+ N_("Send a link of the current page"),
+ G_CALLBACK (window_cmd_file_send_to), NULL },
+ { "FileAddBookmark", N_("_Add Bookmark..."), GTK_STOCK_ADD, "<control>D",
+ N_("Add a bookmark for the current page"),
+ G_CALLBACK (window_cmd_file_add_bookmark), NULL },
+ { "FileCloseTab", N_("_Close Tab"), GTK_STOCK_CLOSE, "<control>W",
+ N_("Send a link of the current page"),
+ G_CALLBACK (window_cmd_file_close_tab), NULL },
+ { "FileCloseWindow", N_("Close _Window"), NULL, "<shift><control>W",
+ N_("Send a link of the current page"),
+ G_CALLBACK (window_cmd_file_close_window), NULL },
+
+ /* Edit menu */
+ { "EditCut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+ N_("Cut the selection"),
+ G_CALLBACK (window_cmd_edit_cut), NULL },
+ { "EditCopy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+ N_("Copy the selection"),
+ G_CALLBACK (window_cmd_edit_copy), NULL },
+ { "EditPaste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+ N_("Paste clipboard"),
+ G_CALLBACK (window_cmd_edit_paste), NULL },
+ { "EditSelectAll", N_("Select _All"), NULL, "<control>A",
+ N_("Select the entire page"),
+ G_CALLBACK (window_cmd_edit_select_all), NULL },
+ { "EditFind", N_("_Find"), GTK_STOCK_FIND, "<control>F",
+ N_("Find a string"),
+ G_CALLBACK (window_cmd_edit_find), NULL },
+ { "EditFindNext", N_("Find Ne_xt"), NULL, "<control>G",
+ N_("Find next occurence of the string"),
+ G_CALLBACK (window_cmd_edit_find_next), NULL },
+ { "EditFindPrev", N_("Find Pre_vious"), NULL, "<shift><control>G",
+ N_("Find previous occurence of the string"),
+ G_CALLBACK (window_cmd_edit_find_prev), NULL },
+ { "EditPersonalData", N_("P_ersonal Data"), NULL, "<control>F",
+ N_("View and remove cookies and passwords"),
+ G_CALLBACK (window_cmd_edit_personal_data), NULL },
+ { "EditToolbar", N_("T_oolbars"), NULL, NULL,
+ N_("Costumize toolbars"),
+ G_CALLBACK (window_cmd_edit_toolbar), NULL },
+ { "EditPrefs", N_("P_references"), GTK_STOCK_PREFERENCES, NULL,
+ N_("Configure the web browser"),
+ G_CALLBACK (window_cmd_edit_prefs), NULL },
+
+ /* View menu */
+ { "ViewStop", N_("_Stop"), GTK_STOCK_STOP, "Escape",
+ N_("Stop current data transfer"),
+ G_CALLBACK (window_cmd_view_stop), NULL },
+ { "ViewReload", N_("_Reload"), GTK_STOCK_REFRESH, "<control>R",
+ N_("Display the latest content of the current page"),
+ G_CALLBACK (window_cmd_view_reload), NULL },
+ { "ViewStatusbar", N_("St_atusbar"), NULL, NULL,
+ N_("Show or hide statusbar"),
+ G_CALLBACK (window_cmd_view_statusbar), NULL, TOGGLE_ACTION },
+ { "ViewFullscreen", N_("_Fullscreen"), NULL, NULL,
+ N_("Browse at full screen"),
+ G_CALLBACK (window_cmd_view_fullscreen), NULL, TOGGLE_ACTION},
+ { "ViewZoomIn", N_("Zoom _In"), GTK_STOCK_ZOOM_IN, "<control>plus",
+ N_("Show the contents in more detail"),
+ G_CALLBACK (window_cmd_view_zoom_in), NULL },
+ { "ViewZoomOut", N_("Zoom _Out"), GTK_STOCK_ZOOM_OUT, "<control>minus",
+ N_("Show the contents in less detail"),
+ G_CALLBACK (window_cmd_view_zoom_out), NULL },
+ { "ViewZoomNormal", N_("_Normal Size"), GTK_STOCK_ZOOM_100, NULL,
+ N_("Show the contents at the normal size"),
+ G_CALLBACK (window_cmd_view_zoom_normal), NULL },
+ { "ViewPageSource", N_("_Page Source"), NULL, NULL,
+ N_("View the source code of the page"),
+ G_CALLBACK (window_cmd_view_page_source), NULL },
+
+ /* Go menu */
+ { "GoBack", N_("_Back"), GTK_STOCK_GO_BACK, "<alt>left",
+ N_("Go to the previous visited page"),
+ G_CALLBACK (window_cmd_go_back), NULL },
+ { "GoForward", N_("_Forward"), GTK_STOCK_GO_FORWARD, "<alt>right",
+ N_("Go to the next visited page"),
+ G_CALLBACK (window_cmd_go_forward), NULL },
+ { "GoUp", N_("_Up"), GTK_STOCK_GO_UP, "<alt>up",
+ N_("Go up one level"),
+ G_CALLBACK (window_cmd_go_up), NULL },
+ { "GoHome", N_("_Home"), GTK_STOCK_HOME, "<alt>home",
+ N_("Go to the home page"),
+ G_CALLBACK (window_cmd_go_home), NULL },
+ { "GoLocation", N_("_Location..."), NULL, "<control>L",
+ N_("Go to a specified location"),
+ G_CALLBACK (window_cmd_go_location), NULL },
+ { "GoHistory", N_("_History"), NULL, "<control>H",
+ N_("Go to an already visited page"),
+ G_CALLBACK (window_cmd_go_history), NULL },
+ { "GoBookmarks", N_("_Bookmarks"), NULL, "<control>B",
+ N_("Go to a bookmark"),
+ G_CALLBACK (window_cmd_go_bookmarks), NULL },
+
+ /* Tabs menu */
+ { "TabsPrevious", N_("_Previous Tab"), NULL, "<control>page_up",
+ N_("Activate previous tab"),
+ G_CALLBACK (window_cmd_tabs_previous), NULL },
+ { "TabsNext", N_("_Next Tab"), NULL, "<control>page_down",
+ N_("Activate next tab"),
+ G_CALLBACK (window_cmd_tabs_next), NULL },
+ { "TabsMoveLeft", N_("Move Tab _Left"), NULL, "<shift><control>page_up",
+ N_("Move current tab to left"),
+ G_CALLBACK (window_cmd_tabs_move_left), NULL },
+ { "TabsMoveRight", N_("Move Tab _Right"), NULL, "<shift><control>page_up",
+ N_("Move current tab to right"),
+ G_CALLBACK (window_cmd_tabs_move_right), NULL },
+ { "TabsDetach", N_("_Detach Tab"), NULL, "<shift><control>M",
+ N_("Detach current tab"),
+ G_CALLBACK (window_cmd_tabs_detach), NULL },
+
+ /* Help menu */
+ { "HelpAbout", N_("_About"), NULL, NULL,
+ N_("Display credits for the web browser creators"),
+ G_CALLBACK (window_cmd_help_about), NULL },
};
-
-static BonoboUIVerb ephy_popup_verbs [] = {
- BONOBO_UI_VERB ("EPOpenInNewWindow", (BonoboUIVerbFn)popup_cmd_new_window),
- BONOBO_UI_VERB ("EPOpenInNewTab", (BonoboUIVerbFn)popup_cmd_new_tab),
- BONOBO_UI_VERB ("EPAddBookmark", (BonoboUIVerbFn)popup_cmd_add_bookmark),
- BONOBO_UI_VERB ("EPOpenImageInNewWindow", (BonoboUIVerbFn)popup_cmd_image_in_new_window),
- BONOBO_UI_VERB ("EPOpenImageInNewTab", (BonoboUIVerbFn)popup_cmd_image_in_new_tab),
- BONOBO_UI_VERB ("DPOpenFrameInNewWindow", (BonoboUIVerbFn)popup_cmd_frame_in_new_window),
- BONOBO_UI_VERB ("DPOpenFrameInNewTab", (BonoboUIVerbFn)popup_cmd_frame_in_new_tab),
- BONOBO_UI_VERB ("DPAddFrameBookmark", (BonoboUIVerbFn)popup_cmd_add_frame_bookmark),
- BONOBO_UI_VERB ("DPViewSource", (BonoboUIVerbFn)popup_cmd_view_source),
-
- BONOBO_UI_VERB_END
+static guint ephy_menu_n_entries = G_N_ELEMENTS (ephy_menu_entries);
+
+static EggActionGroupEntry ephy_popups_entries [] = {
+ /* Toplevel */
+ { "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
+
+ /* Document */
+ { "SaveBackgroundAs", N_("Save Background As..."), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_save_background_as), NULL },
+ { "CopyPageLocation", N_("Copy Page Location"), GTK_STOCK_COPY, NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_page_location), NULL },
+
+ /* Framed document */
+ { "OpenFrame", N_("Open Frame"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_open_frame), NULL },
+ { "OpenFrameInNewWindow", N_("Open Frame in New Window"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_frame_in_new_window), NULL },
+ { "OpenFrameInNewTab", N_("Open Frame in New Tab"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_frame_in_new_tab), NULL },
+
+ /* Links */
+ { "OpenLink", N_("Open Link"), GTK_STOCK_OPEN, NULL,
+ NULL, G_CALLBACK (popup_cmd_open_link), NULL },
+ { "OpenLinkInNewWindow", N_("Open Link in New Window"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_link_in_new_window), NULL },
+ { "OpenLinkInNewTab", N_("Open Link in New Tab"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_link_in_new_tab), NULL },
+ { "DownloadLink", N_("Download Link"), GTK_STOCK_SAVE, NULL,
+ NULL, G_CALLBACK (popup_cmd_download_link), NULL },
+ { "AddLinkBookmark", N_("Add Bookmark"), GTK_STOCK_ADD, NULL,
+ NULL, G_CALLBACK (popup_cmd_add_link_bookmark), NULL },
+ { "CopyLinkLocation", N_("Copy Link Location"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_link_location), NULL },
+ { "CopyEmail", N_("Copy Email"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_email), NULL },
+
+ /* Images */
+ { "OpenImage", N_("Open Image"), GTK_STOCK_OPEN, NULL,
+ NULL, G_CALLBACK (popup_cmd_open_image), NULL },
+ { "OpenImageInNewWindow", N_("Open Image in New Window"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_image_in_new_window), NULL },
+ { "OpenImageInNewTab", N_("Open Image in New Tab"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_image_in_new_tab), NULL },
+ { "SaveImageAs", N_("Save Image As..."), GTK_STOCK_SAVE_AS, NULL,
+ NULL, G_CALLBACK (popup_cmd_save_image_as), NULL },
+ { "SetImageAsBackground", N_("Use Image as Background"), NULL, NULL,
+ NULL, G_CALLBACK (popup_cmd_set_image_as_background), NULL },
+ { "CopyImageLocation", N_("Copy Image Location"), GTK_STOCK_COPY, NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_image_location), NULL },
};
+static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries);
struct EphyWindowPrivate
{
+ GtkWidget *main_vbox;
+ GtkWidget *menubar;
+ Toolbar *toolbar;
+ GtkWidget *statusbar;
+ EggActionGroup *action_group;
+ EggActionGroup *popups_action_group;
EphyFavoritesMenu *fav_menu;
PPViewToolbar *ppview_toolbar;
- Toolbar *toolbar;
- Statusbar *statusbar;
GtkNotebook *notebook;
EphyTab *active_tab;
GtkWidget *sidebar;
- EphyEmbedPopupBW *embed_popup;
EphyDialog *find_dialog;
EphyDialog *history_dialog;
EphyDialog *history_sidebar;
@@ -191,7 +318,7 @@ ephy_window_get_type (void)
(GInstanceInitFunc) ephy_window_init
};
- ephy_window_type = g_type_register_static (BONOBO_TYPE_WINDOW,
+ ephy_window_type = g_type_register_static (GTK_TYPE_WINDOW,
"EphyWindow",
&our_info, 0);
}
@@ -212,8 +339,7 @@ ephy_window_class_init (EphyWindowClass *klass)
widget_class->show = ephy_window_show;
}
-static
-gboolean
+static gboolean
ephy_window_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
EphyWindow *window)
@@ -287,63 +413,75 @@ ephy_window_state_event_cb (GtkWidget *widget,
}
static void
-setup_bonobo_window (EphyWindow *window,
- BonoboUIComponent **ui_component)
+add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window)
+{
+ if (GTK_IS_MENU_SHELL (widget))
+ {
+ window->priv->menubar = widget;
+ }
+
+ gtk_box_pack_start (GTK_BOX (window->priv->main_vbox),
+ widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+}
+
+static void
+setup_window (EphyWindow *window)
{
- BonoboWindow *win = BONOBO_WINDOW(window);
- BonoboUIContainer *container;
- Bonobo_UIContainer corba_container;
+ EggActionGroup *action_group;
+ EggMenuMerge *merge;
+ int i;
+
+ window->priv->main_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (window->priv->main_vbox);
+ gtk_container_add (GTK_CONTAINER (window),
+ window->priv->main_vbox);
+
+ for (i = 0; i < ephy_menu_n_entries; i++)
+ {
+ ephy_menu_entries[i].user_data = window;
+ }
- container = bonobo_window_get_ui_container (win);
+ for (i = 0; i < ephy_popups_n_entries; i++)
+ {
+ ephy_popups_entries[i].user_data = window;
+ }
- bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
- "/apps/ephy/UIConfig/kvps");
+ merge = egg_menu_merge_new ();
- corba_container = BONOBO_OBJREF (container);
+ action_group = egg_action_group_new ("WindowActions");
+ 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;
- *ui_component = bonobo_ui_component_new_default ();
+ action_group = egg_action_group_new ("PopupsActions");
+ egg_action_group_add_actions (action_group, ephy_popups_entries,
+ ephy_popups_n_entries);
+ egg_menu_merge_insert_action_group (merge, action_group, 0);
+ window->priv->popups_action_group = action_group;
- bonobo_ui_component_set_container (*ui_component,
- corba_container,
- NULL);
+ window->ui_merge = G_OBJECT (merge);
+ g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), window);
+ egg_menu_merge_add_ui_from_file (merge, ephy_file ("epiphany-ui.xml"), NULL);
+ gtk_window_add_accel_group (GTK_WINDOW (window), merge->accel_group);
- bonobo_ui_util_set_ui (*ui_component,
- DATADIR,
- "epiphany-ui.xml",
- "ephy", NULL);
+ window->priv->toolbar = toolbar_new (window);
- /* Key handling */
- g_signal_connect(G_OBJECT(win),
+ g_signal_connect(window,
"key-press-event",
G_CALLBACK(ephy_window_key_press_event_cb),
window);
-
- g_signal_connect (G_OBJECT(win), "configure_event",
+ g_signal_connect (window, "configure_event",
G_CALLBACK (ephy_window_configure_event_cb), NULL);
- g_signal_connect (G_OBJECT(win), "window_state_event",
+ g_signal_connect (window, "window_state_event",
G_CALLBACK (ephy_window_state_event_cb), NULL);
-
- g_signal_connect (G_OBJECT(win),
+ g_signal_connect (window,
"selection-received",
G_CALLBACK (ephy_window_selection_received_cb),
window);
}
-static EphyEmbedPopupBW *
-setup_popup_factory (EphyWindow *window,
- BonoboUIComponent *ui_component)
-{
- EphyEmbedPopupBW *popup;
-
- popup = ephy_window_get_popup_factory (window);
- g_object_set_data (G_OBJECT(popup), "EphyWindow", window);
- bonobo_ui_component_add_verb_list_with_data (ui_component,
- ephy_popup_verbs,
- popup);
-
- return popup;
-}
-
static GtkNotebook *
setup_notebook (EphyWindow *window)
{
@@ -369,89 +507,6 @@ setup_notebook (EphyWindow *window)
}
static void
-view_toolbar_changed_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EphyWindow *window)
-{
- EmbedChromeMask mask;
-
- if (window->priv->ignore_layout_toggles) return;
-
- mask = ephy_window_get_chrome (window);
- mask ^= EMBED_CHROME_TOOLBARON;
- ephy_window_set_chrome (window, mask);
-}
-
-static void
-view_statusbar_changed_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EphyWindow *window)
-{
- EmbedChromeMask mask;
-
- if (window->priv->ignore_layout_toggles) return;
-
- mask = ephy_window_get_chrome (window);
- mask ^= EMBED_CHROME_STATUSBARON;
- ephy_window_set_chrome (window, mask);
-}
-
-static void
-view_fullscreen_changed_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EphyWindow *window)
-{
- EmbedChromeMask mask;
-
- if (window->priv->ignore_layout_toggles) return;
-
- mask = ephy_window_get_chrome (window);
- mask ^= EMBED_CHROME_OPENASFULLSCREEN;
- mask |= EMBED_CHROME_DEFAULT;
- ephy_window_set_chrome (window, mask);
-}
-
-static void
-update_layout_toggles (EphyWindow *window)
-{
- BonoboUIComponent *ui_component = BONOBO_UI_COMPONENT (window->ui_component);
- EmbedChromeMask mask = window->priv->chrome_mask;
-
- window->priv->ignore_layout_toggles = TRUE;
-
- ephy_bonobo_set_toggle_state (ui_component, VIEW_TOOLBAR_PATH,
- mask & EMBED_CHROME_TOOLBARON);
- ephy_bonobo_set_toggle_state (ui_component, VIEW_STATUSBAR_PATH,
- mask & EMBED_CHROME_STATUSBARON);
- ephy_bonobo_set_toggle_state (ui_component, VIEW_FULLSCREEN_PATH,
- mask & EMBED_CHROME_OPENASFULLSCREEN);
-
- window->priv->ignore_layout_toggles = FALSE;
-}
-
-static void
-setup_layout_menus (EphyWindow *window)
-{
- BonoboUIComponent *ui_component = BONOBO_UI_COMPONENT (window->ui_component);
-
- bonobo_ui_component_add_listener (ui_component, ID_VIEW_TOOLBAR,
- (BonoboUIListenerFn)view_toolbar_changed_cb,
- window);
- bonobo_ui_component_add_listener (ui_component, ID_VIEW_STATUSBAR,
- (BonoboUIListenerFn)view_statusbar_changed_cb,
- window);
- bonobo_ui_component_add_listener (ui_component, ID_VIEW_FULLSCREEN,
- (BonoboUIListenerFn)view_fullscreen_changed_cb,
- window);
-}
-
-static void
favicon_cache_changed_cb (EphyFaviconCache *cache, char *url, EphyWindow *window)
{
ephy_window_update_control (window, FaviconControl);
@@ -460,14 +515,12 @@ favicon_cache_changed_cb (EphyFaviconCache *cache, char *url, EphyWindow *window
static void
ephy_window_init (EphyWindow *window)
{
- BonoboUIComponent *ui_component;
Session *session;
EphyFaviconCache *cache;
session = ephy_shell_get_session (ephy_shell);
window->priv = g_new0 (EphyWindowPrivate, 1);
- window->priv->embed_popup = NULL;
window->priv->active_tab = NULL;
window->priv->chrome_mask = 0;
window->priv->ignore_layout_toggles = FALSE;
@@ -482,42 +535,25 @@ ephy_window_init (EphyWindow *window)
0);
/* Setup the window and connect verbs */
- setup_bonobo_window (window, &ui_component);
- window->ui_component = G_OBJECT (ui_component);
- bonobo_ui_component_add_verb_list_with_data (ui_component,
- ephy_verbs,
- window);
- setup_layout_menus (window);
-
- /* Setup the embed popups factory */
- window->priv->embed_popup = setup_popup_factory (window,
- ui_component);
-
- bonobo_ui_component_freeze (ui_component, NULL);
-
- /* Setup menubar */
- ephy_embed_utils_build_charsets_submenu (ui_component,
- CHARSET_MENU_PATH,
- (BonoboUIVerbFn)window_cmd_set_charset,
- window);
- window->priv->fav_menu = ephy_favorites_menu_new (window);
- ephy_favorites_menu_set_path (window->priv->fav_menu, GO_FAVORITES_PATH);
+ setup_window (window);
- /* Setup toolbar and statusbar */
- window->priv->toolbar = toolbar_new (window);
- window->priv->statusbar = statusbar_new (window);
- window->priv->ppview_toolbar = ppview_toolbar_new (window);
+ window->priv->fav_menu = ephy_favorites_menu_new (window);
/* Setup window contents */
window->priv->notebook = setup_notebook (window);
- bonobo_window_set_contents (BONOBO_WINDOW (window),
- GTK_WIDGET (window->priv->notebook));
+ gtk_box_pack_start (GTK_BOX (window->priv->main_vbox),
+ GTK_WIDGET (window->priv->notebook),
+ TRUE, TRUE, 0);
- bonobo_ui_component_thaw (ui_component, NULL);
+ window->priv->statusbar = statusbar_new ();
+ gtk_widget_show (window->priv->statusbar);
+ gtk_box_pack_start (GTK_BOX (window->priv->main_vbox),
+ GTK_WIDGET (window->priv->statusbar),
+ FALSE, TRUE, 0);
g_object_ref (ephy_shell);
- /*Once window is fully created, add it to the session list*/
+ /* Once window is fully created, add it to the session list*/
session_add_window (session, window);
}
@@ -572,14 +608,6 @@ ephy_window_finalize (GObject *object)
remove_from_session (window);
- if (window->priv->embed_popup)
- {
- g_object_unref (G_OBJECT (window->priv->embed_popup));
- }
-
- g_object_unref (G_OBJECT (window->priv->toolbar));
- g_object_unref (G_OBJECT (window->priv->statusbar));
-
if (window->priv->find_dialog)
{
g_object_unref (G_OBJECT (window->priv->find_dialog));
@@ -592,7 +620,14 @@ ephy_window_finalize (GObject *object)
(gpointer *)&window->priv->history_dialog);
}
- g_free (window->priv);
+ g_object_unref (window->priv->fav_menu);
+
+ if (window->priv->ppview_toolbar)
+ {
+ g_object_unref (window->priv->ppview_toolbar);
+ }
+
+ g_free (window->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -607,16 +642,6 @@ ephy_window_new (void)
return EPHY_WINDOW (g_object_new (EPHY_WINDOW_TYPE, NULL));
}
-static void
-dock_item_set_visibility (EphyWindow *window,
- const char *path,
- gboolean visibility)
-{
- ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(window->ui_component),
- path,
- !visibility);
-}
-
EmbedChromeMask
ephy_window_get_chrome (EphyWindow *window)
{
@@ -718,29 +743,46 @@ void
ephy_window_set_chrome (EphyWindow *window,
EmbedChromeMask flags)
{
- gboolean toolbar, ppvtoolbar, statusbar;
-
if (flags & EMBED_CHROME_DEFAULT)
{
translate_default_chrome (&flags);
}
- dock_item_set_visibility (window, "/menu",
- flags & EMBED_CHROME_MENUBARON);
+ if (flags & EMBED_CHROME_MENUBARON)
+ {
+ gtk_widget_show (window->priv->menubar);
+ }
+ else
+ {
+ gtk_widget_hide (window->priv->menubar);
+ }
- toolbar = (flags & EMBED_CHROME_TOOLBARON) != FALSE;
toolbar_set_visibility (window->priv->toolbar,
- toolbar);
+ flags & EMBED_CHROME_TOOLBARON);
- statusbar = (flags & EMBED_CHROME_STATUSBARON) != FALSE;
- statusbar_set_visibility (window->priv->statusbar,
- statusbar);
+ if (flags & EMBED_CHROME_STATUSBARON)
+ {
+ gtk_widget_show (window->priv->statusbar);
+ }
+ else
+ {
+ gtk_widget_hide (window->priv->statusbar);
+ }
- ppvtoolbar = (flags & EMBED_CHROME_PPVIEWTOOLBARON) != FALSE;
- ppview_toolbar_set_old_chrome (window->priv->ppview_toolbar,
- window->priv->chrome_mask);
- ppview_toolbar_set_visibility (window->priv->ppview_toolbar,
- ppvtoolbar);
+ if ((flags & EMBED_CHROME_PPVIEWTOOLBARON) != FALSE)
+ {
+ if (!window->priv->ppview_toolbar)
+ {
+ window->priv->ppview_toolbar = ppview_toolbar_new (window);
+ }
+ }
+ else
+ {
+ if (window->priv->ppview_toolbar)
+ {
+ g_object_unref (window->priv->ppview_toolbar);
+ }
+ }
/* set fullscreen only when it's really changed */
if ((window->priv->chrome_mask & EMBED_CHROME_OPENASFULLSCREEN) !=
@@ -753,8 +795,6 @@ ephy_window_set_chrome (EphyWindow *window,
window->priv->chrome_mask = flags;
- update_layout_toggles (window);
-
save_window_chrome (window);
}
@@ -988,14 +1028,11 @@ update_security (EphyWindow *window)
static void
update_nav_control (EphyWindow *window)
{
- /* the zoom control is updated at the same time than the navigation
- controls. This keeps it synched most of the time, but not always,
- because we don't get a notification when zoom changes */
-
gresult back, forward, up, stop;
EphyEmbed *embed;
EphyTab *tab;
- gint zoom;
+ EggActionGroup *action_group;
+ EggAction *action;
g_return_if_fail (window != NULL);
@@ -1010,29 +1047,16 @@ update_nav_control (EphyWindow *window)
up = ephy_embed_can_go_up (embed);
stop = ephy_tab_get_load_status (tab) & TAB_LOAD_STARTED;
- toolbar_button_set_sensitive (window->priv->toolbar,
- TOOLBAR_BACK_BUTTON,
- back == G_OK ? TRUE : FALSE);
- toolbar_button_set_sensitive (window->priv->toolbar,
- TOOLBAR_FORWARD_BUTTON,
- forward == G_OK ? TRUE : FALSE);
- toolbar_button_set_sensitive (window->priv->toolbar,
- TOOLBAR_UP_BUTTON,
- up == G_OK ? TRUE : FALSE);
- toolbar_button_set_sensitive (window->priv->toolbar,
- TOOLBAR_STOP_BUTTON,
- stop);
- if (ephy_embed_zoom_get (embed, &zoom) == G_OK)
- {
- toolbar_set_zoom (window->priv->toolbar, zoom);
- }
+ 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);
- 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);
+ toolbar_update_navigation_actions (window->priv->toolbar,
+ back, forward, up);
}
static void
@@ -1066,8 +1090,7 @@ update_location_control (EphyWindow *window)
if (!location) location = "";
- toolbar_set_location (window->priv->toolbar,
- location);
+ toolbar_set_location (window->priv->toolbar, location);
}
static void
@@ -1108,11 +1131,11 @@ update_find_control (EphyWindow *window)
(FIND_DIALOG(window->priv->find_dialog));
can_go_prev = find_dialog_can_go_prev
(FIND_DIALOG(window->priv->find_dialog));
-
+/*
ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
EDIT_FIND_NEXT_CMD_PATH, can_go_next);
ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
- EDIT_FIND_PREV_CMD_PATH, can_go_prev);
+ EDIT_FIND_PREV_CMD_PATH, can_go_prev);*/
}
}
@@ -1218,7 +1241,7 @@ void
ephy_window_update_all_controls (EphyWindow *window)
{
g_return_if_fail (IS_EPHY_WINDOW (window));
-
+
if (ephy_window_get_active_tab (window) != NULL)
{
update_nav_control (window);
@@ -1257,21 +1280,6 @@ ephy_window_get_active_embed (EphyWindow *window)
else return NULL;
}
-EphyEmbedPopupBW *
-ephy_window_get_popup_factory (EphyWindow *window)
-{
- if (!window->priv->embed_popup)
- {
- window->priv->embed_popup = ephy_embed_popup_bw_new
- (BONOBO_WINDOW(window));
- ephy_embed_popup_connect_verbs
- (EPHY_EMBED_POPUP (window->priv->embed_popup),
- BONOBO_UI_COMPONENT (window->ui_component));
- }
-
- return window->priv->embed_popup;
-}
-
GList *
ephy_window_get_tabs (EphyWindow *window)
{
@@ -1296,8 +1304,11 @@ ephy_window_get_tabs (EphyWindow *window)
static void
save_old_embed_status (EphyTab *tab, EphyWindow *window)
{
- /* save old tab location status */
- ephy_tab_set_location (tab, toolbar_get_location (window->priv->toolbar));
+ char *location;
+
+ location = toolbar_get_location (window->priv->toolbar);
+ ephy_tab_set_location (tab, location);
+ g_free (location);
}
static void
@@ -1335,9 +1346,9 @@ update_embed_dialogs (EphyWindow *window,
static void
ephy_window_notebook_switch_page_cb (GtkNotebook *notebook,
- GtkNotebookPage *page,
- guint page_num,
- EphyWindow *window)
+ GtkNotebookPage *page,
+ guint page_num,
+ EphyWindow *window)
{
EphyTab *tab, *old_tab;
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 315cd8cca..10712e3ff 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -20,13 +20,11 @@
#define EPHY_WINDOW_H
#include "ephy-embed.h"
-#include "ephy-embed-persist.h"
-#include "ephy-embed-popup-bw.h"
#include "ephy-dialog.h"
#include "ephy-notebook.h"
#include <glib-object.h>
#include <glib.h>
-#include <bonobo/bonobo-window.h>
+#include <gtk/gtkwindow.h>
G_BEGIN_DECLS
@@ -44,16 +42,16 @@ typedef struct Toolbar Toolbar;
struct EphyWindow
{
- BonoboWindow parent;
+ GtkWindow parent;
EphyWindowPrivate *priv;
/* Public to toolbar and statusbar, dont use outside */
- GObject *ui_component;
+ GObject *ui_merge;
};
struct EphyWindowClass
{
- BonoboWindowClass parent_class;
+ GtkWindowClass parent_class;
};
typedef enum
@@ -123,8 +121,6 @@ EphyTab *ephy_window_get_active_tab (EphyWindow *window);
EphyEmbed *ephy_window_get_active_embed (EphyWindow *window);
-EphyEmbedPopupBW *ephy_window_get_popup_factory (EphyWindow *window);
-
GList *ephy_window_get_tabs (EphyWindow *window);
Toolbar *ephy_window_get_toolbar (EphyWindow *window);
diff --git a/src/popup-commands.c b/src/popup-commands.c
index f1ec8ae74..84ce259c8 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -18,47 +18,60 @@
#include "popup-commands.h"
#include "ephy-shell.h"
+#include "ephy-new-bookmark.h"
+#include "ephy-embed-persist.h"
+#include "ephy-prefs.h"
+#include "ephy-embed-utils.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-file-helpers.h"
-static EphyWindow *
-get_window_from_popup (EphyEmbedPopup *popup)
+#include <string.h>
+
+static EphyEmbedEvent *
+get_event_info (EphyWindow *window)
{
- return EPHY_WINDOW (g_object_get_data(G_OBJECT(popup), "EphyWindow"));
+ EphyEmbedEvent *info;
+ EphyTab *tab;
+
+ tab = ephy_window_get_active_tab (window);
+ g_return_val_if_fail (tab != NULL, NULL);
+
+ info = ephy_tab_get_event (tab);
+ g_return_val_if_fail (info != NULL, NULL);
+
+ return info;
}
-void popup_cmd_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_link_in_new_window (EggAction *action,
+ EphyWindow *window)
{
EphyEmbedEvent *info;
EphyTab *tab;
const GValue *value;
- tab = ephy_window_get_active_tab (get_window_from_popup (popup));
+ tab = ephy_window_get_active_tab (window);
- info = ephy_embed_popup_get_event (popup);
+ info = get_event_info (window);
ephy_embed_event_get_property (info, "link", &value);
ephy_shell_new_tab (ephy_shell, NULL, tab,
- g_value_get_string (value),
- EPHY_NEW_TAB_IN_NEW_WINDOW);
+ g_value_get_string (value),
+ EPHY_NEW_TAB_IN_NEW_WINDOW);
}
-void popup_cmd_new_tab (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_link_in_new_tab (EggAction *action,
+ EphyWindow *window)
{
EphyEmbedEvent *info;
EphyTab *tab;
- EphyWindow *window;
const GValue *value;
- window = get_window_from_popup (popup);
- g_return_if_fail (window != NULL);
-
tab = ephy_window_get_active_tab (window);
- info = ephy_embed_popup_get_event (popup);
+ info = get_event_info (window);
ephy_embed_event_get_property (info, "link", &value);
@@ -67,21 +80,17 @@ void popup_cmd_new_tab (BonoboUIComponent *uic,
EPHY_NEW_TAB_IN_EXISTING_WINDOW);
}
-void popup_cmd_image_in_new_tab (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_image_in_new_tab (EggAction *action,
+ EphyWindow *window)
{
EphyEmbedEvent *info;
EphyTab *tab;
- EphyWindow *window;
const GValue *value;
- window = get_window_from_popup (popup);
- g_return_if_fail (window != NULL);
-
tab = ephy_window_get_active_tab (window);
- info = ephy_embed_popup_get_event (popup);
+ info = get_event_info (window);
ephy_embed_event_get_property (info, "image", &value);
@@ -90,17 +99,17 @@ void popup_cmd_image_in_new_tab (BonoboUIComponent *uic,
EPHY_NEW_TAB_IN_EXISTING_WINDOW);
}
-void popup_cmd_image_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_image_in_new_window (EggAction *action,
+ EphyWindow *window)
{
EphyEmbedEvent *info;
EphyTab *tab;
const GValue *value;
- tab = ephy_window_get_active_tab (get_window_from_popup (popup));
+ tab = ephy_window_get_active_tab (window);
- info = ephy_embed_popup_get_event (popup);
+ info = get_event_info (window);
ephy_embed_event_get_property (info, "image", &value);
@@ -109,15 +118,14 @@ void popup_cmd_image_in_new_window (BonoboUIComponent *uic,
EPHY_NEW_TAB_IN_NEW_WINDOW);
}
-void popup_cmd_add_bookmark (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_add_link_bookmark (EggAction *action,
+ EphyWindow *window)
{
GtkWidget *new_bookmark;
EphyBookmarks *bookmarks;
- EphyEmbedEvent *info = ephy_embed_popup_get_event (popup);
+ EphyEmbedEvent *info;
EphyEmbed *embed;
- GtkWidget *window;
const GValue *link_title;
const GValue *link_rel;
const GValue *link;
@@ -127,8 +135,8 @@ void popup_cmd_add_bookmark (BonoboUIComponent *uic,
const char *rel;
gboolean is_smart;
- embed = ephy_embed_popup_get_embed (popup);
- window = gtk_widget_get_toplevel (GTK_WIDGET (embed));
+ info = get_event_info (window);
+ embed = ephy_window_get_active_embed (window);
ephy_embed_event_get_property (info, "link_is_smart", &link_is_smart);
ephy_embed_event_get_property (info, "link", &link);
@@ -157,18 +165,14 @@ void popup_cmd_add_bookmark (BonoboUIComponent *uic,
gtk_widget_show (new_bookmark);
}
-void popup_cmd_frame_in_new_tab (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_frame_in_new_tab (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
- EphyWindow *window;
EphyEmbed *embed;
char *location;
- window = get_window_from_popup (popup);
- g_return_if_fail (window != NULL);
-
tab = ephy_window_get_active_tab (window);
embed = ephy_window_get_active_embed (window);
@@ -182,18 +186,14 @@ void popup_cmd_frame_in_new_tab (BonoboUIComponent *uic,
g_free (location);
}
-void popup_cmd_frame_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_frame_in_new_window (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
EphyEmbed *embed;
- EphyWindow *window;
char *location;
- window = get_window_from_popup (popup);
- g_return_if_fail (window != NULL);
-
tab = ephy_window_get_active_tab (window);
embed = ephy_window_get_active_embed (window);
@@ -207,16 +207,260 @@ void popup_cmd_frame_in_new_window (BonoboUIComponent *uic,
g_free (location);
}
-void popup_cmd_add_frame_bookmark (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+static void
+popup_cmd_copy_to_clipboard (EphyWindow *window, const char *text)
+{
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_NONE),
+ text, -1);
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY),
+ text, -1);
+}
+
+void
+popup_cmd_copy_page_location (EggAction *action,
+ EphyWindow *window)
+{
+ char *location;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_get_location (embed, FALSE, &location);
+ popup_cmd_copy_to_clipboard (window, location);
+ g_free (location);
+}
+
+void
+popup_cmd_copy_email (EggAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, "email", &value);
+ location = g_value_get_string (value);
+ popup_cmd_copy_to_clipboard (window, location);
+}
+
+void
+popup_cmd_copy_link_location (EggAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, "link", &value);
+ location = g_value_get_string (value);
+ popup_cmd_copy_to_clipboard (window, location);
+}
+
+static void
+save_property_url (EggAction *action,
+ EphyWindow *window,
+ gboolean ask_dest,
+ gboolean show_progress,
+ const char *property)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ GtkWidget *widget;
+ EphyEmbedPersist *persist;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, property, &value);
+ location = g_value_get_string (value);
+
+ widget = GTK_WIDGET (embed);
+
+ persist = ephy_embed_persist_new (embed);
+
+ ephy_embed_persist_set_source (persist, location);
+
+ if (show_progress)
+ {
+ ephy_embed_persist_set_flags (persist,
+ EMBED_PERSIST_SHOW_PROGRESS);
+ }
+
+ ephy_embed_utils_save (GTK_WIDGET (window),
+ CONF_STATE_DOWNLOADING_DIR,
+ ask_dest,
+ FALSE,
+ persist);
+}
+
+void
+popup_cmd_open_link (EggAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, "link", &value);
+ location = g_value_get_string (value);
+
+ ephy_embed_load_url (embed, location);
+}
+
+void
+popup_cmd_download_link (EggAction *action,
+ EphyWindow *window)
+{
+ save_property_url (action, window,
+ eel_gconf_get_boolean
+ (CONF_STATE_DOWNLOADING_DIR),
+ TRUE, "link");
+}
+
+void
+popup_cmd_save_image_as (EggAction *action,
+ EphyWindow *window)
+{
+ save_property_url (action, window, TRUE, FALSE, "image");
+}
+
+#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename"
+#define CONF_DESKTOP_BG_TYPE "/desktop/gnome/background/picture_options"
+
+static void
+background_download_completed (EphyEmbedPersist *persist,
+ gpointer data)
+{
+ const char *bg;
+ char *type;
+
+ ephy_embed_persist_get_dest (persist, &bg);
+ eel_gconf_set_string (CONF_DESKTOP_BG_PICTURE, bg);
+
+ type = eel_gconf_get_string (CONF_DESKTOP_BG_TYPE);
+ if (type || strcmp (type, "none") == 0)
+ {
+ eel_gconf_set_string (CONF_DESKTOP_BG_TYPE,
+ "wallpaper");
+ }
+
+ g_free (type);
+
+ g_object_unref (persist);
+}
+
+void
+popup_cmd_set_image_as_background (EggAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ char *dest, *base;
+ const GValue *value;
+ EphyEmbedPersist *persist;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+
+ persist = ephy_embed_persist_new (embed);
+
+ base = g_path_get_basename (location);
+ dest = g_build_filename (ephy_dot_dir (),
+ base, NULL);
+
+ ephy_embed_persist_set_source (persist, location);
+ ephy_embed_persist_set_dest (persist, dest);
+
+ ephy_embed_persist_save (persist);
+
+ g_signal_connect (persist, "completed",
+ G_CALLBACK (background_download_completed),
+ NULL);
+
+ g_free (dest);
+ g_free (base);
+}
+
+void
+popup_cmd_copy_image_location (EggAction *action,
+ EphyWindow *window)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+ popup_cmd_copy_to_clipboard (window, location);
+}
+
+void
+popup_cmd_save_background_as (EggAction *action,
+ EphyWindow *window)
+{
+ save_property_url (action, window, TRUE, FALSE, "background_image");
+}
+
+void
+popup_cmd_open_frame (EggAction *action,
+ EphyWindow *window)
{
- /* FIXME implement */
+ char *location;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_get_location (embed, FALSE, &location);
+
+ ephy_embed_load_url (embed, location);
}
-void popup_cmd_view_source (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname)
+void
+popup_cmd_open_image (EggAction *action,
+ EphyWindow *window)
{
- /* FIXME implement */
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ info = get_event_info (window);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+
+ ephy_embed_load_url (embed, location);
}
+
diff --git a/src/popup-commands.h b/src/popup-commands.h
index e5b369c76..c2ac4fb36 100644
--- a/src/popup-commands.h
+++ b/src/popup-commands.h
@@ -16,43 +16,69 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "ephy-embed-popup.h"
-#include "ephy-new-bookmark.h"
+#include "egg-action.h"
+#include "ephy-window.h"
-#include <bonobo/bonobo-ui-component.h>
+void popup_cmd_link_in_new_window (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_link_in_new_tab (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_new_tab (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_image_in_new_tab (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_image_in_new_tab (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_image_in_new_window (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_image_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_add_link_bookmark (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_add_bookmark (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_frame_in_new_tab (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_frame_in_new_tab (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_frame_in_new_window (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_frame_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_add_frame_bookmark (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_add_frame_bookmark (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
+void popup_cmd_view_source (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_copy_page_location (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_copy_email (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_copy_link_location (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_open_link (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_download_link (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_set_image_as_background (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_copy_image_location (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_save_background_as (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_open_frame (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_open_image (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_download_link (EggAction *action,
+ EphyWindow *window);
+
+void popup_cmd_save_image_as (EggAction *action,
+ EphyWindow *window);
-void popup_cmd_view_source (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
- const char* verbname);
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index 06b2cbb6e..fea06c2d7 100755
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -22,6 +22,7 @@
#include "ephy-bonobo-extensions.h"
#include "ephy-string.h"
#include "ephy-gui.h"
+#include "egg-menu-merge.h"
#include <string.h>
#include <bonobo/bonobo-i18n.h>
@@ -63,48 +64,68 @@ static GObjectClass *parent_class = NULL;
struct PPViewToolbarPrivate
{
EphyWindow *window;
- BonoboUIComponent *ui_component;
- gboolean visibility;
- EmbedChromeMask old_chrome;
+ EggMenuMerge *ui_merge;
+ EggActionGroup *action_group;
+ guint ui_id;
int current_page;
};
static void
-toolbar_cmd_ppv_goto_first (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname);
+toolbar_cmd_ppv_goto_first (EggMenuMerge *merge,
+ PPViewToolbar *t);
static void
-toolbar_cmd_ppv_goto_last (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname);
+toolbar_cmd_ppv_goto_last (EggMenuMerge *merge,
+ PPViewToolbar *t);
static void
-toolbar_cmd_ppv_go_back (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname);
+toolbar_cmd_ppv_go_back (EggMenuMerge *merge,
+ PPViewToolbar *t);
static void
-toolbar_cmd_ppv_go_forward (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname);
+toolbar_cmd_ppv_go_forward (EggMenuMerge *merge,
+ PPViewToolbar *t);
static void
-toolbar_cmd_ppv_close (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname);
-
-BonoboUIVerb ppview_toolbar_verbs [] = {
- BONOBO_UI_VERB ("PPVGotoFirst", (BonoboUIVerbFn)toolbar_cmd_ppv_goto_first),
- BONOBO_UI_VERB ("PPVGotoLast", (BonoboUIVerbFn)toolbar_cmd_ppv_goto_last),
- BONOBO_UI_VERB ("PPVGoBack", (BonoboUIVerbFn)toolbar_cmd_ppv_go_back),
- BONOBO_UI_VERB ("PPVGoForward", (BonoboUIVerbFn)toolbar_cmd_ppv_go_forward),
- BONOBO_UI_VERB ("PPVClose", (BonoboUIVerbFn)toolbar_cmd_ppv_close),
-
- BONOBO_UI_VERB_END
+toolbar_cmd_ppv_close (EggMenuMerge *merge,
+ PPViewToolbar *t);
+
+static EggActionGroupEntry entries [] = {
+ { "PPVGotoFirst", N_("First"),
+ GTK_STOCK_GOTO_FIRST, NULL,
+ N_("Go to the first page"),
+ (GCallback)toolbar_cmd_ppv_goto_first, NULL },
+ { "PPVGotoLast", N_("Last"),
+ GTK_STOCK_GOTO_LAST, NULL,
+ N_("Go to the last page"),
+ (GCallback)toolbar_cmd_ppv_goto_last, NULL },
+ { "PPVGoBack", N_("Previous"),
+ GTK_STOCK_GO_BACK, NULL,
+ N_("Go to the previous page"),
+ (GCallback)toolbar_cmd_ppv_go_back, NULL },
+ { "PPVGoForward", N_("Next"),
+ GTK_STOCK_GO_FORWARD, NULL,
+ N_("Go to next page"),
+ (GCallback)toolbar_cmd_ppv_go_forward, NULL },
+ { "PPVClose", N_("Close"),
+ GTK_STOCK_CLOSE, NULL,
+ N_("Close print preview"),
+ (GCallback)toolbar_cmd_ppv_close, NULL },
};
-
-GType
+static guint n_entries = G_N_ELEMENTS (entries);
+
+static const gchar *ui_info =
+"<Root>\n"
+" <dockitem name=\"PPViewToolbar\">\n"
+" <toolitem name=\"PPVGotoFirstItem\" verb=\"PPVGotoFirst\" />\n"
+" <toolitem name=\"PPVGotoLastItem\" verb=\"PPVGotoLast\" />\n"
+" <toolitem name=\"PPVGoBackItem\"verb=\"PPVGoBack\" />\n"
+" <toolitem name=\"PPVGoForwardItem\" verb=\"PPVGoForward\" />\n"
+" <toolitem name=\"PPVClose\" verb=\"PPVClose\" />\n"
+" </dockitem>\n"
+"</Root>\n";
+
+GType
ppview_toolbar_get_type (void)
{
static GType ppview_toolbar_type = 0;
@@ -192,22 +213,30 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window)
g_return_if_fail (t->priv->window == NULL);
t->priv->window = window;
- t->priv->ui_component = BONOBO_UI_COMPONENT
- (t->priv->window->ui_component);
-
- bonobo_ui_component_add_verb_list_with_data (t->priv->ui_component,
- ppview_toolbar_verbs,
- t);
+ t->priv->ui_merge = EGG_MENU_MERGE (t->priv->window->ui_merge);
+
+ t->priv->action_group = egg_action_group_new ("PPViewActions");
+ egg_action_group_add_actions (t->priv->action_group, entries, n_entries);
+ egg_menu_merge_insert_action_group (t->priv->ui_merge,
+ t->priv->action_group, 0);
+ t->priv->ui_id = egg_menu_merge_add_ui_from_string
+ (t->priv->ui_merge, ui_info, -1, NULL);
}
static void
ppview_toolbar_init (PPViewToolbar *t)
{
+ int i;
+
t->priv = g_new0 (PPViewToolbarPrivate, 1);
t->priv->window = NULL;
- t->priv->ui_component = NULL;
- t->priv->visibility = TRUE;
+ t->priv->ui_merge = NULL;
+
+ for (i = 0; i < n_entries; i++)
+ {
+ entries[i].user_data = t;
+ }
}
static void
@@ -221,6 +250,8 @@ ppview_toolbar_finalize (GObject *object)
t = PPVIEW_TOOLBAR (object);
g_return_if_fail (t->priv != NULL);
+ egg_menu_merge_remove_ui (t->priv->ui_merge, t->priv->ui_id);
+ g_object_unref (t->priv->action_group);
g_free (t->priv);
@@ -241,13 +272,6 @@ ppview_toolbar_new (EphyWindow *window)
return t;
}
-void
-ppview_toolbar_set_old_chrome (PPViewToolbar *t,
- EmbedChromeMask chrome)
-{
- t->priv->old_chrome = chrome;
-}
-
static void
toolbar_update_sensitivity (PPViewToolbar *t)
{
@@ -260,7 +284,7 @@ toolbar_update_sensitivity (PPViewToolbar *t)
ephy_embed_print_preview_num_pages (embed, &pages);
c_page = t->priv->current_page;
-
+/*
ephy_bonobo_set_sensitive (t->priv->ui_component,
PPV_GO_BACK_PATH, c_page > 1);
ephy_bonobo_set_sensitive (t->priv->ui_component,
@@ -269,30 +293,12 @@ toolbar_update_sensitivity (PPViewToolbar *t)
PPV_GO_FORWARD_PATH, c_page < pages);
ephy_bonobo_set_sensitive (t->priv->ui_component,
PPV_GOTO_LAST_PATH, c_page < pages);
-}
-
-void
-ppview_toolbar_set_visibility (PPViewToolbar *t, gboolean visibility)
-{
- if (visibility == t->priv->visibility) return;
-
- t->priv->visibility = visibility;
-
- if (visibility)
- {
- t->priv->current_page = 1;
- toolbar_update_sensitivity (t);
- }
-
- ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(t->priv->ui_component),
- "/PrintPreview",
- !visibility);
+ */
}
static void
-toolbar_cmd_ppv_goto_first (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname)
+toolbar_cmd_ppv_goto_first (EggMenuMerge *merge,
+ PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
EphyEmbed *embed;
@@ -308,9 +314,8 @@ toolbar_cmd_ppv_goto_first (BonoboUIComponent *uic,
}
static void
-toolbar_cmd_ppv_goto_last (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname)
+toolbar_cmd_ppv_goto_last (EggMenuMerge *merge,
+ PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
EphyEmbed *embed;
@@ -329,9 +334,8 @@ toolbar_cmd_ppv_goto_last (BonoboUIComponent *uic,
}
static void
-toolbar_cmd_ppv_go_back (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname)
+toolbar_cmd_ppv_go_back (EggMenuMerge *merge,
+ PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
EphyEmbed *embed;
@@ -349,9 +353,8 @@ toolbar_cmd_ppv_go_back (BonoboUIComponent *uic,
}
static void
-toolbar_cmd_ppv_go_forward (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname)
+toolbar_cmd_ppv_go_forward (EggMenuMerge *merge,
+ PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
EphyEmbed *embed;
@@ -369,20 +372,8 @@ toolbar_cmd_ppv_go_forward (BonoboUIComponent *uic,
}
static void
-toolbar_cmd_ppv_close (BonoboUIComponent *uic,
- PPViewToolbar *t,
- const char* verbname)
+toolbar_cmd_ppv_close (EggMenuMerge *merge,
+ PPViewToolbar *t)
{
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- ephy_window_set_chrome (window, t->priv->old_chrome);
-
- ephy_embed_print_preview_close (embed);
-
- toolbar_update_sensitivity (t);
}
diff --git a/src/ppview-toolbar.h b/src/ppview-toolbar.h
index 3e6a4b504..35356a0e5 100644
--- a/src/ppview-toolbar.h
+++ b/src/ppview-toolbar.h
@@ -52,12 +52,6 @@ GType ppview_toolbar_get_type (void);
PPViewToolbar *ppview_toolbar_new (EphyWindow *window);
-void ppview_toolbar_set_visibility (PPViewToolbar *t,
- gboolean visibility);
-
-void ppview_toolbar_set_old_chrome (PPViewToolbar *t,
- EmbedChromeMask chrome);
-
G_END_DECLS
#endif
diff --git a/src/statusbar.c b/src/statusbar.c
index 8ac84cfb9..8ff6b4402 100755
--- a/src/statusbar.c
+++ b/src/statusbar.c
@@ -18,7 +18,6 @@
#include "statusbar.h"
#include "ephy-stock-icons.h"
-#include "ephy-bonobo-extensions.h"
#include <string.h>
#include <time.h>
@@ -27,45 +26,22 @@
#include <gtk/gtkimage.h>
#include <gtk/gtkframe.h>
#include <gtk/gtktooltips.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-control.h>
static void statusbar_class_init (StatusbarClass *klass);
static void statusbar_init (Statusbar *t);
static void statusbar_finalize (GObject *object);
-static void
-statusbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void
-statusbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void
-statusbar_set_window (Statusbar *t, EphyWindow *window);
-
-enum
-{
- PROP_0,
- PROP_EPHY_WINDOW
-};
static GObjectClass *parent_class = NULL;
struct StatusbarPrivate
{
- EphyWindow *window;
- BonoboUIComponent *ui_component;
GtkWidget *security_icon;
GtkWidget *progress;
GtkTooltips *tooltips;
GtkWidget *security_evbox;
- gboolean visibility;
};
-GType
+GType
statusbar_get_type (void)
{
static GType statusbar_type = 0;
@@ -85,7 +61,7 @@ statusbar_get_type (void)
(GInstanceInitFunc) statusbar_init
};
- statusbar_type = g_type_register_static (G_TYPE_OBJECT,
+ statusbar_type = g_type_register_static (GTK_TYPE_STATUSBAR,
"Statusbar",
&our_info, 0);
}
@@ -102,55 +78,12 @@ statusbar_class_init (StatusbarClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = statusbar_finalize;
- object_class->set_property = statusbar_set_property;
- object_class->get_property = statusbar_get_property;
-
- g_object_class_install_property (object_class,
- PROP_EPHY_WINDOW,
- g_param_spec_object ("EphyWindow",
- "EphyWindow",
- "Parent window",
- EPHY_WINDOW_TYPE,
- G_PARAM_READWRITE));
-}
-
-static void
-statusbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- Statusbar *s = STATUSBAR (object);
-
- switch (prop_id)
- {
- case PROP_EPHY_WINDOW:
- statusbar_set_window (s, g_value_get_object (value));
- break;
- }
-}
-
-static void
-statusbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- Statusbar *s = STATUSBAR (object);
-
- switch (prop_id)
- {
- case PROP_EPHY_WINDOW:
- g_value_set_object (value, s->priv->window);
- break;
- }
}
static void
create_statusbar_security_icon (Statusbar *s)
{
GtkWidget *security_frame;
- BonoboControl *control;
security_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (security_frame),
@@ -162,61 +95,38 @@ create_statusbar_security_icon (Statusbar *s)
GTK_WIDGET (s->priv->security_evbox));
gtk_container_add (GTK_CONTAINER (s->priv->security_evbox),
GTK_WIDGET (s->priv->security_icon));
- /*
- g_signal_connect (G_OBJECT (security_eventbox),
- "button_release_event",
- GTK_SIGNAL_FUNC
- (security_icon_button_release_cb), t);
- */
-
- control = bonobo_control_new (security_frame);
- bonobo_ui_component_object_set (s->priv->ui_component,
- "/status/SecurityIconWrapper",
- BONOBO_OBJREF (control),
- NULL);
- bonobo_object_unref (control);
statusbar_set_security_state (s, FALSE, NULL);
gtk_widget_show_all (security_frame);
+
+ gtk_box_pack_start (GTK_BOX (s),
+ GTK_WIDGET (security_frame),
+ FALSE, TRUE, 0);
}
static void
create_statusbar_progress (Statusbar *s)
{
- BonoboControl *control;
-
s->priv->progress = gtk_progress_bar_new ();
-
- control = bonobo_control_new (s->priv->progress);
- bonobo_ui_component_object_set (s->priv->ui_component,
- "/status/ProgressWrapper",
- BONOBO_OBJREF (control),
- NULL);
-
gtk_widget_show_all (s->priv->progress);
-}
-
-static void
-statusbar_set_window (Statusbar *s, EphyWindow *window)
-{
- g_return_if_fail (s->priv->window == NULL);
- s->priv->window = window;
- s->priv->ui_component = BONOBO_UI_COMPONENT
- (s->priv->window->ui_component);
-
- create_statusbar_progress (s);
- create_statusbar_security_icon (s);
+ gtk_box_pack_start (GTK_BOX (s),
+ GTK_WIDGET (s->priv->progress),
+ FALSE, TRUE, 0);
}
static void
statusbar_init (Statusbar *t)
{
t->priv = g_new0 (StatusbarPrivate, 1);
- t->priv->visibility = TRUE;
t->priv->tooltips = gtk_tooltips_new ();
+
+ gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (t), FALSE);
+
+ create_statusbar_progress (t);
+ create_statusbar_security_icon (t);
}
static void
@@ -238,34 +148,18 @@ statusbar_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-Statusbar *
-statusbar_new (EphyWindow *window)
+GtkWidget *
+statusbar_new (void)
{
- Statusbar *t;
-
- t = STATUSBAR (g_object_new (STATUSBAR_TYPE,
- "EphyWindow", window,
- NULL));
+ GtkWidget *t;
- g_return_val_if_fail (t->priv != NULL, NULL);
+ t = GTK_WIDGET (g_object_new (STATUSBAR_TYPE,
+ NULL));
return t;
}
void
-statusbar_set_visibility (Statusbar *t,
- gboolean visibility)
-{
- if (visibility == t->priv->visibility) return;
-
- t->priv->visibility = visibility;
-
- ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(t->priv->ui_component),
- "/status",
- !visibility);
-}
-
-void
statusbar_set_security_state (Statusbar *t,
gboolean state,
const char *tooltip)
@@ -302,20 +196,9 @@ void
statusbar_set_message (Statusbar *s,
const char *message)
{
- g_return_if_fail (BONOBO_IS_UI_COMPONENT(s->priv->ui_component));
g_return_if_fail (message != NULL);
- /* Bonobo doesnt like 0 length messages */
- if (g_utf8_strlen (message, -1) == 0)
- {
- message = " ";
- }
-
- if (bonobo_ui_component_get_container (s->priv->ui_component)) /* should not do this here... */
- {
- bonobo_ui_component_set_status (s->priv->ui_component,
- message,
- NULL);
- }
+ gtk_statusbar_pop (GTK_STATUSBAR (s), 0);
+ gtk_statusbar_push (GTK_STATUSBAR (s), 0, message);
}
diff --git a/src/statusbar.h b/src/statusbar.h
index 590b89394..27af4b315 100644
--- a/src/statusbar.h
+++ b/src/statusbar.h
@@ -19,13 +19,10 @@
#ifndef STATUSBAR_H
#define STATUSBAR_H
-#include "ephy-window.h"
+#include <gtk/gtkstatusbar.h>
G_BEGIN_DECLS
-#include <glib-object.h>
-#include <glib.h>
-
typedef struct Statusbar Statusbar;
typedef struct StatusbarClass StatusbarClass;
@@ -39,21 +36,18 @@ typedef struct StatusbarPrivate StatusbarPrivate;
struct Statusbar
{
- GObject parent;
+ GtkStatusbar parent;
StatusbarPrivate *priv;
};
struct StatusbarClass
{
- GObjectClass parent_class;
+ GtkStatusbarClass parent_class;
};
GType statusbar_get_type (void);
-Statusbar *statusbar_new (EphyWindow *window);
-
-void statusbar_set_visibility (Statusbar *s,
- gboolean visibility);
+GtkWidget *statusbar_new (void);
void statusbar_set_security_state (Statusbar *s,
gboolean state,
diff --git a/src/toolbar.c b/src/toolbar.c
index 27c2606f2..51cf64b5f 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -18,48 +18,22 @@
*/
#include "toolbar.h"
-#include "ephy-spinner.h"
-#include "ephy-window.h"
-#include "ephy-bonobo-extensions.h"
-#include "ephy-string.h"
-#include "ephy-gui.h"
-#include "ephy-location-entry.h"
+#include "egg-menu-merge.h"
+#include "ephy-file-helpers.h"
#include "ephy-shell.h"
+#include "ephy-location-entry.h"
#include "ephy-dnd.h"
-#include "ephy-toolbar-bonobo-view.h"
-#include "ephy-toolbar-item-factory.h"
-#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
-#include "ephy-navigation-button.h"
-#include "ephy-debug.h"
-
-#include <string.h>
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-toolbar-button-item.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkmenu.h>
-
-#define DEFAULT_TOOLBAR_SETUP \
- "back_menu=navigation_button(direction=back,arrow=TRUE);" \
- "forward_menu=navigation_button(direction=forward,arrow=TRUE);" \
- "stop=std_toolitem(item=stop);" \
- "reload=std_toolitem(item=reload);" \
- "home=std_toolitem(item=home);" \
- "favicon=favicon;" \
- "location=location;" \
- "spinner=spinner;"
-
-#define ZOOM_DELAY 50
+#include "ephy-spinner.h"
+#include "ephy-spinner-action.h"
+#include "ephy-location-action.h"
+#include "ephy-favicon-action.h"
+#include "ephy-navigation-action.h"
+#include "window-commands.h"
static void toolbar_class_init (ToolbarClass *klass);
static void toolbar_init (Toolbar *t);
static void toolbar_finalize (GObject *object);
static void toolbar_set_window (Toolbar *t, EphyWindow *window);
-static void toolbar_get_widgets (Toolbar *t);
-static void toolbar_changed_cb (EphyToolbar *gt, Toolbar *t);
static void
toolbar_set_property (GObject *object,
guint prop_id,
@@ -78,31 +52,17 @@ enum
PROP_EPHY_WINDOW
};
-enum
-{
- TOOLBAR_ITEM_STYLE_PROP,
- TOOLBAR_ITEM_ORIENTATION_PROP,
- TOOLBAR_ITEM_PRIORITY_PROP
-};
-
static GObjectClass *parent_class = NULL;
struct ToolbarPrivate
{
EphyWindow *window;
- BonoboUIComponent *ui_component;
- EphyTbBonoboView *bview;
-
- GtkWidget *spinner;
+ EggMenuMerge *ui_merge;
+ EggActionGroup *action_group;
gboolean visibility;
GtkWidget *location_entry;
- GSList *navigation_buttons;
- GtkTooltips *tooltips;
+ GtkWidget *spinner;
GtkWidget *favicon;
- GtkWidget *favicon_ebox;
- GtkWidget *zoom_spinbutton;
- guint zoom_timeout_id;
- gboolean zoom_lock;
};
GType
@@ -125,7 +85,7 @@ toolbar_get_type (void)
(GInstanceInitFunc) toolbar_init
};
- toolbar_type = g_type_register_static (EPHY_TYPE_TOOLBAR,
+ toolbar_type = g_type_register_static (G_TYPE_OBJECT,
"Toolbar",
&our_info, 0);
}
@@ -153,8 +113,6 @@ toolbar_class_init (ToolbarClass *klass)
"Parent window",
EPHY_WINDOW_TYPE,
G_PARAM_READWRITE));
- ephy_toolbar_item_register_type
- ("navigation_button", (EphyTbItemConstructor) ephy_navigation_button_new);
}
static void
@@ -190,287 +148,108 @@ toolbar_get_property (GObject *object,
}
static void
-toolbar_location_url_activate_cb (EphyLocationEntry *entry,
- const char *content,
- const char *target,
- EphyWindow *window)
+toolbar_setup_widgets (Toolbar *t)
{
- EphyBookmarks *bookmarks;
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell);
-
- if (!content)
- {
- ephy_window_load_url (window, target);
- }
- else
- {
- char *url;
-
- url = ephy_bookmarks_solve_smart_url
- (bookmarks, target, content);
- g_return_if_fail (url != NULL);
- ephy_window_load_url (window, url);
- g_free (url);
- }
+ egg_menu_merge_add_ui_from_file (t->priv->ui_merge,
+ ephy_file ("epiphany-toolbar.xml"), NULL);
+ egg_menu_merge_ensure_update (t->priv->ui_merge);
}
static void
-each_url_get_data_binder (EphyDragEachSelectedItemDataGet iteratee,
- gpointer iterator_context, gpointer data)
+add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window)
{
- 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)
+go_location_cb (EggAction *action, char *location, 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);
-}
+ EphyEmbed *embed;
-static void
-toolbar_setup_favicon_ebox (Toolbar *t, GtkWidget *w)
-{
- ToolbarPrivate *p = t->priv;
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
- g_return_if_fail (w == p->favicon_ebox);
-
- p->favicon = g_object_ref (gtk_image_new ());
- gtk_container_add (GTK_CONTAINER (p->favicon_ebox), p->favicon);
- gtk_container_set_border_width (GTK_CONTAINER (p->favicon_ebox), 2);
-
- ephy_dnd_url_drag_source_set (p->favicon_ebox);
-
- g_signal_connect (G_OBJECT (p->favicon_ebox),
- "drag_data_get",
- G_CALLBACK (favicon_drag_data_get_cb),
- p->window);
- gtk_widget_show_all (p->favicon_ebox);
-}
-
-static gboolean
-toolbar_zoom_timeout_cb (gpointer data)
-{
- Toolbar *t = data;
- gint zoom = toolbar_get_zoom (t);
-
- g_return_val_if_fail (IS_EPHY_WINDOW (t->priv->window), FALSE);
-
- ephy_window_set_zoom (t->priv->window, zoom);
-
- return FALSE;
-}
-
-static void
-toolbar_zoom_spinbutton_value_changed_cb (GtkSpinButton *sb, Toolbar *t)
-{
- ToolbarPrivate *p = t->priv;
- if (p->zoom_timeout_id != 0)
- {
- g_source_remove (p->zoom_timeout_id);
- }
- if (!p->zoom_lock)
- {
- p->zoom_timeout_id = g_timeout_add (ZOOM_DELAY, toolbar_zoom_timeout_cb, t);
- }
-}
-
-static void
-toolbar_setup_zoom_spinbutton (Toolbar *t, GtkWidget *w)
-{
- g_signal_connect (w, "value_changed",
- G_CALLBACK (toolbar_zoom_spinbutton_value_changed_cb), t);
- gtk_tooltips_set_tip (t->priv->tooltips, w, _("Zoom"), NULL);
+ ephy_embed_load_url (embed, location);
}
static void
-toolbar_setup_location_entry (Toolbar *t, GtkWidget *w)
-{
- EphyAutocompletion *ac = ephy_shell_get_autocompletion (ephy_shell);
- EphyLocationEntry *e;
-
- g_return_if_fail (w == t->priv->location_entry);
- g_return_if_fail (EPHY_IS_LOCATION_ENTRY (w));
-
- e = EPHY_LOCATION_ENTRY (w);
- ephy_location_entry_set_autocompletion (e, ac);
-
- g_signal_connect (e, "activated",
- GTK_SIGNAL_FUNC(toolbar_location_url_activate_cb),
- t->priv->window);
+toolbar_setup_actions (Toolbar *t)
+{
+ EggAction *action;
+
+ t->priv->action_group = egg_action_group_new ("SpecialToolbarActions");
+
+ action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationBack",
+ "label", _("Back"),
+ "stock_id", GTK_STOCK_GO_BACK,
+ "window", t->priv->window,
+ "direction", EPHY_NAVIGATION_DIRECTION_BACK,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_go_back), t->priv->window);
+ egg_action_group_add_action (t->priv->action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationForward",
+ "label", _("Forward"),
+ "stock_id", GTK_STOCK_GO_FORWARD,
+ "window", t->priv->window,
+ "direction", EPHY_NAVIGATION_DIRECTION_FORWARD,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_go_forward), t->priv->window);
+ egg_action_group_add_action (t->priv->action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationUp",
+ "label", _("Up"),
+ "window", t->priv->window,
+ "direction", EPHY_NAVIGATION_DIRECTION_UP,
+ "stock_id", GTK_STOCK_GO_UP,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_go_up), t->priv->window);
+ egg_action_group_add_action (t->priv->action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_SPINNER_ACTION,
+ "name", "Spinner",
+ NULL);
+ egg_action_group_add_action (t->priv->action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_LOCATION_ACTION,
+ "name", "Location",
+ NULL);
+ g_signal_connect (action, "go_location",
+ G_CALLBACK (go_location_cb), t->priv->window);
+ egg_action_group_add_action (t->priv->action_group, action);
+ g_object_unref (action);
+
+ 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);
}
static void
-toolbar_setup_spinner (Toolbar *t, GtkWidget *w)
-{
- ToolbarPrivate *p = t->priv;
- GtkWidget *spinner;
-
- g_return_if_fail (w == p->spinner);
-
- /* build the spinner and insert it into the box */
- spinner = ephy_spinner_new ();
- ephy_spinner_set_small_mode (EPHY_SPINNER (spinner), TRUE);
- gtk_container_add (GTK_CONTAINER (p->spinner), spinner);
- gtk_widget_show (spinner);
-
- /* don't care about the box anymore */
- g_object_unref (p->spinner);
- p->spinner = g_object_ref (spinner);
-}
-
-
-static void
toolbar_set_window (Toolbar *t, EphyWindow *window)
{
g_return_if_fail (t->priv->window == NULL);
t->priv->window = window;
- t->priv->ui_component = g_object_ref (t->priv->window->ui_component);
-
- ephy_tb_bonobo_view_set_path (t->priv->bview, t->priv->ui_component, "/Toolbar");
-
- toolbar_get_widgets (t);
-}
-
-static void
-toolbar_get_widgets (Toolbar *t)
-{
- ToolbarPrivate *p;
- EphyToolbar *gt;
- EphyTbItem *it;
- GSList *li;
- const gchar *nav_buttons_ids[] = {"back", "back_menu", "up", "up_menu", "forward", "forward_menu" };
- guint i;
-
- LOG ("in toolbar_get_widgets");
-
- g_return_if_fail (IS_TOOLBAR (t));
- p = t->priv;
- g_return_if_fail (IS_EPHY_WINDOW (p->window));
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (p->ui_component));
-
- /* release all the widgets */
-
- for (li = p->navigation_buttons; li; li = li->next)
- {
- g_object_unref (li->data);
- }
- g_slist_free (p->navigation_buttons);
- p->navigation_buttons = NULL;
-
- if (p->favicon_ebox)
- {
- g_object_unref (p->favicon_ebox);
- p->favicon_ebox = NULL;
- }
-
- if (p->favicon)
- {
- g_object_unref (p->favicon);
- p->favicon = NULL;
- }
-
- if (p->location_entry)
- {
- g_object_unref (p->location_entry);
- p->location_entry = NULL;
- }
-
- if (p->spinner)
- {
- g_object_unref (p->spinner);
- p->spinner = NULL;
- }
-
- if (p->zoom_spinbutton)
- {
- g_object_unref (p->zoom_spinbutton);
- p->zoom_spinbutton = NULL;
- }
-
- gt = EPHY_TOOLBAR (t);
-
- for (i = 0; i < G_N_ELEMENTS (nav_buttons_ids); ++i)
- {
- it = ephy_toolbar_get_item_by_id (gt, nav_buttons_ids[i]);
- if (it)
- {
- if (EPHY_IS_NAVIGATION_BUTTON (it))
- {
- LOG ("got a navigation button")
- p->navigation_buttons = g_slist_prepend (p->navigation_buttons, g_object_ref (it));
- if (p->window)
- {
- ephy_tbi_set_window (EPHY_TBI (it), p->window);
- }
- }
- else
- {
- g_warning ("An unexpected button has been found in your toolbar. "
- "Maybe your setup is too old.");
- }
- }
- }
-
- it = ephy_toolbar_get_item_by_id (gt, "location");
- if (it)
- {
- p->location_entry = ephy_tb_item_get_widget (it);
- g_object_ref (p->location_entry);
- toolbar_setup_location_entry (t, p->location_entry);
-
- LOG ("got a location entry")
- }
-
- it = ephy_toolbar_get_item_by_id (gt, "favicon");
- if (it)
- {
- p->favicon_ebox = ephy_tb_item_get_widget (it);
- g_object_ref (p->favicon_ebox);
- toolbar_setup_favicon_ebox (t, p->favicon_ebox);
-
- LOG ("got a favicon ebox")
- }
-
- it = ephy_toolbar_get_item_by_id (gt, "spinner");
- if (it)
- {
- p->spinner = ephy_tb_item_get_widget (it);
- g_object_ref (p->spinner);
- toolbar_setup_spinner (t, p->spinner);
-
- LOG ("got a spinner")
- }
-
- it = ephy_toolbar_get_item_by_id (gt, "zoom");
- if (it)
- {
- p->zoom_spinbutton = ephy_tb_item_get_widget (it);
- g_object_ref (p->zoom_spinbutton);
- toolbar_setup_zoom_spinbutton (t, p->zoom_spinbutton);
-
- LOG ("got a zoom control")
- }
-
- /* update the controls */
- ephy_window_update_all_controls (p->window);
+ t->priv->ui_merge = EGG_MENU_MERGE (window->ui_merge);
+ g_signal_connect (t->priv->ui_merge, "add_widget",
+ G_CALLBACK (add_widget), t);
+
+ toolbar_setup_actions (t);
+ egg_menu_merge_insert_action_group (t->priv->ui_merge,
+ t->priv->action_group, 1);
+ toolbar_setup_widgets (t);
}
static void
@@ -479,38 +258,8 @@ toolbar_init (Toolbar *t)
t->priv = g_new0 (ToolbarPrivate, 1);
t->priv->window = NULL;
- t->priv->ui_component = NULL;
- t->priv->navigation_buttons = NULL;
+ t->priv->ui_merge = NULL;
t->priv->visibility = TRUE;
- t->priv->tooltips = gtk_tooltips_new ();
- g_object_ref (t->priv->tooltips);
- gtk_object_sink (GTK_OBJECT (t->priv->tooltips));
-
- if (!ephy_toolbar_listen_to_gconf (EPHY_TOOLBAR (t), CONF_TOOLBAR_SETUP))
- {
- /* FIXME: make this a dialog? */
- g_warning ("An incorrect toolbar configuration has been found, resetting to the default");
-
- /* this is to make sure we get a toolbar, even if the
- setup is wrong or there is no schema */
- eel_gconf_set_string (CONF_TOOLBAR_SETUP, DEFAULT_TOOLBAR_SETUP);
- }
-
- g_signal_connect (t, "changed", G_CALLBACK (toolbar_changed_cb), t);
-
- t->priv->bview = ephy_tb_bonobo_view_new ();
- ephy_tb_bonobo_view_set_toolbar (t->priv->bview, EPHY_TOOLBAR (t));
-}
-
-static void
-toolbar_changed_cb (EphyToolbar *gt, Toolbar *t)
-{
- g_return_if_fail (gt == EPHY_TOOLBAR (t));
-
- if (t->priv->window)
- {
- toolbar_get_widgets (t);
- }
}
static void
@@ -518,7 +267,6 @@ toolbar_finalize (GObject *object)
{
Toolbar *t;
ToolbarPrivate *p;
- GSList *li;
g_return_if_fail (object != NULL);
g_return_if_fail (IS_TOOLBAR (object));
@@ -528,24 +276,7 @@ toolbar_finalize (GObject *object)
g_return_if_fail (p != NULL);
- if (p->location_entry) g_object_unref (p->location_entry);
- if (p->favicon_ebox) g_object_unref (p->favicon_ebox);
- if (p->favicon) g_object_unref (p->favicon);
- if (p->spinner) g_object_unref (p->spinner);
- if (p->tooltips) g_object_unref (p->tooltips);
- if (p->zoom_spinbutton) g_object_unref (p->zoom_spinbutton);
- if (p->zoom_timeout_id != 0)
- {
- g_source_remove (p->zoom_timeout_id);
- }
-
- for (li = t->priv->navigation_buttons; li; li = li->next)
- {
- g_object_unref (li->data);
- }
- g_slist_free (t->priv->navigation_buttons);
-
- g_object_unref (t->priv->bview);
+ g_object_unref (t->priv->action_group);
g_free (t->priv);
@@ -569,165 +300,106 @@ toolbar_new (EphyWindow *window)
void
toolbar_set_visibility (Toolbar *t, gboolean visibility)
{
- if (visibility == t->priv->visibility) return;
-
- t->priv->visibility = visibility;
-
- ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(t->priv->ui_component),
- "/Toolbar",
- !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;
-static void
-toolbar_navigation_button_set_sensitive (Toolbar *t, EphyNavigationDirection d, gboolean sensitivity)
-{
- GSList *li;
- ToolbarPrivate *p = t->priv;
-
- for (li = p->navigation_buttons; li; li = li->next)
- {
- EphyNavigationButton *b = EPHY_NAVIGATION_BUTTON (li->data);
- if (ephy_navigation_button_get_direction (b) == d)
- {
- ephy_navigation_button_set_sensitive (b, sensitivity);
- }
- }
-}
-
-void
-toolbar_button_set_sensitive (Toolbar *t,
- ToolbarButtonID id,
- gboolean sensitivity)
-{
- switch (id)
- {
- case TOOLBAR_BACK_BUTTON:
- toolbar_navigation_button_set_sensitive (t, EPHY_NAVIGATION_DIRECTION_BACK, sensitivity);
- break;
- case TOOLBAR_FORWARD_BUTTON:
- toolbar_navigation_button_set_sensitive (t, EPHY_NAVIGATION_DIRECTION_FORWARD, sensitivity);
- break;
- case TOOLBAR_UP_BUTTON:
- toolbar_navigation_button_set_sensitive (t, EPHY_NAVIGATION_DIRECTION_UP, sensitivity);
- break;
- case TOOLBAR_STOP_BUTTON:
- ephy_bonobo_set_sensitive (t->priv->ui_component,
- "/commands/GoStop",
- sensitivity);
- 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;
-gint
-toolbar_get_zoom (Toolbar *t)
-{
- gint zoom;
- if (t->priv->zoom_spinbutton)
- {
- zoom = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (t->priv->zoom_spinbutton));
- }
- else
- {
- zoom = 100;
- }
- return zoom;
+ 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_set_zoom (Toolbar *t, gint zoom)
-{
- ToolbarPrivate *p = t->priv;
- if (p->zoom_spinbutton)
- {
- p->zoom_lock = TRUE;
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (p->zoom_spinbutton), zoom);
- p->zoom_lock = FALSE;
- }
+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 5764c14e1..63ebff824 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -22,7 +22,6 @@
#include "ephy-window.h"
#include <glib-object.h>
#include <glib.h>
-#include "ephy-toolbar.h"
G_BEGIN_DECLS
@@ -36,23 +35,15 @@ typedef struct ToolbarClass ToolbarClass;
typedef struct ToolbarPrivate ToolbarPrivate;
-typedef enum
-{
- TOOLBAR_BACK_BUTTON,
- TOOLBAR_FORWARD_BUTTON,
- TOOLBAR_STOP_BUTTON,
- TOOLBAR_UP_BUTTON
-} ToolbarButtonID;
-
struct Toolbar
{
- EphyToolbar parent_object;
+ GObject parent_object;
ToolbarPrivate *priv;
};
struct ToolbarClass
{
- EphyToolbarClass parent_class;
+ GObjectClass parent_class;
};
GType toolbar_get_type (void);
@@ -62,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);
@@ -75,14 +62,15 @@ char *toolbar_get_location (Toolbar *t);
void toolbar_set_location (Toolbar *t,
const char *location);
-gint toolbar_get_zoom (Toolbar *t);
-
-void toolbar_set_zoom (Toolbar *t, gint zoom);
-
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
diff --git a/src/window-commands.c b/src/window-commands.c
index 0364a7d60..ece083b35 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -26,8 +26,6 @@
#include "ephy-prefs.h"
#include "ephy-embed-utils.h"
#include "pdm-dialog.h"
-#include "toolbar.h"
-#include "ephy-toolbar-editor.h"
#include "ephy-bookmarks-editor.h"
#include "ephy-new-bookmark.h"
@@ -58,9 +56,8 @@
"separator;"
void
-window_cmd_edit_find (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_find (EggAction *action,
+ EphyWindow *window)
{
EphyDialog *dialog;
dialog = ephy_window_get_find_dialog (window);
@@ -78,9 +75,8 @@ print_dialog_preview_cb (PrintDialog *dialog,
}
void
-window_cmd_file_print (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_print (EggAction *action,
+ EphyWindow *window)
{
EphyDialog *dialog;
EphyEmbed *embed;
@@ -99,9 +95,8 @@ window_cmd_file_print (BonoboUIComponent *uic,
}
void
-window_cmd_go_back (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_back (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
@@ -112,9 +107,8 @@ window_cmd_go_back (BonoboUIComponent *uic,
}
void
-window_cmd_go_up (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_up (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
@@ -125,9 +119,8 @@ window_cmd_go_up (BonoboUIComponent *uic,
}
void
-window_cmd_file_send_to (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_send_to (EggAction *action,
+ EphyWindow *window)
{
char *url;
EphyTab *tab;
@@ -165,9 +158,8 @@ window_cmd_file_send_to (BonoboUIComponent *uic,
}
void
-window_cmd_go_forward (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_forward (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
@@ -178,28 +170,8 @@ window_cmd_go_forward (BonoboUIComponent *uic,
}
void
-window_cmd_go_go (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
-{
- Toolbar *tb;
-
- g_return_if_fail (IS_EPHY_WINDOW (window));
-
- tb = ephy_window_get_toolbar (window);
-
- if (tb)
- {
- char *location = toolbar_get_location (tb);
- ephy_window_load_url (window, location);
- g_free (location);
- }
-}
-
-void
-window_cmd_go_home (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_home (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
char *location;
@@ -216,30 +188,15 @@ window_cmd_go_home (BonoboUIComponent *uic,
}
void
-window_cmd_go_myportal (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
-{
- EphyEmbed *embed;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- ephy_embed_load_url (embed, "myportal:");
-}
-
-void
-window_cmd_go_location (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_location (EggAction *action,
+ EphyWindow *window)
{
ephy_window_activate_location (window);
}
void
-window_cmd_go_stop (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_view_stop (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
@@ -250,9 +207,8 @@ window_cmd_go_stop (BonoboUIComponent *uic,
}
void
-window_cmd_go_reload (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_view_reload (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
@@ -263,23 +219,8 @@ window_cmd_go_reload (BonoboUIComponent *uic,
}
void
-window_cmd_new (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
-{
- EphyTab *tab;
-
- tab = ephy_window_get_active_tab (window);
-
- ephy_shell_new_tab (ephy_shell, window, tab, NULL,
- EPHY_NEW_TAB_HOMEPAGE |
- EPHY_NEW_TAB_JUMP);
-}
-
-void
-window_cmd_new_window (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_new_window (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
@@ -292,9 +233,8 @@ window_cmd_new_window (BonoboUIComponent *uic,
}
void
-window_cmd_new_tab (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_new_tab (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
@@ -307,9 +247,8 @@ window_cmd_new_tab (BonoboUIComponent *uic,
}
void
-window_cmd_bookmarks_edit (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_bookmarks (EggAction *action,
+ EphyWindow *window)
{
GtkWidget *dialog;
EphyBookmarks *bookmarks;
@@ -321,9 +260,8 @@ window_cmd_bookmarks_edit (BonoboUIComponent *uic,
}
void
-window_cmd_bookmarks_add_default (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_add_bookmark (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
EphyEmbed *embed;
@@ -358,9 +296,8 @@ window_cmd_bookmarks_add_default (BonoboUIComponent *uic,
}
void
-window_cmd_file_open (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_open (EggAction *action,
+ EphyWindow *window)
{
gchar *dir, *retDir;
gchar *file = NULL;
@@ -406,9 +343,8 @@ window_cmd_file_open (BonoboUIComponent *uic,
}
void
-window_cmd_file_save_as (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_save_as (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
EphyEmbedPersist *persist;
@@ -430,9 +366,8 @@ window_cmd_file_save_as (BonoboUIComponent *uic,
}
void
-window_cmd_file_close_tab (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_close_tab (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
@@ -443,17 +378,15 @@ window_cmd_file_close_tab (BonoboUIComponent *uic,
}
void
-window_cmd_file_close_window (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_file_close_window (EggAction *action,
+ EphyWindow *window)
{
gtk_widget_destroy (GTK_WIDGET(window));
}
void
-window_cmd_edit_cut (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_cut (EggAction *action,
+ EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -472,9 +405,8 @@ window_cmd_edit_cut (BonoboUIComponent *uic,
}
void
-window_cmd_edit_copy (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_copy (EggAction *action,
+ EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -494,9 +426,8 @@ window_cmd_edit_copy (BonoboUIComponent *uic,
}
void
-window_cmd_edit_paste (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_paste (EggAction *action,
+ EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -516,9 +447,8 @@ window_cmd_edit_paste (BonoboUIComponent *uic,
}
void
-window_cmd_edit_select_all (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_select_all (EggAction *action,
+ EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -538,9 +468,8 @@ window_cmd_edit_select_all (BonoboUIComponent *uic,
}
void
-window_cmd_edit_find_next (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_find_next (EggAction *action,
+ EphyWindow *window)
{
EphyDialog *dialog;
@@ -552,9 +481,8 @@ window_cmd_edit_find_next (BonoboUIComponent *uic,
}
void
-window_cmd_edit_find_prev (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_find_prev (EggAction *action,
+ EphyWindow *window)
{
EphyDialog *dialog;
@@ -566,9 +494,20 @@ window_cmd_edit_find_prev (BonoboUIComponent *uic,
}
void
-window_cmd_view_zoom_in (BonoboUIComponent *uic,
- EphyWindow *window,
- const char *verbname)
+window_cmd_view_statusbar (EggAction *action,
+ EphyWindow *window)
+{
+}
+
+void
+window_cmd_view_fullscreen (EggAction *action,
+ EphyWindow *window)
+{
+}
+
+void
+window_cmd_view_zoom_in (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
int zoom;
@@ -581,9 +520,8 @@ window_cmd_view_zoom_in (BonoboUIComponent *uic,
}
void
-window_cmd_view_zoom_out (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_view_zoom_out (EggAction *action,
+ EphyWindow *window)
{
EphyEmbed *embed;
int zoom;
@@ -599,17 +537,15 @@ window_cmd_view_zoom_out (BonoboUIComponent *uic,
}
void
-window_cmd_view_zoom_normal (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_view_zoom_normal (EggAction *action,
+ EphyWindow *window)
{
ephy_window_set_zoom (window, 100);
}
void
-window_cmd_view_page_source (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_view_page_source (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
@@ -621,17 +557,15 @@ window_cmd_view_page_source (BonoboUIComponent *uic,
}
void
-window_cmd_tools_history (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_go_history (EggAction *action,
+ EphyWindow *window)
{
ephy_window_show_history (window);
}
void
-window_cmd_tools_pdm (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_personal_data (EggAction *action,
+ EphyWindow *window)
{
EphyDialog *dialog;
@@ -641,9 +575,8 @@ window_cmd_tools_pdm (BonoboUIComponent *uic,
}
void
-window_cmd_edit_prefs (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_prefs (EggAction *action,
+ EphyWindow *window)
{
GtkDialog *dialog;
@@ -655,101 +588,15 @@ window_cmd_edit_prefs (BonoboUIComponent *uic,
gtk_widget_show (GTK_WIDGET(dialog));
}
-static void
-window_cmd_settings_toolbar_editor_revert_clicked_cb (GtkButton *b, EphyTbEditor *tbe)
-{
- gchar *def;
-
- g_return_if_fail (EPHY_IS_TB_EDITOR (tbe));
-
- eel_gconf_unset (CONF_TOOLBAR_SETUP);
- def = eel_gconf_get_string (CONF_TOOLBAR_SETUP);
- if (def)
- {
- EphyToolbar *current;
- EphyToolbar *avail;
- current = ephy_tb_editor_get_toolbar (tbe);
- ephy_toolbar_parse (current, def);
- g_free (def);
-
- avail = ephy_tb_editor_get_available (tbe);
- g_object_ref (avail);
- ephy_toolbar_parse (avail, AVAILABLE_TOOLBAR_ITEMS);
- ephy_tb_editor_set_available (tbe, avail);
- g_object_unref (avail);
- }
-
-}
-
-static void
-window_cmd_settings_toolbar_editor_current_changed_cb (EphyToolbar *tb, gpointer data)
-{
- gchar *current_str;
-
- g_return_if_fail (EPHY_IS_TOOLBAR (tb));
-
- current_str = ephy_toolbar_to_string (tb);
- eel_gconf_set_string (CONF_TOOLBAR_SETUP, current_str);
- g_free (current_str);
-}
-
void
-window_cmd_settings_toolbar_editor (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_edit_toolbar (EggAction *action,
+ EphyWindow *window)
{
- static EphyTbEditor *tbe = NULL;
- EphyToolbar *avail;
- EphyToolbar *current;
- gchar *current_str;
- GtkButton *revert_button;
-
- avail = ephy_toolbar_new ();
- ephy_toolbar_parse (avail, AVAILABLE_TOOLBAR_ITEMS);
-
- current_str = eel_gconf_get_string (CONF_TOOLBAR_SETUP);
- current = ephy_toolbar_new ();
- if (current_str)
- {
- ephy_toolbar_parse (current, current_str);
- g_free (current_str);
- }
-
- if (!tbe)
- {
- tbe = ephy_tb_editor_new ();
- g_object_add_weak_pointer (G_OBJECT (tbe),
- (void **)&tbe);
- ephy_tb_editor_set_parent (tbe,
- GTK_WIDGET(window));
- }
- else
- {
- ephy_tb_editor_show (tbe);
- return;
- }
-
- ephy_tb_editor_set_toolbar (tbe, current);
- ephy_tb_editor_set_available (tbe, avail);
- g_object_unref (avail);
- g_object_unref (current);
-
- g_signal_connect (current, "changed",
- G_CALLBACK (window_cmd_settings_toolbar_editor_current_changed_cb), NULL);
-
- revert_button = ephy_tb_editor_get_revert_button (tbe);
- gtk_widget_show (GTK_WIDGET (revert_button));
-
- g_signal_connect (revert_button, "clicked",
- G_CALLBACK (window_cmd_settings_toolbar_editor_revert_clicked_cb), tbe);
-
- ephy_tb_editor_show (tbe);
}
void
-window_cmd_help_about (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_help_about (EggAction *action,
+ EphyWindow *window)
{
static GtkWidget *about = NULL;
@@ -792,23 +639,8 @@ window_cmd_help_about (BonoboUIComponent *uic,
}
void
-window_cmd_set_charset (BonoboUIComponent *uic,
- EncodingMenuData *data,
- const char* verbname)
-{
- EphyWindow *window = data->data;
- EphyEmbed *embed;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- ephy_embed_set_charset (embed, data->encoding);
-}
-
-void
-window_cmd_tabs_next (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_tabs_next (EggAction *action,
+ EphyWindow *window)
{
GList *tabs;
EphyTab *tab;
@@ -829,9 +661,8 @@ window_cmd_tabs_next (BonoboUIComponent *uic,
}
void
-window_cmd_tabs_previous (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_tabs_previous (EggAction *action,
+ EphyWindow *window)
{
GList *tabs;
EphyTab *tab;
@@ -852,22 +683,19 @@ window_cmd_tabs_previous (BonoboUIComponent *uic,
}
void
-window_cmd_tabs_move_left (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_tabs_move_left (EggAction *action,
+ EphyWindow *window)
{
}
-void window_cmd_tabs_move_right (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+void window_cmd_tabs_move_right (EggAction *action,
+ EphyWindow *window)
{
}
void
-window_cmd_tabs_detach (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname)
+window_cmd_tabs_detach (EggAction *action,
+ EphyWindow *window)
{
EphyTab *tab;
GtkWidget *src_page;
@@ -886,32 +714,3 @@ window_cmd_tabs_detach (BonoboUIComponent *uic,
ephy_tab_set_window (tab, new_win);
gtk_widget_show (GTK_WIDGET (new_win));
}
-
-void
-window_cmd_help_manual (BonoboUIComponent *uic,
- char *filename,
- const char* verbname)
-{
- GError *error;
- GtkWidget *dialog;
-
- error = NULL;
- gnome_help_display ("Ephy.xml", NULL, &error);
-
- if (error)
- {
- dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("There was an error displaying help: \n%s"),
- error->message);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_widget_show (dialog);
- g_error_free (error);
- }
-}
diff --git a/src/window-commands.h b/src/window-commands.h
index df05a4d50..bf733897c 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -16,181 +16,136 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "egg-action.h"
#include "ephy-window.h"
#include "ephy-embed-utils.h"
-#include <bonobo/bonobo-ui-component.h>
+void window_cmd_edit_find (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_find (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_print (EggAction *action,
+ EphyWindow *window);
-void window_cmd_file_print (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_stop (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_stop (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_back (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_back (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_forward (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_forward (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_location (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_go (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_up (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_up (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_home (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_home (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_myportal (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_myportal (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_location (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_location (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_reload (EggAction *action,
+ EphyWindow *window);
-void window_cmd_go_reload (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_new (EggAction *action,
+ EphyWindow *window);
-void window_cmd_new (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_new_window (EggAction *action,
+ EphyWindow *window);
-void window_cmd_new_window (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_new_tab (EggAction *action,
+ EphyWindow *window);
-void window_cmd_new_tab (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_add_bookmark(EggAction *action,
+ EphyWindow *window);
-void window_cmd_bookmarks_add_default (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_bookmarks (EggAction *action,
+ EphyWindow *window);
-void window_cmd_bookmarks_edit (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_open (EggAction *action,
+ EphyWindow *window);
-void window_cmd_file_open (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_save_as (EggAction *action,
+ EphyWindow *window);
-void window_cmd_file_save_as (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_send_to (EggAction *action,
+ EphyWindow *window);
-void window_cmd_file_send_to (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_close_tab (EggAction *action,
+ EphyWindow *window);
-void window_cmd_file_close_tab (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_file_close_window (EggAction *action,
+ EphyWindow *window);
-void window_cmd_file_close_window (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_cut (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_cut (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_copy (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_copy (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_paste (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_paste (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_select_all (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_select_all (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_find_next (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_find_next (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_find_prev (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_find_prev (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_statusbar (EggAction *action,
+ EphyWindow *window);
-void window_cmd_view_zoom_in (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_fullscreen (EggAction *action,
+ EphyWindow *window);
-void window_cmd_view_zoom_out (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_zoom_in (EggAction *action,
+ EphyWindow *window);
-void window_cmd_view_zoom_normal(BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_zoom_out (EggAction *action,
+ EphyWindow *window);
-void window_cmd_view_page_source(BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_zoom_normal(EggAction *action,
+ EphyWindow *window);
-void window_cmd_tools_history (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_view_page_source(EggAction *action,
+ EphyWindow *window);
-void window_cmd_tools_pdm (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_go_history (EggAction *action,
+ EphyWindow *window);
-void window_cmd_edit_prefs (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
+void window_cmd_edit_personal_data (EggAction *action,
+ EphyWindow *window);
-void
-window_cmd_settings_toolbar_editor (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_help_about (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_set_charset (BonoboUIComponent *uic,
- EncodingMenuData *data,
- const char* verbname);
-
-void window_cmd_tabs_next (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_tabs_previous (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_tabs_move_left (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_tabs_move_right (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_tabs_detach (BonoboUIComponent *uic,
- EphyWindow *window,
- const char* verbname);
-
-void window_cmd_help_manual (BonoboUIComponent *uic,
- char *filename,
- const char* verbname);
+void window_cmd_edit_prefs (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_edit_toolbar (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_help_about (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_tabs_next (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_tabs_previous (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_tabs_move_left (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_tabs_move_right (EggAction *action,
+ EphyWindow *window);
+
+void window_cmd_tabs_detach (EggAction *action,
+ EphyWindow *window);