[anjuta] document-manager: Fix icon size in document manager tabs
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] document-manager: Fix icon size in document manager tabs
- Date: Sun, 18 Aug 2013 19:29:28 +0000 (UTC)
commit 91ee1ae76574bd40f93f77cfca0d2050952148a0
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sun Aug 18 19:47:46 2013 +0200
document-manager: Fix icon size in document manager tabs
gtk_icon_theme_choose_icon and similar functions use a size in pixel and not
a constant from GtkIconSize like GTK_ICON_SIZE_MENU
plugins/document-manager/anjuta-docman.c | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/plugins/document-manager/anjuta-docman.c b/plugins/document-manager/anjuta-docman.c
index 1842421..8202ccb 100644
--- a/plugins/document-manager/anjuta-docman.c
+++ b/plugins/document-manager/anjuta-docman.c
@@ -678,10 +678,7 @@ static GdkPixbuf*
anjuta_docman_get_pixbuf_for_file (GFile* file)
{
/* add a nice mime-type icon if we can */
- const gchar** icon_names;
- GtkIconInfo* icon_info;
- GIcon* icon;
- GdkPixbuf* pixbuf;
+ GdkPixbuf* pixbuf = NULL;
GFileInfo* file_info;
GError* err = NULL;
@@ -697,22 +694,28 @@ anjuta_docman_get_pixbuf_for_file (GFile* file)
if (file_info != NULL)
{
+ GIcon* icon;
+ const gchar** icon_names;
+ gint width, height;
+ gint size = 0;
+ GtkIconInfo* icon_info;
+
icon = g_file_info_get_icon (file_info);
g_object_get (icon, "names", &icon_names, NULL);
+ if (gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height)) size = MIN(width, height);
icon_info = gtk_icon_theme_choose_icon (gtk_icon_theme_get_default(),
icon_names,
-
GTK_ICON_SIZE_MENU,
+ size,
GTK_ICON_LOOKUP_GENERIC_FALLBACK);
- pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
- gtk_icon_info_free(icon_info);
- g_object_unref (icon);
-
- if (pixbuf != NULL)
+ if (icon_info != NULL)
{
- return pixbuf;
+ pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
+ gtk_icon_info_free(icon_info);
}
+ g_object_unref (file_info);
}
- return NULL;
+
+ return pixbuf;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]