aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-12 06:39:22 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-12 06:39:22 +0800
commitf9b9d73b82f4eb6568593722af134f32b98d9b57 (patch)
tree3063084fb5168194f742b11181bd15fd3e877a51 /addressbook/gui
parentf35bfdac73e1e48378dfb7afa7928a100a51e707 (diff)
downloadgsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.tar
gsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.tar.gz
gsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.tar.bz2
gsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.tar.lz
gsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.tar.xz
gsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.tar.zst
gsoc2013-evolution-f9b9d73b82f4eb6568593722af134f32b98d9b57.zip
Changed these to use the new ref and unref functions for ECard auxillary
2001-10-11 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-card-simple.c (e_card_simple_destroy, fill_in_info, e_card_simple_sync_card, e_card_simple_set_phone, e_card_simple_set_address, e_card_simple_set_delivery_address, file_as_get_style, file_as_set_style, e_card_simple_set, e_card_simple_set_arbitrary), gui/contact-editor/e-contact-editor-address.c (e_contact_editor_address_destroy, e_contact_editor_address_set_arg, e_contact_editor_address_get_arg), gui/contact-editor/e-contact-editor-fullname.c (e_contact_editor_fullname_destroy, e_contact_editor_fullname_set_arg, e_contact_editor_fullname_get_arg), gui/contact-editor/e-contact-editor.c (phone_entry_changed, address_text_changed, name_entry_changed, full_name_clicked, full_addr_clicked, fill_in_info): Changed these to use the new ref and unref functions for ECard auxillary types. * backend/ebook/e-card-simple.h: Added a comment. * backend/ebook/e-card-types.h: Added ref_count field to all the types. * backend/ebook/e-card.c, backend/ebook/e-card.h: Added ref and unref functions here for all the ECard auxillary types. Removed the corresponding free functions. Switched to using these functions where appropriate. * gui/component/addressbook-factory.c: #include <e-util/e-passwords.h> * gui/component/addressbook.c (load_uri_cb): const correctify. * gui/component/select-names/e-select-names-manager.c, gui/component/select-names/e-select-names.c: #include <addressbook/gui/component/addressbook.h> * gui/widgets/e-addressbook-model.c (modify_card): Removed an unnecessary ref here. svn path=/trunk/; revision=13604
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-factory.c1
-rw-r--r--addressbook/gui/component/addressbook.c11
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c1
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c1
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.c7
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c7
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c29
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c1
8 files changed, 26 insertions, 32 deletions
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
index 1719c4fd8f..c941cbf24d 100644
--- a/addressbook/gui/component/addressbook-factory.c
+++ b/addressbook/gui/component/addressbook-factory.c
@@ -17,6 +17,7 @@
#include <bonobo/bonobo-main.h>
#include <glade/glade.h>
#include <gal/widgets/e-cursors.h>
+#include <e-util/e-passwords.h>
#include <camel/camel.h>
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 8dc978f603..41b2ff7396 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -603,7 +603,8 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
if (source &&
source->type == ADDRESSBOOK_SOURCE_LDAP &&
source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- char *password;
+ const char *password;
+ char *pass_dup = NULL;
password = e_passwords_get_password(load_uri_data->uri);
@@ -613,7 +614,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
prompt = g_strdup_printf (_("Enter password for %s (user %s)"), source->name, source->email_addr);
remember = source->remember_passwd;
- password = e_passwords_ask_password (
+ pass_dup = e_passwords_ask_password (
prompt, load_uri_data->uri, prompt, TRUE,
E_PASSWORDS_REMEMBER_FOREVER, &remember,
NULL);
@@ -624,10 +625,10 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
g_free (prompt);
}
- if (password) {
- e_book_authenticate_user (book, source->email_addr, password,
+ if (password || pass_dup) {
+ e_book_authenticate_user (book, source->email_addr, password ? password : pass_dup,
load_uri_auth_cb, closure);
- g_free (password);
+ g_free (pass_dup);
return;
}
}
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index 5820a2bf52..d392930570 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -21,6 +21,7 @@
#include "e-select-names-completion.h"
#include "e-select-names-popup.h"
#include <addressbook/backend/ebook/e-destination.h>
+#include <addressbook/gui/component/addressbook.h>
#include <bonobo-conf/bonobo-config-database.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-moniker-util.h>
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index de592dc01e..0befe02ffc 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -38,6 +38,7 @@
#include <addressbook/backend/ebook/e-book.h>
#include <addressbook/gui/component/addressbook-component.h>
#include <addressbook/gui/component/addressbook-storage.h>
+#include <addressbook/gui/component/addressbook.h>
#include <shell/evolution-shell-client.h>
#include "e-select-names.h"
diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c
index 919fb63acb..f07b483c21 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-address.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-address.c
@@ -123,7 +123,7 @@ e_contact_editor_address_destroy (GtkObject *object)
if (e_contact_editor_address->gui)
gtk_object_unref(GTK_OBJECT(e_contact_editor_address->gui));
- e_card_delivery_address_free(e_contact_editor_address->address);
+ e_card_delivery_address_unref(e_contact_editor_address->address);
}
GtkWidget*
@@ -145,8 +145,7 @@ e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_ADDRESS:
- if (e_contact_editor_address->address)
- e_card_delivery_address_free(e_contact_editor_address->address);
+ e_card_delivery_address_unref(e_contact_editor_address->address);
e_contact_editor_address->address = e_card_delivery_address_copy(GTK_VALUE_POINTER (*arg));
fill_in_info(e_contact_editor_address);
break;
@@ -190,7 +189,7 @@ e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_ADDRESS:
extract_info(e_contact_editor_address);
- GTK_VALUE_POINTER (*arg) = e_card_delivery_address_copy(e_contact_editor_address->address);
+ GTK_VALUE_POINTER (*arg) = e_card_delivery_address_ref(e_contact_editor_address->address);
break;
case ARG_IS_READ_ONLY:
GTK_VALUE_BOOL (*arg) = e_contact_editor_address->editable ? TRUE : FALSE;
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index 0af0de3236..ddf69d861c 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -123,7 +123,7 @@ e_contact_editor_fullname_destroy (GtkObject *object)
if (e_contact_editor_fullname->gui)
gtk_object_unref(GTK_OBJECT(e_contact_editor_fullname->gui));
- e_card_name_free(e_contact_editor_fullname->name);
+ e_card_name_unref(e_contact_editor_fullname->name);
}
GtkWidget*
@@ -145,8 +145,7 @@ e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_NAME:
- if (e_contact_editor_fullname->name)
- e_card_name_free(e_contact_editor_fullname->name);
+ e_card_name_unref(e_contact_editor_fullname->name);
e_contact_editor_fullname->name = e_card_name_copy(GTK_VALUE_POINTER (*arg));
fill_in_info(e_contact_editor_fullname);
break;
@@ -188,7 +187,7 @@ e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_NAME:
extract_info(e_contact_editor_fullname);
- GTK_VALUE_POINTER (*arg) = e_card_name_copy(e_contact_editor_fullname->name);
+ GTK_VALUE_POINTER (*arg) = e_card_name_ref(e_contact_editor_fullname->name);
break;
case ARG_IS_READ_ONLY:
GTK_VALUE_BOOL (*arg) = e_contact_editor_fullname->editable ? TRUE : FALSE;
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index d34d1589b3..72d49b5908 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -262,7 +262,6 @@ static void
phone_entry_changed (GtkWidget *widget, EContactEditor *editor)
{
int which;
- gchar *string;
GtkEntry *entry = GTK_ENTRY(widget);
ECardPhone *phone;
@@ -276,14 +275,10 @@ phone_entry_changed (GtkWidget *widget, EContactEditor *editor)
which = 4;
} else
return;
- string = e_utf8_gtk_entry_get_text(entry);
phone = e_card_phone_new();
- phone->number = string;
+ phone->number = e_utf8_gtk_entry_get_text(entry);
e_card_simple_set_phone(editor->simple, editor->phone_choice[which - 1], phone);
-#if 0
- phone->number = NULL;
-#endif
- e_card_phone_free(phone);
+ e_card_phone_unref(phone);
set_fields(editor);
widget_changed (widget, editor);
@@ -318,7 +313,7 @@ address_text_changed (GtkWidget *widget, EContactEditor *editor)
address->data = e_utf8_gtk_editable_get_chars(editable, 0, -1);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
- e_card_address_label_free(address);
+ e_card_address_label_unref(address);
widget_changed (widget, editor);
}
@@ -485,7 +480,7 @@ name_entry_changed (GtkWidget *widget, EContactEditor *editor)
style = file_as_get_style(editor);
- e_card_name_free(editor->name);
+ e_card_name_unref(editor->name);
string = e_utf8_gtk_entry_get_text (GTK_ENTRY(widget));
editor->name = e_card_name_from_string(string);
@@ -689,8 +684,8 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
g_free(full_name);
}
- e_card_name_free(editor->name);
- editor->name = e_card_name_copy(name);
+ e_card_name_unref(editor->name);
+ editor->name = e_card_name_ref(name);
file_as_set_style(editor, style);
}
@@ -729,12 +724,12 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
} else {
ECardAddrLabel *address = e_card_delivery_address_to_label(new_address);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
- e_card_address_label_free(address);
+ e_card_address_label_unref(address);
}
e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address);
- e_card_delivery_address_free(new_address);
+ e_card_delivery_address_unref(new_address);
}
gtk_object_unref(GTK_OBJECT(dialog));
}
@@ -1329,9 +1324,7 @@ e_contact_editor_destroy (GtkObject *object) {
if (e_contact_editor->book)
gtk_object_unref(GTK_OBJECT(e_contact_editor->book));
- if (e_contact_editor->name)
- e_card_name_free(e_contact_editor->name);
-
+ e_card_name_unref(e_contact_editor->name);
g_free (e_contact_editor->company);
gtk_object_unref(GTK_OBJECT(e_contact_editor->gui));
@@ -2332,8 +2325,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);
- e_card_name_free(editor->name);
- editor->name = e_card_name_copy(name);
+ e_card_name_unref(editor->name);
+ editor->name = e_card_name_ref(name);
widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary");
if (widget && E_IS_DATE_EDIT(widget)) {
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index a93ae6aa28..e43d9e5ec6 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -205,7 +205,6 @@ modify_card(EBookView *book_view,
if ( !strcmp(e_card_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) {
gtk_object_unref(GTK_OBJECT(model->data[i]));
model->data[i] = e_card_duplicate(E_CARD(cards->data));
- gtk_object_ref(GTK_OBJECT(model->data[i]));
gtk_signal_emit (GTK_OBJECT (model),
e_addressbook_model_signals [CARD_CHANGED],
i);