diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 0ad8277..5dbbeaa 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -1618,16 +1618,16 @@ ephy_location_entry_set_secure (EphyLocationEntry *entry,
 
 	priv->secure = secure;
 
+	GtkStyleContext *style = gtk_widget_get_style_context(gentry);
+
 	/* We have to set the color of the GtkEntry in the EphyIconEntry */
 	if (priv->secure && priv->apply_colors)
 	{
-		gtk_widget_override_color (gentry, GTK_STATE_FLAG_NORMAL, &priv->secure_fg_color);
-		gtk_widget_override_background_color (gentry, GTK_STATE_FLAG_NORMAL, &priv->secure_bg_color);
+		gtk_style_context_add_class( style, "warning");
 	}
 	else
 	{
-		gtk_widget_override_color (gentry, GTK_STATE_FLAG_NORMAL, NULL);
-		gtk_widget_override_background_color (gentry, GTK_STATE_FLAG_NORMAL, NULL);
+		gtk_style_context_remove_class( style, "warning");
 	}
 	gtk_widget_queue_draw (widget);
 }
