From 6afec98b2cc4c33cd4128d045035a0ec7d43629c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 31 Dec 2002 13:52:44 +0000 Subject: Resync with galeon. 2002-12-31 Marco Pesenti Gritti * embed/mozilla/FilePicker.cpp: * embed/mozilla/FilePicker.h: * embed/mozilla/mozilla-embed-shell.cpp: Resync with galeon. * data/epiphany.schemas.in: * lib/ephy-bonobo-extensions.c: (ephy_bonobo_add_numbered_widget): * lib/ephy-bonobo-extensions.h: * lib/toolbar/Makefile.am: * lib/toolbar/ephy-tbi-std-toolitem.c: (ephy_tbi_std_toolitem_init), (ephy_tbi_std_toolitem_get_icon_impl), (ephy_tbi_std_toolitem_get_name_human_impl), (ephy_tbi_std_toolitem_to_string_impl), (ephy_tbi_std_toolitem_add_to_bonobo_tb_impl), (ephy_tbi_std_toolitem_parse_properties_impl), (ephy_tbi_std_toolitem_set_item): * lib/toolbar/ephy-tbi-std-toolitem.h: * lib/toolbar/ephy-toolbar-item-factory.c: (ephy_tb_item_factory_init), (ephy_toolbar_item_create_from_string), (ephy_toolbar_item_register_type): * lib/toolbar/ephy-toolbar-item-factory.h: * src/Makefile.am: * src/toolbar.c: (toolbar_class_init), (toolbar_set_property), (toolbar_get_widgets), (toolbar_init), (toolbar_finalize), (toolbar_navigation_button_set_sensitive), (toolbar_button_set_sensitive): * src/window-commands.c: Resync with galeon. Now we use a widget for navigation buttons. --- src/Makefile.am | 6 +- src/ephy-navigation-button.c | 614 +++++++++++++++++++++++++++++++++++++++++++ src/ephy-navigation-button.h | 79 ++++++ src/ephy-tbi.c | 193 ++++++++++++++ src/ephy-tbi.h | 70 +++++ src/toolbar.c | 393 +++++---------------------- src/window-commands.c | 15 +- 7 files changed, 1032 insertions(+), 338 deletions(-) create mode 100644 src/ephy-navigation-button.c create mode 100644 src/ephy-navigation-button.h create mode 100644 src/ephy-tbi.c create mode 100644 src/ephy-tbi.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 5ec49453d..cad9cd290 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -79,7 +79,11 @@ epiphany_SOURCES = \ ephy-favorites-menu.c \ ephy-favorites-menu.h \ ephy-history-model.c \ - ephy-history-model.h + ephy-history-model.h \ + ephy-tbi.c \ + ephy-tbi.h \ + ephy-navigation-button.c \ + ephy-navigation-button.h epiphany_LDADD = \ $(top_builddir)/embed/libephyembed.la \ diff --git a/src/ephy-navigation-button.c b/src/ephy-navigation-button.c new file mode 100644 index 000000000..f57de2690 --- /dev/null +++ b/src/ephy-navigation-button.c @@ -0,0 +1,614 @@ +/* + * 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 +#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 +#include + +#define NOT_IMPLEMENTED g_warning ("not implemented: " G_STRLOC); +//#define DEBUG_MSG(x) g_print x +#define DEBUG_MSG(x) + +/** + * 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); + + DEBUG_MSG (("EphyNavigationButton finalized\n")); + + 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 (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 new file mode 100644 index 000000000..036ec6d7e --- /dev/null +++ b/src/ephy-navigation-button.h @@ -0,0 +1,79 @@ +/* + * 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-tbi.c b/src/ephy-tbi.c new file mode 100644 index 000000000..0c6e04f9b --- /dev/null +++ b/src/ephy-tbi.c @@ -0,0 +1,193 @@ +/* + * 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 +#include "ephy-gobject-misc.h" +#include "ephy-marshal.h" +#include "ephy-bonobo-extensions.h" +#include "ephy-tbi.h" +#include + +#define NOT_IMPLEMENTED g_warning ("not implemented: " G_STRLOC); +//#define DEBUG_MSG(x) g_print x +#define DEBUG_MSG(x) + +/** + * 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); + } + + DEBUG_MSG (("EphyTbi finalized\n")); + + 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 new file mode 100644 index 000000000..2296a144f --- /dev/null +++ b/src/ephy-tbi.h @@ -0,0 +1,70 @@ +/* + * 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/toolbar.c b/src/toolbar.c index 4bff4615e..059f1277d 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -32,8 +32,10 @@ #include "ephy-embed-favicon.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 #include @@ -45,18 +47,13 @@ #include #define DEFAULT_TOOLBAR_SETUP \ - "back=std_toolitem(item=back);" \ - "back_history=navigation_history(direction=back);" \ - "up=std_toolitem(item=up);" \ - "up_history=navigation_history(direction=up);" \ - "forward=std_toolitem(item=forward);" \ - "forward_history=navigation_history(direction=forward);" \ + "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;" \ - "zoom=zoom;" \ "spinner=spinner;" #define ZOOM_DELAY 50 @@ -102,13 +99,8 @@ struct ToolbarPrivate GtkWidget *spinner; gboolean visibility; - /* This field is unused... what is it? - GdkPixbufAnimation *animation; - */ - GtkWidget *back_button; - GtkWidget *forward_button; - GtkWidget *up_button; GtkWidget *location_entry; + GSList *navigation_buttons; GtkTooltips *tooltips; GtkWidget *favicon; GtkWidget *favicon_ebox; @@ -165,6 +157,8 @@ 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 @@ -177,9 +171,9 @@ toolbar_set_property (GObject *object, switch (prop_id) { - case PROP_EPHY_WINDOW: - toolbar_set_window (t, g_value_get_object (value)); - break; + case PROP_EPHY_WINDOW: + toolbar_set_window (t, g_value_get_object (value)); + break; } } @@ -199,247 +193,6 @@ toolbar_get_property (GObject *object, } } -static GtkWidget * -new_history_menu_item (gint num, gchar *origtext, gboolean lettersok, - GtkWidget *menu, 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 gboolean -back_or_forward_button_pressed_callback (GtkWidget *widget, - GdkEventButton *event, - gpointer *user_data) -{ - Toolbar *t; - GtkWidget *menu; - int pos, count; - EphyEmbed *embed; - int start, end, accell_count = 0; - - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - - t = TOOLBAR (user_data); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - - embed = ephy_window_get_active_embed (t->priv->window); - g_return_val_if_fail (embed != NULL, FALSE); - - ephy_embed_shistory_get_pos (embed, &pos); - ephy_embed_shistory_count (embed, &count); - - if (count == 0) return FALSE; - - if (widget == t->priv->back_button) - { - start = pos - 1; - end = -1; - } - else - { - start = pos + 1; - end = count; - } - - menu = gtk_menu_new (); - - while (start != end) - { - char *title, *url; - GtkWidget *item; - ephy_embed_shistory_get_nth (embed, start, FALSE, - &url, &title); - item = new_history_menu_item (accell_count, url, TRUE, - menu, NULL); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), 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), - t->priv->window); - gtk_widget_show_all (item); - - g_free (url); - g_free (title); - - accell_count++; - if (start < end) start++; - else start--; - } - - - gnome_popup_menu_do_popup_modal (menu, - ephy_gui_menu_position_under_widget, widget, event, widget, widget); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - - return TRUE; -} - -static gboolean -up_button_pressed_callback (GtkWidget *widget, - GdkEventButton *event, - gpointer *user_data) -{ - Toolbar *t; - GtkWidget *menu; - EphyEmbed *embed; - int accell_count = 0; - GSList *l; - GSList *li; - - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - - t = TOOLBAR (user_data); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - - embed = ephy_window_get_active_embed (t->priv->window); - g_return_val_if_fail (embed != NULL, FALSE); - - ephy_embed_get_go_up_list (embed, &l); - - if (l == NULL) return FALSE; - - menu = gtk_menu_new (); - - for (li = l; li; li = li->next) - { - char *url = li->data; - GtkWidget *item; - item = new_history_menu_item (accell_count, url, TRUE, - menu, NULL); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - g_object_set_data (G_OBJECT(item), "go_nth", GINT_TO_POINTER (accell_count)); - g_signal_connect (item, "activate", - G_CALLBACK (activate_up_menu_item_cb), - t->priv->window); - gtk_widget_show_all (item); - - accell_count++; - } - - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); - - gnome_popup_menu_do_popup_modal (menu, - ephy_gui_menu_position_under_widget, widget, event, widget, widget); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - - return TRUE; -} - -static gboolean -back_or_forward_key_pressed_callback (GtkWidget *widget, - GdkEventKey *event, - gpointer *user_data) -{ - if (event->keyval == GDK_space || - event->keyval == GDK_KP_Space || - event->keyval == GDK_Return || - event->keyval == GDK_KP_Enter) - { - back_or_forward_button_pressed_callback (widget, NULL, user_data); - } - - return FALSE; -} - -static gboolean -up_key_pressed_callback (GtkWidget *widget, - GdkEventKey *event, - gpointer *user_data) -{ - if (event->keyval == GDK_space || - event->keyval == GDK_KP_Space || - event->keyval == GDK_Return || - event->keyval == GDK_KP_Enter) - { - up_button_pressed_callback (widget, NULL, user_data); - } - - return FALSE; -} - -static void -toolbar_setup_navigation_button (Toolbar *t, GtkWidget *w, const char *tooltip) -{ - g_signal_connect_object (w, "key_press_event", - G_CALLBACK (back_or_forward_key_pressed_callback), - t, 0); - g_signal_connect_object (w, "button_press_event", - G_CALLBACK (back_or_forward_button_pressed_callback), - t, 0); - - gtk_tooltips_set_tip (t->priv->tooltips, w, tooltip, NULL); -} - -static void -toolbar_setup_up_button (Toolbar *t, GtkWidget *w, const char *tooltip) -{ - g_signal_connect_object (w, "key_press_event", - G_CALLBACK (up_key_pressed_callback), - t, 0); - g_signal_connect_object (w, "button_press_event", - G_CALLBACK (up_button_pressed_callback), - t, 0); - - gtk_tooltips_set_tip (t->priv->tooltips, w, tooltip, NULL); -} - - static void toolbar_location_url_activate_cb (EphyLocationEntry *entry, const char *content, @@ -607,6 +360,9 @@ 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; DEBUG_MSG (("in toolbar_get_widgets\n")); @@ -617,23 +373,12 @@ toolbar_get_widgets (Toolbar *t) /* release all the widgets */ - if (p->back_button) + for (li = p->navigation_buttons; li; li = li->next) { - g_object_unref (p->back_button); - p->back_button = NULL; - } - - if (p->forward_button) - { - g_object_unref (p->forward_button); - p->forward_button = NULL; - } - - if (p->up_button) - { - g_object_unref (p->up_button); - p->up_button = NULL; + g_object_unref (li->data); } + g_slist_free (p->navigation_buttons); + p->navigation_buttons = NULL; if (p->favicon_ebox) { @@ -667,34 +412,26 @@ toolbar_get_widgets (Toolbar *t) gt = EPHY_TOOLBAR (t); - it = ephy_toolbar_get_item_by_id (gt, "back_history"); - if (it) - { - p->back_button = ephy_tb_item_get_widget (it); - g_object_ref (p->back_button); - toolbar_setup_navigation_button (t, p->back_button, _("Go back a number of pages")); - - DEBUG_MSG ((" got a back_history button\n")); - } - - it = ephy_toolbar_get_item_by_id (gt, "forward_history"); - if (it) - { - p->forward_button = ephy_tb_item_get_widget (it); - g_object_ref (p->forward_button); - toolbar_setup_navigation_button (t, p->forward_button, _("Go forward a number of pages")); - - DEBUG_MSG ((" got a forward_history button\n")); - } - - it = ephy_toolbar_get_item_by_id (gt, "up_history"); - if (it) + for (i = 0; i < G_N_ELEMENTS (nav_buttons_ids); ++i) { - p->up_button = ephy_tb_item_get_widget (it); - g_object_ref (p->up_button); - toolbar_setup_up_button (t, p->up_button, _("Go up a number of levels")); - - DEBUG_MSG ((" got a up_history button\n")); + it = ephy_toolbar_get_item_by_id (gt, nav_buttons_ids[i]); + if (it) + { + if (EPHY_IS_NAVIGATION_BUTTON (it)) + { + DEBUG_MSG ((" got a navigation button\n")); + 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"); @@ -748,6 +485,7 @@ toolbar_init (Toolbar *t) t->priv->window = NULL; t->priv->ui_component = NULL; + t->priv->navigation_buttons = NULL; t->priv->visibility = TRUE; t->priv->tooltips = gtk_tooltips_new (); g_object_ref (t->priv->tooltips); @@ -785,6 +523,7 @@ toolbar_finalize (GObject *object) { Toolbar *t; ToolbarPrivate *p; + GSList *li; g_return_if_fail (object != NULL); g_return_if_fail (IS_TOOLBAR (object)); @@ -795,9 +534,6 @@ toolbar_finalize (GObject *object) g_return_if_fail (p != NULL); if (p->location_entry) g_object_unref (p->location_entry); - if (p->back_button) g_object_unref (p->back_button); - if (p->forward_button) g_object_unref (p->forward_button); - if (p->up_button) g_object_unref (p->up_button); 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); @@ -808,6 +544,12 @@ toolbar_finalize (GObject *object) 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_free (t->priv); @@ -869,6 +611,22 @@ toolbar_spinner_stop (Toolbar *t) } } +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, @@ -877,40 +635,19 @@ toolbar_button_set_sensitive (Toolbar *t, switch (id) { case TOOLBAR_BACK_BUTTON: - ephy_bonobo_set_sensitive (t->priv->ui_component, - "/commands/GoBack", - sensitivity); - if (t->priv->back_button) - { - gtk_widget_set_sensitive (t->priv->back_button, - sensitivity); - } + toolbar_navigation_button_set_sensitive (t, EPHY_NAVIGATION_DIRECTION_BACK, sensitivity); break; case TOOLBAR_FORWARD_BUTTON: - ephy_bonobo_set_sensitive (t->priv->ui_component, - "/commands/GoForward", - sensitivity); - if (t->priv->forward_button) - { - gtk_widget_set_sensitive (t->priv->forward_button, - sensitivity); - } + 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; - case TOOLBAR_UP_BUTTON: - ephy_bonobo_set_sensitive (t->priv->ui_component, - "/commands/GoUp", - sensitivity); - if (t->priv->up_button) - { - gtk_widget_set_sensitive (t->priv->up_button, - sensitivity); - } - break; } } diff --git a/src/window-commands.c b/src/window-commands.c index cef1d675c..c7d5ec16c 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -41,13 +41,12 @@ #include #define AVAILABLE_TOOLBAR_ITEMS \ - "new=std_toolitem(item=new);" \ - "back=std_toolitem(item=back);" \ - "back_history=navigation_history(direction=back);" \ - "up=std_toolitem(item=up);" \ - "up_history=navigation_history(direction=up);" \ - "forward=std_toolitem(item=forward);" \ - "forward_history=navigation_history(direction=forward);" \ + "back=navigation_button(direction=back,arrow=FALSE);" \ + "back_menu=navigation_button(direction=back,arrow=TRUE);" \ + "forward=navigation_button(direction=forward,arrow=FALSE);" \ + "forward_menu=navigation_button(direction=forward,arrow=TRUE);" \ + "up=navigation_button(direction=up,arrow=FALSE);" \ + "up_menu=navigation_button(direction=up,arrow=TRUE);" \ "stop=std_toolitem(item=stop);" \ "reload=std_toolitem(item=reload);" \ "home=std_toolitem(item=home);" \ @@ -58,8 +57,6 @@ "spinner=spinner;" \ "separator;" - - void window_cmd_edit_find (BonoboUIComponent *uic, EphyWindow *window, -- cgit v1.2.3