aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-utils.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-05-16 21:14:43 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-05-16 21:14:43 +0800
commit68ef3f9f9873e2629f0953f0b5380fdce9a5dd05 (patch)
tree758b9eb3adb32cd548e5436397e238f259e8d5d4 /shell/e-shell-utils.c
parent6b41e702201a040f3b2f9b8ef02ffdb4a846e981 (diff)
downloadgsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.tar
gsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.tar.gz
gsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.tar.bz2
gsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.tar.lz
gsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.tar.xz
gsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.tar.zst
gsoc2013-evolution-68ef3f9f9873e2629f0953f0b5380fdce9a5dd05.zip
Use TigerT's new mini icons in the shell's folder tree view.
svn path=/trunk/; revision=3091
Diffstat (limited to 'shell/e-shell-utils.c')
-rw-r--r--shell/e-shell-utils.c66
1 files changed, 61 insertions, 5 deletions
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index 746f985874..9065fc224c 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -27,16 +27,16 @@
#include <gnome.h>
+#include "e-shell-constants.h"
+
#include "e-shell-utils.h"
-char *
-e_shell_get_icon_path (const char *icon_name)
+static char *
+get_icon_path (const char *icon_name)
{
char *icon_path;
- g_return_val_if_fail (icon_name != NULL, NULL);
-
if (g_path_is_absolute (icon_name)) {
icon_path = g_strdup (icon_name);
} else {
@@ -47,5 +47,61 @@ e_shell_get_icon_path (const char *icon_name)
icon_name);
}
- return icon_path;
+ if (g_file_exists (icon_path)) {
+ return icon_path;
+ } else {
+ g_free (icon_path);
+ return NULL;
+ }
+}
+
+static char *
+get_mini_name (const char *icon_name)
+{
+ const char *dot_ptr;
+ const char *basename;
+ char *name_without_extension;
+ char *mini_name;
+
+ basename = g_basename (icon_name);
+ if (basename == NULL)
+ return NULL;
+
+ dot_ptr = strrchr (basename, '.');
+
+ if (dot_ptr == NULL) {
+ /* No extension. */
+ return g_strconcat (icon_name, E_SHELL_MINI_ICON_SUFFIX, NULL);
+ }
+
+ name_without_extension = g_strndup (icon_name, dot_ptr - icon_name);
+ mini_name = g_strconcat (name_without_extension, E_SHELL_MINI_ICON_SUFFIX,
+ dot_ptr, NULL);
+ g_free (name_without_extension);
+
+ return mini_name;
+}
+
+
+char *
+e_shell_get_icon_path (const char *icon_name,
+ gboolean try_mini)
+{
+ if (try_mini) {
+ char *path;
+ char *mini_name;
+
+ mini_name = get_mini_name (icon_name);
+ if (mini_name == NULL) {
+ path = NULL;
+ } else {
+ path = get_icon_path (mini_name);
+ g_free (mini_name);
+ }
+
+ if (path != NULL)
+ return path;
+ }
+
+ return get_icon_path (icon_name);
}