diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-05-16 21:14:43 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-05-16 21:14:43 +0800 |
commit | 68ef3f9f9873e2629f0953f0b5380fdce9a5dd05 (patch) | |
tree | 758b9eb3adb32cd548e5436397e238f259e8d5d4 | |
parent | 6b41e702201a040f3b2f9b8ef02ffdb4a846e981 (diff) | |
download | gsoc2013-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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | art/Makefile.am | 27 | ||||
-rw-r--r-- | shell/ChangeLog | 30 | ||||
-rw-r--r-- | shell/Makefile.am | 1 | ||||
-rw-r--r-- | shell/e-folder-type-repository.c | 29 | ||||
-rw-r--r-- | shell/e-folder-type-repository.h | 3 | ||||
-rw-r--r-- | shell/e-shell-constants.h | 36 | ||||
-rw-r--r-- | shell/e-shell-utils.c | 66 | ||||
-rw-r--r-- | shell/e-shell-utils.h | 3 | ||||
-rw-r--r-- | shell/e-shell-view.c | 2 | ||||
-rw-r--r-- | shell/e-shortcuts-view.c | 3 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 31 |
12 files changed, 196 insertions, 39 deletions
@@ -1,3 +1,7 @@ +2000-05-16 Ettore Perazzoli <ettore@helixcode.com> + + * art/Makefile.am: Install the mini icons. + 2000-05-16 Chris Toshok <toshok@helixcode.com> * configure.in: add --with-purify-options support, and default it diff --git a/art/Makefile.am b/art/Makefile.am index 931f54054a..25eaf379e8 100644 --- a/art/Makefile.am +++ b/art/Makefile.am @@ -1,17 +1,22 @@ imagesdir = $(datadir)/images/evolution images_DATA = \ - evolution-calendar.png \ - evolution-contacts.png \ - evolution-inbox.png \ - evolution-notes.png \ - evolution-tasks.png \ - evolution-today.png \ - briefcase.png \ - cellphone.png \ - globe.png \ - house.png \ - envelope.png \ + evolution-calendar.png \ + evolution-contacts.png \ + evolution-inbox.png \ + evolution-notes.png \ + evolution-tasks.png \ + evolution-calendar-mini.png \ + evolution-contacts-mini.png \ + evolution-inbox-mini.png \ + evolution-notes-mini.png \ + evolution-tasks-mini.png \ + evolution-today.png \ + briefcase.png \ + cellphone.png \ + globe.png \ + house.png \ + envelope.png \ malehead.png EXTRA_DIST = \ diff --git a/shell/ChangeLog b/shell/ChangeLog index d071167dc7..107ff4941d 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,35 @@ 2000-05-16 Ettore Perazzoli <ettore@helixcode.com> + * e-storage-set-view.c: Get rid of the `ICON_WIDTH' and + `ICON_HEIGHT' #defines. + (get_pixmap_and_mask_for_folder): Get the mini icon instead of the + big one. Use `E_SHELL_MINI_ICON_SIZE' instead of `ICON_WIDTH' and + `ICON_HEIGHT'. + + * e-folder-type-repository.c: New member `mini_icon_pixbuf' in + `FolderType'. + (folder_type_new): Initialize `mini_icon_pixbuf' by loading the + mini icon if possible. If the mini icon is not found, resort to + the big one. + (folder_type_free): Unref the mini icon. + (e_folder_type_repository_get_icon_for_type): New arg @mini. If + true, return the mini icon instead of the standard one. + + * e-shell-view.c (set_icon): Get the mini icon instead of the big + one by using `e_shell_get_icon_path's @try_mini arg. + + * e-shell-constants.h: New file. + + * e-shell-utils.c + (e_shell_get_icon_path): New arg @try_mini. If true, look for the + mini version [whose name ends in `-mini']. + + * e-folder-type-repository.c + (folder_type_new): Free string returned by + `e_shell_get_icon_path()'. + +2000-05-16 Ettore Perazzoli <ettore@helixcode.com> + * e-shell-view.c: New members `storage_set_view_box', `shortcut_bar_box', `hpaned1_position', `hpaned2_position' in `EShellViewPrivate'. diff --git a/shell/Makefile.am b/shell/Makefile.am index 73f44566cf..607d827396 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -33,6 +33,7 @@ evolution_SOURCES = \ e-local-storage.h \ e-setup.c \ e-setup.h \ + e-shell-constants.h \ e-shell-utils.c \ e-shell-utils.h \ e-shell-view-menu.c \ diff --git a/shell/e-folder-type-repository.c b/shell/e-folder-type-repository.c index c96ab5a5b6..3170f3173e 100644 --- a/shell/e-folder-type-repository.c +++ b/shell/e-folder-type-repository.c @@ -41,8 +41,11 @@ static GtkObjectClass *parent_class = NULL; struct _FolderType { char *name; char *icon_name; - GdkPixbuf *icon_pixbuf; char *control_id; + + /* The icon, standard (48x48) and mini (16x16) versions. */ + GdkPixbuf *icon_pixbuf; + GdkPixbuf *mini_icon_pixbuf; }; typedef struct _FolderType FolderType; @@ -80,12 +83,24 @@ folder_type_new (const char *name, new->icon_name = g_strdup (icon_name); new->control_id = g_strdup (control_id); - icon_path = e_shell_get_icon_path (icon_name); + icon_path = e_shell_get_icon_path (icon_name, FALSE); if (icon_path == NULL) new->icon_pixbuf = NULL; else new->icon_pixbuf = gdk_pixbuf_new_from_file (icon_path); + icon_path = e_shell_get_icon_path (icon_name, TRUE); + if (icon_path != NULL) { + new->mini_icon_pixbuf = gdk_pixbuf_new_from_file (icon_path); + } else { + if (new->icon_pixbuf != NULL) + new->mini_icon_pixbuf = gdk_pixbuf_ref (new->icon_pixbuf); + else + new->mini_icon_pixbuf = NULL; + } + + g_free (icon_path); + return new; } @@ -98,6 +113,8 @@ folder_type_free (FolderType *folder_type) if (folder_type->icon_pixbuf != NULL) gdk_pixbuf_unref (folder_type->icon_pixbuf); + if (folder_type->mini_icon_pixbuf != NULL) + gdk_pixbuf_unref (folder_type->mini_icon_pixbuf); g_free (folder_type); } @@ -241,7 +258,8 @@ e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_t GdkPixbuf * e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name) + const char *type_name, + gboolean mini) { const FolderType *folder_type; @@ -255,7 +273,10 @@ e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_r return NULL; } - return folder_type->icon_pixbuf; + if (mini) + return folder_type->mini_icon_pixbuf; + else + return folder_type->icon_pixbuf; } const char * diff --git a/shell/e-folder-type-repository.h b/shell/e-folder-type-repository.h index 0b2c53e1ce..fe2b06eaf6 100644 --- a/shell/e-folder-type-repository.h +++ b/shell/e-folder-type-repository.h @@ -63,7 +63,8 @@ void e_folder_type_repository_construct (EFolderTypeRepositor EFolderTypeRepository *e_folder_type_repository_new (void); GdkPixbuf *e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository, - const char *type_name); + const char *type_name, + gboolean mini); const char *e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_type_repository, const char *type_name); const char *e_folder_type_repository_get_control_id_for_type (EFolderTypeRepository *folder_type_repository, diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h new file mode 100644 index 0000000000..70986144d0 --- /dev/null +++ b/shell/e-shell-constants.h @@ -0,0 +1,36 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* e-shell-utils.h + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli + */ + +#ifndef E_SHELL_CONSTANTS_H +#define E_SHELL_CONSTANTS_H + +#define E_SHELL_URI_PREFIX "evolution:" +#define E_SHELL_URI_PREFIX_LEN 10 + +#define E_SHELL_MINI_ICON_SUFFIX "-mini" +#define E_SHELL_MINI_ICON_SUFFIX_LEN 5 + +#define E_SHELL_ICON_SIZE 48 +#define E_SHELL_MINI_ICON_SIZE 16 + +#endif 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); } diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h index 56f43b1b91..a701dd38eb 100644 --- a/shell/e-shell-utils.h +++ b/shell/e-shell-utils.h @@ -24,6 +24,7 @@ #ifndef E_SHELL_UTILS_H #define E_SHELL_UTILS_H -char *e_shell_get_icon_path (const char *icon_name); +char *e_shell_get_icon_path (const char *icon_name, + gboolean try_mini); #endif diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 20d5b89660..f3dd6d1a9d 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -452,7 +452,7 @@ set_icon (EShellView *shell_view, if (icon_name == NULL) icon_path = NULL; else - icon_path = e_shell_get_icon_path (icon_name); + icon_path = e_shell_get_icon_path (icon_name, TRUE); } if (icon_path == NULL) { diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index 86c386bf72..dd17326d8c 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -171,7 +171,8 @@ icon_callback (EShortcutBar *shortcut_bar, if (type == NULL) return NULL; - pixbuf = e_folder_type_repository_get_icon_for_type (folder_type_repository, type); + /* FIXME mini icons? */ + pixbuf = e_folder_type_repository_get_icon_for_type (folder_type_repository, type, FALSE); if (pixbuf != NULL) gdk_pixbuf_ref (pixbuf); diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index a63ab66e27..1e2a9a5807 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -28,6 +28,7 @@ #include <gnome.h> #include "e-util/e-util.h" +#include "e-shell-constants.h" #include "e-storage-set-view.h" @@ -69,10 +70,6 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -#define ICON_WIDTH 24 -#define ICON_HEIGHT 24 - - /* DND stuff. */ enum _DndTargetType { @@ -424,32 +421,36 @@ get_pixmap_and_mask_for_folder (EStorageSetView *storage_set_view, type_name = e_folder_get_type_string (folder); icon_pixbuf = e_folder_type_repository_get_icon_for_type (folder_type_repository, - type_name); + type_name, TRUE); scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf), gdk_pixbuf_get_has_alpha (icon_pixbuf), gdk_pixbuf_get_bits_per_sample (icon_pixbuf), - ICON_WIDTH, ICON_HEIGHT); + E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE); gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf, - 0, 0, ICON_WIDTH, ICON_HEIGHT, + 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, 0.0, 0.0, - (double) ICON_WIDTH / gdk_pixbuf_get_width (icon_pixbuf), - (double) ICON_HEIGHT / gdk_pixbuf_get_height (icon_pixbuf), + (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf), + (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf), GDK_INTERP_HYPER); visual = gdk_rgb_get_visual (); - *pixmap_return = gdk_pixmap_new (NULL, ICON_WIDTH, ICON_HEIGHT, visual->depth); + *pixmap_return = gdk_pixmap_new (NULL, + E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, + visual->depth); gc = gdk_gc_new (*pixmap_return); gdk_pixbuf_render_to_drawable (scaled_pixbuf, *pixmap_return, gc, 0, 0, 0, 0, - ICON_WIDTH, ICON_HEIGHT, + E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, GDK_RGB_DITHER_NORMAL, 0, 0); gdk_gc_unref (gc); - *mask_return = gdk_pixmap_new (NULL, ICON_WIDTH, ICON_HEIGHT, 1); - gdk_pixbuf_render_threshold_alpha (scaled_pixbuf, *mask_return, 0, 0, 0, 0, - ICON_WIDTH, ICON_HEIGHT, 0x7f); + *mask_return = gdk_pixmap_new (NULL, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, 1); + gdk_pixbuf_render_threshold_alpha (scaled_pixbuf, *mask_return, + 0, 0, 0, 0, + E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE, + 0x7f); gdk_pixbuf_unref (scaled_pixbuf); } @@ -556,7 +557,7 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, gtk_ctree_construct (ctree, 1, 0, NULL); gtk_ctree_set_line_style (ctree, GTK_CTREE_LINES_DOTTED); gtk_clist_set_selection_mode (GTK_CLIST (ctree), GTK_SELECTION_BROWSE); - gtk_clist_set_row_height (GTK_CLIST (ctree), ICON_HEIGHT); + gtk_clist_set_row_height (GTK_CLIST (ctree), E_SHELL_MINI_ICON_SIZE); priv = storage_set_view->priv; |