[anjal] Add utils for getting icon/pixbufs/filenames of icons.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjal] Add utils for getting icon/pixbufs/filenames of icons.
- Date: Thu, 4 Jun 2009 00:07:38 -0400 (EDT)
commit 2aed9ab4372f3e5b65322b9ff33c32e9a59e446d
Author: Srinivasa Ragavan <sragavan novell com>
Date: Wed Jun 3 19:40:17 2009 +0530
Add utils for getting icon/pixbufs/filenames of icons.
---
src/mail-utils.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/mail-utils.h | 30 +++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/src/mail-utils.c b/src/mail-utils.c
new file mode 100644
index 0000000..ebcdb1b
--- /dev/null
+++ b/src/mail-utils.c
@@ -0,0 +1,58 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ * Srinivasa Ragavan <sragavan novell com>
+ *
+ * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include <mail-utils.h>
+
+static GtkIconTheme *theme = NULL;
+
+GdkPixbuf *
+mail_utils_get_icon (const char *icon, int icon_size)
+{
+ int width, height;
+
+ if(!theme)
+ theme = gtk_icon_theme_get_default ();
+
+ gtk_icon_size_lookup (icon_size, &width, &height);
+ return gtk_icon_theme_load_icon (theme, icon, width, GTK_ICON_LOOKUP_FORCE_SIZE|GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+}
+
+char *
+mail_utils_get_icon_path (const char *icon, int icon_size)
+{
+ int width, height;
+ GtkIconInfo *info;
+ char *file;
+
+ if(!theme)
+ theme = gtk_icon_theme_get_default ();
+
+ gtk_icon_size_lookup (icon_size, &width, &height);
+
+ info = gtk_icon_theme_lookup_icon (theme, icon, width, GTK_ICON_LOOKUP_FORCE_SIZE|GTK_ICON_LOOKUP_USE_BUILTIN);
+
+ file = g_strdup(gtk_icon_info_get_filename(info));
+ gtk_icon_info_free (info);
+
+ return file;
+}
+
diff --git a/src/mail-utils.h b/src/mail-utils.h
new file mode 100644
index 0000000..1e703e2
--- /dev/null
+++ b/src/mail-utils.h
@@ -0,0 +1,30 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ * Srinivasa Ragavan <sragavan novell com>
+ *
+ * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include <gtk/gtk.h>
+
+#ifndef MAIL_UTILS_H
+#define MAIL_UTILS_H
+
+GdkPixbuf * mail_utils_get_icon (const char *icon, int icon_size);
+char * mail_utils_get_icon_path (const char *icon, int icon_size);
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]