aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@gnome.org>2007-08-01 20:31:43 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2007-08-01 20:31:43 +0800
commit2e2245bdc10e8ef53112f395d2b8047314fe7b10 (patch)
tree1a242bef17e7b5c3a08c478d06e65ea55dad9609
parented4e14dc5fd743ae81abf66424eb0fbe04d5be75 (diff)
downloadgsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.tar
gsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.tar.gz
gsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.tar.bz2
gsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.tar.lz
gsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.tar.xz
gsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.tar.zst
gsoc2013-epiphany-2e2245bdc10e8ef53112f395d2b8047314fe7b10.zip
Fix completion model to show icons for history items too,
2007-08-01 Diego Escalante Urrelo <diegoe@gnome.org> * src/ephy-completion-model.c: * embed/ephy-history.c: Fix completion model to show icons for history items too, istory/bookmarks/favicon_cache service objects are now stored in the completion priv. Patch by Imran Patel. Fixes bug #459811. svn path=/trunk/; revision=7233
-rw-r--r--ChangeLog9
-rw-r--r--embed/ephy-history.c11
-rw-r--r--src/ephy-completion-model.c42
3 files changed, 43 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index a38f2c313..1b89fadac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2007-08-01 Diego Escalante Urrelo <diegoe@gnome.org>
+ * src/ephy-completion-model.c:
+ * embed/ephy-history.c:
+
+ Fix completion model to show icons for history items too,
+ istory/bookmarks/favicon_cache service objects are now stored in the
+ completion priv. Patch by Imran Patel. Fixes bug #459811.
+
+2007-08-01 Diego Escalante Urrelo <diegoe@gnome.org>
+
* data/epiphany-lockdown.schemas.in:
Remove misleading text from hide menu bar lockdown. Fixes bug #321989.
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 401c661a1..bc84c4bca 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -966,11 +966,16 @@ ephy_history_set_icon (EphyHistory *gh,
const char *url,
const char *icon)
{
- EphyNode *host;
+ EphyNode *node, *host;
+ int host_id;
- LOG ("Set host icon");
+ node = ephy_history_get_page (gh, url);
+ if (node == NULL) return;
+
+ host_id = ephy_node_get_property_int (node, EPHY_NODE_PAGE_PROP_HOST_ID);
+ g_return_if_fail (host_id >= 0);
- host = g_hash_table_lookup (gh->priv->hosts_hash, url);
+ host = ephy_node_db_get_node_from_id (gh->priv->db, host_id);
if (host)
{
ephy_node_set_property_string (host, EPHY_NODE_PAGE_PROP_ICON,
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index c2699ccac..c15286309 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -35,6 +35,10 @@ static void ephy_completion_model_tree_model_init (GtkTreeModelIface *iface);
struct _EphyCompletionModelPrivate
{
+ EphyHistory *history_service;
+ EphyBookmarks *bookmarks_service;
+ EphyFaviconCache *favicon_cache;
+
EphyNode *history;
EphyNode *bookmarks;
int stamp;
@@ -228,19 +232,24 @@ connect_signals (EphyCompletionModel *model, EphyNode *root)
static void
ephy_completion_model_init (EphyCompletionModel *model)
{
- EphyBookmarks *bookmarks;
- EphyHistory *history;
-
model->priv = EPHY_COMPLETION_MODEL_GET_PRIVATE (model);
model->priv->stamp = g_random_int ();
- history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell));
- model->priv->history = ephy_history_get_pages (history);
+ model->priv->history_service = EPHY_HISTORY (
+ ephy_embed_shell_get_global_history (
+ embed_shell));
+ model->priv->history = ephy_history_get_pages (
+ model->priv->history_service);
connect_signals (model, model->priv->history);
- bookmarks = ephy_shell_get_bookmarks (ephy_shell);
- model->priv->bookmarks = ephy_bookmarks_get_bookmarks (bookmarks);
+ model->priv->bookmarks_service = ephy_shell_get_bookmarks (ephy_shell);
+ model->priv->bookmarks = ephy_bookmarks_get_bookmarks (
+ model->priv->bookmarks_service);
connect_signals (model, model->priv->bookmarks);
+
+ model->priv->favicon_cache = EPHY_FAVICON_CACHE (
+ ephy_embed_shell_get_favicon_cache (
+ EPHY_EMBED_SHELL (ephy_shell)));
}
EphyCompletionModel *
@@ -353,14 +362,12 @@ 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)
+init_favicon_col (EphyCompletionModel *model, 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)));
+ const char *url;
switch (group)
{
@@ -369,8 +376,10 @@ init_favicon_col (GValue *value, EphyNode *node, int group)
(node, EPHY_NODE_BMK_PROP_ICON);
break;
case HISTORY_GROUP:
- icon_location = ephy_node_get_property_string
- (node, EPHY_NODE_PAGE_PROP_ICON);
+ url = ephy_node_get_property_string
+ (node, EPHY_NODE_PAGE_PROP_LOCATION);
+ icon_location = ephy_history_get_icon (
+ model->priv->history_service, url);
break;
default:
icon_location = NULL;
@@ -378,7 +387,8 @@ init_favicon_col (GValue *value, EphyNode *node, int group)
if (icon_location)
{
- pixbuf = ephy_favicon_cache_get (cache, icon_location);
+ pixbuf = ephy_favicon_cache_get (
+ model->priv->favicon_cache, icon_location);
}
g_value_take_object (value, pixbuf);
@@ -504,7 +514,7 @@ ephy_completion_model_get_value (GtkTreeModel *tree_model,
break;
case EPHY_COMPLETION_FAVICON_COL:
g_value_init (value, GDK_TYPE_PIXBUF);
- init_favicon_col (value, node, group);
+ init_favicon_col (model, value, node, group);
break;
case EPHY_COMPLETION_ACTION_COL:
g_value_init (value, G_TYPE_STRING);