diff options
author | Larry Ewing <lewing@ximian.com> | 2003-06-14 12:34:20 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2003-06-14 12:34:20 +0800 |
commit | 1761fff007b20c765181f7e89c1cb4fd84c699e3 (patch) | |
tree | cf9abbc667602f494d2eaf5d2054980c4e30585b /addressbook/gui/widgets | |
parent | b3b0f96535867fa18399c4769fdd6bf2168ba144 (diff) | |
download | gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.tar gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.tar.gz gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.tar.bz2 gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.tar.lz gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.tar.xz gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.tar.zst gsoc2013-evolution-1761fff007b20c765181f7e89c1cb4fd84c699e3.zip |
Fix lots of leaks, update for correct use of g_object_get. Some misc
2003-06-13 Larry Ewing <lewing@ximian.com>
* gui/component/addressbook.c:
* gui/component/e-cardlist-model.c:
* gui/component/select-names/e-select-names-text-model.c:
* gui/contact-editor/e-contact-editor.c:
* gui/contact-editor/e-contact-save-as.c:
* gui/contact-list-editor/e-contact-list-editor.c:
* gui/widgets/e-addressbook-table-adapter.c:
* gui/widgets/e-addressbook-util.c:
* gui/widgets/e-addressbook-view.c:
* gui/widgets/e-minicard-view.c:
* gui/widgets/e-minicard.c: Fix lots of leaks, update for correct
use of g_object_get. Some misc cleanups.
svn path=/trunk/; revision=21442
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-table-adapter.c | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-util.c | 11 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 28 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard-view.c | 19 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 28 |
5 files changed, 65 insertions, 22 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index e733d8a7a8..b3f79f064c 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -166,6 +166,7 @@ addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) 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); diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c index ff1b3cd837..1226698486 100644 --- a/addressbook/gui/widgets/e-addressbook-util.c +++ b/addressbook/gui/widgets/e-addressbook-util.c @@ -525,6 +525,7 @@ e_addressbook_send_card_list (GList *cards, EAddressbookDisposition disposition) 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 *cards, EAddressbookDisposition disposition) g_object_get(card, "file_as", &tempstr2, NULL); - if (!tempstr2 || !*tempstr2) + if (!tempstr2 || !*tempstr2) { + g_free (tempstr2); g_object_get(card, "full_name", &tempstr2, NULL); - if (!tempstr2 || !*tempstr2) + } if (!tempstr2 || !*tempstr2) { + g_free (tempstr2); g_object_get(card, "org", &tempstr2, NULL); - if (!tempstr2 || !*tempstr2) { + } if (!tempstr2 || !*tempstr2) { EList *list; EIterator *iterator; g_object_get(card, @@ -590,6 +593,7 @@ e_addressbook_send_card_list (GList *cards, EAddressbookDisposition disposition) tempstr2 = e_iterator_get (iterator); } g_object_unref (iterator); + g_object_unref (list); } if (!tempstr2 || !*tempstr2) @@ -597,6 +601,7 @@ e_addressbook_send_card_list (GList *cards, EAddressbookDisposition disposition) else tempstr = g_strdup_printf ("Contact information for %s", tempstr2); subject = CORBA_string_dup (tempstr); + g_free (tempstr2); g_free (tempstr); } diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 7ff7a6654f..35decd7ee2 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -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 *card_and_book) } } e_free_object_list(list); + g_object_unref(book); } } @@ -809,22 +812,30 @@ static void new_card (GtkWidget *widget, CardAndBook *card_and_book) { EBook *book; + ECard *card; g_object_get(card_and_book->view->model, "book", &book, NULL); - e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, TRUE); + + e_addressbook_show_contact_editor (book, card = e_card_new(""), TRUE, TRUE); + g_object_unref(book); + g_object_unref(card); } static void new_list (GtkWidget *widget, CardAndBook *card_and_book) { EBook *book; + ECard *card; g_object_get(card_and_book->view->model, "book", &book, NULL); - e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, TRUE); + + e_addressbook_show_contact_list_editor (book, card = e_card_new(""), TRUE, TRUE); + g_object_unref(book); + g_object_unref(card); } #if 0 @@ -1220,6 +1231,9 @@ table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, E 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); + g_object_unref (card); } } @@ -1407,6 +1421,9 @@ treeview_row_activated(GtkTreeView *treeview, 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); + g_object_unref (card); } static void @@ -1652,6 +1669,8 @@ e_addressbook_view_print(EAddressbookView *view) "book", &book, NULL); print = e_contact_print_dialog_new(book, query); + + g_object_unref(book); g_free(query); gtk_widget_show_all(print); } @@ -1667,7 +1686,7 @@ e_addressbook_view_print(EAddressbookView *view) 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); @@ -1704,6 +1723,7 @@ e_addressbook_view_print_preview(EAddressbookView *view) "book", &book, NULL); e_contact_print_preview(book, query); + g_object_unref(book); g_free(query); } else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) { @@ -1716,6 +1736,7 @@ e_addressbook_view_print_preview(EAddressbookView *view) g_object_get(view->widget, "table", &etable, NULL); printable = e_table_get_printable(etable); + g_object_unref(etable); master = gnome_print_job_new(NULL); config = gnome_print_job_get_config (master); @@ -1947,6 +1968,7 @@ view_transfer_cards (EAddressbookView *view, gboolean delete_from_source) 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 diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index 7f834317e2..18c4049e65 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -183,6 +183,7 @@ e_minicard_view_set_property (GObject *object, 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 *item, GdkEvent *event) 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, const char *utf_str) 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 diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 782f5c40a9..7ce6d2f518 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -582,6 +582,7 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) 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, GdkEvent *event) 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 *minicard) 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, EMinicard *minicard2) 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 |