diff options
author | Jean-François Rameau <jframeau@cvs.gnome.org> | 2005-07-01 06:11:38 +0800 |
---|---|---|
committer | Jean-François Rameau <jframeau@src.gnome.org> | 2005-07-01 06:11:38 +0800 |
commit | b0488b2a6c81ef558613c34fb398a111643b72e3 (patch) | |
tree | 937eb0603f9428585c48fc2f5c65dd8a529d030a /src/ephy-navigation-action.c | |
parent | 98d3c926bde2378bffc3ca14db34f29c07fe421a (diff) | |
download | gsoc2013-epiphany-b0488b2a6c81ef558613c34fb398a111643b72e3.tar.gz gsoc2013-epiphany-b0488b2a6c81ef558613c34fb398a111643b72e3.tar.zst gsoc2013-epiphany-b0488b2a6c81ef558613c34fb398a111643b72e3.zip |
Show URI in status bar when selecting Back/Forward/Up menu items. Fixes
2005-07-01 Jean-François Rameau <jframeau@cvs.gnome.org>
* src/ephy-navigation-action.c: (build_back_or_forward_menu),
(build_up_menu), (select_menu_item_cb), (deselect_menu_item_cb),
(ephy_navigation_action_set_property):
Show URI in status bar when selecting Back/Forward/Up menu items.
Fixes partly #161710.
Diffstat (limited to 'src/ephy-navigation-action.c')
-rw-r--r-- | src/ephy-navigation-action.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c index 4a5c17dbe..8ad4a18f0 100644 --- a/src/ephy-navigation-action.c +++ b/src/ephy-navigation-action.c @@ -39,6 +39,7 @@ #include <gtk/gtkmenu.h> #include <gtk/gtkmenutoolbutton.h> #include <gtk/gtktoolbar.h> +#include <gtk/gtkstatusbar.h> #define NTH_DATA_KEY "GoNTh" #define URL_DATA_KEY "GoURL" @@ -50,6 +51,7 @@ struct _EphyNavigationActionPrivate EphyWindow *window; EphyNavigationDirection direction; char *arrow_tooltip; + guint statusbar_cid; }; enum @@ -151,6 +153,36 @@ activate_back_or_forward_menu_item_cb (GtkWidget *menuitem, } static void +select_menu_item_cb (GtkWidget *menuitem, + EphyNavigationAction *action) +{ + char *url; + GtkWidget *statusbar; + + url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); + g_return_if_fail (url != NULL); + + statusbar = ephy_window_get_statusbar (action->priv->window); + + gtk_statusbar_push (GTK_STATUSBAR (statusbar), action->priv->statusbar_cid, url); +} + +static void +deselect_menu_item_cb (GtkWidget *menuitem, + EphyNavigationAction *action) +{ + char *url; + GtkWidget *statusbar; + + url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); + g_return_if_fail (url != NULL); + + statusbar = ephy_window_get_statusbar (action->priv->window); + + gtk_statusbar_pop (GTK_STATUSBAR (statusbar), action->priv->statusbar_cid); +} + +static void activate_up_menu_item_cb (GtkWidget *menuitem, EphyNavigationAction *action) { @@ -210,14 +242,22 @@ build_back_or_forward_menu (EphyNavigationAction *action) g_object_set_data (G_OBJECT (item), NTH_DATA_KEY, GINT_TO_POINTER (start)); + g_object_set_data_full (G_OBJECT (item), URL_DATA_KEY, url, + (GDestroyNotify) g_free); + g_signal_connect (item, "activate", G_CALLBACK (activate_back_or_forward_menu_item_cb), action); + g_signal_connect (item, "select", + G_CALLBACK (select_menu_item_cb), + action); + g_signal_connect (item, "deselect", + G_CALLBACK (deselect_menu_item_cb), + action); gtk_menu_shell_append (menu, item); gtk_widget_show_all (item); - g_free (url); g_free (title); if (start < end) @@ -262,6 +302,10 @@ build_up_menu (EphyNavigationAction *action) (GDestroyNotify) g_free); g_signal_connect (item, "activate", G_CALLBACK (activate_up_menu_item_cb), action); + g_signal_connect (item, "select", + G_CALLBACK (select_menu_item_cb), action); + g_signal_connect (item, "deselect", + G_CALLBACK (deselect_menu_item_cb), action); gtk_menu_shell_append (menu, item); gtk_widget_show (item); @@ -370,7 +414,18 @@ ephy_navigation_action_set_property (GObject *object, nav->priv->direction = g_value_get_int (value); break; case PROP_WINDOW: - nav->priv->window = EPHY_WINDOW (g_value_get_object (value)); + { + GtkWidget *statusbar; + + nav->priv->window = EPHY_WINDOW (g_value_get_object (value)); + + /* statusbar context to display current selected item */ + statusbar = ephy_window_get_statusbar (nav->priv->window); + + nav->priv->statusbar_cid = gtk_statusbar_get_context_id ( + GTK_STATUSBAR (statusbar), + "navigation_message"); + } break; } } |