aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-navigation-action.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-10-22 23:50:27 +0800
committerChristian Persch <chpe@src.gnome.org>2004-10-22 23:50:27 +0800
commitc32a9d9770aa342802bb8f8bdf5e54663b40437f (patch)
tree9e77a821e4aef497c3a04fdade8ca49924754978 /src/ephy-navigation-action.c
parent79d6fe5e18ec0e08e8ed165d47b41f012316ec55 (diff)
downloadgsoc2013-epiphany-c32a9d9770aa342802bb8f8bdf5e54663b40437f.tar.gz
gsoc2013-epiphany-c32a9d9770aa342802bb8f8bdf5e54663b40437f.tar.zst
gsoc2013-epiphany-c32a9d9770aa342802bb8f8bdf5e54663b40437f.zip
Add tooltips on the arrows, and fix the tooltip on the "Up" button to be
2004-10-22 Christian Persch <chpe@cvs.gnome.org> * src/ephy-navigation-action.c: (set_tooltip_cb), (connect_proxy), (ephy_navigation_action_finalize), (ephy_navigation_action_set_property), (ephy_navigation_action_get_property), (ephy_navigation_action_class_init): * src/ephy-navigation-action.h: * src/toolbar.c: (toolbar_setup_actions): Add tooltips on the arrows, and fix the tooltip on the "Up" button to be consistent with nautilus. Thanks to spark for the string review; fixes bug #155825.
Diffstat (limited to 'src/ephy-navigation-action.c')
-rw-r--r--src/ephy-navigation-action.c57
1 files changed, 50 insertions, 7 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",