[evolution-patches] initial addressbook patches



This isn't complete but I thought I'd get what I have out there for
people to look at while I continue working on it.

--Larry


? ebook/ChangeLog
? ebook/Evolution-Composer-common.c
? ebook/Evolution-Composer-skels.c
? ebook/Evolution-Composer-stubs.c
? ebook/Evolution-Composer.h
Index: ebook/e-card-simple.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/e-card-simple.c,v
retrieving revision 1.48
diff -u -p -r1.48 e-card-simple.c
--- ebook/e-card-simple.c	28 Mar 2003 22:22:40 -0000	1.48
+++ ebook/e-card-simple.c	13 Jun 2003 18:03:40 -0000
@@ -556,6 +556,11 @@ fill_in_info(ECardSimple *simple)
 			}
 		}
 		g_object_unref(iterator);
+
+		g_object_unref(phone_list);
+		g_object_unref(email_list);
+		g_object_unref(address_list);
+		g_object_unref(delivery_list);
 		e_card_free_empty_lists (card);
 	}
 }
@@ -719,6 +724,11 @@ e_card_simple_sync_card(ECardSimple *sim
 			}
 		}
 		fill_in_info(simple);
+
+		g_object_unref(phone_list);
+		g_object_unref(email_list);
+		g_object_unref(address_list);
+		g_object_unref(delivery_list);
 		e_card_free_empty_lists (card);
 	}
 
@@ -803,7 +813,7 @@ char     *e_card_simple_get            (
 	ECardSimpleInternalType type = field_data[field].type;
 	const ECardAddrLabel *addr;
 	const ECardPhone *phone;
-	const char *string;
+	char *string;
 	ECardDate *date;
 	ECardName *name;
 	switch(type) {
@@ -812,7 +822,7 @@ char     *e_card_simple_get            (
 			g_object_get(simple->card,
 				     field_data[field].ecard_field, &string,
 				     NULL);
-			return g_strdup(string);
+			return string;
 		} else
 			return NULL;
 	case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
@@ -877,17 +887,26 @@ char     *e_card_simple_get            (
 					     "file_as", &string,
 					     NULL);
 				if (string && *string)
-					return g_strdup(string);
+					return string
+;				else 
+					g_free (string);
+
 				g_object_get(simple->card,
 					     "full_name", &string,
 					     NULL);
 				if (string && *string)
 					return g_strdup(string);
+				else 
+					g_free (string);
+
 				g_object_get(simple->card,
 					     "org", &string,
 					     NULL);
 				if (string && *string)
 					return g_strdup(string);
+				else 
+					g_free (string);
+
 				is_list = e_card_evolution_list (simple->card);
 				if (is_list)
 					string = _("Unnamed List");
@@ -1199,6 +1218,8 @@ void                  e_card_simple_arbi
 			if (callback)
 				(*callback) (arbitrary, closure);
 		}
+		
+		g_object_unref (list);
 		e_card_free_empty_lists (simple->card);
 	}
 }
@@ -1217,6 +1238,8 @@ const ECardArbitrary *e_card_simple_get_
 			if (!strcasecmp(arbitrary->key, key))
 				return arbitrary;
 		}
+
+		g_object_unref (list);
 		e_card_free_empty_lists (simple->card);
 	}
 	return NULL;
@@ -1254,6 +1277,7 @@ void                  e_card_simple_set_
 		new_arb->type = g_strdup(type);
 		new_arb->value = g_strdup(value);
 		e_list_append(list, new_arb);
+		g_object_unref(list);
 		e_card_arbitrary_unref(new_arb);
 	}
 }
Index: ebook/e-card.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/e-card.c,v
retrieving revision 1.110
diff -u -p -r1.110 e-card.c
--- ebook/e-card.c	28 Mar 2003 22:46:50 -0000	1.110
+++ ebook/e-card.c	13 Jun 2003 18:03:41 -0000
@@ -839,6 +839,7 @@ parse_email(ECard *card, VObject *vobj, 
 		     NULL);
 	e_list_append(list, next_email);
 	g_free (next_email);
+	g_object_unref(list);
 }
 
 /* Deal with charset */
@@ -869,6 +870,7 @@ parse_phone(ECard *card, VObject *vobj, 
 		     NULL);
 	e_list_append(list, next_phone);
 	e_card_phone_unref (next_phone);
+	g_object_unref(list);
 }
 
 static void
@@ -891,6 +893,7 @@ parse_address(ECard *card, VObject *vobj
 		     NULL);
 	e_list_append(list, next_addr);
 	e_card_delivery_address_unref (next_addr);
+	g_object_unref(list);
 }
 
 static void
@@ -907,6 +910,7 @@ parse_address_label(ECard *card, VObject
 		     NULL);
 	e_list_append(list, next_addr);
 	e_card_address_label_unref (next_addr);
+	g_object_unref(list);
 }
 
 static void
@@ -1097,6 +1101,7 @@ do_parse_categories(ECard *card, char *s
 	}
 	copy[j] = 0;
 	add_list_unique(card, list, copy);
+	g_object_unref(list);
 	g_free(copy);
 }
 
@@ -1203,6 +1208,7 @@ parse_arbitrary(ECard *card, VObject *vo
 		     NULL);
 	e_list_append(list, arbitrary);
 	e_card_arbitrary_unref(arbitrary);
+	g_object_unref(list);
 }
 
 static void
@@ -1218,8 +1224,7 @@ parse_last_use(ECard *card, VObject *vob
 {
 	if ( vObjectValueType (vobj) ) {
 		char *str = fakeCString (vObjectUStringZValue (vobj));
-		if ( card->last_use )
-			g_free(card->last_use);
+		g_free(card->last_use);
 		card->last_use = g_new(ECardDate, 1);
 		*(card->last_use) = e_card_date_from_string(str);
 		free(str);
@@ -2044,6 +2049,7 @@ e_card_dispose (GObject *object)
 	FREE_IF(card->caluri);
 	FREE_IF(card->fburl);
 	FREE_IF(card->icscalendar);
+	FREE_IF(card->last_use);
 	FREE_IF(card->note);
 	FREE_IF(card->related_contacts);
 
@@ -2310,7 +2316,7 @@ e_card_get_property (GObject *object,
 				strs[i] = (char *)e_iterator_get(iterator);
 			}
 			strs[i] = 0;
-			g_value_set_string(value, g_strjoinv(", ", strs));
+			g_value_set_string_take_ownership(value, g_strjoinv(", ", strs));
 			g_free(strs);
 		}
 		break;
Index: ebook/evolution-ldif-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/evolution-ldif-importer.c,v
retrieving revision 1.12
diff -u -p -r1.12 evolution-ldif-importer.c
--- ebook/evolution-ldif-importer.c	2 Apr 2003 16:34:32 -0000	1.12
+++ ebook/evolution-ldif-importer.c	13 Jun 2003 18:03:41 -0000
@@ -275,6 +275,7 @@ parseLine( ECardSimple *simple, ECardDel
 					      "email", &email,
 					      NULL);
 				e_list_append (email, ldif_value->str);
+				g_object_unref (email);
 			}
 		}
 
@@ -383,10 +384,12 @@ resolve_list_card (LDIFImporter *gci, EC
 
 	/* set file_as to full_name so we don't later try and figure
            out a first/last name for the list. */
-	if (full_name)
+	if (full_name) {
 		g_object_set (card,
 			      "file_as", full_name,
 			      NULL);
+		g_free (full_name);
+	}
 
 	email_iter = e_list_get_iterator (email);
 	while (e_iterator_is_valid (email_iter)) {
@@ -413,6 +416,7 @@ resolve_list_card (LDIFImporter *gci, EC
 			e_iterator_delete (email_iter);
 		}
 	}
+	g_object_unref(email);
 }
 
 static void
Index: ebook/load-pine-addressbook.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/load-pine-addressbook.c,v
retrieving revision 1.15
diff -u -p -r1.15 load-pine-addressbook.c
--- ebook/load-pine-addressbook.c	6 Mar 2003 17:30:53 -0000	1.15
+++ ebook/load-pine-addressbook.c	13 Jun 2003 18:03:41 -0000
@@ -42,6 +42,7 @@ parse_line (EBook *book, char *line)
 			     NULL);
 		e_list_append(list, strings[2]);
 		e_book_add_card(book, card, add_card_cb, card);
+		g_object_unref(list);
 	}
 	g_strfreev(strings);
 }
Index: ebook/test-card.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/test-card.c,v
retrieving revision 1.16
diff -u -p -r1.16 test-card.c
--- ebook/test-card.c	3 Nov 2002 06:14:01 -0000	1.16
+++ ebook/test-card.c	13 Jun 2003 18:03:41 -0000
@@ -152,6 +152,7 @@ main (int argc, char **argv)
 	    printf("Email : %s\n", (char *) e_iterator_get(iterator));
 	  }
 	  g_object_unref(iterator);
+	  g_object_unref(email);
 	}
 	if ( phone ) {
 	  iterator = e_list_get_iterator(address);
@@ -160,6 +161,7 @@ main (int argc, char **argv)
 	    printf("Phone ; %d : %s\n", e_card_phone->flags, e_card_phone->number);
 	  }
 	  g_object_unref(iterator);
+	  g_object_unref(phone);
 	}
 	if ( address ) {
 	  iterator = e_list_get_iterator(address);
@@ -182,6 +184,7 @@ main (int argc, char **argv)
 	      printf("  Country : %s\n", del_address->country);
 	  }
 	  g_object_unref(iterator);
+	  g_object_unref(address);
 	}
 	printf("%s", e_card_get_vcard_assume_utf8(card));
 	g_object_unref (card);
Index: pas/pas-backend-card-sexp.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/pas/pas-backend-card-sexp.c,v
retrieving revision 1.9
diff -u -p -r1.9 pas-backend-card-sexp.c
--- pas/pas-backend-card-sexp.c	8 Feb 2003 09:06:29 -0000	1.9
+++ pas/pas-backend-card-sexp.c	13 Jun 2003 18:03:42 -0000
@@ -122,6 +122,8 @@ compare_category (ECardSimple *card, con
 
 	g_object_unref (iterator);
 	e_card_free_empty_lists (ecard);
+	g_object_unref (categories);
+	g_object_unref (ecard);
 	return ret_val;
 }
 
@@ -152,6 +154,8 @@ compare_arbitrary (ECardSimple *card, co
 
 	g_object_unref (iterator);
 	e_card_free_empty_lists (ecard);
+	g_object_unref (list);
+	g_object_unref (ecard);
 	return ret_val;
 }
 
Index: pas/pas-backend-ldap.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/pas/pas-backend-ldap.c,v
retrieving revision 1.130
diff -u -p -r1.130 pas-backend-ldap.c
--- pas/pas-backend-ldap.c	19 May 2003 20:30:24 -0000	1.130
+++ pas/pas-backend-ldap.c	13 Jun 2003 18:03:44 -0000
@@ -2308,6 +2308,7 @@ category_populate (ECardSimple *card, ch
 	g_object_unref (categories);
 
 	e_card_simple_sync_card (card);
+	g_object_unref (ecard);
 }
 
 struct berval**
@@ -2342,6 +2343,8 @@ category_ber (ECardSimple *card)
 		g_object_unref (iterator);
 	}
 
+	g_object_unref (categories);
+	g_object_unref (ecard);
 	return result;
 }
 
Index: component/addressbook.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook.c,v
retrieving revision 1.210
diff -u -p -r1.210 addressbook.c
--- component/addressbook.c	15 May 2003 22:50:29 -0000	1.210
+++ component/addressbook.c	13 Jun 2003 18:04:07 -0000
@@ -875,6 +875,7 @@ addressbook_search_activated (ESearchBar
 				      NULL);
 
 		g_free (search_query);
+		g_free (search_word);
 	}
 
 	g_free (search_word);
@@ -1047,7 +1048,7 @@ compare_subitems (const void *a, const v
 static void
 make_suboptions (AddressbookView *view)
 {
-	ESearchBarSubitem *subitems;
+	ESearchBarSubitem *subitems, *s;
 	ECategoriesMasterList *master_list;
 	gint i, N;
 
@@ -1072,6 +1073,12 @@ make_suboptions (AddressbookView *view)
 	qsort (subitems + 1, N, sizeof (subitems[0]), compare_subitems);
 
 	e_search_bar_set_suboption (view->search, ESB_CATEGORY, subitems);
+
+	for (s = subitems; s->id != -1; s++) {
+		if (s->text)
+			g_free (s->text);
+	}
+	g_free (subitems);
 }
 
 static void
Index: component/e-cardlist-model.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/e-cardlist-model.c,v
retrieving revision 1.12
diff -u -p -r1.12 e-cardlist-model.c
--- component/e-cardlist-model.c	6 Dec 2002 17:29:57 -0000	1.12
+++ component/e-cardlist-model.c	13 Jun 2003 18:04:07 -0000
@@ -63,16 +63,13 @@ static void
 e_cardlist_model_set_value_at (ETableModel *etc, int col, int row, const void *val)
 {
 	ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc);
-	ECard *card;
+
 	if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count )
 		return;
 	e_table_model_pre_change(etc);
 	e_card_simple_set(e_cardlist_model->data[row],
 			  col + 1,
 			  val);
-	g_object_get(e_cardlist_model->data[row],
-		     "card", &card,
-		     NULL);
 
 	e_table_model_cell_changed(etc, col, row);
 }
@@ -192,7 +189,6 @@ e_cardlist_model_get(ECardlistModel *mod
 		g_object_get(model->data[row],
 			     "card", &card,
 			     NULL);
-		g_object_ref(card);
 		return card;
 	}
 	return NULL;
Index: component/select-names/e-select-names-text-model.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names-text-model.c,v
retrieving revision 1.36
diff -u -p -r1.36 e-select-names-text-model.c
--- component/select-names/e-select-names-text-model.c	14 May 2003 00:45:20 -0000	1.36
+++ component/select-names/e-select-names-text-model.c	13 Jun 2003 18:04:08 -0000
@@ -334,6 +334,7 @@ e_select_names_text_model_insert_length 
 	ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model);
 	ESelectNamesModel *source = text_model->source;
 	const char *t;
+	gchar *text;
 
 	if (out) {
 		gchar *tmp = g_strndup (text, length);
@@ -341,7 +342,9 @@ e_select_names_text_model_insert_length 
 		g_free (tmp);
 	}
 
-	pos = CLAMP (pos, 0, g_utf8_strlen (e_select_names_model_get_textification (source, text_model->sep), -1));
+	text = e_select_names_model_get_textification (source, text_model->sep);
+	pos = CLAMP (pos, 0, g_utf8_strlen (text, -1));
+	g_free (text)
 
 	/* We want to control all cursor motions ourselves, rather than taking hints
 	   from the ESelectNamesModel. */
Index: contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.149
diff -u -p -r1.149 e-contact-editor.c
--- contact-editor/e-contact-editor.c	14 May 2003 22:00:45 -0000	1.149
+++ contact-editor/e-contact-editor.c	13 Jun 2003 18:04:09 -0000
@@ -1433,6 +1433,11 @@ e_contact_editor_dispose (GObject *objec
 		g_object_unref(e_contact_editor->simple);
 		e_contact_editor->simple = NULL;
 	}
+	
+	if (e_contact_editor->card) {
+		g_object_unref(e_contact_editor->card);
+		e_contact_editor->card = NULL;
+	}
 
 	if (e_contact_editor->book) {
 		g_object_unref(e_contact_editor->book);
@@ -2160,6 +2165,7 @@ fill_in_card_field(EContactEditor *edito
 		       key, &string,
 		       NULL);
 	fill_in_field(editor, id, string);
+	g_free (string);
 }
 
 static void
@@ -2432,7 +2438,6 @@ fill_in_info(EContactEditor *editor)
 	ECard *card = editor->card;
 	if (card) {
 		char *file_as;
-		char *related_contacts;
 		ECardName *name;
 		const ECardDate *anniversary;
 		const ECardDate *bday;
@@ -2443,7 +2448,6 @@ fill_in_info(EContactEditor *editor)
 
 		g_object_get (card,
 			       "file_as",          &file_as,
-			       "related_contacts", &related_contacts,
 			       "name",             &name,
 			       "anniversary",      &anniversary,
 			       "birth_date",       &bday,
@@ -2472,7 +2476,8 @@ fill_in_info(EContactEditor *editor)
 
 		/* File as has to come after company and name or else it'll get messed up when setting them. */
 		fill_in_field(editor, "entry-file-as", file_as);
-		
+		g_free (file_as);
+
 		e_card_name_unref(editor->name);
 		editor->name = e_card_name_ref(name);
 
Index: contact-editor/e-contact-save-as.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-save-as.c,v
retrieving revision 1.22
diff -u -p -r1.22 e-contact-save-as.c
--- contact-editor/e-contact-save-as.c	4 Feb 2003 00:13:38 -0000	1.22
+++ contact-editor/e-contact-save-as.c	13 Jun 2003 18:04:09 -0000
@@ -132,6 +132,7 @@ e_contact_save_as(char *title, ECard *ca
 	file = make_safe_filename (g_get_home_dir(), name);
 	gtk_file_selection_set_filename (filesel, file);
 	g_free (file);
+	g_free (name);
 
 	info->filesel = filesel;
 	info->vcard = e_card_get_vcard(card);
@@ -168,6 +169,7 @@ e_contact_list_save_as(char *title, GLis
 		file = make_safe_filename (g_get_home_dir(), name);
 		gtk_file_selection_set_filename (filesel, file);
 		g_free (file);
+		g_free (name);
 	} else {
 		char *file;
 		file = make_safe_filename (g_get_home_dir(), _("list"));
Index: 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.41
diff -u -p -r1.41 e-contact-list-editor.c
--- contact-list-editor/e-contact-list-editor.c	12 May 2003 08:54:42 -0000	1.41
+++ contact-list-editor/e-contact-list-editor.c	13 Jun 2003 18:04:10 -0000
@@ -135,7 +135,7 @@ e_contact_list_editor_class_init (EConta
 
 	object_class->set_property = e_contact_list_editor_set_property;
 	object_class->get_property = e_contact_list_editor_get_property;
-	object_class->dispose = e_contact_list_editor_dispose;
+	/* object_class->dispose = e_contact_list_editor_dispose;*/
 
 	g_object_class_install_property (object_class, PROP_BOOK, 
 					 g_param_spec_object ("book",
@@ -968,6 +968,7 @@ extract_info(EContactListEditor *editor)
 			}
 			g_free (dest_xml);
 		}
+		g_object_unref (email_list);
 	}
 }
 
@@ -992,6 +993,7 @@ fill_in_info(EContactListEditor *editor)
 		if (file_as) {
 			int position = 0;
 			gtk_editable_insert_text (GTK_EDITABLE (editor->list_name_entry), file_as, strlen (file_as), &position);
+			g_free (file_as);
 		}
 
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton), !show_addresses);
@@ -1013,6 +1015,7 @@ fill_in_info(EContactListEditor *editor)
 
 			e_iterator_next (email_iter);
 		}
+		g_object_unref (email_list);
 	}
 }
 
Index: widgets/e-addressbook-table-adapter.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-table-adapter.c,v
retrieving revision 1.24
diff -u -p -r1.24 e-addressbook-table-adapter.c
--- widgets/e-addressbook-table-adapter.c	13 May 2003 17:49:19 -0000	1.24
+++ widgets/e-addressbook-table-adapter.c	13 Jun 2003 18:04:10 -0000
@@ -166,6 +166,7 @@ addressbook_set_value_at (ETableModel *e
 
 		e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model),
 						card, card_modified_cb, NULL);
+		g_object_unref (card);
 
 		/* XXX do we need this?  shouldn't the commit_card generate a changed signal? */
 		e_table_model_cell_changed(etc, col, row);
Index: widgets/e-addressbook-util.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-util.c,v
retrieving revision 1.25
diff -u -p -r1.25 e-addressbook-util.c
--- widgets/e-addressbook-util.c	10 Mar 2003 06:40:18 -0000	1.25
+++ widgets/e-addressbook-util.c	13 Jun 2003 18:04:10 -0000
@@ -525,6 +525,7 @@ e_addressbook_send_card_list (GList *car
 			tempstr = g_strdup_printf (_("VCard for %s"), file_as);
 			description = CORBA_string_dup (tempstr);
 			g_free (tempstr);
+			g_free (file_as);
 		}
 
 		show_inline = FALSE;
@@ -571,15 +572,17 @@ e_addressbook_send_card_list (GList *car
 			g_object_get(card,
 				     "file_as", &tempstr2,
 				     NULL);
-			if (!tempstr2 || !*tempstr2)
+			if (!tempstr2 || !*tempstr2) {
 				g_object_get(card,
 					     "full_name", &tempstr2,
 					     NULL);
-			if (!tempstr2 || !*tempstr2)
+				g_free (tempstr2);
+			} if (!tempstr2 || !*tempstr2) {
 				g_object_get(card,
 					     "org", &tempstr2,
 					     NULL);
-			if (!tempstr2 || !*tempstr2) {
+				g_free (tempstr2);
+			} if (!tempstr2 || !*tempstr2) {
 				EList *list;
 				EIterator *iterator;
 				g_object_get(card,
@@ -590,6 +593,7 @@ e_addressbook_send_card_list (GList *car
 					tempstr2 = e_iterator_get (iterator);
 				}
 				g_object_unref (iterator);
+				g_object_unref (list);
 			}
 
 			if (!tempstr2 || !*tempstr2)
Index: widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.114
diff -u -p -r1.114 e-addressbook-view.c
--- widgets/e-addressbook-view.c	11 May 2003 21:51:45 -0000	1.114
+++ widgets/e-addressbook-view.c	13 Jun 2003 18:04:11 -0000
@@ -648,6 +648,8 @@ has_email_address_1(gint model_row,
 
 	if (e_list_length (email) > 0)
 		*has_email = TRUE;
+
+	g_object_unref (email);
 }
 
 static gboolean
@@ -784,6 +786,7 @@ delete (GtkWidget *widget, CardAndBook *
 			}
 		}
 		e_free_object_list(list);
+		g_object_unref(list);
 	}
 }
 
@@ -1220,6 +1223,8 @@ table_double_click(ETableScrolled *table
 			e_addressbook_show_contact_list_editor (book, card, FALSE, view->editable);
 		else
 			e_addressbook_show_contact_editor (book, card, FALSE, view->editable);
+
+		g_object_unref (book);
 	}
 }
 
@@ -1407,6 +1412,8 @@ treeview_row_activated(GtkTreeView *tree
 		e_addressbook_show_contact_list_editor (book, card, FALSE, view->editable);
 	else
 		e_addressbook_show_contact_editor (book, card, FALSE, view->editable);
+
+	g_object_unref (book);
 }
 
 static void
@@ -1667,7 +1674,7 @@ e_addressbook_view_print(EAddressbookVie
 
 		g_object_get(view->widget, "table", &etable, NULL);
 		printable = e_table_get_printable(etable);
-
+		g_object_unref(etable);
 		g_object_ref (view->widget);
 
 		g_object_set_data (G_OBJECT (dialog), "table", view->widget);
@@ -1947,6 +1954,7 @@ view_transfer_cards (EAddressbookView *v
 	parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
 
 	e_addressbook_transfer_cards (book, cards, delete_from_source, parent_window);
+	g_object_unref(book);
 }
 
 void
Index: widgets/e-minicard-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard-view.c,v
retrieving revision 1.60
diff -u -p -r1.60 e-minicard-view.c
--- widgets/e-minicard-view.c	5 Feb 2003 23:48:14 -0000	1.60
+++ widgets/e-minicard-view.c	13 Jun 2003 18:04:12 -0000
@@ -183,6 +183,7 @@ e_minicard_view_set_property (GObject *o
 					      NULL);
 				if (model) {
 					g_signal_handler_disconnect (model, view->writable_status_id);
+					g_object_unref (model);
 				}
 			}
 
@@ -282,6 +283,7 @@ e_minicard_view_dispose (GObject *object
 				      NULL);
 			if (model) {
 				g_signal_handler_disconnect (model, view->writable_status_id);
+				g_object_unref (model);
 			}
 		}
 
@@ -321,8 +323,10 @@ e_minicard_view_event (GnomeCanvasItem *
 				EBook *book;
 				g_object_get(view, "book", &book, NULL);
  
-				if (book && E_IS_BOOK (book))
+				if (book && E_IS_BOOK (book)) {
 					e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, editable);
+					g_object_unref (book);
+				}
 			}
 			return TRUE;
 		}
@@ -402,6 +406,7 @@ do_remove (int i, gpointer user_data)
 	e_book_remove_card(book, card, cb, closure);
 
 	g_object_unref (card);
+	g_object_unref (book);
 }
 
 #if 0
@@ -420,13 +425,13 @@ compare_to_utf_str (EMinicard *card, con
 		g_object_get(card->card,
 			     "file_as", &file_as,
 			     NULL);
-		if (file_as)
-			return g_utf8_strcasecmp (file_as, utf_str);
-		else
-			return 0;
-	} else {
-		return 0;
+		if (file_as) {
+			int cmp = g_utf8_strcasecmp (file_as, utf_str);
+			g_free (file_as);
+			return cmp;
+		}
 	}
+	return 0;
 }
 #endif
 
Index: widgets/e-minicard.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard.c,v
retrieving revision 1.106
diff -u -p -r1.106 e-minicard.c
--- widgets/e-minicard.c	8 Apr 2003 04:44:57 -0000	1.106
+++ widgets/e-minicard.c	13 Jun 2003 18:04:12 -0000
@@ -582,6 +582,7 @@ e_minicard_event (GnomeCanvasItem *item,
 										 e_minicard->card,
 										 card_modified_cb,
 										 NULL);
+						g_object_unref(book);
 					} else {
 						remodel(e_minicard);
 						e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard));
@@ -678,6 +679,7 @@ e_minicard_event (GnomeCanvasItem *item,
 					g_signal_connect (e_minicard->editor, "editor_closed",
 							  G_CALLBACK (editor_closed_cb), e_minicard);
 
+					g_object_unref (book);
 				}
 			}
 			return TRUE;
@@ -1021,6 +1023,8 @@ e_minicard_get_card_id (EMinicard *minic
 int
 e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
 {
+	int cmp = 0;
+	
 	g_return_val_if_fail(minicard1 != NULL, 0);
 	g_return_val_if_fail(E_IS_MINICARD(minicard1), 0);
 	g_return_val_if_fail(minicard2 != NULL, 0);
@@ -1028,22 +1032,28 @@ e_minicard_compare (EMinicard *minicard1
 
 	if (minicard1->card && minicard2->card) {
 		char *file_as1, *file_as2;
+
 		g_object_get(minicard1->card,
 			     "file_as", &file_as1,
 			     NULL);
 		g_object_get(minicard2->card,
 			     "file_as", &file_as2,
 			     NULL);
-		if (file_as1 && file_as2)
-			return g_utf8_collate(file_as1, file_as2);
-		if (file_as1)
-			return -1;
-		if (file_as2)
-			return 1;
-		return strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2));
-	} else {
-		return 0;
+
+		if (file_as1 && file_as2) 
+			cmp = g_utf8_collate(file_as1, file_as2);
+		else if (file_as1)
+			cmp = -1;
+		else if (file_as2)
+			cmp = 1;
+		else 
+			cmp = strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2));
+
+		g_free (file_as1);
+		g_free (file_as2);
 	}
+
+	return cmp;
 }
 
 int
Index: e-contact-print.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/printing/e-contact-print.c,v
retrieving revision 1.35
diff -u -p -r1.35 e-contact-print.c
--- e-contact-print.c	9 May 2003 15:02:46 -0000	1.35
+++ e-contact-print.c	13 Jun 2003 18:05:11 -0000
@@ -421,6 +421,8 @@ e_contact_get_card_size(ECardSimple *sim
 		     "file_as", &file_as,
 		     NULL);
 	height += e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, file_as);
+	g_free (file_as);
+
 	height += gnome_font_get_size (ctxt->style->headings_font) * .2;
 
 	height += gnome_font_get_size (ctxt->style->headings_font) * .2;
@@ -459,7 +461,6 @@ e_contact_print_card (ECardSimple *simpl
 	gnome_print_gsave(ctxt->pc);
 
 	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
-
 	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
 
 	g_object_get(simple->card,
@@ -469,9 +470,10 @@ e_contact_print_card (ECardSimple *simpl
 		e_contact_rectangle(ctxt->pc, ctxt->x, ctxt->y + gnome_font_get_size (ctxt->style->headings_font) * .3, ctxt->x + column_width, ctxt->y - e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, file_as) - gnome_font_get_size (ctxt->style->headings_font) * .3, .85, .85, .85);
 	e_contact_output(ctxt->pc, ctxt->style->headings_font, ctxt->x + 2, ctxt->y, column_width - 4, file_as);
 	ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, file_as);
-	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
+	g_free (file_as);
 
 	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
+	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
 	
 	for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; field++) {
 		char *string;
@@ -610,8 +612,11 @@ complete_sequence(EBookView *book_view, 
 
 static int
 card_compare (ECard *card1, ECard *card2) {
+	int cmp = 0;
+
 	if (card1 && card2) {
 		char *file_as1, *file_as2;
+
 		g_object_get(card1,
 			     "file_as", &file_as1,
 			     NULL);
@@ -619,15 +624,19 @@ card_compare (ECard *card1, ECard *card2
 			     "file_as", &file_as2,
 			     NULL);
 		if (file_as1 && file_as2)
-			return g_utf8_collate(file_as1, file_as2);
-		if (file_as1)
-			return -1;
-		if (file_as2)
-			return 1;
-		return strcmp(e_card_get_id(card1), e_card_get_id(card2));
-	} else {
-		return 0;
+			cmp = g_utf8_collate(file_as1, file_as2);
+		else if (file_as1)
+			cmp = -1;
+		else if (file_as2)
+			cmp = 1;
+		else 
+			cmp = strcmp(e_card_get_id(card1), e_card_get_id(card2));
+
+		g_free (file_as2);
+		g_free (file_as1);
+
 	}
+	return cmp;
 }
 
 static void
@@ -707,7 +716,6 @@ e_contact_print_phone_list (ECard *card,
 	gnome_print_gsave(ctxt->pc);
 
 	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
-
 	ctxt->y -= gnome_font_get_size (ctxt->style->headings_font) * .2;
 
 	e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x, ctxt->y, -1, e_card_get_string_fileas(card));
@@ -787,6 +795,7 @@ e_contact_do_print_phone_list (EBook *bo
 			ctxt->first_char_on_page = ctxt->last_char_on_page;
 		e_contact_print_phone_list(card, ctxt, shown_fields);
 		first_contact = FALSE;
+		g_free (file_as);
 	}
 	ctxt->last_char_on_page = 'Z';
 	if ( ctxt->style->letter_tabs )


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