diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-navigation-action.c | 57 | ||||
-rw-r--r-- | src/ephy-navigation-action.h | 6 | ||||
-rwxr-xr-x | src/toolbar.c | 5 |
3 files changed, 57 insertions, 11 deletions
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c index 45b7c110f..77ac1acbb 100644 --- a/src/ephy-navigation-action.c +++ b/src/ephy-navigation-action.c @@ -36,21 +36,24 @@ #include <gtk/gtkmenushell.h> #include <gtk/gtkmenu.h> #include <gtk/gtkmenutoolbutton.h> +#include <gtk/gtktoolbar.h> #define NTH_DATA_KEY "GoNTh" #define URL_DATA_KEY "GoURL" #define EPHY_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionPrivate)) -struct EphyNavigationActionPrivate +struct _EphyNavigationActionPrivate { EphyWindow *window; EphyNavigationDirection direction; + char *arrow_tooltip; }; enum { PROP_0, + PROP_ARROW_TOOLTIP, PROP_DIRECTION, PROP_WINDOW }; @@ -291,6 +294,21 @@ menu_activated_cb (GtkMenuToolButton *button, gtk_menu_tool_button_set_menu (button, menu); } +static gboolean +set_tooltip_cb (GtkMenuToolButton *proxy, + GtkTooltips *tooltips, + const char *tip, + const char *tip_private, + EphyNavigationAction *action) +{ + gtk_menu_tool_button_set_arrow_tooltip (proxy, tooltips, + action->priv->arrow_tooltip, + NULL); + + /* don't stop emission */ + return FALSE; +} + static void connect_proxy (GtkAction *action, GtkWidget *proxy) { @@ -306,6 +324,9 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) g_signal_connect (proxy, "show-menu", G_CALLBACK (menu_activated_cb), action); + + g_signal_connect (proxy, "set-tooltip", + G_CALLBACK (set_tooltip_cb), action); } GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); @@ -318,17 +339,29 @@ ephy_navigation_action_init (EphyNavigationAction *action) } static void +ephy_navigation_action_finalize (GObject *object) +{ + EphyNavigationAction *action = EPHY_NAVIGATION_ACTION (object); + + g_free (action->priv->arrow_tooltip); + + parent_class->finalize (object); +} + +static void ephy_navigation_action_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - EphyNavigationAction *nav; - - nav = EPHY_NAVIGATION_ACTION (object); + EphyNavigationAction *nav = EPHY_NAVIGATION_ACTION (object); switch (prop_id) { + case PROP_ARROW_TOOLTIP: + nav->priv->arrow_tooltip = g_value_dup_string (value); + g_object_notify (object, "tooltip"); + break; case PROP_DIRECTION: nav->priv->direction = g_value_get_int (value); break; @@ -344,12 +377,13 @@ ephy_navigation_action_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - EphyNavigationAction *nav; - - nav = EPHY_NAVIGATION_ACTION (object); + EphyNavigationAction *nav = EPHY_NAVIGATION_ACTION (object); switch (prop_id) { + case PROP_ARROW_TOOLTIP: + g_value_set_string (value, nav->priv->arrow_tooltip); + break; case PROP_DIRECTION: g_value_set_int (value, nav->priv->direction); break; @@ -365,6 +399,7 @@ ephy_navigation_action_class_init (EphyNavigationActionClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); GtkActionClass *action_class = GTK_ACTION_CLASS (class); + object_class->finalize = ephy_navigation_action_finalize; object_class->set_property = ephy_navigation_action_set_property; object_class->get_property = ephy_navigation_action_get_property; @@ -374,6 +409,14 @@ ephy_navigation_action_class_init (EphyNavigationActionClass *class) action_class->connect_proxy = connect_proxy; g_object_class_install_property (object_class, + PROP_ARROW_TOOLTIP, + g_param_spec_string ("arrow-tooltip", + "Arrow Tooltip", + "Arrow Tooltip", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_DIRECTION, g_param_spec_int ("direction", "Direction", diff --git a/src/ephy-navigation-action.h b/src/ephy-navigation-action.h index cfcda586b..d007c986d 100644 --- a/src/ephy-navigation-action.h +++ b/src/ephy-navigation-action.h @@ -30,9 +30,9 @@ #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 struct _EphyNavigationAction EphyNavigationAction; +typedef struct _EphyNavigationActionClass EphyNavigationActionClass; +typedef struct _EphyNavigationActionPrivate EphyNavigationActionPrivate; typedef enum { diff --git a/src/toolbar.c b/src/toolbar.c index a15257599..e4242b971 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -295,6 +295,7 @@ toolbar_setup_actions (Toolbar *t) "label", _("Back"), "stock_id", GTK_STOCK_GO_BACK, "tooltip", _("Go back"), + "arrow-tooltip", _("Back history"), "window", t->priv->window, "direction", EPHY_NAVIGATION_DIRECTION_BACK, "is_important", TRUE, @@ -309,6 +310,7 @@ toolbar_setup_actions (Toolbar *t) "label", _("Forward"), "stock_id", GTK_STOCK_GO_FORWARD, "tooltip", _("Go forward"), + "arrow-tooltip", _("Forward history"), "window", t->priv->window, "direction", EPHY_NAVIGATION_DIRECTION_FORWARD, NULL); @@ -321,7 +323,8 @@ toolbar_setup_actions (Toolbar *t) "name", "NavigationUp", "label", _("Up"), "stock_id", GTK_STOCK_GO_UP, - "tooltip", _("Go up"), + "tooltip", _("Go up one level"), + "arrow-tooltip", _("List of upper levels"), "window", t->priv->window, "direction", EPHY_NAVIGATION_DIRECTION_UP, NULL); |