From dbc4e091133eee525a8b7c0fd449dcca6a5c719f Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 6 Nov 2000 22:03:24 +0000 Subject: First draft of folder tree unread message indication for /local mail folders. * mail-local.c: Add a new CamelStore subclass, MailLocalStore, which attaches to an Evolution_LocalStorage on one side and CamelSession on the other, and keeps track of local folders. Some of this code was previously in mail-local-storage.c, which no longer exists. (local_reconfigure_folder, etc): Various mail_op-related cleanups, and wrap d() around a bunch of printfs. * mail-tools.c (mail_tool_get_local_inbox_url, mail_tool_get_local_movemail_url): Removed (mail_tool_get_local_inbox): Simplified. (mail_tool_do_movemail): Remove unused dest_url variable. (mail_tool_uri_to_folder): Simplify. Now down to two cases (vfolder, and everything else). * component-factory.c (owner_set_cb): Pass evolution_dir to mail_local_storage_startup. * Makefile.am (evolution_mail_SOURCES): Remove mail-local-storage.[ch] svn path=/trunk/; revision=6456 --- mail/mail-local-storage.c | 188 ---------------------------------------------- 1 file changed, 188 deletions(-) delete mode 100644 mail/mail-local-storage.c (limited to 'mail/mail-local-storage.c') diff --git a/mail/mail-local-storage.c b/mail/mail-local-storage.c deleted file mode 100644 index ea343c41b0..0000000000 --- a/mail/mail-local-storage.c +++ /dev/null @@ -1,188 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-local-storage.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 - */ - -/* This handles the interfacing with the shell's local storage. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "e-folder-tree.h" -#include "evolution-storage-listener.h" - -#include "mail-local-storage.h" - - -/* Static stuff. Sigh, it sucks, but it fits in the way the whole mail - compnent is written. */ - -/* The interface to the local storage. */ -static Evolution_LocalStorage corba_local_storage = CORBA_OBJECT_NIL; - -/* The listener on our side. We get notified of things happening in the local - storage through this. */ -static EvolutionStorageListener *local_storage_listener = NULL; - -/* The folder set. The folder data is an Evolution_Folder, allocated through - CORBA normally. */ -static EFolderTree *folder_tree = NULL; - - -/* Folder destroy notification function for the `folder_tree'. */ - -static void -folder_tree_folder_notify_cb (EFolderTree *tree, - const char *path, - void *data, - void *closure) -{ - Evolution_Folder *corba_folder; - - corba_folder = (Evolution_Folder *) data; - CORBA_free (corba_folder); -} - - -/* Callbacks for the EvolutionStorageListner signals. */ - -static void -local_storage_destroyed_cb (EvolutionStorageListener *storage_listener, - void *data) -{ - /* FIXME: Dunno how to handle this yet. */ - g_warning ("%s -- The LocalStorage has gone?!", __FILE__); -} - -static void -local_storage_new_folder_cb (EvolutionStorageListener *storage_listener, - const char *path, - const Evolution_Folder *folder, - void *data) -{ - Evolution_Folder *copy_of_folder; - CORBA_Environment ev; - - if (strcmp (folder->type, "mail") != 0) - return; - - CORBA_exception_init (&ev); - -#if 0 - /* This is how we could do to display extra information about the - folder. */ - display_name = g_strconcat (folder->display_name, _(" (XXX unread)"), NULL); - Evolution_LocalStorage_set_display_name (corba_local_storage, path, display_name, &ev); -#endif - - copy_of_folder = Evolution_Folder__alloc (); - copy_of_folder->type = CORBA_string_dup (folder->type); - copy_of_folder->description = CORBA_string_dup (folder->description); - copy_of_folder->display_name = CORBA_string_dup (folder->display_name); - copy_of_folder->physical_uri = CORBA_string_dup (folder->physical_uri); - - e_folder_tree_add (folder_tree, path, copy_of_folder); - - CORBA_exception_free (&ev); -} - -static void -local_storage_removed_folder_cb (EvolutionStorageListener *storage_listener, - const char *path, - void *data) -{ - /* Prevent a warning from `e_folder_tree_remove()'. */ - if (e_folder_tree_get_folder (folder_tree, path) == NULL) - return; - - e_folder_tree_remove (folder_tree, path); -} - - -gboolean -mail_local_storage_startup (EvolutionShellClient *shell_client) -{ - Evolution_StorageListener corba_local_storage_listener; - - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - corba_local_storage = evolution_shell_client_get_local_storage (shell_client); - if (corba_local_storage == CORBA_OBJECT_NIL) { - CORBA_exception_free (&ev); - return FALSE; - } - - local_storage_listener = evolution_storage_listener_new (); - corba_local_storage_listener = evolution_storage_listener_corba_objref (local_storage_listener); - - gtk_signal_connect (GTK_OBJECT (local_storage_listener), "destroyed", - GTK_SIGNAL_FUNC (local_storage_destroyed_cb), NULL); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), "new_folder", - GTK_SIGNAL_FUNC (local_storage_new_folder_cb), NULL); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), "removed_folder", - GTK_SIGNAL_FUNC (local_storage_removed_folder_cb), NULL); - - folder_tree = e_folder_tree_new (folder_tree_folder_notify_cb, NULL); - - Evolution_Storage_add_listener (corba_local_storage, corba_local_storage_listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("%s -- Cannot add a listener to the Local Storage.", __FILE__); - - gtk_object_unref (GTK_OBJECT (local_storage_listener)); - - Bonobo_Unknown_unref (corba_local_storage, &ev); - CORBA_Object_release (corba_local_storage, &ev); - - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - return TRUE; -} - -void -mail_local_storage_shutdown (void) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Bonobo_Unknown_unref (corba_local_storage, &ev); - CORBA_Object_release (corba_local_storage, &ev); - corba_local_storage = CORBA_OBJECT_NIL; - - gtk_object_unref (GTK_OBJECT (local_storage_listener)); - local_storage_listener = NULL; - - gtk_object_unref (GTK_OBJECT (folder_tree)); - folder_tree = NULL; - - CORBA_exception_free (&ev); -} -- cgit v1.2.3