From 935122ff3e1e3bbfceaade8914e407ffaec5aaac Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Wed, 22 Aug 2012 18:41:34 +0300 Subject: ephy-embed-shell: set the default icon for the frecent store Add a helper method for this. --- embed/ephy-embed-shell.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'embed/ephy-embed-shell.c') diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index a87095f2c..c0e22a440 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -31,6 +31,7 @@ #include "ephy-file-helpers.h" #include "ephy-history-service.h" #include "ephy-print-utils.h" +#include "ephy-snapshot-service.h" #include #include @@ -177,6 +178,29 @@ ephy_embed_shell_get_global_history_service (EphyEmbedShell *shell) return G_OBJECT (shell->priv->global_history_service); } +static GdkPixbuf * +ephy_embed_shell_get_icon (const char *icon_name) +{ + GError *error = NULL; + GtkIconTheme *icon_theme; + GdkPixbuf *pixbuf; + + icon_theme = gtk_icon_theme_get_default (); + + pixbuf = gtk_icon_theme_load_icon (icon_theme, + icon_name, + EPHY_THUMBNAIL_WIDTH, + 0, + &error); + + if (!pixbuf) { + g_warning ("Couldn't load icon: %s", error->message); + g_error_free (error); + } + + return pixbuf; +} + /** * ephy_embed_shell_get_frecent_store: * @shell: a #EphyEmbedShell @@ -189,16 +213,21 @@ ephy_embed_shell_get_global_history_service (EphyEmbedShell *shell) EphyFrecentStore * ephy_embed_shell_get_frecent_store (EphyEmbedShell *shell) { + GdkPixbuf *default_icon; + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); if (shell->priv->frecent_store == NULL) { shell->priv->frecent_store = ephy_frecent_store_new (); + default_icon = ephy_embed_shell_get_icon ("text-html"); g_object_set (shell->priv->frecent_store, "history-service", ephy_embed_shell_get_global_history_service (shell), "history-length", 10, + "default-icon", default_icon, NULL); + g_object_unref (default_icon); } return shell->priv->frecent_store; -- cgit v1.2.3