[evolution-patches] Meeting Model



So for better fixing of the meeting model not being freed, i present the
following patch.

Note this now shows the delegators in the dialog but when I thought
about it a) it was weird that if you deleted the delegatee a new
attendee might pop right into place and b) this case happens rarely
(evolution and outlook don't allow it so it would have to come from
somewhere else).

Maybe for further UI improvements down the road, the meeting page could
be a tree with the delegators as children.

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.
? circular-ref.patch
? conduit-libs.patch
? e-meeting.diff
? meeting-model.patch
? warning.patch
? gui/model.patch
? gui/ref.backup
? gui/ref.txt
? gui/dialogs/alarm-options.gladep
? gui/dialogs/event-page.gladep
? gui/dialogs/meeting-page.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1757
diff -u -r1.1757 ChangeLog
--- ChangeLog	30 Apr 2003 11:12:26 -0000	1.1757
+++ ChangeLog	1 May 2003 19:04:16 -0000
@@ -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
Index: conduits/calendar/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/Makefile.am,v
retrieving revision 1.30
diff -u -r1.30 Makefile.am
--- conduits/calendar/Makefile.am	25 Apr 2003 01:59:20 -0000	1.30
+++ conduits/calendar/Makefile.am	1 May 2003 19:04:17 -0000
@@ -23,7 +23,7 @@
 	$(top_builddir)/libversit/libversit.la				\
 	$(top_builddir)/libical/src/libical/libical-static.la		\
 	$(top_builddir)/libwombat/libwombat-static.la		 	\
-	$(top_builddir)/e-util/libeconduit-static.la	 		\
+	$(top_builddir)/e-util/libeconduit.la	 			\
 	$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
 
 e-calendar.conduit: e-calendar.conduit.in Makefile
Index: conduits/todo/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/todo/Makefile.am,v
retrieving revision 1.30
diff -u -r1.30 Makefile.am
--- conduits/todo/Makefile.am	25 Apr 2003 01:59:20 -0000	1.30
+++ conduits/todo/Makefile.am	1 May 2003 19:04:17 -0000
@@ -23,7 +23,7 @@
 	$(top_builddir)/libversit/libversit.la				\
 	$(top_builddir)/libical/src/libical/libical-static.la		\
 	$(top_builddir)/libwombat/libwombat-static.la	 		\
-	$(top_builddir)/e-util/libeconduit-static.la	 		\
+	$(top_builddir)/e-util/libeconduit.la		 		\
 	$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
 
 e-todo.conduit: e-todo.conduit.in Makefile
Index: gui/e-meeting-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-model.c,v
retrieving revision 1.47
diff -u -r1.47 e-meeting-model.c
--- gui/e-meeting-model.c	15 Apr 2003 22:26:10 -0000	1.47
+++ gui/e-meeting-model.c	1 May 2003 19:04:17 -0000
@@ -56,9 +56,7 @@
 struct _EMeetingModelPrivate 
 {
 	GPtrArray *attendees;
-	GList *edit_rows;
 
-	ETableWithout *without;
 	GList *tables;
 	
 	CalClient *client;
@@ -576,41 +574,6 @@
 	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 @@
 
 	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 @@
 
 	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 @@
 	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 @@
 		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 @@
 	
 	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 @@
 
 	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 @@
 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 @@
 	
 	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 @@
 	}
 	
 	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
Index: gui/e-meeting-model.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-model.h,v
retrieving revision 1.10
diff -u -r1.10 e-meeting-model.h
--- gui/e-meeting-model.h	25 Jun 2002 13:11:46 -0000	1.10
+++ gui/e-meeting-model.h	1 May 2003 19:04:17 -0000
@@ -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 @@
 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 @@
 
 void e_meeting_model_invite_others_dialog (EMeetingModel *im);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
-#endif /* _E_MEETING_MODEL_H_ */
+#endif
Index: gui/dialogs/.cvsignore
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/.cvsignore,v
retrieving revision 1.7
diff -u -r1.7 .cvsignore
--- gui/dialogs/.cvsignore	11 Apr 2003 18:18:20 -0000	1.7
+++ gui/dialogs/.cvsignore	1 May 2003 19:04:17 -0000
@@ -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
Index: gui/dialogs/event-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-editor.c,v
retrieving revision 1.32
diff -u -r1.32 event-editor.c
--- gui/dialogs/event-editor.c	29 Apr 2003 18:51:51 -0000	1.32
+++ gui/dialogs/event-editor.c	1 May 2003 19:04:17 -0000
@@ -300,7 +300,9 @@
 			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 @@
 	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);
 
Index: gui/dialogs/meeting-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/meeting-page.c,v
retrieving revision 1.67
diff -u -r1.67 meeting-page.c
--- gui/dialogs/meeting-page.c	22 Apr 2003 21:15:41 -0000	1.67
+++ gui/dialogs/meeting-page.c	1 May 2003 19:04:18 -0000
@@ -683,8 +683,10 @@
 		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 */	
Index: gui/dialogs/task-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-editor.c,v
retrieving revision 1.62
diff -u -r1.62 task-editor.c
--- gui/dialogs/task-editor.c	29 Apr 2003 18:51:51 -0000	1.62
+++ gui/dialogs/task-editor.c	1 May 2003 19:04:18 -0000
@@ -256,7 +256,8 @@
 			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 @@
 	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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]