aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog39
-rw-r--r--calendar/gui/calendar-view-factory.c6
-rw-r--r--calendar/gui/calendar-view.c3
-rw-r--r--calendar/gui/e-cal-list-view.c73
-rw-r--r--calendar/gui/e-cal-list-view.etspec12
-rw-r--r--calendar/gui/e-cal-list-view.h19
-rw-r--r--calendar/gui/e-calendar-table.etspec12
-rw-r--r--calendar/gui/e-tasks.c2
-rw-r--r--calendar/gui/gnome-cal.c75
9 files changed, 116 insertions, 125 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 90092a529a..7a2c720e26 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,42 @@
+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
+
2004-03-24 Rodrigo Moya <rodrigo@ximian.com>
* gui/gnome-cal.c (update_query): don't create queries for the clients
diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c
index a90e8a46d4..f8d2d92ce3 100644
--- a/calendar/gui/calendar-view-factory.c
+++ b/calendar/gui/calendar-view-factory.c
@@ -126,9 +126,6 @@ calendar_view_factory_get_title (GalViewFactory *factory)
case GNOME_CAL_MONTH_VIEW:
return _("Month View");
- case GNOME_CAL_LIST_VIEW:
- return _("List View");
-
default:
g_assert_not_reached ();
return NULL;
@@ -158,9 +155,6 @@ calendar_view_factory_get_type_code (GalViewFactory *factory)
case GNOME_CAL_MONTH_VIEW:
return "month_view";
- case GNOME_CAL_LIST_VIEW:
- return "list_view";
-
default:
g_assert_not_reached ();
return NULL;
diff --git a/calendar/gui/calendar-view.c b/calendar/gui/calendar-view.c
index 98a754accd..34fd98e676 100644
--- a/calendar/gui/calendar-view.c
+++ b/calendar/gui/calendar-view.c
@@ -191,9 +191,6 @@ calendar_view_get_type_code (GalView *view)
case GNOME_CAL_MONTH_VIEW:
return "month_view";
- case GNOME_CAL_LIST_VIEW :
- return "list_view";
-
default:
g_assert_not_reached ();
return NULL;
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 19134800d3..73e10e0065 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -73,7 +73,6 @@
static void e_cal_list_view_class_init (ECalListViewClass *class);
static void e_cal_list_view_init (ECalListView *cal_list_view);
static void e_cal_list_view_destroy (GtkObject *object);
-static void e_cal_list_view_update_query (ECalendarView *cal_view);
static GList *e_cal_list_view_get_selected_events (ECalendarView *cal_view);
static gboolean e_cal_list_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
@@ -112,8 +111,6 @@ e_cal_list_view_class_init (ECalListViewClass *class)
view_class->get_selected_events = e_cal_list_view_get_selected_events;
view_class->get_selected_time_range = e_cal_list_view_get_selected_time_range;
view_class->get_visible_time_range = e_cal_list_view_get_visible_time_range;
-
- view_class->update_query = e_cal_list_view_update_query;
}
static gint
@@ -177,28 +174,27 @@ get_current_time_cb (ECellDateEdit *ecde, gpointer data)
return tmp_tm;
}
-static void
-load_table_state (ECalListView *cal_list_view)
+void
+e_cal_list_view_load_state (ECalListView *cal_list_view, gchar *filename)
{
struct stat st;
- if (!cal_list_view->table_state_path)
- return;
+ g_return_if_fail (cal_list_view != NULL);
+ g_return_if_fail (E_IS_CAL_LIST_VIEW (cal_list_view));
+ g_return_if_fail (filename != NULL);
- if (stat (cal_list_view->table_state_path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
- e_table_load_state (e_table_scrolled_get_table (cal_list_view->table_scrolled),
- cal_list_view->table_state_path);
- }
+ if (stat (filename, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode))
+ e_table_load_state (e_table_scrolled_get_table (cal_list_view->table_scrolled), filename);
}
-static void
-save_table_state (ECalListView *cal_list_view)
+void
+e_cal_list_view_save_state (ECalListView *cal_list_view, gchar *filename)
{
- if (!cal_list_view->table_state_path)
- return;
+ g_return_if_fail (cal_list_view != NULL);
+ g_return_if_fail (E_IS_CAL_LIST_VIEW (cal_list_view));
+ g_return_if_fail (filename != NULL);
- e_table_save_state (e_table_scrolled_get_table (cal_list_view->table_scrolled),
- cal_list_view->table_state_path);
+ e_table_save_state (e_table_scrolled_get_table (cal_list_view->table_scrolled), filename);
}
static void
@@ -213,11 +209,6 @@ setup_e_table (ECalListView *cal_list_view)
model = E_CAL_MODEL_CALENDAR (e_calendar_view_get_model (E_CALENDAR_VIEW (cal_list_view)));
- if (cal_list_view->table_scrolled) {
- save_table_state (cal_list_view);
- gtk_widget_destroy (GTK_WIDGET (cal_list_view->table_scrolled));
- }
-
/* Create the header columns */
extras = e_table_extras_new();
@@ -291,12 +282,7 @@ setup_e_table (ECalListView *cal_list_view)
style->fg [GTK_STATE_ACTIVE] = style->text [GTK_STATE_NORMAL];
gtk_widget_set_style (GTK_WIDGET (canvas), style);
- /* Load state, if possible */
-
- load_table_state (cal_list_view);
-
/* Connect signals */
-
g_signal_connect (e_table_scrolled_get_table (cal_list_view->table_scrolled),
"right-click", G_CALLBACK (e_cal_list_view_on_table_right_click), cal_list_view);
@@ -308,13 +294,8 @@ setup_e_table (ECalListView *cal_list_view)
}
GtkWidget *
-e_cal_list_view_construct (ECalListView *cal_list_view, const gchar *table_state_path)
+e_cal_list_view_construct (ECalListView *cal_list_view)
{
- if (table_state_path)
- cal_list_view->table_state_path = g_strdup (table_state_path);
- else
- cal_list_view->table_state_path = NULL;
-
setup_e_table (cal_list_view);
return GTK_WIDGET (cal_list_view);
@@ -327,7 +308,7 @@ e_cal_list_view_construct (ECalListView *cal_list_view, const gchar *table_state
* Creates a new #ECalListView.
**/
GtkWidget *
-e_cal_list_view_new (const gchar *table_state_path)
+e_cal_list_view_new (void)
{
ECalListView *cal_list_view;
ECalModel *model;
@@ -335,7 +316,7 @@ e_cal_list_view_new (const gchar *table_state_path)
model = E_CAL_MODEL (e_cal_model_calendar_new ());
cal_list_view = g_object_new (e_cal_list_view_get_type (), "model", model, NULL);
- if (!e_cal_list_view_construct (cal_list_view, table_state_path)) {
+ if (!e_cal_list_view_construct (cal_list_view)) {
g_message (G_STRLOC ": Could not construct the calendar list GUI");
g_object_unref (cal_list_view);
return NULL;
@@ -365,12 +346,6 @@ e_cal_list_view_destroy (GtkObject *object)
cal_list_view->set_table_id = 0;
}
- if (cal_list_view->table_state_path) {
- save_table_state (cal_list_view);
- g_free (cal_list_view->table_state_path);
- cal_list_view->table_state_path = NULL;
- }
-
if (cal_list_view->cursor_event) {
g_free (cal_list_view->cursor_event);
cal_list_view->cursor_event = NULL;
@@ -384,22 +359,6 @@ e_cal_list_view_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
-static gboolean
-setup_e_table_cb (gpointer data)
-{
- setup_e_table (E_CAL_LIST_VIEW (data));
- E_CAL_LIST_VIEW (data)->set_table_id = 0;
- return FALSE;
-}
-
-static void
-e_cal_list_view_update_query (ECalendarView *cal_list_view)
-{
- if (!E_CAL_LIST_VIEW (cal_list_view)->set_table_id)
- E_CAL_LIST_VIEW (cal_list_view)->set_table_id =
- g_idle_add (setup_e_table_cb, cal_list_view);
-}
-
static void
e_cal_list_view_show_popup_menu (ECalListView *cal_list_view, gint row, GdkEvent *gdk_event)
{
diff --git a/calendar/gui/e-cal-list-view.etspec b/calendar/gui/e-cal-list-view.etspec
index 49a12bc849..01e3e15979 100644
--- a/calendar/gui/e-cal-list-view.etspec
+++ b/calendar/gui/e-cal-list-view.etspec
@@ -1,17 +1,13 @@
<ETableSpecification draw-grid="true" alternating-row-colors="true">
- <ETableColumn model_col="0" _title="Categories" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
- <ETableColumn model_col="1" _title="Classification" expansion="1.0" minimum_width="10" resizable="true" cell="classification" compare="string" priority="-1"/>
- <ETableColumn model_col="2" _title="color" cell="calcolor" priority="-4"/>
- <ETableColumn model_col="3" _title="component" cell="calcomp" priority="-4"/>
- <ETableColumn model_col="4" _title="Description" expansion="2.0" minimum_width="10" resizable="true" cell="calstring" compare="string" priority="-1"/>
<ETableColumn model_col="5" _title="Start Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
+ <ETableColumn model_col="10" _title="End Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col="8" _title="Summary" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="string" priority="10"/>
+ <ETableColumn model_col="11" _title="Location" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="string" priority="10"/>
<ETableState>
- <column source="4"/>
- <column source="3"/>
- <column source="1"/>
+ <column source="2"/>
<column source="0"/>
+ <column source="1"/>
<grouping></grouping>
</ETableState>
</ETableSpecification>
diff --git a/calendar/gui/e-cal-list-view.h b/calendar/gui/e-cal-list-view.h
index 55eb79f94d..6b700c7b8a 100644
--- a/calendar/gui/e-cal-list-view.h
+++ b/calendar/gui/e-cal-list-view.h
@@ -31,9 +31,7 @@
#include "e-calendar-view.h"
#include "gnome-cal.h"
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
/*
* ECalListView - displays calendar events in an ETable.
@@ -54,9 +52,6 @@ struct _ECalListView
/* The main display table */
ETableScrolled *table_scrolled;
- /* The path to the table's state file */
- gchar *table_state_path;
-
/* S-expression for query and the query object */
ECalView *query;
@@ -80,18 +75,16 @@ struct _ECalListViewClass
GtkType e_cal_list_view_get_type (void);
-GtkWidget *e_cal_list_view_construct (ECalListView *cal_list_view, const gchar *table_state_path);
+GtkWidget *e_cal_list_view_construct (ECalListView *cal_list_view);
-GtkWidget *e_cal_list_view_new (const gchar *table_state_path);
+GtkWidget *e_cal_list_view_new (void);
+void e_cal_list_view_load_state (ECalListView *cal_list_view, gchar *filename);
+void e_cal_list_view_save_state (ECalListView *cal_list_view, gchar *filename);
-void e_cal_list_view_set_query (ECalListView *cal_list_view, const gchar *sexp);
-void e_cal_list_view_set_default_category (ECalListView *cal_list_view, const gchar *category);
gboolean e_cal_list_view_get_range_shown (ECalListView *cal_list_view, GDate *start_date,
gint *days_shown);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_CAL_LIST_VIEW_H_ */
diff --git a/calendar/gui/e-calendar-table.etspec b/calendar/gui/e-calendar-table.etspec
index 84957fe207..ec65c07619 100644
--- a/calendar/gui/e-calendar-table.etspec
+++ b/calendar/gui/e-calendar-table.etspec
@@ -1,25 +1,19 @@
<ETableSpecification click-to-add="true" _click-to-add-message="Click to add a task" draw-grid="true">
- <ETableColumn model_col= "0" _title="Categories" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
- <ETableColumn model_col= "1" _title="Classification" expansion="1.0" minimum_width="10" resizable="true" cell="classification" compare="string" priority="-1"/>
- <ETableColumn model_col="4" _title="Description" expansion="2.0" minimum_width="10" resizable="true" cell="calstring" compare="string" priority="-1"/>
<ETableColumn model_col= "5" _title="Start date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
- <ETableColumn model_col="6" _title="Alarms" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string" disabled="true"/>
<ETableColumn model_col="7" pixbuf="icon" _title="Type" expansion="1.0" minimum_width="16" resizable="false" cell="icon" compare="integer" priority="-4"/>
<ETableColumn model_col= "8" _title="Summary" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="string" priority="10"/>
<ETableColumn model_col= "10" _title="Completion date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col="11" pixbuf="complete" _title="Complete" expansion="1.0" minimum_width="16" resizable="false" cell="checkbox" compare="integer" priority="-4"/>
<ETableColumn model_col= "12" _title="Due date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
- <ETableColumn model_col= "13" _title="Geographical position" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
<ETableColumn model_col= "15" _title="% Complete" expansion="1.0" minimum_width="10" resizable="true" cell="percent" compare="percent-compare" priority="-3"/>
<ETableColumn model_col= "16" _title="Priority" expansion="1.0" minimum_width="10" resizable="true" cell="priority" compare="priority-compare" priority="-3"/>
<ETableColumn model_col="17" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="calstatus" compare="string" priority="-1"/>
- <ETableColumn model_col="18" _title="URL" expansion="2.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
<ETableColumn model_col="19" _title="Task sort" cell="task-sort" compare="task-sort" priority="-4"/>
<ETableState>
- <column source="7"/>
- <column source="11"/>
- <column source= "8"/>
+ <column source="1"/>
+ <column source="4"/>
+ <column source= "2"/>
<grouping></grouping>
</ETableState>
</ETableSpecification>
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 4506b5a529..162634c035 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -1161,7 +1161,7 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
gal_view_collection_load (collection);
}
- priv->view_instance = gal_view_instance_new (collection, e_cal_get_uri (e_tasks_get_default_client (tasks)));
+ priv->view_instance = gal_view_instance_new (collection, NULL);
priv->view_menus = gal_view_menus_new (priv->view_instance);
gal_view_menus_apply (priv->view_menus, uic, NULL);
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);