aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog29
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shell-view.c83
-rw-r--r--shell/e-shell.c9
-rw-r--r--shell/e-shortcuts-view.c20
-rw-r--r--shell/e-storage-set-view.c30
-rw-r--r--shell/e-summary-storage.c125
-rw-r--r--shell/e-summary-storage.h66
8 files changed, 285 insertions, 79 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 1a739f4030..1921bd4695 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,34 @@
2001-08-03 Ettore Perazzoli <ettore@ximian.com>
+ * e-storage-set-view.c (storage_sort_callback): Put the storage
+ named E_SUMMARY_STORAGE_NAME on top.
+
+ * e-shell.c: New member `summary_storage' in `EShellPrivate'.
+ (init): Init to NULL.
+ (destroy): Unref if not NULL.
+
+ * e-summary-storage.c: New.
+ * e-summary-storage.h: New.
+
+ * e-storage-set-view.c: New #define `ROOT_NODE_NAME', defined to
+ be "/RootNode".
+ (e_storage_set_view_set_show_folders): Use that instead of "My
+ Evolution".
+ (e_storage_set_view_construct): Hide the root node. Use
+ `ROOT_NODE_NAME' instead of "My Evolution".
+
+ * e-shortcuts-view.c (icon_callback): No bad special hack for "My
+ Evolution" here.
+
+ * e-shell-view.c (update_window_icon): Remove kludgey
+ @is_my_evolution arg and stop doing special "My Evolution" things.
+ (update_folder_title_bar): Likewise.
+ (update_for_current_uri): Don't do special "My Evolution" things
+ here either.
+ (get_control_for_uri): Don't do the "My Evolution" hack here.
+
+2001-08-03 Ettore Perazzoli <ettore@ximian.com>
+
* e-storage-set-view.c (tree_drag_data_received): Call
`gtk_drag_finish()' here.
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 9ec35f1c48..474d11210b 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -147,6 +147,8 @@ evolution_SOURCES = \
e-storage-set.h \
e-storage.c \
e-storage.h \
+ e-summary-storage.c \
+ e-summary-storage.h \
e-task-bar.c \
e-task-bar.h \
e-task-widget.c \
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 5e2c2cbf1b..809e9c1cbd 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1281,8 +1281,7 @@ get_storage_set_path_from_uri (const char *uri)
static void
update_window_icon (EShellView *shell_view,
- EFolder *folder,
- gboolean is_my_evolution)
+ EFolder *folder)
{
EShellViewPrivate *priv;
const char *type;
@@ -1291,15 +1290,10 @@ update_window_icon (EShellView *shell_view,
priv = shell_view->priv;
- if (folder == NULL) {
- if (is_my_evolution) {
- type = "My Evolution";
- } else {
+ if (folder == NULL)
type = NULL;
- }
- } else {
+ else
type = e_folder_get_type_string (folder);
- }
if (type == NULL) {
icon_path = NULL;
@@ -1324,8 +1318,7 @@ update_window_icon (EShellView *shell_view,
static void
update_folder_title_bar (EShellView *shell_view,
- EFolder *folder,
- gboolean is_my_evolution)
+ EFolder *folder)
{
EShellViewPrivate *priv;
EFolderTypeRegistry *folder_type_registry;
@@ -1335,15 +1328,10 @@ update_folder_title_bar (EShellView *shell_view,
priv = shell_view->priv;
- if (folder == NULL) {
- if (is_my_evolution) {
- folder_type_name = "My Evolution";
- } else {
- folder_type_name = NULL;
- }
- } else {
+ if (folder == NULL)
+ folder_type_name = NULL;
+ else
folder_type_name = e_folder_get_type_string (folder);
- }
if (folder_type_name == NULL) {
folder_name = NULL;
@@ -1353,11 +1341,8 @@ update_folder_title_bar (EShellView *shell_view,
folder_icon = e_folder_type_registry_get_icon_for_type (folder_type_registry,
folder_type_name,
TRUE);
- if (is_my_evolution) {
- folder_name = "My Evolution";
- } else {
- folder_name = e_folder_get_name (folder);
- }
+
+ folder_name = e_folder_get_name (folder);
}
if (folder_icon)
@@ -1378,7 +1363,6 @@ update_for_current_uri (EShellView *shell_view)
char *folder_name;
const char *path;
char *window_title;
- gboolean is_my_evolution = FALSE;
priv = shell_view->priv;
@@ -1391,23 +1375,16 @@ update_for_current_uri (EShellView *shell_view)
path = get_storage_set_path_from_uri (priv->uri);
- if (priv->uri != NULL && strcmp (priv->uri, "evolution:/My Evolution") == 0) {
- /* Special case for My Evolution */
- folder_name = g_strdup (_("My Evolution"));
- is_my_evolution = TRUE;
+ if (path == NULL)
folder = NULL;
- } else {
- if (path == NULL)
- folder = NULL;
- else
- folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell),
- path);
+ else
+ folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell),
+ path);
- if (folder == NULL)
- folder_name = g_strdup (_("None"));
- else
- folder_name = e_utf8_to_gtk_string ((GtkWidget *) shell_view, e_folder_get_name (folder));
- }
+ if (folder == NULL)
+ folder_name = g_strdup (_("None"));
+ else
+ folder_name = e_utf8_to_gtk_string ((GtkWidget *) shell_view, e_folder_get_name (folder));
if (SUB_VERSION[0] == '\0')
window_title = g_strdup_printf (_("%s - Evolution %s"), folder_name, VERSION);
@@ -1418,9 +1395,9 @@ update_for_current_uri (EShellView *shell_view)
g_free (window_title);
g_free (folder_name);
- update_folder_title_bar (shell_view, folder, is_my_evolution);
+ update_folder_title_bar (shell_view, folder);
- update_window_icon (shell_view, folder, is_my_evolution);
+ update_window_icon (shell_view, folder);
gtk_signal_handler_block_by_func (GTK_OBJECT (priv->storage_set_view),
GTK_SIGNAL_FUNC (folder_selected_cb),
@@ -1711,21 +1688,15 @@ get_control_for_uri (EShellView *shell_view,
if (*path == '\0')
return NULL;
- /* Hack for My Evolution */
- if (strcmp (path, "/My Evolution") == 0) {
- folder_type = "My Evolution";
- physical_uri = "";
- } else {
- /* FIXME: This code needs to be made more robust. */
+ /* FIXME: This code needs to be made more robust. */
- slash = strchr (path + 1, G_DIR_SEPARATOR);
- if (slash == NULL || slash[1] == '\0')
- folder_type = get_type_for_storage (shell_view, path + 1, &physical_uri);
- else
- folder_type = get_type_for_folder (shell_view, path, &physical_uri);
- if (folder_type == NULL)
- return NULL;
- }
+ slash = strchr (path + 1, G_DIR_SEPARATOR);
+ if (slash == NULL || slash[1] == '\0')
+ folder_type = get_type_for_storage (shell_view, path + 1, &physical_uri);
+ else
+ folder_type = get_type_for_folder (shell_view, path, &physical_uri);
+ if (folder_type == NULL)
+ return NULL;
folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view));
diff --git a/shell/e-shell.c b/shell/e-shell.c
index a27c3cb42b..94db128307 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -52,6 +52,7 @@
#include "e-shortcuts.h"
#include "e-storage-set.h"
#include "e-splash.h"
+#include "e-summary-storage.h"
#include "e-uri-schema-registry.h"
#include "evolution-storage-set-view-factory.h"
@@ -74,6 +75,7 @@ struct _EShellPrivate {
EStorageSet *storage_set;
ELocalStorage *local_storage;
+ ESummaryStorage *summary_storage;
EShortcuts *shortcuts;
EFolderTypeRegistry *folder_type_registry;
@@ -452,6 +454,9 @@ setup_local_storage (EShell *shell)
e_storage_set_add_storage (priv->storage_set, local_storage);
priv->local_storage = E_LOCAL_STORAGE (local_storage);
+ priv->summary_storage = E_SUMMARY_STORAGE (e_summary_storage_new ());
+ e_storage_set_add_storage (priv->storage_set, priv->summary_storage);
+
return TRUE;
}
@@ -646,6 +651,9 @@ destroy (GtkObject *object)
if (priv->local_storage != NULL)
gtk_object_unref (GTK_OBJECT (priv->local_storage));
+ if (priv->summary_storage != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->summary_storage));
+
if (priv->shortcuts != NULL)
gtk_object_unref (GTK_OBJECT (priv->shortcuts));
@@ -749,6 +757,7 @@ init (EShell *shell)
priv->local_directory = NULL;
priv->storage_set = NULL;
priv->local_storage = NULL;
+ priv->summary_storage = NULL;
priv->shortcuts = NULL;
priv->component_registry = NULL;
priv->folder_type_registry = NULL;
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c
index 6cae3293ab..ecc2b1487e 100644
--- a/shell/e-shortcuts-view.c
+++ b/shell/e-shortcuts-view.c
@@ -104,19 +104,15 @@ icon_callback (EShortcutBar *shortcut_bar,
storage_set = e_shortcuts_get_storage_set (shortcuts);
folder_type_registry = e_storage_set_get_folder_type_registry (storage_set);
- if (strcmp ("evolution:/My Evolution", uri) == 0) {
- type = "My Evolution";
- } else {
- folder = e_storage_set_get_folder (storage_set,
- get_storage_set_path_from_uri (uri));
-
- if (folder == NULL)
- return NULL;
+ folder = e_storage_set_get_folder (storage_set,
+ get_storage_set_path_from_uri (uri));
+
+ if (folder == NULL)
+ return NULL;
- type = e_folder_get_type_string (folder);
- if (type == NULL)
- return NULL;
- }
+ type = e_folder_get_type_string (folder);
+ if (type == NULL)
+ return NULL;
/* FIXME mini icons? */
pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, type, FALSE);
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 063aadac36..1322cb60ef 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -43,13 +43,17 @@
#include "e-shell-constants.h"
#include "e-local-storage.h"
+#include "e-summary-storage.h"
+
/*#define DEBUG_XML*/
#define DRAG_RESISTANCE 3 /* FIXME hardcoded in ETable to this value as
* well, and there is no way for us to use the
* same value as it's not exported. */
+#define ROOT_NODE_NAME "/RootNode"
+
/* This is used on the source side to define the two basic types that we always
export. */
@@ -139,6 +143,14 @@ storage_sort_callback (ETreeMemory *etmm,
folder_path1 = e_tree_memory_node_get_data(etmm, node1);
folder_path2 = e_tree_memory_node_get_data(etmm, node2);
+
+ /* FIXME bad hack to put the "my evolution" and "local" storages on
+ top. */
+
+ if (strcmp (folder_path1, G_DIR_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0)
+ return -1;
+ if (strcmp (folder_path2, G_DIR_SEPARATOR_S E_SUMMARY_STORAGE_NAME) == 0)
+ return +1;
path1_local = ! strcmp (folder_path1, G_DIR_SEPARATOR_S E_LOCAL_STORAGE_NAME);
path2_local = ! strcmp (folder_path2, G_DIR_SEPARATOR_S E_LOCAL_STORAGE_NAME);
@@ -1526,9 +1538,7 @@ new_storage_cb (EStorageSet *storage_set,
path = g_strconcat (G_DIR_SEPARATOR_S, e_storage_get_name (storage), NULL);
- node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model),
- priv->root_node,
- -1, path);
+ node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node, -1, path);
e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model), priv->root_node, storage_sort_callback, storage_set_view);
if (! add_node_to_hash (storage_set_view, path, node)) {
@@ -1848,8 +1858,7 @@ insert_storages (EStorageSetView *storage_set_view)
name = e_storage_get_name (storage);
path = g_strconcat ("/", name, NULL);
- parent = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node,
- -1, path);
+ parent = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), priv->root_node, -1, path);
e_tree_memory_sort_node (E_TREE_MEMORY(priv->etree_model),
priv->root_node,
storage_sort_callback, storage_set_view);
@@ -1905,10 +1914,8 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
e_tree_memory_set_node_destroy_func (E_TREE_MEMORY (priv->etree_model), (GFunc) g_free, NULL);
e_tree_memory_set_expanded_default (E_TREE_MEMORY (priv->etree_model), TRUE);
- priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model),
- NULL, -1,
- g_strdup ("/My Evolution"));
- add_node_to_hash (storage_set_view, "/My Evolution", priv->root_node);
+ priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1,
+ g_strdup (ROOT_NODE_NAME));
extras = e_table_extras_new ();
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1919,7 +1926,7 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
e_tree_construct_from_spec_file (E_TREE (storage_set_view), priv->etree_model, extras,
EVOLUTION_ETSPECDIR "/e-storage-set-view.etspec", NULL);
- e_tree_root_node_set_visible (E_TREE(storage_set_view), TRUE);
+ e_tree_root_node_set_visible (E_TREE(storage_set_view), FALSE);
gtk_object_unref (GTK_OBJECT (extras));
@@ -2030,7 +2037,8 @@ e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view,
e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node);
/* now re-add the root node */
- priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1, g_strdup ("/My Evolution"));
+ priv->root_node = e_tree_memory_node_insert (E_TREE_MEMORY(priv->etree_model), NULL, -1,
+ g_strdup (ROOT_NODE_NAME));
/* then reinsert the storages after setting the "show_folders"
flag. insert_storages will call insert_folders if
diff --git a/shell/e-summary-storage.c b/shell/e-summary-storage.c
new file mode 100644
index 0000000000..5d18fa3b36
--- /dev/null
+++ b/shell/e-summary-storage.c
@@ -0,0 +1,125 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-summary-storage.c
+ *
+ * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-summary-storage.h"
+
+#include "e-folder.h"
+
+#include <gal/util/e-util.h>
+
+#include <gtk/gtktypeutils.h>
+
+#include <libgnome/gnome-i18n.h>
+
+
+#define PARENT_TYPE e_storage_get_type ()
+static EStorageClass *parent_class = NULL;
+
+
+/* GtkObject methods. */
+
+static void
+impl_destroy (GtkObject *object)
+{
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+/* EStorage methods. */
+
+static GList *
+impl_get_subfolder_paths (EStorage *storage,
+ const char *path)
+{
+ /* We never have any child folders. */
+ return NULL;
+}
+
+static EFolder *
+impl_get_folder (EStorage *storage,
+ const char *path)
+{
+ return NULL;
+}
+
+static const char *
+impl_get_name (EStorage *storage)
+{
+ return E_SUMMARY_STORAGE_NAME;
+}
+
+static const char *
+impl_get_display_name (EStorage *storage)
+{
+ return _("My Evolution");
+}
+
+
+static void
+class_init (GtkObjectClass *object_class)
+{
+ EStorageClass *storage_class;
+
+ object_class->destroy = impl_destroy;
+
+ storage_class = E_STORAGE_CLASS (object_class);
+ storage_class->get_subfolder_paths = impl_get_subfolder_paths;
+ storage_class->get_folder = impl_get_folder;
+ storage_class->get_name = impl_get_name;
+ storage_class->get_display_name = impl_get_display_name;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+}
+
+static void
+init (ESummaryStorage *summary_storage)
+{
+ /* No members. */
+}
+
+
+/**
+ * e_summary_storage_new:
+ *
+ * Create a new summary storage.
+ *
+ * Return value: The newly created ESummaryStorage object.
+ **/
+EStorage *
+e_summary_storage_new (void)
+{
+ EStorage *storage;
+
+ storage = gtk_type_new (e_summary_storage_get_type ());
+
+ e_storage_construct (storage, "/", "My Evolution");
+
+ return storage;
+}
+
+
+E_MAKE_TYPE (e_summary_storage, "ESummaryStorage", ESummaryStorage, class_init, init, PARENT_TYPE)
diff --git a/shell/e-summary-storage.h b/shell/e-summary-storage.h
new file mode 100644
index 0000000000..bdbd81bd5d
--- /dev/null
+++ b/shell/e-summary-storage.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-summary-storage.h
+ *
+ * Copyright (C) 2001 Ximian, 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 <ettore@ximian.com>
+ */
+
+#ifndef _E_SUMMARY_STORAGE_H_
+#define _E_SUMMARY_STORAGE_H_
+
+#include "e-storage.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define E_TYPE_SUMMARY_STORAGE (e_summary_storage_get_type ())
+#define E_SUMMARY_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SUMMARY_STORAGE, ESummaryStorage))
+#define E_SUMMARY_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SUMMARY_STORAGE, ESummaryStorageClass))
+#define E_IS_SUMMARY_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SUMMARY_STORAGE))
+#define E_IS_SUMMARY_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SUMMARY_STORAGE))
+
+
+#define E_SUMMARY_STORAGE_NAME "summary"
+
+
+typedef struct _ESummaryStorage ESummaryStorage;
+typedef struct _ESummaryStoragePrivate ESummaryStoragePrivate;
+typedef struct _ESummaryStorageClass ESummaryStorageClass;
+
+struct _ESummaryStorage {
+ EStorage parent;
+
+ ESummaryStoragePrivate *priv;
+};
+
+struct _ESummaryStorageClass {
+ EStorageClass parent_class;
+};
+
+
+GtkType e_summary_storage_get_type (void);
+EStorage *e_summary_storage_new (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_SUMMARY_STORAGE_H_ */