diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-12-07 02:38:39 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-12-07 02:38:39 +0800 |
commit | 6dce720dc64061352041f4a55c46590c8ffcc3a0 (patch) | |
tree | aeaa4f941fc9964f0289d9078b1299d8148a4dbd /widgets/menus/gal-view.c | |
parent | af6115e56fddb10b0dc1dd8f38aff42754e47950 (diff) | |
download | gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.tar gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.tar.gz gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.tar.bz2 gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.tar.lz gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.tar.xz gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.tar.zst gsoc2013-evolution-6dce720dc64061352041f4a55c46590c8ffcc3a0.zip |
Added gal-view-collection.c, gal-view-etable.c, gal-view-factory-etable.c,
2000-12-06 Christopher James Lahey <clahey@helixcode.com>
* Makefile.am: Added gal-view-collection.c, gal-view-etable.c,
gal-view-factory-etable.c, gal-view-factory.c,
gal-view-collection.h, gal-view-etable.h,
gal-view-factory-etable.h, and gal-view-factory.h.
* gal-define-views-dialog.c, gal-define-views-dialog.h: Rewrote
this to take a GalViewCollection. This now passes its collection
to the new view dialog but still doesn't get its list of views
from the collection.
* gal-define-views-model.c: Changed this to use the gal_view_get_title
function instead of the "title" gtk argument.
* gal-define-views.glade, gal-define-views.glade.h: Changed this
dialog to be a bit cleaner.
* gal-view-collection.c, gal-view-collection.h: A collection of
views and view factories.
* gal-view-etable.c, gal-view-etable.h: An implementation of the
view class. This stores an ETableSpecification and the current
ETableState.
* gal-view-factory-etable.c, gal-view-factory-etable.h: An
implementation of the view factory class. This stores an
ETableSpecification and creates GalViewEtables when requested.
* gal-view-factory.c, gal-view-factory.h: A new virtual class.
Its primary job is to return new GalViews.
* gal-view-new-dialog.c, gal-view-new-dialog.h: Added a collection
argument to the new function here so that it can get a list of
factories to choose from.
* gal-view-new-dialog.glade, gal-view-new-dialog.glade.h: Added a
CList for the list of factories to choose from.
* gal-view.c, gal-view.h: Changed this to be a virtual class.
svn path=/trunk/; revision=6811
Diffstat (limited to 'widgets/menus/gal-view.c')
-rw-r--r-- | widgets/menus/gal-view.c | 148 |
1 files changed, 87 insertions, 61 deletions
diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c index 19c9d50f85..1ff9ffab16 100644 --- a/widgets/menus/gal-view.c +++ b/widgets/menus/gal-view.c @@ -1,97 +1,123 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gal-view-menus.c: Savable state of a table. + * gal-view.c: A View * - * Author: - * Chris Lahey <clahey@helixcode.com> + * Authors: + * Chris Lahey (clahey@helixcode.com) * * (C) 2000 Helix Code, Inc. */ #include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> #include "gal-view.h" -#include <gal/util/e-util.h> -static void gal_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +#define GV_CLASS(e) ((GalViewClass *)((GtkObject *)e)->klass) -#define PARENT_TYPE (gtk_object_get_type()) +#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *gv_parent_class; +#define d(x) -enum { - ARG_0, - ARG_NAME, -}; +d(static gint depth = 0); -static void -gv_destroy (GtkObject *object) -{ - GalView *gv = GAL_VIEW (object); - g_free(gv->name); +static GtkObjectClass *gal_view_parent_class; + +/** + * gal_view_edit + * @view: The view to edit + */ +void +gal_view_edit (GalView *view) +{ + g_return_if_fail (view != NULL); + g_return_if_fail (GAL_IS_VIEW (view)); - GTK_OBJECT_CLASS (gv_parent_class)->destroy (object); + if (GV_CLASS (view)->edit) + GV_CLASS (view)->edit (view); } -static void -gal_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +/** + * gal_view_load_from_node + * @view: The view to load to + * @node: The xml data to load + */ +void +gal_view_load_from_node (GalView *view, + xmlNode *node) { - GalView *view; + g_return_if_fail (view != NULL); + g_return_if_fail (GAL_IS_VIEW (view)); - view = GAL_VIEW (o); - - switch (arg_id){ - case ARG_NAME: - g_free(view->name); - view->name = g_strdup(GTK_VALUE_STRING (*arg)); - break; - } + if (GV_CLASS (view)->load_from_node) + GV_CLASS (view)->load_from_node (view, node); } -static void -gal_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +/** + * gal_view_save_to_node + * @view: The view to save + * @parent: Save the data as a child of this node + */ +void +gal_view_save_to_node (GalView *view, + xmlNode *parent) { - GalView *view; + g_return_if_fail (view != NULL); + g_return_if_fail (GAL_IS_VIEW (view)); - view = GAL_VIEW (object); - - switch (arg_id) { - case ARG_NAME: - GTK_VALUE_STRING (*arg) = g_strdup(view->name); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } + if (GV_CLASS (view)->save_to_node) + GV_CLASS (view)->save_to_node (view, parent); } -static void -gv_init (GalView *view) +/** + * gal_view_get_title + * @view: The view to query. + * + * Returns: The title of the view. + */ +const char * +gal_view_get_title (GalView *view) { - view->name = NULL; + g_return_val_if_fail (view != NULL, NULL); + g_return_val_if_fail (GAL_IS_VIEW (view), NULL); + + if (GV_CLASS (view)->get_title) + return GV_CLASS (view)->get_title (view); + else + return NULL; } static void -gv_class_init (GtkObjectClass *klass) +gal_view_class_init (GtkObjectClass *object_class) { - gv_parent_class = gtk_type_class (PARENT_TYPE); + GalViewClass *klass = GAL_VIEW_CLASS(object_class); + gal_view_parent_class = gtk_type_class (PARENT_TYPE); - klass->destroy = gv_destroy; - klass->set_arg = gal_view_set_arg; - klass->get_arg = gal_view_get_arg; - - gtk_object_add_arg_type ("GalView::name", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_NAME); + klass->edit = NULL; + klass->load_from_node = NULL; + klass->save_to_node = NULL; + klass->get_title = NULL; } -E_MAKE_TYPE(gal_view, "GalView", GalView, gv_class_init, gv_init, PARENT_TYPE); - -GalView * -gal_view_new (void) +GtkType +gal_view_get_type (void) { - GalView *gv = gtk_type_new (GAL_VIEW_TYPE); + static guint type = 0; + + if (!type) + { + GtkTypeInfo info = + { + "GalView", + sizeof (GalView), + sizeof (GalViewClass), + (GtkClassInitFunc) gal_view_class_init, + NULL, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + type = gtk_type_unique (PARENT_TYPE, &info); + } - return (GalView *) gv; + return type; } |