/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-shell.c * * 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 */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "e-util/e-util.h" #include "e-folder-type-repository.h" #include "e-local-storage.h" #include "e-shell-view.h" #include "e-shortcuts.h" #include "e-storage-set.h" #include "e-shell.h" #define PARENT_TYPE GTK_TYPE_OBJECT static GtkObjectClass *parent_class = NULL; struct _EShellPrivate { char *local_directory; EStorageSet *storage_set; EShortcuts *shortcuts; EFolderTypeRepository *folder_type_repository; }; #define SHORTCUTS_FILE_NAME "shortcuts.xml" #define LOCAL_STORAGE_DIRECTORY "local" /* Initialization of the storages. */ static gboolean setup_storages (EShell *shell) { EStorage *local_storage; EShellPrivate *priv; gchar *local_storage_path; priv = shell->priv; local_storage_path = g_concat_dir_and_file (priv->local_directory, LOCAL_STORAGE_DIRECTORY); local_storage = e_local_storage_open (local_storage_path); g_free (local_storage_path); if (local_storage == NULL) return FALSE; priv->storage_set = e_storage_set_new (); e_storage_set_add_storage (priv->storage_set, local_storage); return TRUE; } /* GtkObject methods. */ static void destroy (GtkObject *object) { EShell *shell; EShellPrivate *priv; shell = E_SHELL (object); priv = shell->priv; gtk_object_unref (GTK_OBJECT (priv->storage_set)); gtk_object_unref (GTK_OBJECT (priv->shortcuts)); gtk_object_unref (GTK_OBJECT (priv->folder_type_repository)); g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } static void class_init (EShellClass *klass) { GtkObjectClass *object_class; object_class = GTK_OBJECT_CLASS (klass); object_class->destroy = destroy; parent_class = gtk_type_class (gtk_object_get_type ()); } static void init (EShell *shell) { EShellPrivate *priv; priv = g_new (EShellPrivate, 1); priv->local_directory = NULL; priv->storage_set = NULL; priv->shortcuts = NULL; priv->folder_type_repository = NULL; shell->priv = priv; } void e_shell_construct (EShell *shell, const char *local_directory) { EShellPrivate *priv; gchar *shortcut_path; g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); g_return_if_fail (local_directory != NULL); g_return_if_fail (g_path_is_absolute (local_directory)); GTK_OBJECT_UNSET_FLAGS (shell, GTK_FLOATING); priv = shell->priv; priv->local_directory = g_strdup (local_directory); 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); shortcut_path = g_concat_dir_and_file (local_directory, "shortcuts.xml"); if (! e_shortcuts_load (priv->shortcuts, shortcut_path)) { gtk_object_unref (GTK_OBJECT (priv->shortcuts)); priv->shortcuts = NULL; } g_free (shortcut_path); } EShell * e_shell_new (const char *local_directory) { EShell *new; EShellPrivate *priv; new = gtk_type_new (e_shell_get_type ()); e_shell_construct (new, local_directory); priv = new->priv; if (priv->shortcuts == NULL || priv->storage_set == NULL) { gtk_object_unref (GTK_OBJECT (new)); return NULL; } return new; } GtkWidget * e_shell_new_view (EShell *shell, const char *uri) { GtkWidget *view_widget; EShellView *shell_view; g_return_val_if_fail (shell != NULL, NULL); g_return_val_if_fail (E_IS_SHELL (shell), NULL); view_widget = e_shell_view_new (shell, uri); shell_view = E_SHELL_VIEW (view_widget); gtk_widget_show (view_widget); return view_widget; } EShortcuts * e_shell_get_shortcuts (EShell *shell) { g_return_val_if_fail (shell != NULL, NULL); g_return_val_if_fail (E_IS_SHELL (shell), NULL); return shell->priv->shortcuts; } EStorageSet * e_shell_get_storage_set (EShell *shell) { g_return_val_if_fail (shell != NULL, NULL); g_return_val_if_fail (E_IS_SHELL (shell), NULL); return shell->priv->storage_set; } EFolderTypeRepository * e_shell_get_folder_type_repository (EShell *shell) { g_return_val_if_fail (shell != NULL, NULL); g_return_val_if_fail (E_IS_SHELL (shell), NULL); return shell->priv->folder_type_repository; } E_MAKE_TYPE (e_shell, "EShell", EShell, class_init, init, PARENT_TYPE) href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/refs/?id=e0e8a1ec9dd152f0fb440fbec4407479065b586f'>refslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* - Update to 4.20.0miwi2010-07-012-4/+4
* - Update to 4.19.0sylvio2010-06-302-4/+4
* - Update to 4.17.0sylvio2010-05-012-4/+4
* - Update to 4.15.0wen2009-12-032-4/+4
* - Update to 4.13.0miwi2009-11-033-21/+9
* - Update to 4.11.0.araujo2009-08-103-21/+4
* - Update to 4.9.2miwi2009-07-262-4/+4
* - [1]: Update to 4.9.1wxs2009-06-123-5/+7
* - Add patch to reduce excess loggingamdmi32009-01-292-0/+18
* - Update to 4.8.4rafan2008-09-282-4/+4
* - Update to 4.8.3miwi2008-08-132-4/+4
* - Update 4.8.2miwi2008-08-032-4/+4
* - Uppdate to 4.8.1miwi2008-03-302-4/+4
* - Update to 4.8.0beech2008-02-202-4/+4
* - Update to 4.7.8miwi2008-02-133-8/+9
* - Update to 4.7.7miwi2007-12-132-4/+4
* - Update to 4.7.6rafan2007-08-122-4/+4
* - Update to 4.7.5rafan2007-06-142-4/+4
* - Update to 4.7.3pav2007-03-242-4/+4
* - Update to 4.7.2miwi2007-03-012-4/+4
* - Update to 4.7.0pav2007-01-272-4/+4
* Update to 4.6.5.shaun2006-11-222-4/+4
* - Update to 4.6.4miwi2006-09-302-4/+4
* - Update mail/getmail to 4.6.3 which includes several bugfixes.clsung2006-06-272-4/+5
* - Update mail/getmail to 4.6.2, which includes the following fix noted inclsung2006-06-092-4/+4
* - update to 4.6.1clsung2006-06-012-4/+4
* - Update to 4.6.0mnag2006-04-082-4/+4
* - Update mail/getmail to 4.5.4, which includes a new configuration parameterclsung2006-02-162-4/+4
* - Update mail/getmail to 4.5.3, which includes a minor updates to the SSLclsung2006-02-102-4/+4
* - Update to 4.5.2pav2006-02-082-4/+4
* - Update to 4.5.1barner2006-02-052-4/+4
* Update mail/getmail to 4.4.4, which includes the following change perclsung2006-01-042-4/+4
* Update to 4.4.3mnag2005-12-022-4/+4
* Update to 4.4.2mnag2005-11-142-4/+4
* Update to 4.4.1mnag2005-11-112-4/+4
* Update to 4.4.0mnag2005-11-093-4/+6
* Update to 4.3.14, which fixes an error introduced toarved2005-11-032-3/+3
* - Remove "." entry from MASTER_SITE_SUBDIR that was added for testingclsung2005-10-171-1/+1
* Update mail/getmail to 4.3.13, which includes a new retriever type as notedvs2005-10-162-5/+6
* - Update to 4.3.12ehaupt2005-10-154-25/+3
* Update to 4.3.11.novel2005-06-172-5/+4
* - Update to 4.3.10pav2005-05-204-19/+3
* Put the tarball on MASTER_SITE_LOCAL to fix fetching while the masternovel2005-05-201-1/+2
* Update to 4.3.9.novel2005-05-194-62/+34
* - Update mail/getmail to 4.3.8.clsung2005-05-072-3/+3
* Update to 4.3.7jylefort2005-05-022-3/+3
* - Update mail/getmail to 4.3.6leeym2005-04-092-3/+3
* - Update the port to 4.3.5;clsung2005-04-042-3/+3
* - Update to 4.3.4ahze2005-03-152-4/+3
* - Add two patches to mail/getmail to tell modules not to use "strict"clsung2005-03-043-0/+67
* - Update pkg-descr with new URLclsung2005-02-221-1/+1
* Update port to 4.3.3 (which includes fixes for avoiding delivery ofclsung2005-02-222-4/+4
* Update mail/getmail to 4.3.2, which includes a fix to eliminate duplicateleeym2005-02-082-3/+3
* Update Port: mail/getmail to 4.3.1edwin2005-01-202-3/+3
* Update Port: mail/getmail to 4.3.0edwin2005-01-122-3/+3
* - Update to 4.2.6sem2005-01-092-3/+3
* - Update to 4.2.5pav2004-12-112-3/+3
* - Update to 4.2.4sergei2004-11-252-3/+3
* - Update to 4.2.3sergei2004-11-242-4/+3
* - Simplify Makefile install target by utilizing USE_PYDISTUTILSsergei2004-10-185-44/+106
* - Update to 4.2.2 [1]sergei2004-10-142-6/+6
* - Update to 4.1.3sergei2004-10-124-25/+41
* Fix MASTER_SITESkrion2004-07-121-4/+2
* BROKEN: Unfetchablekris2004-07-111-0/+2
* - Update to 3.2.4sergei2004-07-052-3/+3
* - Update to 3.2.2sergei2004-04-122-4/+3
* SIZE *DOES* MATTER.sergei2004-01-311-0/+1
* - Restore a fix for breakage when run under cron(8) introduced insergei2004-01-14