From 3bc843ceb5bd66288077a4f8db1b6cdb7123f298 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 6 Mar 2002 23:36:27 +0000 Subject: Keep the storage name and display_name in EStoragePriv. (impl_get_name, * e-storage.c: Keep the storage name and display_name in EStoragePriv. (impl_get_name, impl_get_display_name): Return them. (e_storage_construct): Set them here. (e_storage_new): And here. * e-local-storage.c: (impl_get_name, impl_get_display_name): Removed. (construct): Pass E_LOCAL_STORAGE_NAME and U_("Local Folders") to e_storage_construct. * e-corba-storage.c: Remove priv->name. (get_name, get_display_name): Removed. (e_corba_storage_construct): Pass name to e_storage_construct(). * e-summary-storage.[ch]: Gone. This didn't override anything in EStorage but get_name/get_display_name, and the defaults for those DTRT now. * e-shell-constants.h: Move E_SUMMARY_STORAGE_NAME here from e-summary-storage.h, and move E_LOCAL_STORAGE_NAME too for consistency. * e-storage-set-view.c: Fix up #includes. * e-shell-importer.c: Likewise * e-shell.c: Likewise. Create summary_storage as a plain EStorage since ESummaryStorage is gone now. * Makefile.am (evolution_SOURCES): Remove e-summary-storage.[ch] svn path=/trunk/; revision=15955 --- shell/ChangeLog | 34 ++++++++++++ shell/Makefile.am | 2 - shell/e-corba-storage.c | 38 ++------------ shell/e-local-storage.c | 22 ++------ shell/e-local-storage.h | 3 -- shell/e-shell-constants.h | 3 ++ shell/e-shell-importer.c | 2 +- shell/e-shell.c | 10 ++-- shell/e-storage-set-view.c | 2 - shell/e-storage.c | 23 +++++++-- shell/e-storage.h | 6 ++- shell/e-summary-storage.c | 126 --------------------------------------------- shell/e-summary-storage.h | 65 ----------------------- 13 files changed, 75 insertions(+), 261 deletions(-) delete mode 100644 shell/e-summary-storage.c delete mode 100644 shell/e-summary-storage.h diff --git a/shell/ChangeLog b/shell/ChangeLog index e5f5f5983f..fd976a604c 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,37 @@ +2002-03-06 Dan Winship + + * e-storage.c: Keep the storage name and display_name in + EStoragePriv. + (impl_get_name, impl_get_display_name): Return them. + (e_storage_construct): Set them here. + (e_storage_new): And here. + + * e-local-storage.c: (impl_get_name, impl_get_display_name): + Removed. + (construct): Pass E_LOCAL_STORAGE_NAME and U_("Local Folders") to + e_storage_construct. + + * e-corba-storage.c: Remove priv->name. + (get_name, get_display_name): Removed. + (e_corba_storage_construct): Pass name to e_storage_construct(). + + * e-summary-storage.[ch]: Gone. This didn't override anything in + EStorage but get_name/get_display_name, and the defaults for those + DTRT now. + + * e-shell-constants.h: Move E_SUMMARY_STORAGE_NAME here from + e-summary-storage.h, and move E_LOCAL_STORAGE_NAME too for + consistency. + + * e-storage-set-view.c: Fix up #includes. + + * e-shell-importer.c: Likewise + + * e-shell.c: Likewise. Create summary_storage as a plain EStorage + since ESummaryStorage is gone now. + + * Makefile.am (evolution_SOURCES): Remove e-summary-storage.[ch] + 2002-03-06 Dan Winship * e-corba-storage-registry.c diff --git a/shell/Makefile.am b/shell/Makefile.am index b884150927..35cea451f8 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -160,8 +160,6 @@ 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-corba-storage.c b/shell/e-corba-storage.c index 1aa1c67674..9601d1d89d 100644 --- a/shell/e-corba-storage.c +++ b/shell/e-corba-storage.c @@ -39,8 +39,6 @@ static EStorageClass *parent_class = NULL; typedef struct _StorageListenerServant StorageListenerServant; struct _ECorbaStoragePrivate { - char *name; - GNOME_Evolution_Storage storage_interface; /* The Evolution::StorageListener interface we expose. */ @@ -217,8 +215,6 @@ destroy (GtkObject *object) corba_storage = E_CORBA_STORAGE (object); priv = corba_storage->priv; - g_free (priv->name); - CORBA_exception_init (&ev); if (priv->storage_interface != CORBA_OBJECT_NIL) { @@ -250,31 +246,6 @@ destroy (GtkObject *object) /* EStorage methods. */ -static const char * -get_name (EStorage *storage) -{ - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - - corba_storage = E_CORBA_STORAGE (storage); - priv = corba_storage->priv; - - return priv->name; -} -static const char * -get_display_name (EStorage *storage) -{ - ECorbaStorage *corba_storage; - ECorbaStoragePrivate *priv; - - corba_storage = E_CORBA_STORAGE (storage); - priv = corba_storage->priv; - - /* FIXME: Abstract a display_name, return it. Necessary - changes to the IDL and EvolutionStorage required. */ - return priv->name; -} - struct async_folder_closure { EStorageResultCallback callback; EStorage *storage; @@ -495,8 +466,6 @@ class_init (ECorbaStorageClass *klass) object_class->destroy = destroy; storage_class = E_STORAGE_CLASS (klass); - storage_class->get_name = get_name; - storage_class->get_display_name = get_display_name; storage_class->async_create_folder = async_create_folder; storage_class->async_remove_folder = async_remove_folder; storage_class->async_xfer_folder = async_xfer_folder; @@ -512,7 +481,6 @@ init (ECorbaStorage *corba_storage) ECorbaStoragePrivate *priv; priv = g_new (ECorbaStoragePrivate, 1); - priv->name = NULL; priv->storage_interface = CORBA_OBJECT_NIL; corba_storage->priv = priv; @@ -535,12 +503,12 @@ e_corba_storage_construct (ECorbaStorage *corba_storage, g_return_if_fail (storage_interface != CORBA_OBJECT_NIL); g_return_if_fail (name != NULL); - e_storage_construct (E_STORAGE (corba_storage), toplevel_node_uri, toplevel_node_type); + /* FIXME: Need separate name and display name. */ + e_storage_construct (E_STORAGE (corba_storage), name, name, + toplevel_node_uri, toplevel_node_type); priv = corba_storage->priv; - priv->name = g_strdup (name); - CORBA_exception_init (&ev); Bonobo_Unknown_ref (storage_interface, &ev); diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 97a26b5634..95175106ac 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -50,6 +50,7 @@ #include #include "e-util/e-path.h" #include "e-local-folder.h" +#include "e-shell-constants.h" #include "evolution-storage.h" @@ -621,21 +622,6 @@ impl_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } - -/* EStorage methods. */ - -static const char * -impl_get_name (EStorage *storage) -{ - return E_LOCAL_STORAGE_NAME; -} - -static const char * -impl_get_display_name (EStorage *storage) -{ - return U_("Local Folders"); -} - /* Creating folders. */ @@ -1004,8 +990,6 @@ class_init (ELocalStorageClass *class) object_class->destroy = impl_destroy; - storage_class->get_name = impl_get_name; - storage_class->get_display_name = impl_get_display_name; storage_class->async_create_folder = impl_async_create_folder; storage_class->async_remove_folder = impl_async_remove_folder; storage_class->async_xfer_folder = impl_async_xfer_folder; @@ -1034,7 +1018,9 @@ construct (ELocalStorage *local_storage, ELocalStoragePrivate *priv; int base_path_len; - e_storage_construct (E_STORAGE (local_storage), NULL, NULL); + e_storage_construct (E_STORAGE (local_storage), + E_LOCAL_STORAGE_NAME, U_("Local Folders"), + NULL, NULL); priv = local_storage->priv; diff --git a/shell/e-local-storage.h b/shell/e-local-storage.h index 555d1ff812..c640c29b70 100644 --- a/shell/e-local-storage.h +++ b/shell/e-local-storage.h @@ -51,9 +51,6 @@ struct _ELocalStorageClass { EStorageClass parent_class; }; - -#define E_LOCAL_STORAGE_NAME "local" - GtkType e_local_storage_get_type (void); diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h index 00635161d0..ce21d5db8e 100644 --- a/shell/e-shell-constants.h +++ b/shell/e-shell-constants.h @@ -32,4 +32,7 @@ #define E_SHELL_ICON_SIZE 48 #define E_SHELL_MINI_ICON_SIZE 16 +#define E_LOCAL_STORAGE_NAME "local" +#define E_SUMMARY_STORAGE_NAME "summary" + #endif diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index c6e2bac359..54012965ab 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -46,7 +46,7 @@ #include "e-shell.h" #include "e-shell-view.h" -#include "e-local-storage.h" /* for E_LOCAL_STORAGE_NAME */ +#include "e-shell-constants.h" #include "e-shell-folder-selection-dialog.h" #include "importer/evolution-importer-client.h" diff --git a/shell/e-shell.c b/shell/e-shell.c index a22d255784..8b137adc68 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -45,6 +45,7 @@ #include #include +#include #include "Evolution.h" @@ -64,7 +65,6 @@ #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" @@ -87,7 +87,7 @@ struct _EShellPrivate { EStorageSet *storage_set; ELocalStorage *local_storage; - ESummaryStorage *summary_storage; + EStorage *summary_storage; EShortcuts *shortcuts; EFolderTypeRegistry *folder_type_registry; @@ -657,8 +657,10 @@ 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, E_STORAGE (priv->summary_storage)); + priv->summary_storage = e_storage_new (E_SUMMARY_STORAGE_NAME, + U_("Summary"), + "/", "summary"); + e_storage_set_add_storage (priv->storage_set, priv->summary_storage); return TRUE; } diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 370cb7753e..68845aadd5 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -43,8 +43,6 @@ #include "e-util/e-gtk-utils.h" #include "e-shell-constants.h" -#include "e-local-storage.h" -#include "e-summary-storage.h" /*#define DEBUG_XML*/ diff --git a/shell/e-storage.c b/shell/e-storage.c index f49cddcf39..7b55145d6e 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -50,6 +50,12 @@ struct _EStoragePrivate { /* The set of folders we have in this storage. */ EFolderTree *folder_tree; + /* Internal name of the storage */ + char *name; + + /* User-visible localized UTF-8 name */ + char *display_name; + /* URI for the toplevel node. */ char *toplevel_node_uri; @@ -141,6 +147,8 @@ destroy (GtkObject *object) if (priv->folder_tree != NULL) e_folder_tree_destroy (priv->folder_tree); + g_free (priv->name); + g_free (priv->display_name); g_free (priv->toplevel_node_uri); g_free (priv->toplevel_node_type); @@ -178,13 +186,13 @@ impl_get_folder (EStorage *storage, static const char * impl_get_name (EStorage *storage) { - return _("(No name)"); + return storage->priv->name; } static const char * impl_get_display_name (EStorage *storage) { - return _("(No name)"); + return storage->priv->display_name; } static void @@ -286,6 +294,8 @@ init (EStorage *storage) void e_storage_construct (EStorage *storage, + const char *name, + const char *display_name, const char *toplevel_node_uri, const char *toplevel_node_type) { @@ -296,6 +306,8 @@ e_storage_construct (EStorage *storage, priv = storage->priv; + priv->name = g_strdup (name); + priv->display_name = g_strdup (display_name); priv->toplevel_node_uri = g_strdup (toplevel_node_uri); priv->toplevel_node_type = g_strdup (toplevel_node_type); @@ -303,14 +315,17 @@ e_storage_construct (EStorage *storage, } EStorage * -e_storage_new (const char *toplevel_node_uri, +e_storage_new (const char *name, + const char *display_name, + const char *toplevel_node_uri, const char *toplevel_node_type) { EStorage *new; new = gtk_type_new (e_storage_get_type ()); - e_storage_construct (new, toplevel_node_uri, toplevel_node_type); + e_storage_construct (new, name, display_name, + toplevel_node_uri, toplevel_node_type); return new; } diff --git a/shell/e-storage.h b/shell/e-storage.h index ae74f242a6..9a64732503 100644 --- a/shell/e-storage.h +++ b/shell/e-storage.h @@ -111,9 +111,13 @@ struct _EStorageClass { GtkType e_storage_get_type (void); void e_storage_construct (EStorage *storage, + const char *name, + const char *display_name, const char *toplevel_node_uri, const char *toplevel_node_type); -EStorage *e_storage_new (const char *toplevel_node_uri, +EStorage *e_storage_new (const char *name, + const char *display_name, + const char *toplevel_node_uri, const char *toplevel_node_type); gboolean e_storage_path_is_relative (const char *path); diff --git a/shell/e-summary-storage.c b/shell/e-summary-storage.c deleted file mode 100644 index 19266fa419..0000000000 --- a/shell/e-summary-storage.c +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- 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 version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-summary-storage.h" - -#include "e-folder.h" - -#include - -#include - -#include - -#include - - -#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 U_("Summary"); -} - - -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, "/", "summary"); - - 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 deleted file mode 100644 index 4d5aab7641..0000000000 --- a/shell/e-summary-storage.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- 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 version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_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_ */ -- cgit v1.2.3