[epiphany/overview: 17/24] ephy-location-entry: make it possible to hide the favicon



commit 43a60cb0ce1ef1e0e090cde3bc592d1eace71a3d
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed May 9 18:21:40 2012 +0300

    ephy-location-entry: make it possible to hide the favicon
    
    The favicon is not needed when the overview is visible.

 lib/widgets/ephy-location-entry.c |   27 +++++++++++++++++++++++++--
 lib/widgets/ephy-location-entry.h |    3 +++
 2 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index ad36fe1..adff846 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 [] =
@@ -240,13 +241,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
@@ -256,6 +257,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
@@ -780,6 +787,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);
@@ -1371,6 +1379,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 1bc923a..307a45e 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]