Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
Epiphany
Commits
6119b95c
Commit
6119b95c
authored
Mar 07, 2012
by
Sergio
Committed by
Xan Lopez
Mar 20, 2012
Browse files
Replace EphyFaviconCache by WebKit's icon database cache
https://bugzilla.gnome.org/show_bug.cgi?id=648653
parent
bc0e3b41
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
embed/Makefile.am
View file @
6119b95c
...
...
@@ -11,7 +11,6 @@ NOINST_H_FILES = \
ephy-embed-dialog.h
\
ephy-embed-private.h
\
ephy-encodings.h
\
ephy-favicon-cache.h
\
ephy-request-about.h
\
ephy-web-app-utils.h
...
...
@@ -47,7 +46,6 @@ libephyembed_la_SOURCES = \
ephy-embed-shell.c
\
ephy-embed-utils.c
\
ephy-encodings.c
\
ephy-favicon-cache.c
\
ephy-history.c
\
ephy-permission-manager.c
\
ephy-request-about.c
\
...
...
embed/ephy-embed-prefs.h
View file @
6119b95c
...
...
@@ -28,6 +28,7 @@
#endif
#define USER_STYLESHEET_FILENAME "user-stylesheet.css"
#define FAVICON_SIZE 16
G_BEGIN_DECLS
...
...
embed/ephy-embed-shell.c
View file @
6119b95c
...
...
@@ -34,7 +34,6 @@
#include
"ephy-embed-single.h"
#include
"ephy-embed-type-builtins.h"
#include
"ephy-encodings.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-file-helpers.h"
#include
"ephy-history.h"
#include
"ephy-history-service.h"
...
...
@@ -54,7 +53,6 @@ struct _EphyEmbedShellPrivate
EphyHistory
*
global_history
;
EphyHistoryService
*
global_history_service
;
GList
*
downloads
;
EphyFaviconCache
*
favicon_cache
;
EphyEmbedSingle
*
embed_single
;
EphyEncodings
*
encodings
;
EphyAdBlockManager
*
adblock_manager
;
...
...
@@ -96,13 +94,6 @@ ephy_embed_shell_dispose (GObject *object)
EphyEmbedShell
*
shell
=
EPHY_EMBED_SHELL
(
object
);
EphyEmbedShellPrivate
*
priv
=
shell
->
priv
;
if
(
priv
->
favicon_cache
!=
NULL
)
{
LOG
(
"Unref favicon cache"
);
g_object_unref
(
priv
->
favicon_cache
);
priv
->
favicon_cache
=
NULL
;
}
if
(
priv
->
encodings
!=
NULL
)
{
LOG
(
"Unref encodings"
);
...
...
@@ -166,27 +157,6 @@ ephy_embed_shell_finalize (GObject *object)
G_OBJECT_CLASS
(
ephy_embed_shell_parent_class
)
->
finalize
(
object
);
}
/**
* ephy_embed_shell_get_favicon_cache:
* @shell: the #EphyEmbedShell
*
* Returns the favicons cache.
*
* Return value: (transfer none): the favicons cache
**/
GObject
*
ephy_embed_shell_get_favicon_cache
(
EphyEmbedShell
*
shell
)
{
g_return_val_if_fail
(
EPHY_IS_EMBED_SHELL
(
shell
),
NULL
);
if
(
shell
->
priv
->
favicon_cache
==
NULL
)
{
shell
->
priv
->
favicon_cache
=
ephy_favicon_cache_new
();
}
return
G_OBJECT
(
shell
->
priv
->
favicon_cache
);
}
/**
* ephy_embed_shell_get_global_history:
* @shell: the #EphyEmbedShell
...
...
embed/ephy-embed-shell.h
View file @
6119b95c
...
...
@@ -79,8 +79,6 @@ GType ephy_embed_shell_get_type (void);
EphyEmbedShell
*
ephy_embed_shell_get_default
(
void
);
GObject
*
ephy_embed_shell_get_favicon_cache
(
EphyEmbedShell
*
shell
);
GObject
*
ephy_embed_shell_get_global_history
(
EphyEmbedShell
*
shell
);
GObject
*
ephy_embed_shell_get_global_history_service
(
EphyEmbedShell
*
shell
);
...
...
embed/ephy-embed-single.c
View file @
6119b95c
...
...
@@ -350,6 +350,7 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
char
*
filename
;
char
*
cookie_policy
;
char
*
cache_dir
;
char
*
favicon_db_path
;
EphyEmbedSinglePrivate
*
priv
=
single
->
priv
;
SoupSessionFeature
*
requester
;
...
...
@@ -412,6 +413,11 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
soup_session_add_feature_by_type
(
session
,
SOUP_TYPE_PASSWORD_MANAGER_GNOME
);
#endif
/* Initialize the favicon cache. */
favicon_db_path
=
g_build_filename
(
g_get_user_data_dir
(),
g_get_prgname
(),
NULL
);
webkit_favicon_database_set_path
(
webkit_get_favicon_database
(),
favicon_db_path
);
g_free
(
favicon_db_path
);
return
TRUE
;
}
...
...
embed/ephy-favicon-cache.c
deleted
100644 → 0
View file @
bc0e3b41
This diff is collapsed.
Click to expand it.
embed/ephy-favicon-cache.h
deleted
100644 → 0
View file @
bc0e3b41
/*
* Copyright © 2002 Jorn Baayen
* Copyright © 2003-2004 Marco Pesenti Gritti
* Copyright © 2004, 2005 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
#error "Only <epiphany/epiphany.h> can be included directly."
#endif
#ifndef EPHY_FAVICON_CACHE_H
#define EPHY_FAVICON_CACHE_H
#include
<glib-object.h>
#include
<gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
#define EPHY_TYPE_FAVICON_CACHE (ephy_favicon_cache_get_type ())
#define EPHY_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCache))
#define EPHY_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass))
#define EPHY_IS_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FAVICON_CACHE))
#define EPHY_IS_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FAVICON_CACHE))
#define EPHY_FAVICON_CACHE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass))
typedef
struct
_EphyFaviconCacheClass
EphyFaviconCacheClass
;
typedef
struct
_EphyFaviconCache
EphyFaviconCache
;
typedef
struct
_EphyFaviconCachePrivate
EphyFaviconCachePrivate
;
struct
_EphyFaviconCache
{
GObject
parent
;
/*< private >*/
EphyFaviconCachePrivate
*
priv
;
};
struct
_EphyFaviconCacheClass
{
GObjectClass
parent_class
;
/* Signals */
void
(
*
changed
)
(
EphyFaviconCache
*
cache
,
const
char
*
url
);
};
GType
ephy_favicon_cache_get_type
(
void
);
EphyFaviconCache
*
ephy_favicon_cache_new
(
void
);
GdkPixbuf
*
ephy_favicon_cache_get
(
EphyFaviconCache
*
cache
,
const
char
*
url
);
void
ephy_favicon_cache_clear
(
EphyFaviconCache
*
cache
);
G_END_DECLS
#endif
/* EPHY_FAVICON_CACHE_H */
embed/ephy-web-view.c
View file @
6119b95c
...
...
@@ -32,7 +32,6 @@
#include
"ephy-embed-type-builtins.h"
#include
"ephy-embed-utils.h"
#include
"ephy-embed.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-file-helpers.h"
#include
"ephy-history.h"
#include
"ephy-history-service.h"
...
...
@@ -1593,41 +1592,18 @@ static void
_ephy_web_view_load_icon
(
EphyWebView
*
view
)
{
EphyWebViewPrivate
*
priv
=
view
->
priv
;
EphyEmbedShell
*
shell
;
EphyFaviconCache
*
cache
;
const
char
*
icon_address
;
icon_address
=
webkit_web_view_get_icon_uri
(
WEBKIT_WEB_VIEW
(
view
));
const
char
*
uri
;
if
(
icon_address
==
NULL
||
priv
->
icon
!=
NULL
)
return
;
shell
=
ephy_embed_shell_get_default
();
cache
=
EPHY_FAVICON_CACHE
(
ephy_embed_shell_get_favicon_cache
(
shell
));
if
(
priv
->
icon
!=
NULL
)
return
;
/* ephy_favicon_cache_get returns a reference already */
priv
->
icon
=
ephy_favicon_cache_get
(
cache
,
icon_address
);
uri
=
webkit_web_view_get_uri
(
WEBKIT_WEB_VIEW
(
view
));
priv
->
icon
=
webkit_favicon_database_try_get_favicon_pixbuf
(
webkit_get_favicon_database
(),
uri
,
FAVICON_SIZE
,
FAVICON_SIZE
);
g_object_notify
(
G_OBJECT
(
view
),
"icon"
);
}
static
void
icon_cache_changed_cb
(
EphyFaviconCache
*
cache
,
const
char
*
address
,
EphyWebView
*
view
)
{
const
char
*
icon_address
;
g_return_if_fail
(
address
!=
NULL
);
icon_address
=
webkit_web_view_get_icon_uri
(
WEBKIT_WEB_VIEW
(
view
));
/* is this for us? */
if
(
icon_address
!=
NULL
&&
strcmp
(
icon_address
,
address
)
==
0
)
{
_ephy_web_view_load_icon
(
view
);
}
}
static
void
_ephy_web_view_set_icon_address
(
EphyWebView
*
view
,
const
char
*
icon_address
)
...
...
@@ -2337,7 +2313,6 @@ static void
ephy_web_view_init
(
EphyWebView
*
web_view
)
{
EphyWebViewPrivate
*
priv
;
EphyFaviconCache
*
cache
;
priv
=
web_view
->
priv
=
EPHY_WEB_VIEW_GET_PRIVATE
(
web_view
);
...
...
@@ -2407,11 +2382,6 @@ ephy_web_view_init (EphyWebView *web_view)
G_CALLBACK
(
ge_popup_blocked_cb
),
NULL
);
cache
=
EPHY_FAVICON_CACHE
(
ephy_embed_shell_get_favicon_cache
(
embed_shell
));
g_signal_connect_object
(
G_OBJECT
(
cache
),
"changed"
,
G_CALLBACK
(
icon_cache_changed_cb
),
web_view
,
(
GConnectFlags
)
0
);
}
/**
...
...
src/Makefile.am
View file @
6119b95c
...
...
@@ -224,7 +224,6 @@ EPHY_GIR_H_FILES = \
$(top_srcdir)
/embed/ephy-embed-event.h
\
$(top_srcdir)
/embed/ephy-embed-shell.h
\
$(top_srcdir)
/embed/ephy-embed-single.h
\
$(top_srcdir)
/embed/ephy-favicon-cache.h
\
$(top_srcdir)
/embed/ephy-history.h
\
$(top_srcdir)
/embed/ephy-permission-manager.h
\
$(top_srcdir)
/embed/ephy-web-view.h
\
...
...
@@ -254,7 +253,6 @@ EPHY_GIR_C_FILES = \
$(top_srcdir)
/embed/ephy-embed-event.c
\
$(top_srcdir)
/embed/ephy-embed-shell.c
\
$(top_srcdir)
/embed/ephy-embed-single.c
\
$(top_srcdir)
/embed/ephy-favicon-cache.c
\
$(top_srcdir)
/embed/ephy-history.c
\
$(top_srcdir)
/embed/ephy-permission-manager.c
\
$(top_srcdir)
/embed/ephy-web-view.c
\
...
...
src/bookmarks/ephy-bookmark-action.c
View file @
6119b95c
...
...
@@ -26,7 +26,7 @@
#include
"ephy-bookmarks.h"
#include
"ephy-debug.h"
#include
"ephy-dnd.h"
#include
"ephy-
favicon-cache
.h"
#include
"ephy-
embed-prefs
.h"
#include
"ephy-gui.h"
#include
"ephy-shell.h"
#include
"ephy-string.h"
...
...
@@ -67,20 +67,22 @@ typedef struct
G_DEFINE_TYPE
(
EphyBookmarkAction
,
ephy_bookmark_action
,
EPHY_TYPE_LINK_ACTION
)
static
void
favicon_
cache_chang
ed_cb
(
Ephy
Favicon
Cache
*
cach
e
,
const
char
*
icon
_address
,
EphyBookmarkAction
*
action
)
favicon_
load
ed_cb
(
WebKit
Favicon
Database
*
databas
e
,
const
char
*
page
_address
,
EphyBookmarkAction
*
action
)
{
const
char
*
icon
;
char
*
icon_address
;
g_return_if_fail
(
action
->
priv
->
node
!=
NULL
);
icon
=
ephy_node_get_property_string
(
action
->
priv
->
node
,
EPHY_NODE_BMK_PROP_ICON
);
if
(
icon
!=
NULL
&&
strcmp
(
icon
,
icon_address
)
==
0
)
icon_address
=
webkit_favicon_database_get_favicon_uri
(
database
,
page_address
);
if
(
g_strcmp0
(
icon
,
icon_address
)
==
0
)
{
g_signal_handler_disconnect
(
cach
e
,
action
->
priv
->
cache_handler
);
g_signal_handler_disconnect
(
databas
e
,
action
->
priv
->
cache_handler
);
action
->
priv
->
cache_handler
=
0
;
g_object_notify
(
G_OBJECT
(
action
),
"icon"
);
...
...
@@ -93,28 +95,27 @@ ephy_bookmark_action_sync_icon (GtkAction *action,
GtkWidget
*
proxy
)
{
EphyBookmarkAction
*
bma
=
EPHY_BOOKMARK_ACTION
(
action
);
const
char
*
icon
_location
;
Ephy
Favicon
Cache
*
cach
e
;
const
char
*
page
_location
;
WebKit
Favicon
Database
*
databas
e
;
GdkPixbuf
*
pixbuf
=
NULL
;
g_return_if_fail
(
bma
->
priv
->
node
!=
NULL
);
icon
_location
=
ephy_node_get_property_string
(
bma
->
priv
->
node
,
EPHY_NODE_BMK_PROP_I
C
ON
);
page
_location
=
ephy_node_get_property_string
(
bma
->
priv
->
node
,
EPHY_NODE_BMK_PROP_
LOCAT
ION
);
cache
=
EPHY_FAVICON_CACHE
(
ephy_embed_shell_get_favicon_cache
(
ephy_embed_shell_get_default
()));
if
(
icon_location
&&
*
icon_location
)
database
=
webkit_get_favicon_database
();
if
(
page_location
&&
*
page_location
)
{
pixbuf
=
ephy_favicon_cache_get
(
cache
,
icon_location
);
pixbuf
=
webkit_favicon_database_try_get_favicon_pixbuf
(
database
,
page_location
,
FAVICON_SIZE
,
FAVICON_SIZE
);
if
(
pixbuf
==
NULL
&&
bma
->
priv
->
cache_handler
==
0
)
{
bma
->
priv
->
cache_handler
=
g_signal_connect_object
(
cache
,
"chang
ed"
,
G_CALLBACK
(
favicon_
cache_chang
ed_cb
),
(
database
,
"icon-load
ed"
,
G_CALLBACK
(
favicon_
load
ed_cb
),
action
,
0
);
}
}
...
...
@@ -370,14 +371,11 @@ ephy_bookmark_action_dispose (GObject *object)
{
EphyBookmarkAction
*
action
=
(
EphyBookmarkAction
*
)
object
;
EphyBookmarkActionPrivate
*
priv
=
action
->
priv
;
GObject
*
cache
;
if
(
priv
->
cache_handler
!=
0
)
{
cache
=
ephy_embed_shell_get_favicon_cache
(
ephy_embed_shell_get_default
());
g_signal_handler_disconnect
(
cache
,
priv
->
cache_handler
);
WebKitFaviconDatabase
*
database
=
webkit_get_favicon_database
();
g_signal_handler_disconnect
(
database
,
priv
->
cache_handler
);
priv
->
cache_handler
=
0
;
}
...
...
src/bookmarks/ephy-bookmarks-editor.c
View file @
6119b95c
...
...
@@ -26,7 +26,7 @@
#include
"ephy-bookmarks-ui.h"
#include
"ephy-debug.h"
#include
"ephy-dnd.h"
#include
"ephy-
favicon-cache
.h"
#include
"ephy-
embed-prefs
.h"
#include
"ephy-file-chooser.h"
#include
"ephy-file-helpers.h"
#include
"ephy-gui.h"
...
...
@@ -1460,27 +1460,43 @@ node_dropped_cb (EphyNodeView *view,
}
}
static
void
icon_loaded_cb
(
WebKitFaviconDatabase
*
database
,
GAsyncResult
*
result
,
GValue
*
value
)
{
GdkPixbuf
*
favicon
=
webkit_favicon_database_get_favicon_pixbuf_finish
(
database
,
result
,
NULL
);
if
(
!
favicon
)
return
;
g_value_take_object
(
value
,
favicon
);
}
static
void
provide_favicon
(
EphyNode
*
node
,
GValue
*
value
,
gpointer
user_data
)
{
EphyFaviconCache
*
cache
;
const
char
*
icon_location
;
GdkPixbuf
*
pixbuf
=
NULL
;
const
char
*
page_location
;
GdkPixbuf
*
favicon
=
NULL
;
cache
=
EPHY_FAVICON_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
);
page_location
=
ephy_node_get_property_string
(
node
,
EPHY_NODE_BMK_PROP_LOCATION
);
LOG
(
"Get favicon for %s"
,
icon
_location
?
icon
_location
:
"None"
);
LOG
(
"Get favicon for %s"
,
page
_location
?
page
_location
:
"None"
);
if
(
icon_location
)
{
pixbuf
=
ephy_favicon_cache_get
(
cache
,
icon_location
);
}
if
(
page_location
)
{
WebKitFaviconDatabase
*
database
=
webkit_get_favicon_database
();
/* Try with the sync version first as this method will be frequently called. */
favicon
=
webkit_favicon_database_try_get_favicon_pixbuf
(
database
,
page_location
,
FAVICON_SIZE
,
FAVICON_SIZE
);
if
(
!
favicon
&&
webkit_favicon_database_get_favicon_uri
(
database
,
page_location
))
webkit_favicon_database_get_favicon_pixbuf
(
database
,
page_location
,
FAVICON_SIZE
,
FAVICON_SIZE
,
NULL
,
(
GAsyncReadyCallback
)
icon_loaded_cb
,
value
);
}
g_value_init
(
value
,
GDK_TYPE_PIXBUF
);
g_value_take_object
(
value
,
pixbuf
);
g_value_take_object
(
value
,
favicon
);
}
static
void
...
...
src/ephy-completion-model.c
View file @
6119b95c
...
...
@@ -21,8 +21,8 @@
#include
"config.h"
#include
"ephy-completion-model.h"
#include
"ephy-embed-prefs.h"
#include
"ephy-embed-shell.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-history.h"
#include
"ephy-history-service.h"
#include
"ephy-shell.h"
...
...
@@ -36,7 +36,6 @@ G_DEFINE_TYPE (EphyCompletionModel, ephy_completion_model, GTK_TYPE_LIST_STORE)
struct
_EphyCompletionModelPrivate
{
EphyHistoryService
*
history_service
;
EphyHistory
*
legacy_history_service
;
EphyFaviconCache
*
favicon_cache
;
EphyNode
*
bookmarks
;
GSList
*
search_terms
;
...
...
@@ -99,7 +98,6 @@ ephy_completion_model_init (EphyCompletionModel *model)
priv
->
history_service
=
EPHY_HISTORY_SERVICE
(
ephy_embed_shell_get_global_history_service
(
embed_shell
));
priv
->
legacy_history_service
=
EPHY_HISTORY
(
ephy_embed_shell_get_global_history
(
embed_shell
));
priv
->
favicon_cache
=
EPHY_FAVICON_CACHE
(
ephy_embed_shell_get_favicon_cache
(
embed_shell
));
bookmarks_service
=
ephy_shell_get_bookmarks
(
ephy_shell
);
priv
->
bookmarks
=
ephy_bookmarks_get_bookmarks
(
bookmarks_service
);
...
...
@@ -165,22 +163,69 @@ typedef struct {
gboolean
is_bookmark
;
}
PotentialRow
;
typedef
struct
{
GtkListStore
*
model
;
GtkTreeRowReference
*
row_reference
;
}
IconLoadData
;
static
void
icon_loaded_cb
(
GObject
*
source
,
GAsyncResult
*
result
,
gpointer
user_data
)
{
GtkTreeIter
iter
;
IconLoadData
*
data
=
(
IconLoadData
*
)
user_data
;
GdkPixbuf
*
favicon
=
webkit_favicon_database_get_favicon_pixbuf_finish
(
webkit_get_favicon_database
(),
result
,
NULL
);
if
(
favicon
)
{
/* The completion model might have changed its contents */
if
(
gtk_tree_row_reference_valid
(
data
->
row_reference
))
{
gtk_tree_model_get_iter
(
GTK_TREE_MODEL
(
data
->
model
),
&
iter
,
gtk_tree_row_reference_get_path
(
data
->
row_reference
));
gtk_list_store_set
(
data
->
model
,
&
iter
,
EPHY_COMPLETION_FAVICON_COL
,
favicon
,
-
1
);
}
}
g_object_unref
(
data
->
model
);
gtk_tree_row_reference_free
(
data
->
row_reference
);
g_slice_free
(
IconLoadData
,
data
);
}
static
void
set_row_in_model
(
EphyCompletionModel
*
model
,
int
position
,
PotentialRow
*
row
)
{
const
char
*
favicon_location
=
ephy_history_get_icon
(
model
->
priv
->
legacy_history_service
,
row
->
location
);
GtkTreeIter
iter
;
GdkPixbuf
*
favicon
;
GtkTreePath
*
path
;
IconLoadData
*
data
;
WebKitFaviconDatabase
*
database
=
webkit_get_favicon_database
();
gtk_list_store_insert_with_values
(
GTK_LIST_STORE
(
model
),
NULL
,
position
,
gtk_list_store_insert_with_values
(
GTK_LIST_STORE
(
model
),
&
iter
,
position
,
EPHY_COMPLETION_TEXT_COL
,
row
->
title
?
row
->
title
:
""
,
EPHY_COMPLETION_URL_COL
,
row
->
location
,
EPHY_COMPLETION_ACTION_COL
,
row
->
location
,
EPHY_COMPLETION_KEYWORDS_COL
,
row
->
keywords
?
row
->
keywords
:
""
,
EPHY_COMPLETION_EXTRA_COL
,
row
->
is_bookmark
,
EPHY_COMPLETION_FAVICON_COL
,
ephy_favicon_cache_get
(
model
->
priv
->
favicon_cache
,
favicon_location
),
EPHY_COMPLETION_RELEVANCE_COL
,
row
->
relevance
,
-
1
);
/* We try first with the try_get_favicon_pixbuf() because if the icon
is in the DB it's faster than the async version. */
favicon
=
webkit_favicon_database_try_get_favicon_pixbuf
(
database
,
row
->
location
,
FAVICON_SIZE
,
FAVICON_SIZE
);
if
(
favicon
)
{
gtk_list_store_set
(
GTK_LIST_STORE
(
model
),
&
iter
,
EPHY_COMPLETION_FAVICON_COL
,
favicon
,
-
1
);
return
;
}
data
=
g_slice_new
(
IconLoadData
);
data
->
model
=
GTK_LIST_STORE
(
g_object_ref
(
model
));
path
=
gtk_tree_model_get_path
(
GTK_TREE_MODEL
(
model
),
&
iter
);
data
->
row_reference
=
gtk_tree_row_reference_new
(
GTK_TREE_MODEL
(
model
),
path
);
gtk_tree_path_free
(
path
);
webkit_favicon_database_get_favicon_pixbuf
(
webkit_get_favicon_database
(),
row
->
location
,
FAVICON_SIZE
,
FAVICON_SIZE
,
NULL
,
icon_loaded_cb
,
data
);
}
static
void
...
...
src/ephy-history-window.c
View file @
6119b95c
...
...
@@ -26,7 +26,6 @@
#include
"ephy-bookmarks-ui.h"
#include
"ephy-debug.h"
#include
"ephy-dnd.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-file-helpers.h"
#include
"ephy-gui.h"
#include
"ephy-hosts-store.h"
...
...
@@ -870,21 +869,22 @@ delete_event_cb (EphyHistoryWindow *editor)
static void
provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
{
EphyFaviconCache *cache;
const char *icon_location;
const char *page_location;
GdkPixbuf *pixbuf = NULL;
cache = EPHY_FAVICON_CACHE
(ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)));
icon_location = ephy_node_get_property_string
(node, EPHY_NODE_PAGE_PROP_ICON);
page_location = ephy_node_get_property_string
(node, EPHY_NODE_PAGE_PROP_LOCATION);
LOG ("Get favicon for %s",
icon
_location ?
icon
_location : "None");
LOG ("Get favicon for %s",
page
_location ?
page
_location : "None");
if (icon_location)
{
pixbuf = ephy_favicon_cache_get (cache, icon_location);
}
if (page_location)
{
/* No need to use the async version as this function will be
called many times by the treeview. */
WebKitFaviconDatabase *database = webkit_get_favicon_database ();
pixbuf = webkit_favicon_database_get_favicon_pixbuf (database, page_location,
FAVICON_SIZE, FAVICON_SIZE);
}
g_value_init (value, GDK_TYPE_PIXBUF);
g_value_take_object (value, pixbuf);
...
...
src/ephy-shell.c
View file @
6119b95c
...
...
@@ -30,7 +30,6 @@
#include
"ephy-embed-single.h"
#include
"ephy-embed-utils.h"
#include
"ephy-extensions-manager.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-file-helpers.h"
#include
"ephy-gui.h"
#include
"ephy-history-window.h"
...
...
src/pdm-dialog.c
View file @
6119b95c
...
...
@@ -33,7 +33,6 @@
#include
"ephy-debug.h"
#include
"ephy-time-helpers.h"
#include
"ephy-embed-single.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-history-service.h"
#include
"ephy-password-info.h"
...
...
@@ -284,7 +283,6 @@ clear_all_dialog_response_cb (GtkDialog *dialog,
{
EphyEmbedShell
*
shell
;
EphyEmbedSingle
*
single
;
EphyFaviconCache
*
cache
;
shell
=
ephy_embed_shell_get_default
();
...
...
@@ -292,8 +290,7 @@ clear_all_dialog_response_cb (GtkDialog *dialog,
ephy_embed_single_clear_cache
(
single
);
cache
=
EPHY_FAVICON_CACHE
(
ephy_embed_shell_get_favicon_cache
(
shell
));
ephy_favicon_cache_clear
(
cache
);
webkit_favicon_database_clear
(
webkit_get_favicon_database
());
}
}
gtk_widget_destroy
(
GTK_WIDGET
(
dialog
));
...
...
src/prefs-dialog.c
View file @
6119b95c
...
...
@@ -31,7 +31,6 @@
#include
"ephy-embed-single.h"
#include
"ephy-embed-utils.h"
#include
"ephy-encodings.h"
#include
"ephy-favicon-cache.h"
#include
"ephy-file-chooser.h"
#include
"ephy-file-helpers.h"