aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-iterator.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-04 06:25:47 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-04 06:25:47 +0800
commit40e24cdab6d294af61ca54a96b0b901181dc7751 (patch)
tree47443df546a952e8a74fb40a514dc6889c290f49 /e-util/e-iterator.c
parenta1d1e450a1ec2f8c2fd921b18e695031cf061887 (diff)
downloadgsoc2013-evolution-40e24cdab6d294af61ca54a96b0b901181dc7751.tar.gz
gsoc2013-evolution-40e24cdab6d294af61ca54a96b0b901181dc7751.tar.zst
gsoc2013-evolution-40e24cdab6d294af61ca54a96b0b901181dc7751.zip
New list class with iterators.
2000-07-03 Christopher James Lahey <clahey@helixcode.com> * e-iterator.c, e-iterator.h, e-list-iterator.c, e-list-iterator.h, e-list.c, e-list.h: New list class with iterators. * e-canvas.c: Made it so that you don't get the same selection in the selection list more than once. svn path=/trunk/; revision=3871
Diffstat (limited to 'e-util/e-iterator.c')
-rw-r--r--e-util/e-iterator.c169
1 files changed, 169 insertions, 0 deletions
diff --git a/e-util/e-iterator.c b/e-util/e-iterator.c
new file mode 100644
index 0000000000..cff6fec946
--- /dev/null
+++ b/e-util/e-iterator.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@umich.edu>
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Copyright (C) 1999 The Free Software Foundation
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+
+#include "e-iterator.h"
+
+#define ECI_CLASS(object) (E_ITERATOR_CLASS(GTK_OBJECT((object))->klass))
+
+static void e_iterator_init (EIterator *card);
+static void e_iterator_class_init (EIteratorClass *klass);
+
+#define PARENT_TYPE (gtk_object_get_type ())
+
+static GtkObjectClass *parent_class;
+
+enum {
+ INVALIDATE,
+ LAST_SIGNAL
+};
+
+static guint e_iterator_signals [LAST_SIGNAL] = { 0, };
+
+/**
+ * e_iterator_get_type:
+ * @void:
+ *
+ * Registers the &EIterator class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &EIterator class.
+ **/
+GtkType
+e_iterator_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type) {
+ GtkTypeInfo info = {
+ "EIterator",
+ sizeof (EIterator),
+ sizeof (EIteratorClass),
+ (GtkClassInitFunc) e_iterator_class_init,
+ (GtkObjectInitFunc) e_iterator_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ type = gtk_type_unique (PARENT_TYPE, &info);
+ }
+
+ return type;
+}
+
+static void
+e_iterator_class_init (EIteratorClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS(klass);
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ e_iterator_signals [INVALIDATE] =
+ gtk_signal_new ("invalidate",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EIteratorClass, invalidate),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (object_class, e_iterator_signals, LAST_SIGNAL);
+
+ klass->invalidate = NULL;
+ klass->get = NULL;
+ klass->reset = NULL;
+ klass->next = NULL;
+ klass->prev = NULL;
+ klass->delete = NULL;
+ klass->set = NULL;
+ klass->is_valid = NULL;
+}
+
+/**
+ * e_iterator_init:
+ */
+static void
+e_iterator_init (EIterator *card)
+{
+}
+
+/*
+ * Virtual functions:
+ */
+const void *
+e_iterator_get (EIterator *iterator)
+{
+ if (ECI_CLASS(iterator)->get)
+ return ECI_CLASS(iterator)->get(iterator);
+ else
+ return NULL;
+}
+
+void
+e_iterator_reset (EIterator *iterator)
+{
+ if (ECI_CLASS(iterator)->reset)
+ ECI_CLASS(iterator)->reset(iterator);
+}
+
+gboolean
+e_iterator_next (EIterator *iterator)
+{
+ if (ECI_CLASS(iterator)->next)
+ return ECI_CLASS(iterator)->next(iterator);
+ else
+ return FALSE;
+}
+
+gboolean
+e_iterator_prev (EIterator *iterator)
+{
+ if (ECI_CLASS(iterator)->prev)
+ return ECI_CLASS(iterator)->prev(iterator);
+ else
+ return FALSE;
+}
+
+void
+e_iterator_delete (EIterator *iterator)
+{
+ if (ECI_CLASS(iterator)->delete)
+ ECI_CLASS(iterator)->delete(iterator);
+}
+
+void
+e_iterator_set (EIterator *iterator,
+ const void *object)
+{
+ if (ECI_CLASS(iterator)->set)
+ ECI_CLASS(iterator)->set(iterator, object);
+}
+
+gboolean
+e_iterator_is_valid (EIterator *iterator)
+{
+ if (ECI_CLASS(iterator)->is_valid)
+ return ECI_CLASS(iterator)->is_valid(iterator);
+ else
+ return FALSE;
+}
+
+void
+e_iterator_invalidate (EIterator *iterator)
+{
+ g_return_if_fail (iterator != NULL);
+ g_return_if_fail (E_IS_ITERATOR (iterator));
+
+ gtk_signal_emit (GTK_OBJECT (iterator),
+ e_iterator_signals [INVALIDATE]);
+}
6&id=a4492e35917380cdb0f4fb55ac2f54ce66300e4e'>Update to 2.23.2.marcus2008-05-153-5/+8 * Update to 2.23.1ahze2008-04-237-0/+376 * Remove these ports now that they have been merged into the FreeBSD ports tree.marcus2008-03-2412-426/+0 * Use ltasneededhackahze2008-03-161-3/+3 * No longer need to take care of extensions-1.0 directory.mezz2008-03-122-5/+3 * merge my change with marcus's.mezz2008-03-112-4/+18 * Update to 2.22.0.marcus2008-03-112-5/+5 * Update to 2.21.92.kwm2008-02-263-5/+6 * Update to 2.21.91.marcus2008-02-122-5/+5 * With recently update of shared-mime-info, now nautilus's plist no longer needmezz2008-02-011-16/+0 * Update to 2.21.90.marcus2008-01-292-5/+5 * Update to 2.21.6.marcus2008-01-223-7/+17 * Fix the dirrmtry locale stuff, ran by locale_dirrmtry.sh.mezz2008-01-201-1/+1 * Update to 2.21.5.marcus2008-01-153-6/+13 * Add create directory and remove extensions-1.0, there are ports that stillmezz2008-01-142-1/+5 * Update to 0.5.0.marcus2008-01-145-0/+71 * extention dir changed from lib/nautilus/extensions-1.0 tokwm2008-01-111-2/+2 * Update to 2.12.2.marcus2008-01-107-0/+337 * Remove these now that they have been committed to the FreeBSD ports tree.marcus2007-10-2524-913/+0 * Remove share/applications from gnomehier and add dirrmtry of this path inmezz2007-10-113-0/+3 * @dirrm share/locale -> @dirrmtry share/localemezz2007-09-191-2/+2 * Update to 2.20.0ahze2007-09-183-5/+9 * Update to 2.19.91.marcus2007-08-282-5/+5 * Sync w/ FreeBSD ports.mezz2007-08-174-41/+17 * Update to 2.19.90.marcus2007-08-152-5/+5 * share/gnome/ -> share/.mezz2007-08-0712-0/+412 * Add a missing file.mezz2007-08-071-0/+28 * Update to 2.19.6.mezz2007-08-023-21/+5 * Sync w/ FreeBSD ports.mezz2007-07-311-1/+7 * Fix the crash with new gtk.mezz2007-07-222-1/+17 * Update to 2.19.5ahze2007-07-103-5/+8 * Update to 2.19.4.marcus2007-06-202-5/+5 * Update to 2.19.3.mezz2007-06-083-66/+68 * Fix and catch up with locale stuff in our new mtree. Using locale_dirrmtry.shmezz2007-05-311-2/+0 * Get rid of X11BASE and replace a few to LOCALBASE. I only touch these portsmezz2007-05-302-5/+5 * Chase libexif update again. Don't worry, pav has added ltverhack in libexifmezz2007-05-281-3/+3 * Fix these ports by chase w/ libexif update.mezz2007-05-261-3/+3 * Sync plist changes from ports.marcus2007-05-222-42/+0 * Bump PORTREVISION to sync with ports.marcus2007-05-202-2/+3 * Update to 2.19.2.marcus2007-05-155-7/+43 * share/gnome/ -> share/mezz2007-05-045-0/+158 * share/gnome -> sharemarcus2007-04-295-0/+328 * Remove these ports now that they have been committed to FreeBSD.marcus2007-03-195-328/+0 * Add a missing locale file.marcus2007-03-172-1/+3 * Update to 2.18.0.1ahze2007-03-132-5/+5 * Update to 2.18.0ahze2007-03-122-5/+5 * Update to 2.17.92.marcus2007-02-272-5/+5 * Remove unneeded patchahze2007-02-141-10/+0 * Update to 2.17.91.marcus2007-02-132-5/+5 * Update to 2.17.90.marcus2007-01-292-5/+5 * Turn tracker support off by default. Tracker for the most part is stable,ahze2007-01-221-3/+3 * - Chase tracker (no need to bump PORTREVISION since nautilus doesn't link toahze2006-12-241-3/+3 * - Update to 2.17.1ahze2006-12-186-0/+336 * Clean out MarcusCom after the big import into ports.marcus2006-10-1426-1141/+0 * Add dirrmtry locale stuff in more ports' plist.mezz2006-10-051-6/+28 * Fix the dirrmtry locale in plist. Don't freak out, a lot of them are reordermezz2006-10-051-14/+70 * - Update to 2.16.1ahze2006-10-032-5/+5 * - Move to LOCALBASEahze2006-10-035-0/+410 * - move to LOCALBASEahze2006-09-309-0/+207 * - Update to 2.16.0ahze2006-09-043-5/+11 * Update to 2.15.92.1.marcus2006-08-232-5/+5 * - Update to 2.15.92ahze2006-08-222-5/+5 * - Update to 2.15.91ahze2006-08-093-7/+8 * X11BASE -> LOCALBASE, gtk12 lives in LOCALBASE. Bump the PORTREVISION.mezz2006-08-026-0/+179 * Update to 2.15.90.marcus2006-07-263-7/+8 * USE_X_PREFIX -> USE_XLIBmezz2006-07-221-2/+2 * - Update to 2.15.4ahze2006-07-113-5/+8 * Update to 2.15.2.marcus2006-06-132-5/+5 * Sync w/ FreeBSD ports tree for x11-fm/nautilus2 -> x11-fm/nautilus.mezz2006-05-297-261/+3 * - Update to 2.15.1ahze2006-05-2012-0/+514 * Remove these ports now that they are in the ports tree.marcus2006-04-3014-552/+0 * Correct suboptimal regexp I suggested to mezz.bland2006-04-132-4/+4 * - Update to 2.14.1ahze2006-04-118-26/+26 * Change the MASTER_SITE_SUBDIR from:mezz2006-03-142-4/+4 * - Update to 2.14.0ahze2006-03-136-10/+16 * Change the MASTER_SITE_SUBDIR from:mezz2006-03-132-4/+4 * Add USE_GETTEXT to make portlint happy.mezz2006-03-032-2/+4 * Use dirrmtry instead of the unexec rmdir...mezz2006-03-032-4/+4 * Update to 2.13.92.marcus2006-02-286-12/+16 * Update for new libtool world order.marcus2006-02-254-4/+8 * - Update to 2.13.91ahze2006-02-134-10/+10 * Remove USE_REINPLACE.marcus2006-02-012-4/+2 * - Update to 2.13.90ahze2006-01-314-10/+10 * - Replace @unexec rmdir with modern @dirrmtrypav2006-01-232-8/+8 * - Update to 2.13.4ahze2006-01-176-10/+12 * Update to 2.13.3.marcus2005-12-146-10/+18 * - Update to 2.13.2ahze2005-11-154-8/+10 * - Removeahze2005-11-064-53/+0 * - Update to 2.13.1ahze2005-11-066-16/+10 * Update to 2.12.1.marcus2005-10-046-22/+10 * Update to 0.4.1.marcus2005-10-033-19/+21 * This patch is no longer needed since this problem was fixed in a better way.marcus2005-09-064-72/+4 * Update to 2.12.0.kwm2005-09-056-26/+28 * Update to 2.11.92.marcus2005-08-236-44/+8 * Update to 2.11.91.marcus2005-08-096-10/+10 * Fix text drag and drop when the destination is not on the same file systemmarcus2005-08-014-2/+72 * Update to 2.11.90.marcus2005-07-264-8/+8 * Update to 2.11.4.marcus2005-07-124-8/+8 * Update to 2.11.3.marcus2005-07-046-8/+44 * Switch to the new USE_AUTOTOOLS world order.marcus2005-07-023-6/+6