From 07ab95690e85015a6623ffd4443daa1fd42b66b5 Mon Sep 17 00:00:00 2001 From: jaortega Date: Sun, 18 Feb 2001 22:21:09 +0000 Subject: mvc effort abandoned --- mixmvc/mvc.c | 69 ------------------------------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 mixmvc/mvc.c (limited to 'mixmvc/mvc.c') diff --git a/mixmvc/mvc.c b/mixmvc/mvc.c deleted file mode 100644 index dcd254f..0000000 --- a/mixmvc/mvc.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*-c-*- -------------- mvc.c : - * Implementation of the functions declared in mvc.h - * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/02/13 02:17:37 jose" - * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, 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. - * - */ - - - -#include "mvc.h" - -/* clean up a subject */ -void -subject_clean (subject_t *sub) -{ - g_return_if_fail (sub != NULL); - g_slist_free (sub->observers); -} - -/* add a new observer */ -void -subject_add_observer (subject_t *sub, observer_t *obs) -{ - g_return_if_fail (sub != NULL); - g_return_if_fail (obs != NULL); - sub->observers = g_slist_append (sub->observers, (gpointer)obs); - obs->subject = sub; -} - -/* remove an observer */ -void -subject_remove_observer (subject_t *sub, observer_t *obs) -{ - g_return_if_fail (sub != NULL); - g_return_if_fail (obs != NULL); - sub->observers = g_slist_remove (sub->observers, (gpointer)obs); -} - -/* observer notifier callback */ -static void -update_callback (gpointer obs, gpointer data) -{ - ((observer_t *)obs)->update((observer_t *)obs, data); -} - -/* notify all observers of a change */ -void -subject_update_observers (subject_t *sub, data_t *data) -{ - g_return_if_fail (sub != NULL); - g_slist_foreach (sub->observers, update_callback, data); -} - -- cgit v1.2.3