aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-05-02 20:37:17 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-05-02 20:37:17 +0800
commitcde584d3484348fd434d22b853292e93b4134a2c (patch)
tree9dd21dc201436f4e65d24b31797d598a560ca09b
parentce850eda80ba927be45a5c559a38a8b18cbc53aa (diff)
downloadgsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.tar
gsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.tar.gz
gsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.tar.bz2
gsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.tar.lz
gsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.tar.xz
gsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.tar.zst
gsoc2013-evolution-cde584d3484348fd434d22b853292e93b4134a2c.zip
unref the model again (task_editor_edit_comp): don't allow editing if the
2003-05-01 JP Rosevear <jpr@ximian.com> * gui/dialogs/task-editor.c (task_editor_finalize): unref the model again (task_editor_edit_comp): don't allow editing if the assignee has delegated * gui/dialogs/meeting-page.c (popup_delete_cb): set the new non-delegator to be editable * gui/dialogs/event-editor.c (event_editor_edit_comp): don't allow editing if the attendee has delegated (event_editor_finalize): unref the model again * gui/e-meeting-model.c: remove e-table-without related functions (finalize): don't create without table (e_meeting_model_etable_from_model): build the table with this as model (e_meeting_model_etable_model_to_view_row): directly use the model_to_view call (e_meeting_model_etable_view_to_model_row): as above (attendee_changed_cb): make sure pre change is alwasy called * gui/e-meeting-model.h: use DECLS, remove protos for long dead functions, don't include config.h svn path=/trunk/; revision=21045
-rw-r--r--calendar/ChangeLog26
-rw-r--r--calendar/gui/dialogs/.cvsignore3
-rw-r--r--calendar/gui/dialogs/event-editor.c8
-rw-r--r--calendar/gui/dialogs/meeting-page.c4
-rw-r--r--calendar/gui/dialogs/task-editor.c7
-rw-r--r--calendar/gui/e-meeting-model.c90
-rw-r--r--calendar/gui/e-meeting-model.h23
7 files changed, 57 insertions, 104 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 514a0fd94a..ef4a06c16f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,29 @@
+2003-05-01 JP Rosevear <jpr@ximian.com>
+
+ * gui/dialogs/task-editor.c (task_editor_finalize): unref the
+ model again
+ (task_editor_edit_comp): don't allow editing if the assignee has
+ delegated
+
+ * gui/dialogs/meeting-page.c (popup_delete_cb): set the new
+ non-delegator to be editable
+
+ * gui/dialogs/event-editor.c (event_editor_edit_comp): don't allow
+ editing if the attendee has delegated
+ (event_editor_finalize): unref the model again
+
+ * gui/e-meeting-model.c: remove e-table-without related functions
+ (finalize): don't create without table
+ (e_meeting_model_etable_from_model): build the table with this as
+ model
+ (e_meeting_model_etable_model_to_view_row): directly use the
+ model_to_view call
+ (e_meeting_model_etable_view_to_model_row): as above
+ (attendee_changed_cb): make sure pre change is alwasy called
+
+ * gui/e-meeting-model.h: use DECLS, remove protos for long dead
+ functions, don't include config.h
+
2003-04-30 Rodrigo Moya <rodrigo@ximian.com>
* gui/alarm-notify/alarm-notify.c (alarm_notify_add_calendar): removed
diff --git a/calendar/gui/dialogs/.cvsignore b/calendar/gui/dialogs/.cvsignore
index 3c01d14597..182657d5ac 100644
--- a/calendar/gui/dialogs/.cvsignore
+++ b/calendar/gui/dialogs/.cvsignore
@@ -2,4 +2,7 @@
.pure
Makefile
Makefile.in
+Evolution-Addressbook-SelectNames-common.c
+Evolution-Addressbook-SelectNames-skels.c
+Evolution-Addressbook-SelectNames-stubs.c
Evolution-Addressbook-SelectNames.h
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 73bb0e7d7b..93d0a39c53 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -300,7 +300,9 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
EMeetingAttendee *ia;
ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
- if (!comp_editor_get_user_org (editor))
+
+ /* If we aren't the organizer or the attendee is just delegating, don't allow editing */
+ if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia))
e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE);
e_meeting_model_add_attendee (priv->model, ia);
@@ -395,11 +397,7 @@ event_editor_finalize (GObject *object)
g_object_unref((priv->meet_page));
g_object_unref((priv->sched_page));
-#if 0
- /* FIXME we don't unref here because we "sink" in
- e-meeting-model.c:init */
g_object_unref (priv->model);
-#endif
g_free (priv);
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index d7e6e80d24..b511e44f01 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -683,8 +683,10 @@ popup_delete_cb (GtkWidget *widget, gpointer data)
EMeetingAttendee *ib;
ib = e_meeting_model_find_attendee (priv->model, e_meeting_attendee_get_delfrom (ia), &pos);
- if (ib != NULL)
+ if (ib != NULL) {
e_meeting_attendee_set_delto (ib, NULL);
+ e_meeting_attendee_set_edit_level (ib, E_MEETING_ATTENDEE_EDIT_FULL);
+ }
}
/* Handle deleting all attendees in the delegation chain */
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index d6f54bb288..f5add85a29 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -256,7 +256,8 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
EMeetingAttendee *ia;
ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
- if (!comp_editor_get_user_org (editor))
+ /* If we aren't the organizer or the attendee is just delegating, don't allow editing */
+ if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia))
e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE);
e_meeting_model_add_attendee (priv->model, ia);
@@ -349,11 +350,7 @@ task_editor_finalize (GObject *object)
g_object_unref((priv->task_details_page));
g_object_unref((priv->meet_page));
-#if 0
- /* FIXME we don't unref here because we "sink" in
- e-meeting-model.c:init */
g_object_unref (priv->model);
-#endif
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index ce6142fc7a..dddc1f2f25 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -56,9 +56,7 @@
struct _EMeetingModelPrivate
{
GPtrArray *attendees;
- GList *edit_rows;
- ETableWithout *without;
GList *tables;
CalClient *client;
@@ -576,41 +574,6 @@ value_to_string (ETableModel *etm, int col, const void *val)
return g_strdup (val);
}
-static void *
-get_key (ETableModel *source, int row, gpointer data)
-{
- EMeetingModel *im;
- EMeetingModelPrivate *priv;
- char *str;
-
- im = E_MEETING_MODEL (source);
- priv = im->priv;
-
- str = value_at (source, E_MEETING_MODEL_DELTO_COL, row);
- if (str && *str)
- return g_strdup ("delegator");
-
- return g_strdup ("none");
-}
-
-static void *
-duplicate_key (const void *key, gpointer data)
-{
- return g_strdup (key);
-}
-
-static void
-free_gotten_key (void *key, gpointer data)
-{
- g_free (key);
-}
-
-static void
-free_duplicated_key (void *key, gpointer data)
-{
- g_free (key);
-}
-
static void
class_init (EMeetingModelClass *klass)
{
@@ -649,20 +612,6 @@ init (EMeetingModel *im)
priv->attendees = g_ptr_array_new ();
- priv->without = E_TABLE_WITHOUT (e_table_without_new (E_TABLE_MODEL (im),
- g_str_hash,
- g_str_equal,
- get_key,
- duplicate_key,
- free_gotten_key,
- free_duplicated_key,
- NULL));
- e_table_without_hide (priv->without, "delegator");
-
- /* FIXME We basically sink a ref otherwise the without table
- * will own a ref to us and we will never get finalized */
- g_object_unref (im);
-
priv->tables = NULL;
priv->client = NULL;
@@ -881,7 +830,7 @@ e_meeting_model_add_attendee (EMeetingModel *im, EMeetingAttendee *ia)
g_object_ref (ia);
g_ptr_array_add (priv->attendees, ia);
-
+
g_signal_connect (ia, "changed", G_CALLBACK (attendee_changed_cb), im);
e_table_model_row_inserted (E_TABLE_MODEL (im), row_count (E_TABLE_MODEL (im)) - 1);
@@ -930,13 +879,13 @@ e_meeting_model_remove_attendee (EMeetingModel *im, EMeetingAttendee *ia)
gint i, row = -1;
priv = im->priv;
-
+
for (i = 0; i < priv->attendees->len; i++) {
if (ia == g_ptr_array_index (priv->attendees, i)) {
row = i;
break;
}
- }
+ }
if (row != -1) {
e_table_model_pre_change (E_TABLE_MODEL (im));
@@ -964,8 +913,8 @@ e_meeting_model_remove_all_attendees (EMeetingModel *im)
EMeetingAttendee *ia = g_ptr_array_index (priv->attendees, i);
g_object_unref (ia);
}
-
g_ptr_array_set_size (priv->attendees, 0);
+
e_table_model_rows_deleted (E_TABLE_MODEL (im), 0, len);
}
@@ -1020,7 +969,7 @@ e_meeting_model_count_actual_attendees (EMeetingModel *im)
priv = im->priv;
- return e_table_model_row_count (E_TABLE_MODEL (priv->without));
+ return e_table_model_row_count (E_TABLE_MODEL (im));
}
const GPtrArray *
@@ -1543,7 +1492,7 @@ e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, co
priv = im->priv;
- ets = build_etable (E_TABLE_MODEL (priv->without), spec_file, state_file);
+ ets = build_etable (E_TABLE_MODEL (im), spec_file, state_file);
priv->tables = g_list_prepend (priv->tables, ets);
@@ -1578,36 +1527,26 @@ int
e_meeting_model_etable_model_to_view_row (ETable *et, EMeetingModel *im, int model_row)
{
EMeetingModelPrivate *priv;
- int row;
g_return_val_if_fail (im != NULL, -1);
g_return_val_if_fail (E_IS_MEETING_MODEL (im), -1);
priv = im->priv;
- row = e_table_model_to_view_row (et, model_row);
- if (row == -1)
- return -1;
-
- return e_table_subset_model_to_view_row (E_TABLE_SUBSET (priv->without), row);
+ return e_table_model_to_view_row (et, model_row);
}
int
e_meeting_model_etable_view_to_model_row (ETable *et, EMeetingModel *im, int view_row)
{
EMeetingModelPrivate *priv;
- int row;
g_return_val_if_fail (im != NULL, -1);
g_return_val_if_fail (E_IS_MEETING_MODEL (im), -1);
priv = im->priv;
- row = e_table_view_to_model_row (et, view_row);
- if (row == -1)
- return -1;
-
- return e_table_subset_view_to_model_row (E_TABLE_SUBSET (priv->without), row);
+ return e_table_view_to_model_row (et, view_row);
}
@@ -1804,6 +1743,10 @@ attendee_changed_cb (EMeetingAttendee *ia, gpointer data)
priv = im->priv;
+ /* FIXME: Ideally I think you are supposed to call pre_change() before
+ the data structures are changed. */
+ e_table_model_pre_change (E_TABLE_MODEL (im));
+
for (i = 0; i < priv->attendees->len; i++) {
if (ia == g_ptr_array_index (priv->attendees, i)) {
row = i;
@@ -1812,12 +1755,9 @@ attendee_changed_cb (EMeetingAttendee *ia, gpointer data)
}
if (row == -1)
- return;
-
- /* FIXME: Ideally I think you are supposed to call pre_change() before
- the data structures are changed. */
- e_table_model_pre_change (E_TABLE_MODEL (im));
- e_table_model_row_changed (E_TABLE_MODEL (im), row);
+ e_table_model_no_change (E_TABLE_MODEL (im));
+ else
+ e_table_model_row_changed (E_TABLE_MODEL (im), row);
}
static void
diff --git a/calendar/gui/e-meeting-model.h b/calendar/gui/e-meeting-model.h
index aea86c6509..50fba6c7a6 100644
--- a/calendar/gui/e-meeting-model.h
+++ b/calendar/gui/e-meeting-model.h
@@ -20,12 +20,8 @@
* Author: JP Rosevear
*/
-#ifndef _E_MODEL_H_
-#define _E_MODEL_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#ifndef _E_MEETING_MODEL_H_
+#define _E_MEETING_MODEL_H_
#include <gtk/gtk.h>
#include <gal/e-table/e-table-scrolled.h>
@@ -33,10 +29,7 @@
#include <cal-client/cal-client.h>
#include "e-meeting-attendee.h"
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
#define E_TYPE_MEETING_MODEL (e_meeting_model_get_type ())
#define E_MEETING_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MEETING_MODEL, EMeetingModel))
@@ -97,10 +90,6 @@ EMeetingAttendee *e_meeting_model_find_attendee_at_row (EMeetingModel *im, gint
gint e_meeting_model_count_actual_attendees (EMeetingModel *im);
const GPtrArray *e_meeting_model_get_attendees (EMeetingModel *im);
-void e_meeting_model_restricted_add (EMeetingModel *im, int row);
-void e_meeting_model_restricted_remove (EMeetingModel *im, int row);
-void e_meeting_model_restricted_clear (EMeetingModel *im);
-
void e_meeting_model_refresh_all_busy_periods (EMeetingModel *im,
EMeetingTime *start,
EMeetingTime *end,
@@ -122,8 +111,6 @@ int e_meeting_model_etable_view_to_model_row (ETable *et, EMeetingModel *im, int
void e_meeting_model_invite_others_dialog (EMeetingModel *im);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* _E_MEETING_MODEL_H_ */
+#endif