diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-08-22 23:41:34 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-09-01 02:34:00 +0800 |
commit | 935122ff3e1e3bbfceaade8914e407ffaec5aaac (patch) | |
tree | cce271ae7033af14e1fdb908227d3a0f78c36d17 | |
parent | 42f980437991a70c387ca5e81b97805dbfa2d85d (diff) | |
download | gsoc2013-epiphany-935122ff3e1e3bbfceaade8914e407ffaec5aaac.tar.gz gsoc2013-epiphany-935122ff3e1e3bbfceaade8914e407ffaec5aaac.tar.zst gsoc2013-epiphany-935122ff3e1e3bbfceaade8914e407ffaec5aaac.zip |
ephy-embed-shell: set the default icon for the frecent store
Add a helper method for this.
-rw-r--r-- | embed/ephy-embed-shell.c | 29 |
1 files changed, 29 insertions, 0 deletions
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 <glib.h> #include <glib/gi18n.h> @@ -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; |