From 23c29cbcf654883e1243f51adb4bfe3556477cff Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 16 Apr 2000 11:36:03 +0000 Subject: Added orginization and role fields. 2000-04-16 Christopher James Lahey * addressbook/backend/ebook/e-card.c, addressbook/backend/ebook/e-card.h, addressbook/backend/ebook/test-card.c, addressbook/backend/pas/pas-backend-file.c, addressbook/gui/minicard/e-minicard.c: Added orginization and role fields. * addressbook/contact-editor/contact-editor.glade, addressbook/contact-editor/e-contact-editor-strings.h: Renamed some incorrectly named fields. * addressbook/contact-editor/e-contact-editor.c: Added orginization and role fields as well as hooking up the birth date field. * addressbook/gui/minicard/e-minicard-view.c: Added a missing include. svn path=/trunk/; revision=2458 --- addressbook/contact-editor/e-contact-editor.c | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'addressbook/contact-editor/e-contact-editor.c') diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index 5461fe3993..74f7e06345 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -583,10 +583,13 @@ fill_in_info(EContactEditor *editor) ECardList *phone_list; ECardList *email_list; char *title; + char *org; char *url; + char *role; char *note; const ECardDeliveryAddress *address; const ECardPhone *phone; + const ECardDate *bday; GtkEditable *editable; int position = 0; const char *email; @@ -599,8 +602,11 @@ fill_in_info(EContactEditor *editor) "phone", &phone_list, "email", &email_list, "url", &url, + "org", &org, "title", &title, + "role", &role, "note", ¬e, + "birth_date", &bday, NULL); position = 0; @@ -642,17 +648,41 @@ fill_in_info(EContactEditor *editor) if (url) gtk_editable_insert_text(editable, url, strlen(url), &position); + position = 0; + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-company")); + gtk_editable_delete_text(editable, 0, -1); + if (org) + gtk_editable_insert_text(editable, org, strlen(org), &position); + position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-jobtitle")); gtk_editable_delete_text(editable, 0, -1); if (title) gtk_editable_insert_text(editable, title, strlen(title), &position); + position = 0; + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-profession")); + gtk_editable_delete_text(editable, 0, -1); + if (role) + gtk_editable_insert_text(editable, role, strlen(role), &position); + position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-comments")); gtk_editable_delete_text(editable, 0, -1); if (note) gtk_editable_insert_text(editable, note, strlen(note), &position); + + if (bday) { + struct tm time_struct = {0,0,0,0,0,0,0,0,0}; + time_t time_val; + GnomeDateEdit *dateedit; + time_struct.tm_mday = bday->day; + time_struct.tm_mon = bday->month; + time_struct.tm_year = bday->year; + time_val = mktime(&time_struct); + dateedit = GNOME_DATE_EDIT(glade_xml_get_widget(editor->gui, "dateedit-birthday")); + gnome_date_edit_set_time(dateedit, time_val); + } } } @@ -667,15 +697,21 @@ extract_info(EContactEditor *editor) ECardList *phone_list; ECardList *email_list; char *url; + char *org; char *title; + char *role; char *note; const ECardDeliveryAddress *address; const ECardPhone *phone; ECardDeliveryAddress *address_copy; ECardPhone *phone_copy; char *email; + ECardDate *bday; GtkEditable *editable; + GnomeDateEdit *dateedit; int position = 0; + struct tm time_struct; + time_t time_val; ECardIterator *iterator; @@ -761,6 +797,14 @@ extract_info(EContactEditor *editor) NULL); g_free(url); + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-company")); + org = gtk_editable_get_chars(editable, 0, -1); + if (org && *org) + gtk_object_set(GTK_OBJECT(card), + "org", org, + NULL); + g_free(org); + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-jobtitle")); title = gtk_editable_get_chars(editable, 0, -1); if (title && *title) @@ -769,6 +813,14 @@ extract_info(EContactEditor *editor) NULL); g_free(title); + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-profession")); + role = gtk_editable_get_chars(editable, 0, -1); + if (role && *role) + gtk_object_set(GTK_OBJECT(card), + "role", role, + NULL); + g_free(role); + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-comments")); note = gtk_editable_get_chars(editable, 0, -1); if (note && *note) @@ -777,5 +829,25 @@ extract_info(EContactEditor *editor) NULL); g_free(note); + dateedit = GNOME_DATE_EDIT(glade_xml_get_widget(editor->gui, "dateedit-birthday")); + time_val = gnome_date_edit_get_date(dateedit); + gmtime_r(&time_val, + &time_struct); + bday = g_new(ECardDate, 1); + bday->day = time_struct.tm_mday; + bday->month = time_struct.tm_mon; + bday->year = time_struct.tm_year; + gtk_object_set(GTK_OBJECT(card), + "birth_date", bday, + NULL); } } + + + + + + + + + -- cgit v1.2.3