diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-05-09 23:21:40 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-06-20 03:15:47 +0800 |
commit | 3916712fac2b29e3825058288954f771a7fb3709 (patch) | |
tree | 38fd69e515f7baa106fb67390be1eb9878308d03 | |
parent | 3b335fc1688be727c7a9a72d4aa2d8282911712a (diff) | |
download | gsoc2013-epiphany-3916712fac2b29e3825058288954f771a7fb3709.tar.gz gsoc2013-epiphany-3916712fac2b29e3825058288954f771a7fb3709.tar.zst gsoc2013-epiphany-3916712fac2b29e3825058288954f771a7fb3709.zip |
ephy-location-entry: make it possible to hide the favicon
https://bugzilla.gnome.org/show_bug.cgi?id=678405
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 42 | ||||
-rw-r--r-- | lib/widgets/ephy-location-entry.h | 3 |
2 files changed, 42 insertions, 3 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 7a1cc5581..fa2a97f89 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -78,6 +78,7 @@ struct _EphyLocationEntryPrivate guint apply_colors : 1; guint needs_reset : 1; guint show_lock : 1; + guint show_favicon : 1; }; static const GtkTargetEntry url_drag_types [] = @@ -108,7 +109,8 @@ enum PROP_LOCATION, PROP_FAVICON, PROP_LOCK_STOCK, - PROP_SHOW_LOCK + PROP_SHOW_LOCK, + PROP_SHOW_FAVICON }; enum signalsEnum @@ -149,6 +151,10 @@ ephy_location_entry_set_property (GObject *object, ephy_location_entry_set_show_lock (entry, g_value_get_boolean (value)); break; + case PROP_SHOW_FAVICON: + ephy_location_entry_set_show_favicon (entry, + g_value_get_boolean (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id,pspec); } @@ -254,6 +260,14 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass) FALSE, G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + g_object_class_install_property (object_class, + PROP_SHOW_FAVICON, + g_param_spec_boolean ("show-favicon", + "Show Favicon", + "Whether to show the favicon", + TRUE, + G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + /** * EphyLocationEntry::user-changed: * @entry: the object on which the signal is emitted @@ -352,13 +366,13 @@ update_favicon (EphyLocationEntry *lentry) /* Only show the favicon if the entry's text is the * address of the current page. */ - if (priv->favicon != NULL && priv->original_address) + if (priv->show_favicon && priv->favicon != NULL && priv->original_address) { gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, priv->favicon); } - else + else if (priv->show_favicon) { /* Here we could consider using fallback favicon that matches * the page MIME type, though text/html should be good enough @@ -368,6 +382,12 @@ update_favicon (EphyLocationEntry *lentry) GTK_ENTRY_ICON_PRIMARY, "text-html"); } + else + { + gtk_entry_set_icon_from_icon_name (entry, + GTK_ENTRY_ICON_PRIMARY, + NULL); + } } static void @@ -892,6 +912,7 @@ ephy_location_entry_init (EphyLocationEntry *le) p->block_update = FALSE; p->saved_text = NULL; p->show_lock = FALSE; + p->show_favicon = TRUE; p->dns_prefetch_handler = 0; ephy_location_entry_construct_contents (le); @@ -1483,6 +1504,21 @@ ephy_location_entry_set_favicon (EphyLocationEntry *entry, update_favicon (entry); } +void +ephy_location_entry_set_show_favicon (EphyLocationEntry *entry, + gboolean show_favicon) +{ + EphyLocationEntryPrivate *priv; + + g_return_if_fail (EPHY_IS_LOCATION_ENTRY (entry)); + + priv = entry->priv; + + priv->show_favicon = show_favicon != FALSE; + + update_favicon (entry); +} + /** * ephy_location_entry_set_show_lock: * @entry: an #EphyLocationEntry widget diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h index 1bc923ac9..307a45e37 100644 --- a/lib/widgets/ephy-location-entry.h +++ b/lib/widgets/ephy-location-entry.h @@ -104,6 +104,9 @@ void ephy_location_entry_activate (EphyLocationEntry *entry); void ephy_location_entry_set_favicon (EphyLocationEntry *entry, GdkPixbuf *pixbuf); +void ephy_location_entry_set_show_favicon (EphyLocationEntry *entry, + gboolean show_favicon); + void ephy_location_entry_set_show_lock (EphyLocationEntry *entry, gboolean show_lock); |