aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook.c8
-rw-r--r--addressbook/gui/component/e-cardlist-model.c6
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.c7
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c11
-rw-r--r--addressbook/gui/contact-editor/e-contact-save-as.c2
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c5
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c1
-rw-r--r--addressbook/gui/widgets/e-addressbook-util.c11
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c28
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c19
-rw-r--r--addressbook/gui/widgets/e-minicard.c28
11 files changed, 92 insertions, 34 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index c770aaa8f5..b21c70a83d 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -1047,7 +1047,7 @@ compare_subitems (const void *a, const void *b)
static void
make_suboptions (AddressbookView *view)
{
- ESearchBarSubitem *subitems;
+ ESearchBarSubitem *subitems, *s;
ECategoriesMasterList *master_list;
gint i, N;
@@ -1072,6 +1072,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
diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c
index 5635d25f86..aca0bac22f 100644
--- a/addressbook/gui/component/e-cardlist-model.c
+++ b/addressbook/gui/component/e-cardlist-model.c
@@ -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 *model,
g_object_get(model->data[row],
"card", &card,
NULL);
- g_object_ref(card);
return card;
}
return NULL;
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c
index c2ddfcf96c..7859d5b056 100644
--- a/addressbook/gui/component/select-names/e-select-names-text-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-text-model.c
@@ -334,14 +334,17 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model);
ESelectNamesModel *source = text_model->source;
const char *t;
+ gchar *tmp;
if (out) {
- gchar *tmp = g_strndup (text, length);
+ tmp = g_strndup (text, length);
fprintf (out, ">> insert \"%s\" (len=%d) at %d\n", tmp, length, pos);
g_free (tmp);
}
- pos = CLAMP (pos, 0, g_utf8_strlen (e_select_names_model_get_textification (source, text_model->sep), -1));
+ tmp = e_select_names_model_get_textification (source, text_model->sep);
+ pos = CLAMP (pos, 0, g_utf8_strlen (tmp, -1));
+ g_free (tmp);
/* We want to control all cursor motions ourselves, rather than taking hints
from the ESelectNamesModel. */
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 8ecd2b6a08..f2eb825e70 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1433,6 +1433,11 @@ e_contact_editor_dispose (GObject *object) {
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 *editor, ECard *card, char *id, char *key)
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);
diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c
index 2478eadeb1..a141560763 100644
--- a/addressbook/gui/contact-editor/e-contact-save-as.c
+++ b/addressbook/gui/contact-editor/e-contact-save-as.c
@@ -132,6 +132,7 @@ e_contact_save_as(char *title, ECard *card, GtkWindow *parent_window)
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, GList *list, GtkWindow *parent_window)
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"));
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 029e7fc06e..ab6ea97096 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -135,7 +135,7 @@ e_contact_list_editor_class_init (EContactListEditorClass *klass)
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);
}
}
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