aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--lib/widgets/ephy-location-entry.c15
-rw-r--r--lib/widgets/ephy-location-entry.h3
-rw-r--r--src/ephy-completion-model.c39
-rw-r--r--src/ephy-completion-model.h1
-rw-r--r--src/ephy-location-action.c3
6 files changed, 71 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 43739a32b..8b4441f3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-12-18 Christian Persch <chpe@cvs.gnome.org>
+
+ * lib/widgets/ephy-location-entry.c:
+ (ephy_location_entry_set_completion):
+ * lib/widgets/ephy-location-entry.h:
+ * src/ephy-completion-model.c:
+ (ephy_completion_model_get_column_type), (init_favicon_col),
+ (ephy_completion_model_get_value):
+ * src/ephy-completion-model.h:
+ * src/ephy-location-action.c: (connect_proxy):
+
+ Show favicons in location entry drop-down. Bug #112748, patch by Diego
+ Escalante Urrelo.
+
2006-12-17 Christian Persch <chpe@cvs.gnome.org>
* data/epiphany-bookmarks-html.xsl:
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 77f5d7514..0455786ea 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -40,6 +40,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcellrendererpixbuf.h>
#include <gtk/gtkcelllayout.h>
#include <gtk/gtktreemodelsort.h>
#include <gtk/gtkstock.h>
@@ -76,6 +77,7 @@ struct _EphyLocationEntryPrivate
guint keywords_col;
guint relevance_col;
guint extra_col;
+ guint favicon_col;
guint hash;
@@ -999,18 +1001,20 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
guint action_col,
guint keywords_col,
guint relevance_col,
- guint extra_col)
+ guint extra_col,
+ guint favicon_col)
{
EphyLocationEntryPrivate *priv = le->priv;
GtkTreeModel *sort_model;
GtkEntryCompletion *completion;
- GtkCellRenderer *cell, *extracell;
+ GtkCellRenderer *cell, *extracell, *iconcell;
le->priv->text_col = text_col;
le->priv->action_col = action_col;
le->priv->keywords_col = keywords_col;
le->priv->relevance_col = relevance_col;
le->priv->extra_col = extra_col;
+ le->priv->favicon_col = favicon_col;
sort_model = gtk_tree_model_sort_new_with_model (model);
g_object_unref (model);
@@ -1027,6 +1031,13 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
g_signal_connect_after (completion, "action-activated",
G_CALLBACK (action_activated_after_cb), le);
+ iconcell = gtk_cell_renderer_pixbuf_new ();
+
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+ iconcell, FALSE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion),
+ iconcell, "pixbuf", favicon_col);
+
cell = gtk_cell_renderer_text_new ();
g_object_set (cell,
"ellipsize", PANGO_ELLIPSIZE_END,
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index cdd02130f..3f188260f 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -72,7 +72,8 @@ void ephy_location_entry_set_completion (EphyLocationEntry *le,
guint action_col,
guint keywords_col,
guint relevance_col,
- guint extra_col);
+ guint extra_col,
+ guint favicon_col);
void ephy_location_entry_set_location (EphyLocationEntry *le,
const char *address,
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 75358c096..6691062fd 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "ephy-completion-model.h"
+#include "ephy-favicon-cache.h"
#include "ephy-node.h"
#include "ephy-shell.h"
#include "ephy-history.h"
@@ -274,6 +275,9 @@ ephy_completion_model_get_column_type (GtkTreeModel *tree_model,
case EPHY_COMPLETION_EXTRA_COL:
type = G_TYPE_STRING;
break;
+ case EPHY_COMPLETION_FAVICON_COL:
+ type = GDK_TYPE_PIXBUF;
+ break;
case EPHY_COMPLETION_RELEVANCE_COL:
type = G_TYPE_INT;
break;
@@ -347,6 +351,37 @@ init_keywords_col (GValue *value, EphyNode *node, int group)
g_value_set_string (value, text);
}
+static void
+init_favicon_col (GValue *value, EphyNode *node, int group)
+{
+ EphyFaviconCache *cache;
+ const char *icon_location;
+ GdkPixbuf *pixbuf = NULL;
+
+ cache = EPHY_FAVICON_CACHE
+ (ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)));
+
+ switch (group)
+ {
+ case BOOKMARKS_GROUP:
+ icon_location = ephy_node_get_property_string
+ (node, EPHY_NODE_BMK_PROP_ICON);
+ break;
+ case HISTORY_GROUP:
+ icon_location = ephy_node_get_property_string
+ (node, EPHY_NODE_PAGE_PROP_ICON);
+ break;
+ default:
+ icon_location = NULL;
+ }
+
+ if (icon_location)
+ {
+ pixbuf = ephy_favicon_cache_get (cache, icon_location);
+ }
+
+ g_value_take_object (value, pixbuf);
+}
static gboolean
is_base_address (const char *address)
@@ -443,6 +478,10 @@ ephy_completion_model_get_value (GtkTreeModel *tree_model,
g_value_init (value, G_TYPE_STRING);
init_text_col (value, node, group);
break;
+ case EPHY_COMPLETION_FAVICON_COL:
+ g_value_init (value, GDK_TYPE_PIXBUF);
+ init_favicon_col (value, node, group);
+ break;
case EPHY_COMPLETION_ACTION_COL:
g_value_init (value, G_TYPE_STRING);
init_action_col (value, node, group);
diff --git a/src/ephy-completion-model.h b/src/ephy-completion-model.h
index d54470912..973951ad8 100644
--- a/src/ephy-completion-model.h
+++ b/src/ephy-completion-model.h
@@ -41,6 +41,7 @@ typedef enum
EPHY_COMPLETION_KEYWORDS_COL,
EPHY_COMPLETION_RELEVANCE_COL,
EPHY_COMPLETION_EXTRA_COL,
+ EPHY_COMPLETION_FAVICON_COL,
N_COL
} EphyCompletionColumn;
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 25af807a5..a4431d813 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -369,7 +369,8 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
EPHY_COMPLETION_ACTION_COL,
EPHY_COMPLETION_KEYWORDS_COL,
EPHY_COMPLETION_RELEVANCE_COL,
- EPHY_COMPLETION_EXTRA_COL);
+ EPHY_COMPLETION_EXTRA_COL,
+ EPHY_COMPLETION_FAVICON_COL);
add_completion_actions (action, proxy);