evolution-3.6.4/widgets/menus/gal-view-factory.c

No issues found

  1 /*
  2  * This program is free software; you can redistribute it and/or
  3  * modify it under the terms of the GNU Lesser General Public
  4  * License as published by the Free Software Foundation; either
  5  * version 2 of the License, or (at your option) version 3.
  6  *
  7  * This program is distributed in the hope that it will be useful,
  8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 10  * Lesser General Public License for more details.
 11  *
 12  * You should have received a copy of the GNU Lesser General Public
 13  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 14  *
 15  *
 16  * Authors:
 17  *		Chris Lahey <clahey@ximian.com>
 18  *
 19  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 20  *
 21  */
 22 
 23 #ifdef HAVE_CONFIG_H
 24 #include <config.h>
 25 #endif
 26 
 27 #include "gal-view-factory.h"
 28 
 29 #include <e-util/e-util.h>
 30 
 31 G_DEFINE_TYPE (GalViewFactory, gal_view_factory, G_TYPE_OBJECT)
 32 
 33 /* XXX Should GalViewFactory be a GInterface? */
 34 
 35 static void
 36 gal_view_factory_class_init (GalViewFactoryClass *class)
 37 {
 38 }
 39 
 40 static void
 41 gal_view_factory_init (GalViewFactory *factory)
 42 {
 43 }
 44 
 45 /**
 46  * gal_view_factory_get_title:
 47  * @factory: a #GalViewFactory
 48  *
 49  * Returns: The title of the factory.
 50  */
 51 const gchar *
 52 gal_view_factory_get_title (GalViewFactory *factory)
 53 {
 54 	GalViewFactoryClass *class;
 55 
 56 	g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
 57 
 58 	class = GAL_VIEW_FACTORY_GET_CLASS (factory);
 59 	g_return_val_if_fail (class->get_title != NULL, NULL);
 60 
 61 	return class->get_title (factory);
 62 }
 63 
 64 /**
 65  * gal_view_factory_get_type_code:
 66  * @factory: a #GalViewFactory
 67  *
 68  * Returns: The type code
 69  */
 70 const gchar *
 71 gal_view_factory_get_type_code (GalViewFactory *factory)
 72 {
 73 	GalViewFactoryClass *class;
 74 
 75 	g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
 76 
 77 	class = GAL_VIEW_FACTORY_GET_CLASS (factory);
 78 	g_return_val_if_fail (class->get_type_code != NULL, NULL);
 79 
 80 	return class->get_type_code (factory);
 81 }
 82 
 83 /**
 84  * gal_view_factory_new_view:
 85  * @factory: a #GalViewFactory
 86  * @name: the name for the view
 87  *
 88  * Returns: The new view
 89  */
 90 GalView *
 91 gal_view_factory_new_view (GalViewFactory *factory,
 92                            const gchar *name)
 93 {
 94 	GalViewFactoryClass *class;
 95 
 96 	g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
 97 
 98 	class = GAL_VIEW_FACTORY_GET_CLASS (factory);
 99 	g_return_val_if_fail (class->new_view != NULL, NULL);
100 
101 	return class->new_view (factory, name);
102 }