From 539426a9bd327676ad71b263e497ce19da1adde9 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 18 Jan 2006 14:21:11 +0000 Subject: Add caret mode indicator UI. Bug #145581. 2006-01-18 Christian Persch * src/ephy-statusbar.c: (create_caret_indicator), (ephy_statusbar_init), (ephy_statusbar_new), (ephy_statusbar_set_caret_mode): * src/ephy-statusbar.h: * src/ephy-window.c: (browse_with_caret_notifier): Add caret mode indicator UI. Bug #145581. --- ChangeLog | 10 ++++++++++ src/ephy-statusbar.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ephy-statusbar.h | 3 +++ src/ephy-window.c | 8 ++++++-- 4 files changed, 73 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 135ec936c..277fd6c13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-18 Christian Persch + + * src/ephy-statusbar.c: (create_caret_indicator), + (ephy_statusbar_init), (ephy_statusbar_new), + (ephy_statusbar_set_caret_mode): + * src/ephy-statusbar.h: + * src/ephy-window.c: (browse_with_caret_notifier): + + Add caret mode indicator UI. Bug #145581. + 2006-01-18 Peter Harvey * src/bookmarks/ephy-bookmarks-menu.c diff --git a/src/ephy-statusbar.c b/src/ephy-statusbar.c index a01b81920..76778967c 100755 --- a/src/ephy-statusbar.c +++ b/src/ephy-statusbar.c @@ -26,6 +26,8 @@ #include "ephy-stock-icons.h" #include +#include +#include #include #include #include @@ -44,6 +46,7 @@ struct _EphyStatusbarPrivate { GtkWidget *icon_container; + GtkWidget *caret_indicator; GtkWidget *security_icon; GtkWidget *progressbar; GtkWidget *security_evbox; @@ -91,6 +94,38 @@ ephy_statusbar_class_init (EphyStatusbarClass *klass) g_type_class_add_private (object_class, sizeof (EphyStatusbarPrivate)); } +static void +create_caret_indicator (EphyStatusbar *statusbar) +{ + EphyStatusbarPrivate *priv = statusbar->priv; + GtkWidget *label, *ebox; + + priv->caret_indicator = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (priv->caret_indicator), + GTK_SHADOW_IN); + ebox = gtk_event_box_new (); + gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE); + gtk_container_add (GTK_CONTAINER (priv->caret_indicator), ebox); + gtk_widget_show (ebox); + + /* Translators: this is displayed in the statusbar; choose a short word + * or even an abbreviation. + */ + label = gtk_label_new (_("Caret")); + gtk_container_add (GTK_CONTAINER (ebox), label); + gtk_widget_show (label); + + gtk_tooltips_set_tip (statusbar->tooltips, ebox, + /* Translators: this is the tooltip on the "Caret" icon + * in the statusbar. + */ + _("In keyboard selection mode, press F7 to exit"), + NULL); + + gtk_box_pack_start (GTK_BOX (priv->icon_container), priv->caret_indicator, + FALSE, FALSE, 0); +} + static void create_statusbar_security_icon (EphyStatusbar *s) { @@ -199,6 +234,7 @@ ephy_statusbar_init (EphyStatusbar *t) create_statusbar_progress (t); create_statusbar_security_icon (t); create_statusbar_popups_manager_icon (t); + create_caret_indicator (t); sync_shadow_type (t, NULL, NULL); g_signal_connect (t, "style-set", G_CALLBACK (sync_shadow_type), NULL); @@ -227,6 +263,24 @@ ephy_statusbar_new (void) return GTK_WIDGET (g_object_new (EPHY_TYPE_STATUSBAR, NULL)); } +/** + * ephy_statusbar_set_caret_mode: + * @statusbar: an #EphyStatusbar + * @enabled: + * + * Sets the statusbar's caret browsing mode indicator. + **/ +void +ephy_statusbar_set_caret_mode (EphyStatusbar *statusbar, + gboolean enabled) +{ + EphyStatusbarPrivate *priv = statusbar->priv; + + enabled = enabled != FALSE; + + g_object_set (priv->caret_indicator, "visible", enabled, NULL); +} + /** * ephy_statusbar_set_security_state: * @statusbar: an #EphyStatusbar diff --git a/src/ephy-statusbar.h b/src/ephy-statusbar.h index 92ceb3b5f..6db674193 100644 --- a/src/ephy-statusbar.h +++ b/src/ephy-statusbar.h @@ -65,6 +65,9 @@ GtkTooltips *ephy_statusbar_get_tooltips (EphyStatusbar *statusbar); GtkWidget *ephy_statusbar_get_security_frame (EphyStatusbar *statusbar); +void ephy_statusbar_set_caret_mode (EphyStatusbar *statusbar, + gboolean enabled); + void ephy_statusbar_set_security_state (EphyStatusbar *statusbar, const char *stock_id, const char *tooltip); diff --git a/src/ephy-window.c b/src/ephy-window.c index 7e9c965c2..d891c078e 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2884,12 +2884,16 @@ browse_with_caret_notifier (GConfClient *client, GConfEntry *entry, EphyWindow *window) { + EphyWindowPrivate *priv = window->priv; GtkAction *action; + gboolean enabled; + enabled = eel_gconf_get_boolean (CONF_BROWSE_WITH_CARET); action = gtk_action_group_get_action (window->priv->action_group, "BrowseWithCaret"); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), - eel_gconf_get_boolean (CONF_BROWSE_WITH_CARET)); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), enabled); + + ephy_statusbar_set_caret_mode (EPHY_STATUSBAR (priv->statusbar), enabled); } static void -- cgit v1.2.3