aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-05-11 19:33:51 +0800
committerChris Toshok <toshok@src.gnome.org>2001-05-11 19:33:51 +0800
commite6a4fcd9a248183751afd1bca0af676e4bc36089 (patch)
treedf57728ace788aebf83decd0f54fe49a3e434af1 /addressbook
parent7da5a58462520d93415418c258acf0cb73972977 (diff)
downloadgsoc2013-evolution-e6a4fcd9a248183751afd1bca0af676e4bc36089.tar.gz
gsoc2013-evolution-e6a4fcd9a248183751afd1bca0af676e4bc36089.tar.zst
gsoc2013-evolution-e6a4fcd9a248183751afd1bca0af676e4bc36089.zip
don't leak the ECard or ECardSimple.
2001-05-11 Chris Toshok <toshok@ximian.com> * contact-editor/e-contact-editor.c (enable_writable_fields): don't leak the ECard or ECardSimple. svn path=/trunk/; revision=9757
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/contact-editor/e-contact-editor.c22
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c22
3 files changed, 31 insertions, 18 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 10e0616c9c..3a70eb7862 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-11 Chris Toshok <toshok@ximian.com>
+
+ * contact-editor/e-contact-editor.c (enable_writable_fields):
+ don't leak the ECard or ECardSimple.
+
2001-05-08 Iain Holmes <iain@ximian.com>
* backend/ebook/GNOME_Evolution_Addressbook_VCard_Importer.oaf.in:
diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c
index 8c9b7519a3..f4ebc9c68d 100644
--- a/addressbook/contact-editor/e-contact-editor.c
+++ b/addressbook/contact-editor/e-contact-editor.c
@@ -1774,13 +1774,15 @@ enable_writable_fields(EContactEditor *editor)
EIterator *iter;
GHashTable *dropdown_hash, *supported_hash;
int i;
- ECardSimple *card;
+ ECardSimple *simple;
+ ECard *card;
char *widget_name;
if (!fields)
return;
- card = e_card_simple_new (e_card_new (""));
+ card = e_card_new ("");
+ simple = e_card_simple_new (card);
dropdown_hash = g_hash_table_new (g_str_hash, g_str_equal);
supported_hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -1789,17 +1791,17 @@ enable_writable_fields(EContactEditor *editor)
e_contact_editor_build_phone_ui (editor);
for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++)
g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(card, e_card_simple_map_phone_to_field (i)),
+ (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_phone_to_field (i)),
editor->phone_info[i].widget);
e_contact_editor_build_email_ui (editor);
for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++)
g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(card, e_card_simple_map_email_to_field (i)),
+ (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_email_to_field (i)),
editor->email_info[i].widget);
e_contact_editor_build_address_ui (editor);
for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++)
g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(card, e_card_simple_map_address_to_field (i)),
+ (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_address_to_field (i)),
editor->address_info[i].widget);
/* then disable them all */
@@ -1843,18 +1845,18 @@ enable_writable_fields(EContactEditor *editor)
disabled label next to a drop down when the item in
the menu (the one reflected in the label) is
enabled. */
- if (!strcmp (field, e_card_simple_get_ecard_field (card, e_card_simple_map_email_to_field(editor->email_choice)))) {
+ if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_email_to_field(editor->email_choice)))) {
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-email1"), TRUE);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "entry-email1"), !editor->is_read_only);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), TRUE);
}
- else if (!strcmp (field, e_card_simple_get_ecard_field (card, e_card_simple_map_address_to_field(editor->address_choice)))) {
+ else if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(editor->address_choice)))) {
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-address"), TRUE);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "button-fulladdr"), !editor->is_read_only);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "text-address"), !editor->is_read_only);
}
else for (i = 0; i < 4; i ++) {
- if (!strcmp (field, e_card_simple_get_ecard_field (card, e_card_simple_map_phone_to_field(editor->phone_choice[i])))) {
+ if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_phone_to_field(editor->phone_choice[i])))) {
widget_name = g_strdup_printf ("label-phone%d", i+1);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, widget_name), TRUE);
g_free (widget_name);
@@ -1869,7 +1871,7 @@ enable_writable_fields(EContactEditor *editor)
for (i = 0; i < num_widget_field_mappings; i ++) {
gboolean enabled = g_hash_table_lookup (supported_hash,
- e_card_simple_get_ecard_field (card,
+ e_card_simple_get_ecard_field (simple,
widget_field_mappings[i].field_id)) != NULL;
gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
widget_field_mappings[i].widget_name), enabled);
@@ -1877,6 +1879,8 @@ enable_writable_fields(EContactEditor *editor)
g_hash_table_destroy (dropdown_hash);
g_hash_table_destroy (supported_hash);
+ gtk_object_unref (GTK_OBJECT(simple));
+ gtk_object_unref (GTK_OBJECT(card));
}
static void
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 8c9b7519a3..f4ebc9c68d 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1774,13 +1774,15 @@ enable_writable_fields(EContactEditor *editor)
EIterator *iter;
GHashTable *dropdown_hash, *supported_hash;
int i;
- ECardSimple *card;
+ ECardSimple *simple;
+ ECard *card;
char *widget_name;
if (!fields)
return;
- card = e_card_simple_new (e_card_new (""));
+ card = e_card_new ("");
+ simple = e_card_simple_new (card);
dropdown_hash = g_hash_table_new (g_str_hash, g_str_equal);
supported_hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -1789,17 +1791,17 @@ enable_writable_fields(EContactEditor *editor)
e_contact_editor_build_phone_ui (editor);
for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++)
g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(card, e_card_simple_map_phone_to_field (i)),
+ (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_phone_to_field (i)),
editor->phone_info[i].widget);
e_contact_editor_build_email_ui (editor);
for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++)
g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(card, e_card_simple_map_email_to_field (i)),
+ (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_email_to_field (i)),
editor->email_info[i].widget);
e_contact_editor_build_address_ui (editor);
for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++)
g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(card, e_card_simple_map_address_to_field (i)),
+ (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_address_to_field (i)),
editor->address_info[i].widget);
/* then disable them all */
@@ -1843,18 +1845,18 @@ enable_writable_fields(EContactEditor *editor)
disabled label next to a drop down when the item in
the menu (the one reflected in the label) is
enabled. */
- if (!strcmp (field, e_card_simple_get_ecard_field (card, e_card_simple_map_email_to_field(editor->email_choice)))) {
+ if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_email_to_field(editor->email_choice)))) {
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-email1"), TRUE);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "entry-email1"), !editor->is_read_only);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), TRUE);
}
- else if (!strcmp (field, e_card_simple_get_ecard_field (card, e_card_simple_map_address_to_field(editor->address_choice)))) {
+ else if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(editor->address_choice)))) {
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-address"), TRUE);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "button-fulladdr"), !editor->is_read_only);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "text-address"), !editor->is_read_only);
}
else for (i = 0; i < 4; i ++) {
- if (!strcmp (field, e_card_simple_get_ecard_field (card, e_card_simple_map_phone_to_field(editor->phone_choice[i])))) {
+ if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_phone_to_field(editor->phone_choice[i])))) {
widget_name = g_strdup_printf ("label-phone%d", i+1);
gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, widget_name), TRUE);
g_free (widget_name);
@@ -1869,7 +1871,7 @@ enable_writable_fields(EContactEditor *editor)
for (i = 0; i < num_widget_field_mappings; i ++) {
gboolean enabled = g_hash_table_lookup (supported_hash,
- e_card_simple_get_ecard_field (card,
+ e_card_simple_get_ecard_field (simple,
widget_field_mappings[i].field_id)) != NULL;
gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
widget_field_mappings[i].widget_name), enabled);
@@ -1877,6 +1879,8 @@ enable_writable_fields(EContactEditor *editor)
g_hash_table_destroy (dropdown_hash);
g_hash_table_destroy (supported_hash);
+ gtk_object_unref (GTK_OBJECT(simple));
+ gtk_object_unref (GTK_OBJECT(card));
}
static void