From 7ff091145f3de097f22fbf60ac731fd8e7d6f207 Mon Sep 17 00:00:00 2001 From: baturix Date: Sun, 15 Nov 2009 01:23:43 +0000 Subject: [PATCH] Added a new provider type to support the retrieval of movie schedules git-svn-id: file:///svnroot/maevies/trunk@13 a96798e0-47ce-444a-94a4-1d14e63744fc --- src/maevies_movie.h | 2 ++ src/maevies_movieschedule.c | 40 ++++++++++++++++++++++++++++++++++++ src/maevies_movieschedule.h | 42 ++++++++++++++++++++++++++++++++++++++ src/maevies_theater.c | 30 +++++++++++++++++++++++++++ src/maevies_theater.h | 40 ++++++++++++++++++++++++++++++++++++ src/schedule_provider.h | 47 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 201 insertions(+) create mode 100644 src/maevies_movieschedule.c create mode 100644 src/maevies_movieschedule.h create mode 100644 src/maevies_theater.c create mode 100644 src/maevies_theater.h create mode 100644 src/schedule_provider.h diff --git a/src/maevies_movie.h b/src/maevies_movie.h index aeeb6d8..ba25c7f 100644 --- a/src/maevies_movie.h +++ b/src/maevies_movie.h @@ -20,6 +20,7 @@ #define MOVIE_H_ #include +#include "maevies_movieschedule.h" G_BEGIN_DECLS @@ -33,6 +34,7 @@ struct _MaeviesMovie { GSList *cast; gint ranking; gint year; + GSList* movieScheduleList; }; diff --git a/src/maevies_movieschedule.c b/src/maevies_movieschedule.c new file mode 100644 index 0000000..baf2c9a --- /dev/null +++ b/src/maevies_movieschedule.c @@ -0,0 +1,40 @@ +/* + * maevies_movieschedule.c + * + * This file is part of maevies + * Copyright (C) 2009 Gervasio Varela + * + * 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 3 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. + * + */ + +#include "maevies_movieschedule.h" + + +MaeviesMovieSchedule *maevies_movieschedule_new(MaeviesMovieSchedule* theater) { + + MaeviesMovieSchedule *ms = g_new0(MaeviesTheater,1); + + ms->theater = theater; + + return ms; +} + + +MaeviesMovieSchedule *maevies_movieschedule_new(MaeviesMovieSchedule* theater, GSList* timeList) { + + MaeviesMovieSchedule *ms = maevies_movieschedule_new(theater); + + ms->timeList = timeList; + + return ms; +} + diff --git a/src/maevies_movieschedule.h b/src/maevies_movieschedule.h new file mode 100644 index 0000000..dfb0eb8 --- /dev/null +++ b/src/maevies_movieschedule.h @@ -0,0 +1,42 @@ +/* + * maevies_movieschedule.h + * + * This file is part of maevies + * Copyright (C) 2009 Gervasio Varela + * + * 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 3 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. + * + */ + +#ifndef MOVIESCHEDULE_H_ +#define MOVIESCHEDULE_H_ + +#include +#include +#include "maevies_theater.h" + +G_BEGIN_DECLS + +struct _MaeviesMovieSchedule +{ + MaeviesTheater* theater; + GSList* timeList; +}; +typedef struct _MaeviesMovieSchedule MaeviesMovieSchedule; + + +MaeviesMovieSchedule* maevies_movieschedule_new(MaeviesTheater* theater); + +MaeviesMovieSchedule* maevies_movieschedule_new(MaeviesTheater* theater, GSList* tiemList); + +G_END_DECLS + +#endif /* MOVIESCHEDULE_H_ */ diff --git a/src/maevies_theater.c b/src/maevies_theater.c new file mode 100644 index 0000000..cf12d92 --- /dev/null +++ b/src/maevies_theater.c @@ -0,0 +1,30 @@ +/* + * maevies_theater.c + * + * This file is part of maevies + * Copyright (C) 2009 Gervasio Varela + * + * 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 3 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. + * + */ + +#include "maevies_theater.h" + +MaeviesTheater* maevies_theater_new(gchar* name, gchar* address) { + + MaeviesTheater* theater = g_new0(MaeviesTheater,1); + + theater->name = name; + theater->address = address; + + return theater; +} + diff --git a/src/maevies_theater.h b/src/maevies_theater.h new file mode 100644 index 0000000..9cf5d86 --- /dev/null +++ b/src/maevies_theater.h @@ -0,0 +1,40 @@ +/* + * maevies_theater.h + * + * This file is part of maevies + * Copyright (C) 2009 Gervasio Varela + * + * 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 3 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. + * + */ + +#ifndef THEATER_H_ +#define THEATER_H_ + +#include + +G_BEGIN_DECLS + +typedef struct _MaeviesTheater MaeviesTheater; + +struct _MaeviesTheater +{ + + gchar *name; + gchar *address; + +}; + +MaeviesTheater* maevies_theater_new(gchar* name, gchar* address); + +G_END_DECLS + +#endif /* THEATER_H_ */ diff --git a/src/schedule_provider.h b/src/schedule_provider.h new file mode 100644 index 0000000..609d66c --- /dev/null +++ b/src/schedule_provider.h @@ -0,0 +1,47 @@ +/* + * schedule_provider.h + * + * This file is part of maevies + * Copyright (C) 2009 Gervasio Varela + * + * 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 3 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. + * + */ + +#ifndef SCHEDULE_PROVIDER_H_ +#define SCHEDULE_PROVIDER_H_ + +#include +#include "maevies_theater.h" +#include "maevies_movieschedule.h" + + +/** Retrieves the schedule of a given movie near a given geographical + * area (city, state, GPS coordiantes, etc.). + * @param movie The movie whose schedule is required + * @param where A string reprensenting a city, a state, GPS coordiantes + * to search for theaters near it + * @return A list of MaeviesMovieSchedule objects + **/ +GSList* get_movie_schedule_near_city(MaeviesMovie* movie, gchar* where); + + +/** Retrieves the movies available to watch near a given a geographical + * area (city, state, GPS coordinates, etc.). + * @param where A string reprensenting a city, a state, GPS coordiantes + * to search for theaters near it + * @return A list of MaeviesMovie objects + **/ +GSList* get_shedule_near_city(gchar* where); + + + +#endif /* SCHEDULE_PROVIDER_H_ */ -- 1.7.9.5