aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-03-26 01:56:07 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-03-26 01:56:07 +0800
commit41810f55a293ed42e3c1cfc19accad1f1fc174e9 (patch)
tree37ce26e31863f7ab3cf9fad4e4af45741fbf4558 /calendar/gui/gnome-cal.c
parent61c49c3f7c94940fc356c08cdd66fde5fee49090 (diff)
downloadgsoc2013-evolution-41810f55a293ed42e3c1cfc19accad1f1fc174e9.tar.gz
gsoc2013-evolution-41810f55a293ed42e3c1cfc19accad1f1fc174e9.tar.zst
gsoc2013-evolution-41810f55a293ed42e3c1cfc19accad1f1fc174e9.zip
Fixes #53499
2004-03-25 JP Rosevear <jpr@ximian.com> Fixes #53499 * gui/gnome-cal.c (setup_widgets): don't give the state file to the list view (set_view): ensure that if the list view was in custom mode it stays that way (display_view_cb): attach to the etable of the list view (gnome_calendar_setup_view_menus): use an etable gal view for the list view and don't set the view twice * gui/e-tasks.c (e_tasks_setup_view_menus): the instance should no longer be per task uri since all the uris are shown together * gui/e-cal-list-view.h: update/add protos * gui/e-cal-list-view.etspec: limit the available columns to what product design agreed on * gui/e-calendar-table.etspec: ditto * gui/e-cal-list-view.c (e_cal_list_view_class_init): ignore update query calls (e_cal_list_view_load_state): make public (e_cal_list_view_save_state): ditto (setup_e_table): don't handle state saving ourselves (e_cal_list_view_construct): ditto (e_cal_list_view_new): ditto (e_cal_list_view_destroy): ditto * gui/calendar-view.c (calendar_view_get_type_code): we don't handle the list view here * gui/calendar-view-factory.c (calendar_view_factory_get_type_code): we don't handle the list view here (calendar_view_factory_get_title): ditto svn path=/trunk/; revision=25185
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c75
1 files changed, 47 insertions, 28 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 0e46d0fb6e..6c489207d8 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -43,6 +43,8 @@
#include <bonobo/bonobo-exception.h>
#include "e-util/e-url.h"
#include <libecal/e-cal-time-util.h>
+#include <gal/menus/gal-view-factory-etable.h>
+#include <gal/menus/gal-view-etable.h>
#include "widgets/menus/gal-view-menus.h"
#include "e-comp-editor-registry.h"
#include "dialogs/delete-error.h"
@@ -1043,10 +1045,7 @@ setup_widgets (GnomeCalendar *gcal)
connect_week_view_focus (gcal, E_WEEK_VIEW (priv->month_view));
/* The List View. */
- filename = g_build_filename (calendar_component_peek_config_directory (calendar_component_peek ()),
- "CalListView", NULL);
- priv->list_view = e_cal_list_view_new (filename);
- g_free (filename);
+ priv->list_view = e_cal_list_view_new ();
e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->list_view), gcal);
@@ -1493,8 +1492,17 @@ set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
updating = TRUE;
gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), (int) view_type);
- if (priv->view_instance)
- gal_view_instance_set_current_view_id (priv->view_instance, view_id);
+ if (priv->view_instance) {
+ char *current_id;
+
+ /* If the list view is actually in "custom" mode, preserve that */
+ current_id = gal_view_instance_get_current_view_id (priv->view_instance);
+
+ if (current_id || view_type != GNOME_CAL_LIST_VIEW)
+ gal_view_instance_set_current_view_id (priv->view_instance, view_id);
+
+ g_free (current_id);
+ }
updating = FALSE;
if (grab_focus)
@@ -1540,16 +1548,30 @@ static void
display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data)
{
GnomeCalendar *gcal;
+ GnomeCalendarPrivate *priv;
CalendarView *cal_view;
-
+ GnomeCalendarViewType view_type;
+
gcal = GNOME_CALENDAR (data);
-
- if (!IS_CALENDAR_VIEW (view))
+ priv = gcal->priv;
+
+ if (GAL_IS_VIEW_ETABLE(view)) {
+ ETable *table;
+
+ view_type = GNOME_CAL_LIST_VIEW;
+
+ table = e_table_scrolled_get_table (E_CAL_LIST_VIEW (priv->list_view)->table_scrolled);
+ gal_view_etable_attach_table (GAL_VIEW_ETABLE (view), table);
+ } else if (IS_CALENDAR_VIEW (view)) {
+ cal_view = CALENDAR_VIEW (view);
+
+ view_type = calendar_view_get_view_type (cal_view);
+ } else {
g_error (G_STRLOC ": Unknown type of view for GnomeCalendar");
-
- cal_view = CALENDAR_VIEW (view);
-
- gnome_calendar_set_view (gcal, calendar_view_get_view_type (cal_view), FALSE, TRUE);
+ return;
+ }
+
+ gnome_calendar_set_view (gcal, view_type, FALSE, TRUE);
}
/**
@@ -1567,6 +1589,7 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
GnomeCalendarPrivate *priv;
char *path;
CalendarViewFactory *factory;
+ GalViewFactory *gal_factory;
static GalViewCollection *collection = NULL;
g_return_if_fail (gcal != NULL);
@@ -1576,14 +1599,13 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
priv = gcal->priv;
- g_return_if_fail (priv->view_instance == NULL);
-
g_assert (priv->view_instance == NULL);
g_assert (priv->view_menus == NULL);
/* Create the view instance */
-
if (collection == NULL) {
+ ETableSpecification *spec;
+
collection = gal_view_collection_new ();
gal_view_collection_set_title (collection, _("Calendar"));
@@ -1613,25 +1635,24 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
g_object_unref (factory);
- factory = calendar_view_factory_new (GNOME_CAL_LIST_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- g_object_unref (factory);
+ spec = e_table_specification_new ();
+ e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/e-cal-list-view.etspec");
+ gal_factory = gal_view_factory_etable_new (spec);
+ g_object_unref (spec);
+ gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (gal_factory));
+ g_object_unref (gal_factory);
/* Load the collection and create the menus */
gal_view_collection_load (collection);
- }
- priv->view_instance = gal_view_instance_new (collection,
- e_cal_get_uri (gnome_calendar_get_default_client (gcal)));
+ }
+ priv->view_instance = gal_view_instance_new (collection, NULL);
priv->view_menus = gal_view_menus_new (priv->view_instance);
- gal_view_menus_set_show_define_views (priv->view_menus, FALSE);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gnome_calendar_set_view (gcal, priv->current_view_type, TRUE, FALSE);
- g_signal_connect (priv->view_instance, "display_view",
- G_CALLBACK (display_view_cb), gcal);
+ g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (display_view_cb), gcal);
display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), gcal);
}
@@ -1652,8 +1673,6 @@ gnome_calendar_discard_view_menus (GnomeCalendar *gcal)
priv = gcal->priv;
- g_return_if_fail (priv->view_instance != NULL);
-
g_assert (priv->view_instance != NULL);
g_assert (priv->view_menus != NULL);