[evolution-patches] patch for #71448 (addressbook)



for HEAD only

Siva

Index: gui/widgets/e-addressbook-model.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-model.c,v
retrieving revision 1.63
diff -u -r1.63 e-addressbook-model.c
--- gui/widgets/e-addressbook-model.c	16 Jul 2004 08:13:51 -0000	1.63
+++ gui/widgets/e-addressbook-model.c	19 Jan 2005 18:16:45 -0000
@@ -42,7 +42,7 @@
 	SEARCH_RESULT,
 	FOLDER_BAR_MESSAGE,
 	CONTACT_ADDED,
-	CONTACT_REMOVED,
+	CONTACTS_REMOVED,
 	CONTACT_CHANGED,
 	MODEL_CHANGED,
 	STOP_STATE_CHANGED,
@@ -193,7 +193,9 @@
 	/* XXX we should keep a hash around instead of this O(n*m) loop */
 	int i = 0;
 	GList *l;
+	GArray *indices;
 
+	indices = g_array_new (FALSE, FALSE, sizeof (gint));
 	for (l = ids; l; l = l->next) {
 		char *id = l->data;
 		for ( i = 0; i < model->data_count; i++) {
@@ -201,16 +203,18 @@
 				g_object_unref (model->data[i]);
 				memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (EContact *));
 				model->data_count--;
-
-				g_signal_emit (model,
+				g_array_append_val (indices, i);
+				/*g_signal_emit (model,
 					       eab_model_signals [CONTACT_REMOVED], 0,
-					       i);
+					       i);*/
 
 				break;
 			}
 		}
 	}
-
+	g_signal_emit (model,
+		       eab_model_signals [CONTACTS_REMOVED], 0,
+		       indices);
 	update_folder_bar_message (model);
 }
 
@@ -367,14 +371,14 @@
 			      eab_marshal_NONE__INT_INT,
 			      G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
 
-	eab_model_signals [CONTACT_REMOVED] =
-		g_signal_new ("contact_removed",
+	eab_model_signals [CONTACTS_REMOVED] =
+		g_signal_new ("contacts_removed",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (EABModelClass, contact_removed),
+			      G_STRUCT_OFFSET (EABModelClass, contacts_removed),
 			      NULL, NULL,
-			      eab_marshal_NONE__INT,
-			      G_TYPE_NONE, 1, G_TYPE_INT);
+			      eab_marshal_NONE__POINTER,
+			      G_TYPE_NONE, 1, G_TYPE_POINTER);
 
 	eab_model_signals [CONTACT_CHANGED] =
 		g_signal_new ("contact_changed",
Index: gui/widgets/e-addressbook-model.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-model.h,v
retrieving revision 1.24
diff -u -r1.24 e-addressbook-model.h
--- gui/widgets/e-addressbook-model.h	17 Jun 2004 21:59:36 -0000	1.24
+++ gui/widgets/e-addressbook-model.h	19 Jan 2005 18:16:45 -0000
@@ -53,7 +53,7 @@
 	void (*status_message)     (EABModel *model, const gchar *message);
 	void (*folder_bar_message) (EABModel *model, const gchar *message);
 	void (*contact_added)      (EABModel *model, gint index, gint count);
-	void (*contact_removed)    (EABModel *model, gint index);
+	void (*contacts_removed)    (EABModel *model, gpointer id_list);
 	void (*contact_changed)    (EABModel *model, gint index);
 	void (*model_changed)      (EABModel *model);
 	void (*stop_state_changed) (EABModel *model);
Index: gui/widgets/e-addressbook-reflow-adapter.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-reflow-adapter.c,v
retrieving revision 1.31
diff -u -r1.31 e-addressbook-reflow-adapter.c
--- gui/widgets/e-addressbook-reflow-adapter.c	7 Oct 2004 01:33:10 -0000	1.31
+++ gui/widgets/e-addressbook-reflow-adapter.c	19 Jan 2005 18:16:47 -0000
@@ -259,11 +259,18 @@
 }
 
 static void
-remove_contact (EABModel *model,
-		gint index,
+remove_contacts (EABModel *model,
+		gpointer data,
 		EAddressbookReflowAdapter *adapter)
 {
-	e_reflow_model_item_removed (E_REFLOW_MODEL (adapter), index);
+	GArray *indices = (GArray *) data;
+	int count = indices->len;
+	
+	if (count == 1)
+		e_reflow_model_item_removed (E_REFLOW_MODEL (adapter), g_array_index (indices, gint, 0));
+	else 
+		e_reflow_model_changed (E_REFLOW_MODEL (adapter));
+	
 }
 
 static void
@@ -472,8 +479,8 @@
 						G_CALLBACK(create_contact),
 						adapter);
 	priv->remove_contact_id = g_signal_connect(priv->model,
-						"contact_removed",
-						G_CALLBACK(remove_contact),
+						"contacts_removed",
+						G_CALLBACK(remove_contacts),
 						adapter);
 	priv->modify_contact_id = g_signal_connect(priv->model,
 						"contact_changed",
@@ -514,3 +521,5 @@
 
 	return eab_model_get_contact (priv->model, index);
 }
+
+
Index: gui/widgets/e-addressbook-table-adapter.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-table-adapter.c,v
retrieving revision 1.30
diff -u -r1.30 e-addressbook-table-adapter.c
--- gui/widgets/e-addressbook-table-adapter.c	9 Apr 2004 17:26:16 -0000	1.30
+++ gui/widgets/e-addressbook-table-adapter.c	19 Jan 2005 18:16:49 -0000
@@ -259,11 +259,18 @@
 
 static void
 remove_contact (EABModel *model,
-		gint index,
+		gpointer data,
 		EAddressbookTableAdapter *adapter)
 {
+	GArray *indices = (GArray *) data;
+	int count = indices->len;
+	
+	
 	e_table_model_pre_change (E_TABLE_MODEL (adapter));
-	e_table_model_rows_deleted (E_TABLE_MODEL (adapter), index, 1);
+	if (count == 1) 
+		e_table_model_rows_deleted (E_TABLE_MODEL (adapter), 1, 1);
+	else
+		e_table_model_changed (E_TABLE_MODEL (adapter));
 }
 
 static void
@@ -321,7 +328,7 @@
 						   G_CALLBACK(create_contact),
 						   adapter);
 	priv->remove_contact_id = g_signal_connect(priv->model,
-						   "contact_removed",
+						   "contacts_removed",
 						   G_CALLBACK(remove_contact),
 						   adapter);
 	priv->modify_contact_id = g_signal_connect(priv->model,
Index: gui/widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.156
diff -u -r1.156 e-addressbook-view.c
--- gui/widgets/e-addressbook-view.c	22 Dec 2004 07:37:03 -0000	1.156
+++ gui/widgets/e-addressbook-view.c	19 Jan 2005 18:16:58 -0000
@@ -98,7 +98,7 @@
 static void writable_status    (GtkObject *object, gboolean writable, EABView *eav);
 static void backend_died       (GtkObject *object, EABView *eav);
 static void contact_changed    (EABModel *model, gint index, EABView *eav);
-static void contact_removed    (EABModel *model, gint index, EABView *eav);
+static void contact_removed    (EABModel *model, gpointer data, EABView *eav);
 static GList *get_selected_contacts (EABView *view);
 
 static void command_state_change (EABView *eav);
@@ -435,7 +435,7 @@
 			  G_CALLBACK (backend_died), eav);
 	g_signal_connect (eav->model, "contact_changed",
 			  G_CALLBACK (contact_changed), eav);
-	g_signal_connect (eav->model, "contact_removed",
+	g_signal_connect (eav->model, "contacts_removed",
 			  G_CALLBACK (contact_removed), eav);
 
 	eav->editable = FALSE;
@@ -1188,13 +1188,21 @@
 }
 
 static void
-contact_removed (EABModel *model, gint index, EABView *eav)
+contact_removed (EABModel *model, gpointer data, EABView *eav)
 {
-	if (eav->displayed_contact == index) {
-		/* if the contact that's presently displayed is changed, clear the display */
-		eab_contact_display_render (EAB_CONTACT_DISPLAY (eav->contact_display), NULL,
-					    EAB_CONTACT_DISPLAY_RENDER_NORMAL);
-		eav->displayed_contact = -1;
+	GArray *indices = (GArray *) data;
+	int count = indices->len;
+	int i;
+	for (i = 0; i < count; i ++) {
+	
+		
+		if (eav->displayed_contact == g_array_index (indices, gint, i)) {
+			/* if the contact that's presently displayed is changed, clear the display */
+			eab_contact_display_render (EAB_CONTACT_DISPLAY (eav->contact_display), NULL,
+						    EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+			eav->displayed_contact = -1;
+			break;
+		}
 	}
 }
 


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