From 7e4f187a1034cc352278f0fa5c3ca0321dbda4cc Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 31 Mar 2000 18:34:59 +0000 Subject: Update for shortcut bar changes. * shell/e-shortcut.c (e_shortcut_bar_view_new, shell_icon_cb): Update for shortcut bar changes. * shell/e-folder.h: add E_FOLDER_SUMMARY * shell/e-shell.c (e_shell_setup_default_folders): make the "Today" icon be of type E_FOLDER_SUMMARY, not E_FOLDER_MAIL. svn path=/trunk/; revision=2269 --- ChangeLog | 9 +++++++++ shell/e-folder.h | 1 + shell/e-shell.c | 2 +- shell/e-shortcut.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8dd591db2..436f0eff69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2000-03-31 Dan Winship + + * shell/e-shortcut.c (e_shortcut_bar_view_new, shell_icon_cb): + Update for shortcut bar changes. + + * shell/e-folder.h: add E_FOLDER_SUMMARY + * shell/e-shell.c (e_shell_setup_default_folders): make the + "Today" icon be of type E_FOLDER_SUMMARY, not E_FOLDER_MAIL. + 2000-03-31 Damon Chaplin * widgets/shortcut-bar/e-shortcut-bar.[hc]: added support for a diff --git a/shell/e-folder.h b/shell/e-folder.h index f631191013..147399268b 100644 --- a/shell/e-folder.h +++ b/shell/e-folder.h @@ -23,6 +23,7 @@ typedef enum { } EFolderDragDropAction; typedef enum { + E_FOLDER_SUMMARY, E_FOLDER_MAIL, E_FOLDER_CONTACTS, E_FOLDER_CALENDAR, diff --git a/shell/e-shell.c b/shell/e-shell.c index f706723f37..2713df3921 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -254,7 +254,7 @@ static void e_shell_setup_default_folders (EShell *eshell) { eshell->default_folders.summary = e_folder_new ( - E_FOLDER_MAIL, "internal:summary", _("Today"), _("Executive Summary"), + E_FOLDER_SUMMARY, "internal:summary", _("Today"), _("Executive Summary"), NULL, "internal:"); eshell->default_folders.inbox = e_folder_new ( E_FOLDER_MAIL, "internal:inbox", _("Inbox"), _("New mail messages"), diff --git a/shell/e-shortcut.c b/shell/e-shortcut.c index 767f9e4067..5386efb182 100644 --- a/shell/e-shortcut.c +++ b/shell/e-shortcut.c @@ -298,8 +298,12 @@ populate_group (EShortcutBarModel *bm, EShortcutGroup *esg, EShortcutBar *shortc char *type = NULL; switch (folder->type){ + case E_FOLDER_SUMMARY: + type = "summary:"; + break; + case E_FOLDER_MAIL: - type = "folder:"; + type = "mail:"; break; case E_FOLDER_CONTACTS: @@ -342,12 +346,51 @@ populate_from_model (EShortcutBarModel *bm, EShortcutBar *shortcut_bar) } +static struct { + char *prefix, *path; + GdkPixbuf *image; +} shell_icons[] = { + { "summary:", "evolution/evolution-today.png", NULL }, + { "mail:", "evolution/evolution-inbox.png", NULL }, + { "calendar:", "evolution/evolution-calendar.png", NULL }, + { "contacts:", "evolution/evolution-contacts.png", NULL }, + { "notes:", "evolution/evolution-notes.png", NULL }, + { "todo:", "evolution/evolution-tasks.png", NULL } +}; +#define NSHELL_ICONS (sizeof (shell_icons) / sizeof (shell_icons[0])) + +static GdkPixbuf * +shell_icon_cb (EShortcutBar *shortcut_bar, gchar *url) +{ + int i; + + for (i = 0; i < NSHELL_ICONS; i++) { + if (!strncmp (shell_icons[i].prefix, url, + strlen (shell_icons[i].prefix))) { + if (!shell_icons[i].image) { + char *pixmap_path; + + pixmap_path = gnome_pixmap_file (shell_icons[i].path); + if (pixmap_path) + shell_icons[i].image = gdk_pixbuf_new_from_file (pixmap_path); + else { + g_warning ("Couldn't find pixmap: %s", + pixmap_path); + } + } + return shell_icons[i].image; + } + } + + return NULL; +} + static void view_destroyed (EShortcutBar *shortcut_bar, EShortcutBarModel *bm) { bm->views = g_slist_remove (bm->views, shortcut_bar); } - + GtkWidget * e_shortcut_bar_view_new (EShortcutBarModel *bm) { @@ -357,6 +400,8 @@ e_shortcut_bar_view_new (EShortcutBarModel *bm) gtk_widget_push_colormap (gdk_rgb_get_cmap ()); shortcut_bar = e_shortcut_bar_new (); + e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcut_bar), + shell_icon_cb); gtk_widget_pop_visual (); gtk_widget_pop_colormap (); -- cgit v1.2.3