From 9ff4f5f92f9db92f4b420430d6368feabc26490b Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 13 Jan 2003 12:29:55 +0000 Subject: Use favicons in bookmarks. Use titles for session history when possible. 2003-01-13 Marco Pesenti Gritti * TODO: * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get): * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_set_icon): * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_finalize), (ephy_new_bookmark_add), (ephy_new_bookmark_init), (ephy_new_bookmark_set_smarturl), (ephy_new_bookmark_set_icon): * src/bookmarks/ephy-new-bookmark.h: * src/bookmarks/ephy-node-view.c: (ephy_node_view_add_column), (ephy_node_view_add_icon_column): * src/bookmarks/ephy-node-view.h: * src/bookmarks/ephy-tree-model-node.c: (ephy_tree_model_node_get_column_type), (get_icon_pixbuf), (ephy_tree_model_node_get_value), (ephy_tree_model_node_column_get_type): * src/bookmarks/ephy-tree-model-node.h: * src/ephy-history-model.c: (ephy_history_model_get_value): * src/ephy-navigation-button.c: (setup_back_or_forward_menu): * src/ephy-tab.c: (ephy_tab_favicon_cb): * src/window-commands.c: (window_cmd_bookmarks_add_default): Use favicons in bookmarks. Use titles for session history when possible. --- src/bookmarks/ephy-tree-model-node.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/bookmarks/ephy-tree-model-node.c') diff --git a/src/bookmarks/ephy-tree-model-node.c b/src/bookmarks/ephy-tree-model-node.c index d1030d5da..e6b467946 100644 --- a/src/bookmarks/ephy-tree-model-node.c +++ b/src/bookmarks/ephy-tree-model-node.c @@ -30,6 +30,8 @@ #include "ephy-tree-model-node.h" #include "ephy-stock-icons.h" #include "ephy-node.h" +#include "ephy-shell.h" +#include "ephy-debug.h" static void ephy_tree_model_node_class_init (EphyTreeModelNodeClass *klass); static void ephy_tree_model_node_init (EphyTreeModelNode *model); @@ -361,6 +363,8 @@ ephy_tree_model_node_get_column_type (GtkTreeModel *tree_model, return G_TYPE_STRING; case EPHY_TREE_MODEL_NODE_COL_VISIBLE: return G_TYPE_BOOLEAN; + case EPHY_TREE_MODEL_NODE_COL_ICON: + return GDK_TYPE_PIXBUF; default: g_assert_not_reached (); return G_TYPE_INVALID; @@ -430,6 +434,28 @@ ephy_tree_model_node_get_path (GtkTreeModel *tree_model, return get_path_real (model, node); } +static void +get_icon_pixbuf (EphyNode *node, GValue *value) +{ + EphyFaviconCache *cache; + const char *icon_location; + GdkPixbuf *pixbuf = NULL; + + cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); + icon_location = ephy_node_get_property_string + (node, EPHY_NODE_BMK_PROP_ICON); + + LOG ("Get favicon for %s", icon_location ? icon_location : "None") + + if (icon_location) + { + pixbuf = ephy_favicon_cache_get (cache, icon_location); + } + + g_value_init (value, GDK_TYPE_PIXBUF); + g_value_set_object (value, pixbuf); +} + static void ephy_tree_model_node_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, @@ -467,6 +493,10 @@ ephy_tree_model_node_get_value (GtkTreeModel *tree_model, EPHY_NODE_KEYWORD_PROP_NAME, value); break; + case EPHY_TREE_MODEL_NODE_COL_ICON: + get_icon_pixbuf (node, value); + break; + case EPHY_TREE_MODEL_NODE_COL_VISIBLE: g_value_init (value, G_TYPE_BOOLEAN); @@ -689,6 +719,7 @@ ephy_tree_model_node_column_get_type (void) { EPHY_TREE_MODEL_NODE_COL_BOOKMARK, "EPHY_TREE_MODEL_NODE_COL_BOOKMARK", "bookmark" }, { EPHY_TREE_MODEL_NODE_COL_LOCATION, "EPHY_TREE_MODEL_NODE_COL_LOCATION", "location" }, { EPHY_TREE_MODEL_NODE_COL_KEYWORD, "EPHY_TREE_MODEL_NODE_COL_KEYWORD", "keyword" }, + { EPHY_TREE_MODEL_NODE_COL_ICON, "EPHY_TREE_MODEL_NODE_COL_ICON", "icon" }, { EPHY_TREE_MODEL_NODE_COL_VISIBLE, "EPHY_TREE_MODEL_NODE_COL_VISIBLE", "visible" }, { 0, 0, 0 } -- cgit v1.2.3