blob: ebbde76d03bf7b4ae88c9ff38d0a2c330435e1d9 (
plain) (
tree)
|
|
/*
* e-mail-shell-view-private.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#include "e-mail-shell-view-private.h"
#include <widgets/menus/gal-view-factory-etable.h>
static void
mail_shell_view_load_view_collection (EShellViewClass *shell_view_class)
{
GalViewCollection *collection;
GalViewFactory *factory;
ETableSpecification *spec;
const gchar *base_dir;
gchar *filename;
collection = shell_view_class->view_collection;
base_dir = EVOLUTION_ETSPECDIR;
spec = e_table_specification_new ();
filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
if (!e_table_specification_load_from_file (spec, filename))
g_critical ("Unable to load ETable specification file "
"for mail");
g_free (filename);
factory = gal_view_factory_etable_new (spec);
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
g_object_unref (spec);
gal_view_collection_load (collection);
}
static void
mail_shell_view_notify_view_id_cb (EMailShellView *mail_shell_view)
{
EMailShellContent *mail_shell_content;
GalViewInstance *view_instance;
const gchar *view_id;
mail_shell_content = mail_shell_view->priv->mail_shell_content;
view_instance = NULL; /* FIXME */
view_id = e_shell_view_get_view_id (E_SHELL_VIEW (mail_shell_view));
/* A NULL view ID implies we're in a custom view. But you can
* only get to a custom view via the "Define Views" dialog, which
* would have already modified the view instance appropriately.
* Furthermore, there's no way to refer to a custom view by ID
* anyway, since custom views have no IDs. */
if (view_id == NULL)
return;
gal_view_instance_set_current_view_id (view_instance, view_id);
}
void
e_mail_shell_view_private_init (EMailShellView *mail_shell_view,
EShellViewClass *shell_view_class)
{
EMailShellViewPrivate *priv = mail_shell_view->priv;
priv->mail_actions = gtk_action_group_new ("mail");
priv->filter_actions = gtk_action_group_new ("mail-filter");
if (!gal_view_collection_loaded (shell_view_class->view_collection))
mail_shell_view_load_view_collection (shell_view_class);
g_signal_connect (
mail_shell_view, "notify::view-id",
G_CALLBACK (mail_shell_view_notify_view_id_cb), NULL);
}
void
e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
{
EMailShellViewPrivate *priv = mail_shell_view->priv;
EShellView *shell_view;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
/* Cache these to avoid lots of awkward casting. */
priv->mail_shell_content = g_object_ref (shell_content);
priv->mail_shell_sidebar = g_object_ref (shell_content);
e_mail_shell_view_actions_init (mail_shell_view);
}
void
e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view)
{
EMailShellViewPrivate *priv = mail_shell_view->priv;
DISPOSE (priv->mail_actions);
DISPOSE (priv->filter_actions);
DISPOSE (priv->mail_shell_content);
DISPOSE (priv->mail_shell_sidebar);
}
void
e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view)
{
}
|