[evolution-patches] partial fix for addressbook 56520



I outline the necessary changes that'll get us to 100% in the bug
report.  This gets us to about 80%, and fixes things in evo proper.

The contact editor now disables the UI when you select a source that
doesn't support contact-lists (as listed in a static capability).  The
file, vcf, and groupwise backends support contact lists, and thus list
that capability.

Chris


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.173
diff -u -r1.173 ChangeLog
--- ChangeLog	3 Jul 2004 13:04:57 -0000	1.173
+++ ChangeLog	9 Jul 2004 23:00:02 -0000
@@ -1,3 +1,18 @@
+2004-07-09  Chris Toshok  <toshok ximian com>
+
+	[ part of fix for #56520 ]
+	
+	* backends/groupwise/e-book-backend-groupwise.c
+	(e_book_backend_groupwise_get_supported_auth_methods): add
+	"contact-lists".
+
+	* backends/vcf/e-book-backend-vcf.c
+	(e_book_backend_vcf_get_static_capabilities): add "contact-lists".
+
+	* backends/file/e-book-backend-file.c
+	(e_book_backend_file_get_static_capabilities): add
+	"contact-lists".
+
 2004-07-03  Sivaiah Nallagatla <snallagatla novell com>
 
 	* backends/groupwise/e-book-backend-groupwise.c 
@@ -8,8 +23,6 @@
 	(build_summary), (update_summary) : set priv->is_summary_ready 
 	to TRUE when summary loading is done  
 	 
-
-	
 2004-06-26  Chris Toshok  <toshok ximian com>
 
 	* backends/ldap/e-book-backend-ldap.c (get_ldap_library_info): use
Index: backends/file/e-book-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/file/e-book-backend-file.c,v
retrieving revision 1.20
diff -u -r1.20 e-book-backend-file.c
--- backends/file/e-book-backend-file.c	25 Jun 2004 01:01:54 -0000	1.20
+++ backends/file/e-book-backend-file.c	9 Jul 2004 23:00:02 -0000
@@ -1090,7 +1090,7 @@
 static char *
 e_book_backend_file_get_static_capabilities (EBookBackend *backend)
 {
-	return g_strdup("local,do-initial-query,bulk-removes");
+	return g_strdup("local,do-initial-query,bulk-removes,contact-lists");
 }
 
 static GNOME_Evolution_Addressbook_CallStatus
Index: backends/groupwise/e-book-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/groupwise/e-book-backend-groupwise.c,v
retrieving revision 1.24
diff -u -r1.24 e-book-backend-groupwise.c
--- backends/groupwise/e-book-backend-groupwise.c	3 Jul 2004 13:04:57 -0000	1.24
+++ backends/groupwise/e-book-backend-groupwise.c	9 Jul 2004 23:00:03 -0000
@@ -2159,9 +2159,9 @@
   
 	ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
 	if (ebgw->priv->is_writable)
-		return g_strdup("net,bulk-removes,do-initial-query");
+		return g_strdup("net,bulk-removes,do-initial-query,contact-lists");
 	else 
-		return g_strdup("net,bulk-removes");
+		return g_strdup("net,bulk-removes,contact-lists");
 }
 static void 
 e_book_backend_groupwise_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid)
Index: backends/vcf/e-book-backend-vcf.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/vcf/e-book-backend-vcf.c,v
retrieving revision 1.9
diff -u -r1.9 e-book-backend-vcf.c
--- backends/vcf/e-book-backend-vcf.c	25 Jun 2004 01:01:54 -0000	1.9
+++ backends/vcf/e-book-backend-vcf.c	9 Jul 2004 23:00:04 -0000
@@ -622,7 +622,7 @@
 static char *
 e_book_backend_vcf_get_static_capabilities (EBookBackend *backend)
 {
-	return g_strdup("local,do-initial-query");
+	return g_strdup("local,do-initial-query,contact-lists");
 }
 
 static GNOME_Evolution_Addressbook_CallStatus
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1787
diff -u -r1.1787 ChangeLog
--- ChangeLog	2 Jul 2004 18:32:18 -0000	1.1787
+++ ChangeLog	9 Jul 2004 22:57:00 -0000
@@ -1,3 +1,23 @@
+2004-07-09  Chris Toshok  <toshok ximian com>
+
+	[ part of fix for bug #56520 ]
+	
+	* gui/contact-list-editor/e-contact-list-editor.c
+	(e_contact_list_editor_init): init allows_contact_lists to TRUE.
+	(list_deleted_cb): nuke, it's unused.
+	(e_contact_list_editor_set_property): check if the book supports
+	contact lists, and desensitize things if it doesn't.
+	(select_names_ok_cb): this isn't valid C.  declarations must come
+	before code.
+	(set_editable): the editable state of the dialog depends on
+	whether or not the backend supports contact lists.
+	(command_state_changed): the ok button needs to depend on
+	allows_contact_lists.
+	(extract_info): quiet compiler warning.
+
+	* gui/contact-list-editor/e-contact-list-editor.h (struct
+	_EContactListEditor): add allow_contact_lists.
+
 2004-07-02  Hans Petter Jansson  <hpj ximian com>
 
 	* gui/contact-list-editor/e-contact-list-editor.c
Index: gui/contact-list-editor/e-contact-list-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-editor.c,v
retrieving revision 1.60
diff -u -r1.60 e-contact-list-editor.c
--- gui/contact-list-editor/e-contact-list-editor.c	2 Jul 2004 18:32:18 -0000	1.60
+++ gui/contact-list-editor/e-contact-list-editor.c	9 Jul 2004 22:57:00 -0000
@@ -43,6 +43,7 @@
 #include "widgets/misc/e-image-chooser.h"
 #include "widgets/misc/e-source-option-menu.h"
 
+#include "addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.h"
 #include "addressbook/gui/component/addressbook.h"
 #include "addressbook/gui/widgets/eab-gui-util.h"
 #include "addressbook/util/eab-book-util.h"
@@ -196,6 +197,7 @@
 	editor->changed = FALSE;
 	editor->image_set = FALSE;
 	editor->editable = TRUE;
+	editor->allows_contact_lists = TRUE;
 	editor->in_async_call = FALSE;
 	editor->is_new_list = FALSE;
 
@@ -468,22 +470,6 @@
 }
 
 static void
-list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle)
-{
-	if (cle->app)
-		gtk_widget_set_sensitive (cle->app, TRUE);
-	cle->in_async_call = FALSE;
-
-	eab_editor_contact_deleted (EAB_EDITOR (cle), status, cle->contact);
-
-	/* always close the dialog after we successfully delete a list */
-	if (status == E_BOOK_ERROR_OK)
-		eab_editor_close (EAB_EDITOR (cle));
-
-	g_object_unref (cle); /* release reference held for callback */
-}
-
-static void
 contact_list_editor_destroy_notify (gpointer data,
 				    GObject *where_the_object_was)
 {
@@ -520,13 +506,26 @@
 	editor = E_CONTACT_LIST_EDITOR (object);
 	
 	switch (prop_id){
-	case PROP_BOOK:
+	case PROP_BOOK: {
+		gboolean changed;
+
 		if (editor->book)
 			g_object_unref (editor->book);
 		editor->book = E_BOOK(g_value_get_object (value));
 		g_object_ref (editor->book);
 		/* XXX more here about editable/etc. */
+
+		changed = (editor->allows_contact_lists != e_book_check_static_capability (editor->book,
+											   "contact-lists"));
+		editor->allows_contact_lists = e_book_check_static_capability (editor->book,
+									       "contact-lists");
+
+		if (changed) {
+			set_editable (editor);
+			command_state_changed (editor);
+		}
 		break;
+	}
 	case PROP_CONTACT:
 		if (editor->contact)
 			g_object_unref (editor->contact);
@@ -660,17 +659,17 @@
 select_names_ok_cb (BonoboListener *listener, const char *event_name, const CORBA_any *arg,
 		    CORBA_Environment *ev, gpointer data)
 {
+	EContactListEditor *ce;
 	EDestination **destv;
-
+	Bonobo_Control corba_control;
+	GtkWidget *control_widget;
 	char *string = NULL;
 
-	EContactListEditor *ce;
-
 	ce = E_CONTACT_LIST_EDITOR (data);
 
-	Bonobo_Control corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection
-			(ce->corba_select_names, "Members", ev);
-	GtkWidget *control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
+	corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (ce->corba_select_names,
+										   "Members", ev);
+	control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
 
 	bonobo_widget_get_property (BONOBO_WIDGET (control_widget), "destinations",
 					    TC_CORBA_string, &string, NULL);
@@ -688,7 +687,6 @@
 static gboolean
 setup_corba (EContactListEditor *editor)
 {
-
 	CORBA_Environment ev;
 
 	CORBA_exception_init (&ev);
@@ -829,11 +827,12 @@
 static void
 set_editable (EContactListEditor *editor)
 {
-	gtk_widget_set_sensitive (editor->email_entry, editor->editable);
-	gtk_widget_set_sensitive (editor->list_name_entry, editor->editable);
-	gtk_widget_set_sensitive (editor->add_button, editor->editable);
-	gtk_widget_set_sensitive (editor->remove_button, editor->editable);
-	gtk_widget_set_sensitive (editor->table, editor->editable);
+	gtk_widget_set_sensitive (editor->email_entry, editor->editable && editor->allows_contact_lists);
+	gtk_widget_set_sensitive (editor->list_name_entry, editor->editable && editor->allows_contact_lists);
+	gtk_widget_set_sensitive (editor->add_button, editor->editable && editor->allows_contact_lists);
+	gtk_widget_set_sensitive (editor->remove_button, editor->editable && editor->allows_contact_lists);
+	gtk_widget_set_sensitive (editor->select_button, editor->editable && editor->allows_contact_lists);
+	gtk_widget_set_sensitive (editor->table, editor->editable && editor->allows_contact_lists);
 }
 
 /* Callback used when the editor is destroyed */
@@ -948,7 +947,7 @@
 	gboolean valid = eab_editor_is_valid (EAB_EDITOR (editor));
 
 	/* FIXME set the ok button to ok */
-	gtk_widget_set_sensitive (editor->ok_button, valid);
+	gtk_widget_set_sensitive (editor->ok_button, valid && editor->allows_contact_lists);
 	gtk_widget_set_sensitive (editor->source_menu, editor->is_new_list);
 	gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "source-label"), editor->is_new_list);
 }
@@ -985,7 +984,7 @@
 
 			e_vcard_add_attribute (E_VCARD (contact), attr);
 
-			e_destination_export_to_vcard_attribute (dest, attr);
+			e_destination_export_to_vcard_attribute ((EDestination*)dest, attr);
 		}
 
 		if (editor->image_set
Index: gui/contact-list-editor/e-contact-list-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-editor.h,v
retrieving revision 1.19
diff -u -r1.19 e-contact-list-editor.h
--- gui/contact-list-editor/e-contact-list-editor.h	17 Jun 2004 21:59:37 -0000	1.19
+++ gui/contact-list-editor/e-contact-list-editor.h	9 Jul 2004 22:57:00 -0000
@@ -94,6 +94,9 @@
 	/* Whether the contact editor will accept modifications */
 	guint editable : 1;
 
+	/* Whether the target book accepts storing of contact lists */
+	guint allows_contact_lists : 1;
+
 	/* Whether an async wombat call is in progress */
 	guint in_async_call : 1;
 


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