aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/e-tasks.c66
-rw-r--r--calendar/gui/gnome-cal.c80
3 files changed, 85 insertions, 67 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 2fe5e36a1b..211835f769 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2002-02-07 Christopher James Lahey <clahey@ximian.com>
+
+ * gui/e-tasks.c (e_tasks_setup_view_menus), gui/gnome-cal.c
+ (gnome_calendar_setup_view_menus): Made these use the new
+ GalViewMenus stuff.
+
2002-02-06 Damon Chaplin <damon@ximian.com>
* cal-util/cal-recur.c (cal_recur_from_icalproperty): convert months
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 3edb4da7c8..2fa52dd652 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -26,7 +26,7 @@
#include <gnome.h>
#include <gal/util/e-util.h>
#include <gal/e-table/e-table-scrolled.h>
-#include <gal/menus/gal-view-collection.h>
+#include <gal/menus/gal-view-instance.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
#include "widgets/menus/gal-view-menus.h"
@@ -54,8 +54,8 @@ struct _ETasksPrivate {
/* Calendar search bar for tasks */
GtkWidget *search_bar;
- /* View collection and the view menus handler */
- GalViewCollection *view_collection;
+ /* View instance and the view menus handler */
+ GalViewInstance *view_instance;
GalViewMenus *view_menus;
};
@@ -122,7 +122,7 @@ e_tasks_init (ETasks *tasks)
priv->client = NULL;
priv->query = NULL;
- priv->view_collection = NULL;
+ priv->view_instance = NULL;
priv->view_menus = NULL;
setup_widgets (tasks);
@@ -646,7 +646,7 @@ e_tasks_delete_completed (ETasks *tasks)
/* Callback used from the view collection when we need to display a new view */
static void
-display_view_cb (GalViewCollection *collection, GalView *view, gpointer data)
+display_view_cb (GalViewInstance *instance, GalView *view, gpointer data)
{
ETasks *tasks;
@@ -674,6 +674,7 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
GalViewFactory *factory;
ETableSpecification *spec;
char *dir;
+ static GalViewCollection *collection = NULL;
g_return_if_fail (tasks != NULL);
g_return_if_fail (E_IS_TASKS (tasks));
@@ -682,40 +683,45 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
priv = tasks->priv;
- g_return_if_fail (priv->view_collection == NULL);
+ g_return_if_fail (priv->view_instance == NULL);
- g_assert (priv->view_collection == NULL);
+ g_assert (priv->view_instance == NULL);
g_assert (priv->view_menus == NULL);
- /* Create the view collection */
+ /* Create the view instance */
- priv->view_collection = gal_view_collection_new ();
+ if (collection == NULL) {
+ collection = gal_view_collection_new ();
- dir = gnome_util_prepend_user_home ("/evolution/views/tasks/");
- gal_view_collection_set_storage_directories (priv->view_collection,
- EVOLUTION_DATADIR "/evolution/views/tasks/",
- dir);
- g_free (dir);
+ dir = gnome_util_prepend_user_home ("/evolution/views/tasks/");
+ gal_view_collection_set_storage_directories (collection,
+ EVOLUTION_DATADIR "/evolution/views/tasks/",
+ dir);
+ g_free (dir);
- /* Create the views */
+ /* Create the views */
- spec = e_table_specification_new ();
- e_table_specification_load_from_file (spec,
- EVOLUTION_ETSPECDIR "/e-calendar-table.etspec");
+ spec = e_table_specification_new ();
+ e_table_specification_load_from_file (spec,
+ EVOLUTION_ETSPECDIR "/e-calendar-table.etspec");
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (priv->view_collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = gal_view_factory_etable_new (spec);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
- /* Load the collection and create the menus */
+ /* Load the collection and create the menus */
- gal_view_collection_load (priv->view_collection);
+ gal_view_collection_load (collection);
+ }
+
+ priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
- priv->view_menus = gal_view_menus_new (priv->view_collection);
+ priv->view_menus = gal_view_menus_new (priv->view_instance);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gtk_signal_connect (GTK_OBJECT (priv->view_collection), "display_view",
+ gtk_signal_connect (GTK_OBJECT (priv->view_instance), "display_view",
GTK_SIGNAL_FUNC (display_view_cb), tasks);
+ display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), tasks);
}
/**
@@ -736,13 +742,13 @@ e_tasks_discard_view_menus (ETasks *tasks)
priv = tasks->priv;
- g_return_if_fail (priv->view_collection != NULL);
+ g_return_if_fail (priv->view_instance != NULL);
- g_assert (priv->view_collection != NULL);
+ g_assert (priv->view_instance != NULL);
g_assert (priv->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (priv->view_collection));
- priv->view_collection = NULL;
+ gtk_object_unref (GTK_OBJECT (priv->view_instance));
+ priv->view_instance = NULL;
gtk_object_unref (GTK_OBJECT (priv->view_menus));
priv->view_menus = NULL;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 664fac4bc8..1590117672 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -129,8 +129,8 @@ struct _GnomeCalendarPrivate {
/* The signal handler id for our GtkCalendar "day_selected" handler. */
guint day_selected_id;
- /* View collection and menus for the control */
- GalViewCollection *view_collection;
+ /* View instance and menus for the control */
+ GalViewInstance *view_instance;
GalViewMenus *view_menus;
/* Whether we are being destroyed and should not mess with the object
@@ -917,7 +917,7 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->zone);
priv->selection_end_time = time_add_day_with_zone (priv->selection_start_time, 1, priv->zone);
- priv->view_collection = NULL;
+ priv->view_instance = NULL;
priv->view_menus = NULL;
priv->visible_start = -1;
@@ -999,9 +999,9 @@ gnome_calendar_destroy (GtkObject *object)
g_hash_table_destroy (priv->object_editor_hash);
priv->object_editor_hash = NULL;
- if (priv->view_collection) {
- gtk_object_unref (GTK_OBJECT (priv->view_collection));
- priv->view_collection = NULL;
+ if (priv->view_instance) {
+ gtk_object_unref (GTK_OBJECT (priv->view_instance));
+ priv->view_instance = NULL;
}
if (priv->view_menus) {
@@ -1325,7 +1325,7 @@ gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
/* Callback used when the view collection asks us to display a particular view */
static void
-display_view_cb (GalViewCollection *view_collection, GalView *view, gpointer data)
+display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data)
{
GnomeCalendar *gcal;
CalendarView *cal_view;
@@ -1355,6 +1355,7 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
GnomeCalendarPrivate *priv;
char *path;
CalendarViewFactory *factory;
+ static GalViewCollection *collection = NULL;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
@@ -1363,47 +1364,52 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
priv = gcal->priv;
- g_return_if_fail (priv->view_collection == NULL);
+ g_return_if_fail (priv->view_instance == NULL);
- g_assert (priv->view_collection == NULL);
+ g_assert (priv->view_instance == NULL);
g_assert (priv->view_menus == NULL);
- /* Create the view collection */
+ /* Create the view instance */
- priv->view_collection = gal_view_collection_new ();
+ if (collection == NULL) {
+ collection = gal_view_collection_new ();
- path = gnome_util_prepend_user_home ("/evolution/views/calendar/");
- gal_view_collection_set_storage_directories (priv->view_collection,
- EVOLUTION_DATADIR "/evolution/views/calendar/",
- path);
- g_free (path);
+ path = gnome_util_prepend_user_home ("/evolution/views/calendar/");
+ gal_view_collection_set_storage_directories (collection,
+ EVOLUTION_DATADIR "/evolution/views/calendar/",
+ path);
+ g_free (path);
- /* Create the views */
+ /* Create the views */
- factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
- gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
+ gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
- gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
+ gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
- gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
+ gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
- gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
+ gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- /* Load the collection and create the menus */
+ /* Load the collection and create the menus */
- gal_view_collection_load (priv->view_collection);
+ gal_view_collection_load (collection);
+ }
+
+ priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
- priv->view_menus = gal_view_menus_new (priv->view_collection);
+ priv->view_menus = gal_view_menus_new (priv->view_instance);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gtk_signal_connect (GTK_OBJECT (priv->view_collection), "display_view",
+ gtk_signal_connect (GTK_OBJECT (priv->view_instance), "display_view",
GTK_SIGNAL_FUNC (display_view_cb), gcal);
+ display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), gcal);
}
/**
@@ -1423,13 +1429,13 @@ gnome_calendar_discard_view_menus (GnomeCalendar *gcal)
priv = gcal->priv;
- g_return_if_fail (priv->view_collection != NULL);
+ g_return_if_fail (priv->view_instance != NULL);
- g_assert (priv->view_collection != NULL);
+ g_assert (priv->view_instance != NULL);
g_assert (priv->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (priv->view_collection));
- priv->view_collection = NULL;
+ gtk_object_unref (GTK_OBJECT (priv->view_instance));
+ priv->view_instance = NULL;
gtk_object_unref (GTK_OBJECT (priv->view_menus));
priv->view_menus = NULL;