[epiphany/overview: 28/28] ephy-overview: use a "text-html" as default icon
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/overview: 28/28] ephy-overview: use a "text-html" as default icon
- Date: Fri, 3 Aug 2012 09:46:14 +0000 (UTC)
commit 2e7eb74c09834c1c9ae4fc9cd3ba20f2118571b9
Author: Claudio Saavedra <csaavedra igalia com>
Date: Tue Jul 31 15:20:56 2012 +0200
ephy-overview: use a "text-html" as default icon
We probably need a nicer icon for this.
src/ephy-overview.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-overview.c b/src/ephy-overview.c
index b0409e4..65cadd7 100644
--- a/src/ephy-overview.c
+++ b/src/ephy-overview.c
@@ -44,6 +44,8 @@ struct _EphyOverviewPrivate
GtkWidget *bottom_view;
};
+#define EPHY_OVERVIEW_ICON_SIZE 175
+
G_DEFINE_TYPE (EphyOverview, ephy_overview, GTK_TYPE_GRID)
static void
@@ -116,6 +118,29 @@ main_view_item_activated (GtkWidget *widget,
}
}
+static GdkPixbuf *
+ephy_overview_get_icon (const gchar *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_OVERVIEW_ICON_SIZE,
+ 0,
+ &error);
+
+ if (!pixbuf) {
+ g_warning ("Couldn't load icon: %s", error->message);
+ g_error_free (error);
+ }
+
+ return pixbuf;
+}
+
static void
ephy_overview_constructed (GObject *object)
{
@@ -123,11 +148,13 @@ ephy_overview_constructed (GObject *object)
EphyOverviewStore *store;
EphyNotebook *notebook;
EphyOverview *self = EPHY_OVERVIEW (object);
+ GdkPixbuf *default_icon;
if (G_OBJECT_CLASS (ephy_overview_parent_class)->constructed)
G_OBJECT_CLASS (ephy_overview_parent_class)->constructed (object);
service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (EPHY_EMBED_SHELL (ephy_shell)));
+ default_icon = ephy_overview_get_icon ("text-html");
self->priv->upper_view = GTK_WIDGET (gd_main_view_new (GD_MAIN_VIEW_ICON));
g_signal_connect (self->priv->upper_view, "item-activated",
@@ -135,6 +162,7 @@ ephy_overview_constructed (GObject *object)
store = EPHY_OVERVIEW_STORE (ephy_frecent_store_new ());
g_object_set (G_OBJECT (store),
"history-service", service,
+ "default-icon", default_icon,
NULL);
gd_main_view_set_model (GD_MAIN_VIEW (self->priv->upper_view),
GTK_TREE_MODEL (store));
@@ -151,6 +179,7 @@ ephy_overview_constructed (GObject *object)
store = EPHY_OVERVIEW_STORE (ephy_active_store_new (notebook));
g_object_set (G_OBJECT (store),
"history-service", service,
+ "default-icon", default_icon,
NULL);
gd_main_view_set_model (GD_MAIN_VIEW (self->priv->bottom_view),
GTK_TREE_MODEL (store));
@@ -158,6 +187,7 @@ ephy_overview_constructed (GObject *object)
0, 1, 1, 1);
gtk_widget_show_all (GTK_WIDGET (self));
+ g_object_unref (default_icon);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]