aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c1
-rw-r--r--src/bookmarks/ephy-bookmarks.c23
-rw-r--r--src/bookmarks/ephy-bookmarks.h7
-rw-r--r--src/bookmarks/ephy-new-bookmark.c18
-rw-r--r--src/bookmarks/ephy-new-bookmark.h3
-rw-r--r--src/bookmarks/ephy-node-view.c20
-rw-r--r--src/bookmarks/ephy-node-view.h3
-rw-r--r--src/bookmarks/ephy-tree-model-node.c31
-rw-r--r--src/bookmarks/ephy-tree-model-node.h1
-rw-r--r--src/ephy-navigation-button.c4
-rw-r--r--src/ephy-tab.c5
-rw-r--r--src/window-commands.c5
12 files changed, 118 insertions, 3 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 94a512fe6..5ba72df03 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -442,6 +442,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
editor->priv->bookmarks_filter = ephy_node_filter_new ();
bm_view = ephy_node_view_new (node, editor->priv->bookmarks_filter);
ephy_node_view_enable_drag_source (bm_view);
+ ephy_node_view_add_icon_column (bm_view, EPHY_TREE_MODEL_NODE_COL_ICON);
ephy_node_view_add_column (bm_view, _("Title"),
EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE);
ephy_node_view_add_column (bm_view, _("Location"),
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 0f68d8858..106a3298e 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -657,6 +657,29 @@ ephy_bookmarks_add (EphyBookmarks *eb,
return bm;
}
+void
+ephy_bookmarks_set_icon (EphyBookmarks *eb,
+ const char *url,
+ const char *icon)
+{
+ EphyNode *node;
+ GValue value = { 0, };
+
+ g_return_if_fail (icon != NULL);
+
+ g_static_rw_lock_reader_lock (eb->priv->bookmarks_hash_lock);
+ node = g_hash_table_lookup (eb->priv->bookmarks_hash, url);
+ g_static_rw_lock_reader_unlock (eb->priv->bookmarks_hash_lock);
+
+ if (node == NULL) return;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, icon);
+ ephy_node_set_property (node, EPHY_NODE_BMK_PROP_ICON,
+ &value);
+ g_value_unset (&value);
+}
+
static gchar *
options_skip_spaces (const gchar *str)
{
diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h
index e355950c4..d2b1d7915 100644
--- a/src/bookmarks/ephy-bookmarks.h
+++ b/src/bookmarks/ephy-bookmarks.h
@@ -42,7 +42,8 @@ enum
EPHY_NODE_BMK_PROP_LOCATION = 3,
EPHY_NODE_BMK_PROP_KEYWORDS = 4,
EPHY_NODE_KEYWORD_PROP_NAME = 5,
- EPHY_NODE_BMK_PROP_SMART_LOCATION = 6
+ EPHY_NODE_BMK_PROP_SMART_LOCATION = 6,
+ EPHY_NODE_BMK_PROP_ICON = 7
};
struct EphyBookmarks
@@ -68,6 +69,10 @@ EphyNode *ephy_bookmarks_add (EphyBookmarks *eb,
const char *smart_url,
const char *keywords);
+void ephy_bookmarks_set_icon (EphyBookmarks *eb,
+ const char *url,
+ const char *icon);
+
char *ephy_bookmarks_solve_smart_url (EphyBookmarks *eb,
const char *smart_url,
const char *content);
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c
index dbda8b11b..de3cdbe80 100644
--- a/src/bookmarks/ephy-new-bookmark.c
+++ b/src/bookmarks/ephy-new-bookmark.c
@@ -47,6 +47,7 @@ struct EphyNewBookmarkPrivate
EphyBookmarks *bookmarks;
char *location;
char *smarturl;
+ char *icon;
GtkWidget *title_entry;
GtkWidget *keywords_entry;
@@ -131,6 +132,7 @@ ephy_new_bookmark_finalize (GObject *object)
g_free (editor->priv->location);
g_free (editor->priv->smarturl);
+ g_free (editor->priv->icon);
g_free (editor->priv);
@@ -150,6 +152,13 @@ ephy_new_bookmark_add (EphyNewBookmark *new_bookmark)
ephy_bookmarks_add (new_bookmark->priv->bookmarks, title,
new_bookmark->priv->location,
new_bookmark->priv->smarturl, keywords);
+
+ if (new_bookmark->priv->icon)
+ {
+ ephy_bookmarks_set_icon (new_bookmark->priv->bookmarks,
+ new_bookmark->priv->location,
+ new_bookmark->priv->icon);
+ }
}
static void
@@ -324,6 +333,7 @@ ephy_new_bookmark_init (EphyNewBookmark *editor)
editor->priv = g_new0 (EphyNewBookmarkPrivate, 1);
editor->priv->location = NULL;
editor->priv->smarturl = NULL;
+ editor->priv->icon = NULL;
}
void
@@ -343,3 +353,11 @@ ephy_new_bookmark_set_smarturl (EphyNewBookmark *bookmark,
bookmark->priv->smarturl = g_strdup (url);
}
+void
+ephy_new_bookmark_set_icon (EphyNewBookmark *bookmark,
+ const char *icon)
+{
+ g_free (bookmark->priv->icon);
+ bookmark->priv->icon = icon ? g_strdup (icon) : NULL;
+}
+
diff --git a/src/bookmarks/ephy-new-bookmark.h b/src/bookmarks/ephy-new-bookmark.h
index 7e1091f50..d0219ea14 100644
--- a/src/bookmarks/ephy-new-bookmark.h
+++ b/src/bookmarks/ephy-new-bookmark.h
@@ -57,6 +57,9 @@ GtkWidget *ephy_new_bookmark_new (EphyBookmarks *bookmarks,
void ephy_new_bookmark_set_title (EphyNewBookmark *bookmark,
const char *title);
+void ephy_new_bookmark_set_icon (EphyNewBookmark *bookmark,
+ const char *icon);
+
void ephy_new_bookmark_set_smarturl (EphyNewBookmark *bookmark,
const char *url);
diff --git a/src/bookmarks/ephy-node-view.c b/src/bookmarks/ephy-node-view.c
index f537855d8..8b9927fb7 100644
--- a/src/bookmarks/ephy-node-view.c
+++ b/src/bookmarks/ephy-node-view.c
@@ -21,6 +21,7 @@
#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcellrendererpixbuf.h>
#include <libgnome/gnome-i18n.h>
#include "eggtreemodelfilter.h"
@@ -420,6 +421,25 @@ ephy_node_view_add_column (EphyNodeView *view,
}
}
+void
+ephy_node_view_add_icon_column (EphyNodeView *view,
+ EphyTreeModelNodeColumn column)
+{
+ GtkTreeViewColumn *gcolumn;
+ GtkCellRenderer *renderer;
+
+ gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_pack_start (gcolumn, renderer, TRUE);
+ gtk_tree_view_column_set_attributes (gcolumn, renderer,
+ "pixbuf", column,
+ NULL);
+ gtk_tree_view_column_set_sizing (gcolumn,
+ GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view->priv->treeview),
+ gcolumn);
+}
+
static void
ephy_node_view_init (EphyNodeView *view)
{
diff --git a/src/bookmarks/ephy-node-view.h b/src/bookmarks/ephy-node-view.h
index 71f19d7c7..3fa1690d9 100644
--- a/src/bookmarks/ephy-node-view.h
+++ b/src/bookmarks/ephy-node-view.h
@@ -66,6 +66,9 @@ void ephy_node_view_add_column (EphyNodeView *view,
EphyTreeModelNodeColumn column,
gboolean sortable);
+void ephy_node_view_add_icon_column (EphyNodeView *view,
+ EphyTreeModelNodeColumn column);
+
void ephy_node_view_remove (EphyNodeView *view);
GList *ephy_node_view_get_selection (EphyNodeView *view);
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;
@@ -431,6 +435,28 @@ ephy_tree_model_node_get_path (GtkTreeModel *tree_model,
}
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,
int column,
@@ -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 }
diff --git a/src/bookmarks/ephy-tree-model-node.h b/src/bookmarks/ephy-tree-model-node.h
index a48bc6ad5..aa2cd9d0e 100644
--- a/src/bookmarks/ephy-tree-model-node.h
+++ b/src/bookmarks/ephy-tree-model-node.h
@@ -41,6 +41,7 @@ typedef enum
EPHY_TREE_MODEL_NODE_COL_LOCATION,
EPHY_TREE_MODEL_NODE_COL_KEYWORD,
EPHY_TREE_MODEL_NODE_COL_VISIBLE,
+ EPHY_TREE_MODEL_NODE_COL_ICON,
EPHY_TREE_MODEL_NODE_NUM_COLUMNS
} EphyTreeModelNodeColumn;
diff --git a/src/ephy-navigation-button.c b/src/ephy-navigation-button.c
index a10b3a942..d0d80af7f 100644
--- a/src/ephy-navigation-button.c
+++ b/src/ephy-navigation-button.c
@@ -91,7 +91,7 @@ ephy_navigation_button_class_init (EphyNavigationButtonClass *klass)
ephy_tb_item_class = g_type_class_peek_parent (klass);
}
-static void
+static void
ephy_navigation_button_init (EphyNavigationButton *tbi)
{
EphyNavigationButtonPrivate *p = g_new0 (EphyNavigationButtonPrivate, 1);
@@ -528,7 +528,7 @@ setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigation
char *title, *url;
GtkWidget *item;
ephy_embed_shistory_get_nth (embed, start, FALSE, &url, &title);
- item = new_history_menu_item (url, NULL);
+ item = new_history_menu_item (title ? title : url, NULL);
gtk_menu_shell_append (ms, item);
g_object_set_data (G_OBJECT (item), "go_nth", GINT_TO_POINTER (start));
g_signal_connect (item, "activate",
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 6a0201d30..a46c29c60 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -429,11 +429,16 @@ ephy_tab_favicon_cb (EphyEmbed *embed,
const char *url,
EphyTab *tab)
{
+ EphyBookmarks *eb;
+
g_strlcpy (tab->priv->favicon_url,
url, 255);
if (!tab->priv->is_active) return;
+ eb = ephy_shell_get_bookmarks (ephy_shell);
+ ephy_bookmarks_set_icon (eb, tab->priv->location,
+ tab->priv->favicon_url);
ephy_window_update_control (tab->priv->window,
FaviconControl);
}
diff --git a/src/window-commands.c b/src/window-commands.c
index 67400748d..0364a7d60 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -330,6 +330,7 @@ window_cmd_bookmarks_add_default (BonoboUIComponent *uic,
EphyBookmarks *bookmarks;
GtkWidget *new_bookmark;
const char *location;
+ const char *icon;
char *title;
tab = ephy_window_get_active_tab (window);
@@ -344,11 +345,15 @@ window_cmd_bookmarks_add_default (BonoboUIComponent *uic,
title = _("Untitled");
}
+ icon = ephy_tab_get_favicon_url (tab);
+
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
new_bookmark = ephy_new_bookmark_new
(bookmarks, GTK_WINDOW (window), location);
ephy_new_bookmark_set_title
(EPHY_NEW_BOOKMARK (new_bookmark), title);
+ ephy_new_bookmark_set_icon
+ (EPHY_NEW_BOOKMARK (new_bookmark), icon);
gtk_widget_show (new_bookmark);
}