aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-09-27 16:10:45 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-09-27 16:10:45 +0800
commitca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1 (patch)
tree4f84320315e1a58b7fa5d48c47405cfe6ab1b07d /calendar
parentfec468e9409d12dc2b37546d646908209da42fdd (diff)
downloadgsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.tar
gsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.tar.gz
gsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.tar.bz2
gsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.tar.lz
gsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.tar.xz
gsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.tar.zst
gsoc2013-evolution-ca9ceb157cff46f1ecddd0b807d9b7776c0f7ca1.zip
2007-09-27 mcrha Fix for bug #346686
svn path=/trunk/; revision=34315
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog13
-rw-r--r--calendar/gui/e-cal-model-calendar.c3
-rw-r--r--calendar/gui/e-cal-model-memos.c2
-rw-r--r--calendar/gui/e-cal-model-tasks.c3
-rw-r--r--calendar/gui/e-cal-model.c38
-rw-r--r--calendar/gui/e-cal-model.h2
6 files changed, 60 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e9ce1b9f68..005901f43a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,18 @@
2007-09-27 Milan Crha <mcrha@redhat.com>
+ ** Fix for bug #346686
+
+ * gui/e-cal-model.h: (e_cal_model_test_row_editable):
+ * gui/e-cal-model.c: (e_cal_model_test_row_editable): New helper
+ function to check if row is editable or not, based on calendar.
+ * gui/e-cal-model-memos.c: (ecmm_is_cell_editable):
+ * gui/e-cal-model-tasks.c: (ecmt_is_cell_editable):
+ * gui/e-cal-model-calendar.c: (ecmc_is_cell_editable):
+ * gui/e-cal-model.c: (ecm_is_cell_editable):
+ Uses new helper function to determine if row is editable.
+
+2007-09-27 Milan Crha <mcrha@redhat.com>
+
** Fix for bug #324472
* gui/e-calendar-table.c: (struct AffectedComponents),
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 6d4ffdf3d7..19e257523a 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -403,6 +403,9 @@ ecmc_is_cell_editable (ETableModel *etm, int col, int row)
if (col < E_CAL_MODEL_FIELD_LAST)
return E_TABLE_MODEL_CLASS (e_cal_model_calendar_parent_class)->is_cell_editable (etm, col, row);
+ if (!e_cal_model_test_row_editable (E_CAL_MODEL (etm), row))
+ return FALSE;
+
switch (col) {
case E_CAL_MODEL_CALENDAR_FIELD_DTEND :
case E_CAL_MODEL_CALENDAR_FIELD_LOCATION :
diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c
index 1b08b714dd..877e3fb8ec 100644
--- a/calendar/gui/e-cal-model-memos.c
+++ b/calendar/gui/e-cal-model-memos.c
@@ -172,6 +172,8 @@ ecmm_is_cell_editable (ETableModel *etm, int col, int row)
g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_MEMOS_FIELD_LAST, FALSE);
g_return_val_if_fail (row >= -1 || (row >= 0 && row < e_table_model_row_count (etm)), FALSE);
+ if (!e_cal_model_test_row_editable (E_CAL_MODEL (etm), row))
+ return FALSE;
if (col < E_CAL_MODEL_FIELD_LAST)
retval = E_TABLE_MODEL_CLASS (e_cal_model_memos_parent_class)->is_cell_editable (etm, col, row);
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 9afd09fe5c..66e7c536d5 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -846,6 +846,9 @@ ecmt_is_cell_editable (ETableModel *etm, int col, int row)
if (col < E_CAL_MODEL_FIELD_LAST)
return E_TABLE_MODEL_CLASS (e_cal_model_tasks_parent_class)->is_cell_editable (etm, col, row);
+ if (!e_cal_model_test_row_editable (E_CAL_MODEL (etm), row))
+ return FALSE;
+
switch (col) {
case E_CAL_MODEL_TASKS_FIELD_COMPLETED :
case E_CAL_MODEL_TASKS_FIELD_COMPLETE :
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index a86c893cc6..36466c1ac1 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -710,6 +710,41 @@ ecm_set_value_at (ETableModel *etm, int col, int row, const void *value)
}
}
+/**
+ * e_cal_model_test_row_editable
+ * Checks if component at row 'row' is editable or not. It doesn't check bounds for 'row'.
+ *
+ * @param model Calendar model.
+ * @param row Row of our interest. -1 is editable only when default client is editable.
+ * @return Whether row is editable or not.
+ **/
+gboolean
+e_cal_model_test_row_editable (ECalModel *model, int row)
+{
+ gboolean readonly;
+ ECal *cal = NULL;
+
+ if (row != -1) {
+ ECalModelComponent *comp_data;
+
+ comp_data = e_cal_model_get_component_at (model, row);
+
+ if (comp_data)
+ cal = comp_data->client;
+
+ } else {
+ cal = e_cal_model_get_default_client (model);
+ }
+
+ readonly = cal == NULL;
+
+ if (!readonly)
+ if (!e_cal_is_read_only (cal, &readonly, NULL))
+ readonly = TRUE;
+
+ return !readonly;
+}
+
static gboolean
ecm_is_cell_editable (ETableModel *etm, int col, int row)
{
@@ -723,6 +758,9 @@ ecm_is_cell_editable (ETableModel *etm, int col, int row)
g_return_val_if_fail (col >= 0 && col <= E_CAL_MODEL_FIELD_LAST, FALSE);
g_return_val_if_fail (row >= -1 || (row >= 0 && row < priv->objects->len), FALSE);
+ if (!e_cal_model_test_row_editable (E_CAL_MODEL (etm), row))
+ return FALSE;
+
switch (col) {
case E_CAL_MODEL_FIELD_CATEGORIES :
case E_CAL_MODEL_FIELD_CLASSIFICATION :
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index c59ed9e6c9..45504acf4e 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -156,7 +156,7 @@ GPtrArray * e_cal_model_get_object_array (ECalModel *model);
void e_cal_model_set_instance_times (ECalModelComponent *comp_data, const icaltimezone *zone);
void e_cal_model_set_search_query_with_time_range (ECalModel *model, const char *sexp, time_t start, time_t end);
-
+gboolean e_cal_model_test_row_editable (ECalModel *model, int row);
G_END_DECLS