aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-05-14 09:32:19 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-05-14 09:32:19 +0800
commit7198aa064a8fc90389087c6704149e19bee51a43 (patch)
tree585f055ab291bf5e21626ceb32ed740a44e65d0b
parent8dea04ca5e0bef9db235e7f2e44a23b61be24e0f (diff)
downloadgsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.tar
gsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.tar.gz
gsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.tar.bz2
gsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.tar.lz
gsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.tar.xz
gsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.tar.zst
gsoc2013-evolution-7198aa064a8fc90389087c6704149e19bee51a43.zip
Initial implementation of the tree view for the folders.
svn path=/trunk/; revision=3020
-rw-r--r--shell/ChangeLog55
-rw-r--r--shell/Makefile.am4
-rw-r--r--shell/e-folder-type-repository.c30
-rw-r--r--shell/e-folder-type-repository.h5
-rw-r--r--shell/e-shell-view.c269
-rw-r--r--shell/e-shell.c11
-rw-r--r--shell/e-shortcuts.c25
-rw-r--r--shell/e-storage-set.c40
-rw-r--r--shell/e-storage-set.h35
9 files changed, 339 insertions, 135 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index bd45ae7c06..21c34978b1 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,58 @@
+2000-05-14 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shell.c
+ (setup_storages): Pass the pointer to the folder type repository.
+ (e_shell_construct): Initialize the folder type repository before
+ everything else.
+
+ * e-storage-set.c: New member `folder_type_repository' in
+ `EStorageSetPrivate'.
+ (init): Initialize it to NULL.
+ (destroy): Unref it.
+ (e_storage_set_construct): New arg @folder_type_repository.
+ Initialize the corresponding member in the private struct through
+ it.
+ (e_storage_set_new): New arg @folder_type_repository.
+ (e_storage_set_get_folder_type_repository): New function.
+
+ * e-shortcuts.c (icon_callback): Just use [the new version of]
+ `e_folder_type_repository_get_icon_for_type()' instead of loading
+ the image manually.
+
+ * e-folder-type-repository.c: New member `icon_pixbuf' in
+ `FolderType'.
+ (folder_type_new): Load the pixbuf.
+ (folder_type_free): Unref the pixbuf.
+ (e_folder_type_repository_get_icon_name_for_type): Renamed from
+ `e_folder_type_repository_get_icon_for_type'.
+ (e_folder_type_repository_get_icon_for_type): New function, now
+ returning a `GdkPixbuf *'.
+
+ * e-shortcuts.c
+ (icon_callback): Use `e_shell_get_icon_name()'.
+
+ * e-shell-view.c: New member `storage_set_view' in
+ `EShellViewPrivate'.
+ (init): Initialize it to NULL.
+ (e_shell_view_construct): Create an EStorageSetView for the
+ shell's EStorageSet and put it into a scrolled window. Also, put
+ the scrolled window into the EShellView with some
+ [temporary] GtkPaned action. Store the pointer to the
+ EStorageSetView to `priv->storage_set_view'.
+ (set_icon): Get an EShellView and an EFolder instead of an
+ EShellView and a URI. Also, don't leak.
+ (update_for_current_uir): New helper function. Call `set_icon'.
+ (show_error): Call it.
+ (folder_selected_cb): New function.
+ (setup_widgets): Connect it to the "folder_selected" signal of the
+ storage set view.
+
+ * e-storage-set-view.c: New file.
+ * e-storage-set-view.h: New file.
+
+ * e-shell-utils.c: New file.
+ * e-shell-utils.h: New file.
+
2000-05-10 Christopher James Lahey <clahey@helixcode.com>
* e-shell-view-menu.c: Added an about box.
diff --git a/shell/Makefile.am b/shell/Makefile.am
index f49b4a72e5..7049e66751 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -32,6 +32,8 @@ evolution_SOURCES = \
e-local-storage.h \
e-setup.c \
e-setup.h \
+ e-shell-utils.c \
+ e-shell-utils.h \
e-shell-view-menu.c \
e-shell-view-menu.h \
e-shell-view.c \
@@ -42,6 +44,8 @@ evolution_SOURCES = \
e-shortcuts-view.h \
e-shortcuts.c \
e-shortcuts.h \
+ e-storage-set-view.c \
+ e-storage-set-view.h \
e-storage-set.c \
e-storage-set.h \
e-storage-watcher.c \
diff --git a/shell/e-folder-type-repository.c b/shell/e-folder-type-repository.c
index 748918886c..d53c0d95d7 100644
--- a/shell/e-folder-type-repository.c
+++ b/shell/e-folder-type-repository.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-folder-type-repository.c
*
-
* Copyright (C) 2000 Helix Code, Inc.
*
* This program is free software; you can redistribute it and/or
@@ -31,6 +30,8 @@
#include "e-util/e-util.h"
+#include "e-shell-utils.h"
+
#include "e-folder-type-repository.h"
@@ -40,6 +41,7 @@ static GtkObjectClass *parent_class = NULL;
struct _FolderType {
char *name;
char *icon_name;
+ GdkPixbuf *icon_pixbuf;
char *control_id;
};
typedef struct _FolderType FolderType;
@@ -70,6 +72,7 @@ folder_type_new (const char *name,
const char *control_id)
{
FolderType *new;
+ char *icon_path;
new = g_new (FolderType, 1);
@@ -77,6 +80,12 @@ 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);
+ if (icon_path == NULL)
+ new->icon_pixbuf = NULL;
+ else
+ new->icon_pixbuf = gdk_pixbuf_new_from_file (icon_path);
+
return new;
}
@@ -87,6 +96,9 @@ folder_type_free (FolderType *folder_type)
g_free (folder_type->icon_name);
g_free (folder_type->control_id);
+ if (folder_type->icon_pixbuf != NULL)
+ gdk_pixbuf_unref (folder_type->icon_pixbuf);
+
g_free (folder_type);
}
@@ -209,6 +221,20 @@ e_folder_type_repository_new (void)
const char *
+e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_type_repository,
+ const char *type_name)
+{
+ const FolderType *folder_type;
+
+ g_return_val_if_fail (folder_type_repository != NULL, NULL);
+ g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL);
+ g_return_val_if_fail (type_name != NULL, NULL);
+
+ folder_type = get_folder_type (folder_type_repository, type_name);
+ return folder_type->icon_name;
+}
+
+GdkPixbuf *
e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository,
const char *type_name)
{
@@ -219,7 +245,7 @@ e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_r
g_return_val_if_fail (type_name != NULL, NULL);
folder_type = get_folder_type (folder_type_repository, type_name);
- return folder_type->icon_name;
+ return folder_type->icon_pixbuf;
}
const char *
diff --git a/shell/e-folder-type-repository.h b/shell/e-folder-type-repository.h
index cdc72e3540..0b2c53e1ce 100644
--- a/shell/e-folder-type-repository.h
+++ b/shell/e-folder-type-repository.h
@@ -29,6 +29,7 @@
#endif
#include <gtk/gtkobject.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#ifdef __cplusplus
extern "C" {
@@ -61,7 +62,9 @@ GtkType e_folder_type_repository_get_type (void);
void e_folder_type_repository_construct (EFolderTypeRepository *folder_type_repository);
EFolderTypeRepository *e_folder_type_repository_new (void);
-const char *e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository,
+GdkPixbuf *e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository,
+ const char *type_name);
+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,
const char *type_name);
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index b5d77ed5c4..ff72d940b8 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -32,15 +32,16 @@
#include <bonobo.h>
#include <libgnomeui/gnome-window-icon.h>
+#include "e-shell-utils.h"
#include "e-shell.h"
#include "e-shortcuts-view.h"
+#include "e-storage-set-view.h"
#include "e-util/e-util.h"
#include "e-shell-view.h"
#include "e-shell-view-menu.h"
-
#define PARENT_TYPE gnome_app_get_type () /* Losing GnomeApp does not define GNOME_TYPE_APP. */
static GnomeAppClass *parent_class = NULL;
@@ -57,6 +58,7 @@ struct _EShellViewPrivate {
/* The widgetry. */
GtkWidget *hpaned;
GtkWidget *shortcut_bar;
+ GtkWidget *storage_set_view;
GtkWidget *contents;
GtkWidget *notebook;
@@ -64,7 +66,12 @@ struct _EShellViewPrivate {
GHashTable *uri_to_control;
};
+/* FIXME this should probably go somewhere else. */
+#define EVOLUTION_URI_PREFIX "evolution:"
+#define EVOLUTION_URI_PREFIX_LEN 10
+
#define DEFAULT_SHORTCUT_BAR_WIDTH 100
+#define DEFAULT_TREE_WIDTH 100
#define DEFAULT_WIDTH 600
#define DEFAULT_HEIGHT 600
@@ -117,6 +124,7 @@ bonobo_widget_is_dead (BonoboWidget *bw)
}
+/* Callback called when an icon on the shortcut bar gets clicked. */
static void
activate_shortcut_cb (EShortcutsView *shortcut_view,
EShortcuts *shortcuts,
@@ -130,39 +138,85 @@ activate_shortcut_cb (EShortcutsView *shortcut_view,
e_shell_view_display_uri (shell_view, uri);
}
+/* Callback called when a folder on the tree view gets clicked. */
+static void
+folder_selected_cb (EStorageSetView *storage_set_view,
+ const char *path,
+ gpointer data)
+{
+ EShellView *shell_view;
+ char *uri;
+
+ shell_view = E_SHELL_VIEW (data);
+
+ uri = g_strconcat (EVOLUTION_URI_PREFIX, path, NULL);
+ e_shell_view_display_uri (shell_view, uri);
+ g_free (uri);
+}
+
+
static void
setup_widgets (EShellView *shell_view)
{
EShellViewPrivate *priv;
+ GtkWidget *storage_set_view_scrolled_window;
+ GtkWidget *left_paned;
priv = shell_view->priv;
- priv->hpaned = gtk_hpaned_new ();
- gnome_app_set_contents (GNOME_APP (shell_view), priv->hpaned);
-
/* The shortcut bar. */
priv->shortcut_bar = e_shortcuts_new_view (e_shell_get_shortcuts (priv->shell));
- gtk_paned_add1 (GTK_PANED (priv->hpaned), priv->shortcut_bar);
- gtk_paned_set_position (GTK_PANED (priv->hpaned), DEFAULT_SHORTCUT_BAR_WIDTH);
gtk_signal_connect (GTK_OBJECT (priv->shortcut_bar), "activate_shortcut",
GTK_SIGNAL_FUNC (activate_shortcut_cb), shell_view);
+ /* The storage set view. */
+
+ priv->storage_set_view = e_storage_set_view_new (e_shell_get_storage_set (priv->shell));
+ gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "folder_selected",
+ GTK_SIGNAL_FUNC (folder_selected_cb), shell_view);
+
+ storage_set_view_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (storage_set_view_scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ gtk_container_add (GTK_CONTAINER (storage_set_view_scrolled_window),
+ priv->storage_set_view);
+
+ left_paned = gtk_hpaned_new ();
+ gtk_paned_set_position (GTK_PANED (left_paned), DEFAULT_SHORTCUT_BAR_WIDTH);
+ gtk_paned_add1 (GTK_PANED (left_paned), priv->shortcut_bar);
+ gtk_paned_add2 (GTK_PANED (left_paned), storage_set_view_scrolled_window);
+
/* The tabless notebook which we used to contain the views. */
priv->notebook = gtk_notebook_new ();
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_paned_add2 (GTK_PANED (priv->hpaned), priv->notebook);
/* Page for "No URL displayed" message. */
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), create_label_for_empty_page (), NULL);
+ /* Put things into a paned and the paned into the GnomeApp. */
+
+ priv->hpaned = gtk_hpaned_new ();
+ gtk_paned_set_position (GTK_PANED (priv->hpaned), DEFAULT_SHORTCUT_BAR_WIDTH + DEFAULT_TREE_WIDTH);
+
+ gtk_paned_add1 (GTK_PANED (priv->hpaned), left_paned);
+ gtk_paned_add2 (GTK_PANED (priv->hpaned), priv->notebook);
+
+ gnome_app_set_contents (GNOME_APP (shell_view), priv->hpaned);
+
/* Show stuff. */
gtk_widget_show (priv->shortcut_bar);
gtk_widget_show (priv->notebook);
+ gtk_widget_show (priv->hpaned);
+ gtk_widget_show (priv->storage_set_view);
+
+ gtk_widget_show (storage_set_view_scrolled_window);
+ gtk_widget_show (left_paned);
/* FIXME: Session management and stuff? */
gtk_window_set_default_size (GTK_WINDOW (shell_view), DEFAULT_WIDTH, DEFAULT_HEIGHT);
@@ -232,13 +286,14 @@ init (EShellView *shell_view)
priv = g_new (EShellViewPrivate, 1);
- priv->shell = NULL;
- priv->uih = NULL;
- priv->uri = NULL;
- priv->hpaned = NULL;
- priv->shortcut_bar = NULL;
- priv->contents = NULL;
- priv->notebook = NULL;
+ priv->shell = NULL;
+ priv->uih = NULL;
+ priv->uri = NULL;
+ priv->hpaned = NULL;
+ priv->shortcut_bar = NULL;
+ priv->storage_set_view = NULL;
+ priv->contents = NULL;
+ priv->notebook = NULL;
priv->uri_to_control = g_hash_table_new (g_str_hash, g_str_equal);
@@ -283,9 +338,103 @@ e_shell_view_new (EShell *shell)
}
-/* This displays the specified page, doing the appropriate Bonobo
- activation/deactivation magic to make sure things work nicely.
- FIXME: Crappy way to solve the issue. */
+static const char *
+get_storage_set_path_from_uri (const char *uri)
+{
+ const char *colon;
+
+ if (g_path_is_absolute (uri))
+ return NULL;
+
+ colon = strchr (uri, ':');
+ if (colon == NULL || colon == uri || colon[1] == '\0')
+ return NULL;
+
+ if (! g_path_is_absolute (colon + 1))
+ return NULL;
+
+ if (g_strncasecmp (uri, EVOLUTION_URI_PREFIX, colon - uri) != 0)
+ return NULL;
+
+ return colon + 1;
+}
+
+static void
+set_icon (EShellView *shell_view,
+ EFolder *folder)
+{
+ EShellViewPrivate *priv;
+ const char *type;
+ const char *icon_name;
+ char *icon_path;
+
+ priv = shell_view->priv;
+
+ type = e_folder_get_type_string (folder);
+ if (type == NULL) {
+ icon_path = NULL;
+ } else {
+ EFolderTypeRepository *folder_type_repository;
+
+ folder_type_repository = e_shell_get_folder_type_repository (priv->shell);
+ icon_name = e_folder_type_repository_get_icon_name_for_type (folder_type_repository,
+ type);
+ if (icon_name == NULL)
+ icon_path = NULL;
+ else
+ icon_path = e_shell_get_icon_path (icon_name);
+ }
+
+ if (icon_path == NULL) {
+ gnome_window_icon_set_from_default (GTK_WINDOW (shell_view));
+ } else {
+ gnome_window_icon_set_from_file (GTK_WINDOW (shell_view), icon_path);
+ g_free (icon_path);
+ }
+}
+
+static void
+update_for_current_uri (EShellView *shell_view)
+{
+ EShellViewPrivate *priv;
+ EFolder *folder;
+ const char *folder_name;
+ const char *path;
+ char *window_title;
+
+ priv = shell_view->priv;
+
+ path = get_storage_set_path_from_uri (priv->uri);
+
+ if (path == NULL)
+ folder = NULL;
+ else
+ folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell),
+ path);
+
+ if (folder == NULL)
+ folder_name = _("None");
+ else
+ folder_name = e_folder_get_name (folder);
+
+ window_title = g_strdup_printf (_("Evolution - %s"), folder_name);
+ gtk_window_set_title (GTK_WINDOW (shell_view), window_title);
+ g_free (window_title);
+
+ set_icon (shell_view, folder);
+
+ gtk_signal_handler_block_by_func (GTK_OBJECT (priv->storage_set_view),
+ GTK_SIGNAL_FUNC (folder_selected_cb),
+ shell_view);
+ e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view),
+ path);
+ gtk_signal_handler_unblock_by_func (GTK_OBJECT (priv->storage_set_view),
+ GTK_SIGNAL_FUNC (folder_selected_cb),
+ shell_view);
+}
+
+/* This displays the specified page, doing the appropriate Bonobo activation/deactivation
+ magic to make sure things work nicely. FIXME: Crappy way to solve the issue. */
static void
set_current_notebook_page (EShellView *shell_view,
int page_num)
@@ -398,72 +547,6 @@ get_control_for_uri (EShellView *shell_view,
return control;
}
-static const char *
-get_storage_set_path_from_uri (const char *uri)
-{
- const char *colon;
-
- if (g_path_is_absolute (uri))
- return NULL;
-
- colon = strchr (uri, ':');
- if (colon == NULL || colon == uri || colon[1] == '\0')
- return NULL;
-
- if (! g_path_is_absolute (colon + 1))
- return NULL;
-
- if (g_strncasecmp (uri, "evolution", colon - uri) != 0)
- return NULL;
-
- return colon + 1;
-}
-
-static void
-set_icon (EShellView *shell_view,
- const char *uri)
-{
- EShellViewPrivate *priv;
- EStorageSet *storage_set;
- EFolderTypeRepository *folder_type_repository;
- EFolder *folder;
- const char *type;
- const char *icon_name;
- char *icon_path;
-
- priv = shell_view->priv;
-
- storage_set = e_shell_get_storage_set (priv->shell);
- folder_type_repository = e_shell_get_folder_type_repository (priv->shell);
-
- folder = e_storage_set_get_folder (storage_set,
- get_storage_set_path_from_uri (uri));
-
- if (folder == NULL)
- return;
-
- type = e_folder_get_type_string (folder);
- if (type == NULL)
- return;
-
- icon_name = e_folder_type_repository_get_icon_for_type (folder_type_repository, type);
- if (icon_name == NULL)
- return;
-
- if (g_path_is_absolute (icon_name))
- icon_path = g_strdup (icon_name);
- else {
- icon_path = gnome_pixmap_file (icon_name);
- if (icon_path == NULL)
- icon_path = g_concat_dir_and_file (EVOLUTION_IMAGES, icon_name);
- }
-
- if (icon_path == NULL)
- return;
-
- gnome_window_icon_set_from_file (GTK_WINDOW(shell_view), icon_path);
-}
-
static gboolean
show_existing_view (EShellView *shell_view,
const char *uri,
@@ -503,7 +586,6 @@ show_existing_view (EShellView *shell_view,
}
set_current_notebook_page (shell_view, notebook_page);
- set_icon(shell_view, uri);
return TRUE;
}
@@ -531,7 +613,6 @@ create_new_view_for_uri (EShellView *shell_view,
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control);
g_assert (page_num != -1);
set_current_notebook_page (shell_view, page_num);
- set_icon(shell_view, uri);
g_hash_table_insert (priv->uri_to_control, g_strdup (uri), control);
@@ -544,6 +625,7 @@ e_shell_view_display_uri (EShellView *shell_view,
{
EShellViewPrivate *priv;
GtkWidget *control;
+ gboolean retval;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
@@ -562,13 +644,14 @@ e_shell_view_display_uri (EShellView *shell_view,
priv->uri = NULL;
}
- return TRUE;
+ retval = TRUE;
+ goto end;
}
g_free (priv->uri);
priv->uri = g_strdup (uri);
- if (strncmp (uri, "evolution:", 10) != 0) {
+ if (strncmp (uri, EVOLUTION_URI_PREFIX, EVOLUTION_URI_PREFIX_LEN) != 0) {
show_error (shell_view, uri);
return FALSE;
}
@@ -577,15 +660,21 @@ e_shell_view_display_uri (EShellView *shell_view,
if (control != NULL) {
g_assert (GTK_IS_WIDGET (control));
show_existing_view (shell_view, uri, control);
- return TRUE;
+ retval = TRUE;
+ goto end;
}
if (! create_new_view_for_uri (shell_view, uri)) {
show_error (shell_view, uri);
- return FALSE;
+ retval = FALSE;
+ goto end;
}
- return TRUE;
+ retval = TRUE;
+
+ end:
+ update_for_current_uri (shell_view);
+ return retval;
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index fd61108a5f..a0851af27a 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -77,16 +77,16 @@ setup_storages (EShell *shell)
local_storage_path = g_concat_dir_and_file (priv->local_directory,
LOCAL_STORAGE_DIRECTORY);
local_storage = e_local_storage_open (local_storage_path);
-
if (local_storage == NULL) {
g_warning (_("Cannot set up local storage -- %s"), local_storage_path);
g_free (local_storage_path);
return FALSE;
}
-
g_free (local_storage_path);
- priv->storage_set = e_storage_set_new ();
+ g_assert (shell->priv->folder_type_repository);
+
+ priv->storage_set = e_storage_set_new (shell->priv->folder_type_repository);
e_storage_set_add_storage (priv->storage_set, local_storage);
return TRUE;
@@ -207,11 +207,12 @@ e_shell_construct (EShell *shell,
priv->local_directory = g_strdup (local_directory);
+ priv->folder_type_repository = e_folder_type_repository_new ();
+
if (! setup_storages (shell))
return;
- priv->folder_type_repository = e_folder_type_repository_new ();
- priv->shortcuts = e_shortcuts_new (priv->storage_set, priv->folder_type_repository);
+ priv->shortcuts = e_shortcuts_new (priv->storage_set, priv->folder_type_repository);
shortcut_path = g_concat_dir_and_file (local_directory, "shortcuts.xml");
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index da8326f9a6..dcc9383638 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -311,8 +311,6 @@ icon_callback (EShortcutBar *shortcut_bar,
EFolder *folder;
GdkPixbuf *pixbuf;
const char *type;
- const char *icon_name;
- char *icon_path;
shortcuts = E_SHORTCUTS (data);
@@ -329,26 +327,9 @@ icon_callback (EShortcutBar *shortcut_bar,
if (type == NULL)
return NULL;
- icon_name = e_folder_type_repository_get_icon_for_type (folder_type_repository, type);
- if (icon_name == NULL)
- return NULL;
-
- if (g_path_is_absolute (icon_name))
- icon_path = g_strdup (icon_name);
- else {
- icon_path = gnome_pixmap_file (icon_name);
- if (icon_path == NULL)
- icon_path = g_concat_dir_and_file (EVOLUTION_IMAGES, icon_name);
- }
-
- if (icon_path == NULL)
- return NULL;
-
- /* FIXME this sucks sucks sucks sucks. We need some caching. Probably
- it's better if EFolderTypeRepository returns a GdkPixbuf directly. */
- pixbuf = gdk_pixbuf_new_from_file (icon_path);
-
- g_free (icon_path);
+ pixbuf = e_folder_type_repository_get_icon_for_type (folder_type_repository, type);
+ if (pixbuf != NULL)
+ gdk_pixbuf_ref (pixbuf);
return pixbuf;
}
diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c
index df1096695d..6fcb4c24ba 100644
--- a/shell/e-storage-set.c
+++ b/shell/e-storage-set.c
@@ -33,6 +33,7 @@
#include "e-util/e-util.h"
+#include "e-storage-set-view.h"
#include "e-storage-set.h"
@@ -50,6 +51,8 @@ static guint signals[LAST_SIGNAL] = { 0 };
struct _EStorageSetPrivate {
GList *storages;
+
+ EFolderTypeRepository *folder_type_repository;
};
@@ -66,6 +69,8 @@ destroy (GtkObject *object)
e_free_object_list (priv->storages);
+ gtk_object_unref (GTK_OBJECT (priv->folder_type_repository));
+
g_free (priv);
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -111,28 +116,33 @@ init (EStorageSet *storage_set)
priv = g_new (EStorageSetPrivate, 1);
priv->storages = NULL;
+ priv->folder_type_repository = NULL;
storage_set->priv = priv;
}
void
-e_storage_set_construct (EStorageSet *storage_set)
+e_storage_set_construct (EStorageSet *storage_set,
+ EFolderTypeRepository *folder_type_repository)
{
g_return_if_fail (storage_set != NULL);
g_return_if_fail (E_IS_STORAGE_SET (storage_set));
GTK_OBJECT_UNSET_FLAGS (storage_set, GTK_FLOATING);
+
+ gtk_object_ref (GTK_OBJECT (folder_type_repository));
+ storage_set->priv->folder_type_repository = folder_type_repository;
}
EStorageSet *
-e_storage_set_new (void)
+e_storage_set_new (EFolderTypeRepository *folder_type_repository)
{
EStorageSet *new;
new = gtk_type_new (e_storage_set_get_type ());
- e_storage_set_construct (new);
+ e_storage_set_construct (new, folder_type_repository);
return new;
}
@@ -263,4 +273,28 @@ e_storage_set_get_folder (EStorageSet *storage_set,
}
+GtkWidget *
+e_storage_set_new_view (EStorageSet *storage_set)
+{
+ GtkWidget *storage_set_view;
+
+ g_return_val_if_fail (storage_set != NULL, NULL);
+ g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
+
+ storage_set_view = e_storage_set_view_new (storage_set);
+
+ return storage_set_view;
+}
+
+
+EFolderTypeRepository *
+e_storage_set_get_folder_type_repository (EStorageSet *storage_set)
+{
+ g_return_val_if_fail (storage_set != NULL, NULL);
+ g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
+
+ return storage_set->priv->folder_type_repository;
+}
+
+
E_MAKE_TYPE (e_storage_set, "EStorageSet", EStorageSet, class_init, init, PARENT_TYPE)
diff --git a/shell/e-storage-set.h b/shell/e-storage-set.h
index 1131a7e0f7..fddf0f0ce9 100644
--- a/shell/e-storage-set.h
+++ b/shell/e-storage-set.h
@@ -28,6 +28,8 @@
#include <config.h>
#endif
+#include "e-folder-type-repository.h"
+
#include "e-storage.h"
#ifdef __cplusplus
@@ -67,18 +69,27 @@ struct _EStorageSetClass {
};
-GtkType e_storage_set_get_type (void);
-void e_storage_set_construct (EStorageSet *storage_set);
-EStorageSet *e_storage_set_new (void);
-
-GList *e_storage_set_get_storage_list (EStorageSet *storage_set);
-EStorage *e_storage_set_get_storage (EStorageSet *storage_set, const char *name);
-
-void e_storage_set_add_storage (EStorageSet *storage_set, EStorage *storage);
-void e_storage_set_remove_storage (EStorageSet *storage_set, EStorage *storage);
-
-EStorage *e_storage_get_storage (EStorageSet *storage_set, const char *storage_name);
-EFolder *e_storage_set_get_folder (EStorageSet *storage_set, const char *path);
+GtkType e_storage_set_get_type (void);
+void e_storage_set_construct (EStorageSet *storage_set,
+ EFolderTypeRepository *folder_type_repository);
+EStorageSet *e_storage_set_new (EFolderTypeRepository *folder_type_repository);
+
+GList *e_storage_set_get_storage_list (EStorageSet *storage_set);
+EStorage *e_storage_set_get_storage (EStorageSet *storage_set,
+ const char *name);
+void e_storage_set_add_storage (EStorageSet *storage_set,
+ EStorage *storage);
+void e_storage_set_remove_storage (EStorageSet *storage_set,
+ EStorage *storage);
+
+EStorage *e_storage_set_get_storage (EStorageSet *storage_set,
+ const char *storage_name);
+EFolder *e_storage_set_get_folder (EStorageSet *storage_set,
+ const char *path);
+
+GtkWidget *e_storage_set_new_view (EStorageSet *storage_set);
+
+EFolderTypeRepository *e_storage_set_get_folder_type_repository (EStorageSet *storage_set);
#ifdef __cplusplus
}