From f699f9902b5e374070e8dd2c0fe43028f8dfb89f Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 5 Jun 2001 23:49:59 +0000 Subject: Copy dates as they come in. 2001-06-05 Christopher James Lahey * backend/ebook/e-card.c (e_card_set_arg): Copy dates as they come in. * backend/pas/pas-backend-file.c (pas_backend_file_changes_foreach_key, pas_backend_file_changes, pas_backend_file_process_remove_card, pas_backend_file_process_modify_card, pas_backend_file_build_all_cards_list, pas_backend_file_get_vcard, pas_backend_file_maybe_upgrade_db): memset DBTs to 0 before using them. (pas_backend_file_build_all_cards_list): Reindented. * contact-editor/contact-editor.glade: Replaced GnomeDateEdits with a custom widget that creates an EDateEdit. * contact-editor/e-contact-editor.c: Use an EDateEdit here instead of a GnomeDateEdit. svn path=/trunk/; revision=10125 --- .../gui/contact-editor/contact-editor.glade | 387 +++++++-------------- addressbook/gui/contact-editor/e-contact-editor.c | 121 ++++--- 2 files changed, 207 insertions(+), 301 deletions(-) (limited to 'addressbook/gui/contact-editor') diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index c6afe583f5..af5d17d954 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -15,19 +15,12 @@ False False False - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h GnomeDialog dialog2 2 - True False GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -42,7 +35,6 @@ GtkVBox GnomeDialog:vbox dialog-vbox2 - True False 4 @@ -51,10 +43,51 @@ True + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button28 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button29 + True + True + GNOME_STOCK_BUTTON_APPLY + + + + GtkButton + button30 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + GtkTable table2 - True 2 2 False @@ -69,7 +102,6 @@ GtkEntry entry2 - True True True True @@ -94,7 +126,6 @@ GtkVBox vbox1 - True False 2 @@ -116,9 +147,9 @@ GtkButton button31 2 - True True + GTK_RELIEF_NORMAL 0 False @@ -130,9 +161,9 @@ GtkButton button32 2 - True True + GTK_RELIEF_NORMAL 0 False @@ -145,7 +176,6 @@ GtkScrolledWindow scrolledwindow1 200 - True GTK_POLICY_ALWAYS GTK_POLICY_ALWAYS GTK_UPDATE_CONTINUOUS @@ -168,7 +198,6 @@ GtkCList clist1 - True True 1 80 @@ -180,7 +209,6 @@ GtkLabel CList:title label20 - True GTK_JUSTIFY_CENTER False @@ -192,12 +220,39 @@ + + + + + GnomeDialog + dialog-add-phone + False + New phone type + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + vbox2 + False + 8 + + 4 + True + True + GtkHButtonBox GnomeDialog:action_area - dialog-action_area2 - True + hbuttonbox1 GTK_BUTTONBOX_END 8 85 @@ -213,67 +268,27 @@ GtkButton - button28 - True - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button29 - True + button43 True + True True - GNOME_STOCK_BUTTON_APPLY + + GNOME_STOCK_PIXMAP_ADD GtkButton - button30 - True + button44 True True GNOME_STOCK_BUTTON_CANCEL - - - - - GnomeDialog - dialog-add-phone - True - False - New phone type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - vbox2 - True - False - 8 - - 4 - True - True - GtkFrame frame-add-phone 4 - True 0 GTK_SHADOW_ETCHED_IN @@ -287,7 +302,6 @@ GtkAlignment alignment9 9 - True 0.5 0.5 1 @@ -296,7 +310,6 @@ GtkEntry entry-add-phone - True True True True @@ -306,52 +319,12 @@ - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - True - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button43 - True - True - True - True - - GNOME_STOCK_PIXMAP_ADD - - - - GtkButton - button44 - True - True - True - GNOME_STOCK_BUTTON_CANCEL - - GnomeApp contact editor - True False Contact Editor GTK_WINDOW_TOPLEVEL @@ -366,7 +339,6 @@ GnomeDock GnomeApp:dock dock1 - True True 0 @@ -378,7 +350,6 @@ GtkNotebook GnomeDock:contents notebook-contact-editor - True True True True @@ -392,7 +363,6 @@ GtkTable table-contact-editor-general 7 - True 14 8 False @@ -402,7 +372,6 @@ GtkEntry entry-phone1 - True True True True @@ -427,7 +396,6 @@ GtkEntry entry-phone2 - True True True True @@ -452,7 +420,6 @@ GtkEntry entry-phone3 - True True True True @@ -477,7 +444,6 @@ GtkEntry entry-phone4 - True True True True @@ -504,7 +470,6 @@ text-address 1 1 - True True True @@ -527,9 +492,9 @@ GtkButton button-fullname - True True + GTK_RELIEF_NORMAL 1 3 @@ -549,7 +514,6 @@ GtkAccelLabel accellabel-fileas - True GTK_JUSTIFY_CENTER False @@ -576,7 +540,6 @@ GtkAccelLabel accellabel-web - True GTK_JUSTIFY_LEFT False @@ -603,7 +566,6 @@ GtkAlignment alignment3 - True 1 0.5 0 @@ -626,7 +588,7 @@ GtkButton button-email1 - True + GTK_RELIEF_NORMAL Placeholder @@ -637,7 +599,6 @@ GtkAlignment alignment5 - True 1 0.5 0 @@ -660,7 +621,7 @@ GtkButton button-phone4 - True + GTK_RELIEF_NORMAL Placeholder @@ -671,7 +632,6 @@ GtkAlignment alignment7 - True 1 0.5 0 @@ -694,7 +654,7 @@ GtkButton button-phone2 - True + GTK_RELIEF_NORMAL Placeholder @@ -705,7 +665,6 @@ GtkAlignment alignment8 - True 1 0.5 0 @@ -728,7 +687,7 @@ GtkButton button-phone1 - True + GTK_RELIEF_NORMAL Placeholder @@ -739,7 +698,6 @@ GtkHSeparator hseparator4 - True 4 8 @@ -759,7 +717,6 @@ GtkAlignment alignment6 - True 1 0.5 0 @@ -782,7 +739,7 @@ GtkButton button-phone3 - True + GTK_RELIEF_NORMAL Placeholder @@ -793,7 +750,6 @@ GtkEntry entry-fullname - True True True True @@ -820,7 +776,6 @@ GtkEntry entry-jobtitle - True True True True @@ -845,7 +800,6 @@ GtkEntry entry-company - True True True True @@ -870,7 +824,6 @@ GtkEntry entry-email1 - True True True True @@ -895,7 +848,6 @@ GtkEntry entry-web - True True True True @@ -920,7 +872,6 @@ GtkHSeparator hseparator5 - True 0 4 @@ -940,7 +891,6 @@ GtkCombo combo-file-as - True False True True @@ -966,7 +916,6 @@ GtkEntry GtkCombo:entry entry-file-as - True True True True @@ -978,7 +927,6 @@ GtkHSeparator hseparator6 - True 0 4 @@ -998,7 +946,6 @@ GtkAlignment alignment10 - True 0.5 0 1 @@ -1021,7 +968,6 @@ GtkCheckButton checkbutton-htmlmail - True False True @@ -1031,7 +977,6 @@ GtkAlignment alignment4 - True 1 0.5 0 @@ -1054,7 +999,7 @@ GtkButton button-address - True + GTK_RELIEF_NORMAL Placeholder @@ -1065,7 +1010,6 @@ GtkEventBox eventbox1 - True 5 6 @@ -1084,7 +1028,6 @@ GtkLabel label-phone1 - True GTK_JUSTIFY_CENTER False @@ -1098,7 +1041,6 @@ GtkEventBox eventbox2 - True 5 6 @@ -1117,7 +1059,6 @@ GtkLabel label-phone2 - True GTK_JUSTIFY_CENTER False @@ -1132,7 +1073,6 @@ GtkEventBox eventbox3 - True 5 6 @@ -1151,7 +1091,6 @@ GtkLabel label-phone3 - True GTK_JUSTIFY_CENTER False @@ -1166,7 +1105,6 @@ GtkEventBox eventbox4 - True 5 6 @@ -1185,7 +1123,6 @@ GtkLabel label-phone4 - True GTK_JUSTIFY_LEFT False @@ -1200,7 +1137,6 @@ GtkEventBox eventbox5 - True 1 2 @@ -1219,7 +1155,6 @@ GtkLabel label-email1 - True GTK_JUSTIFY_CENTER False @@ -1234,7 +1169,6 @@ GtkEventBox eventbox-business - True 5 6 @@ -1253,7 +1187,6 @@ GtkLabel label-address - True GTK_JUSTIFY_CENTER False @@ -1268,7 +1201,6 @@ GtkAlignment alignment2 - True 0 0 0 @@ -1291,7 +1223,6 @@ GtkCheckButton checkbutton-mailingaddress - True False False @@ -1302,7 +1233,6 @@ GtkHSeparator hseparator9 - True 0 4 @@ -1322,7 +1252,6 @@ GtkHSeparator hseparator10 - True 4 8 @@ -1342,7 +1271,6 @@ GtkAlignment alignment-contacts - True 0.5 0.5 1 @@ -1365,16 +1293,15 @@ GtkButton button-contacts - True True + GTK_RELIEF_NORMAL GtkAlignment alignment15 - True 0.5 0.5 1 @@ -1397,7 +1324,6 @@ GtkEntry entry-categories - True True True True @@ -1409,7 +1335,6 @@ GtkAlignment alignment14 - True 0.5 0.5 1 @@ -1432,7 +1357,6 @@ GtkEntry entry-contacts - True True True True @@ -1444,7 +1368,6 @@ GtkAlignment alignment16 - True 0.5 0.5 1 @@ -1467,16 +1390,15 @@ GtkButton button-categories - True True + GTK_RELIEF_NORMAL GtkEventBox eventbox7 - True 1 3 @@ -1495,7 +1417,6 @@ GtkLabel label-jobtitle - True GTK_JUSTIFY_CENTER False @@ -1510,7 +1431,6 @@ Custom custom1 - True e_create_image_widget malehead.png @@ -1536,7 +1456,6 @@ Custom custom2 - True e_create_image_widget cellphone.png @@ -1562,7 +1481,6 @@ Custom custom3 - True e_create_image_widget envelope.png @@ -1588,7 +1506,6 @@ Custom custom4 - True e_create_image_widget house.png @@ -1614,7 +1531,6 @@ Custom custom5 - True e_create_image_widget evolution-contacts-plain.png @@ -1640,7 +1556,6 @@ Custom custom6 - True e_create_image_widget briefcase.png @@ -1666,7 +1581,6 @@ Custom custom10 - True e_create_image_widget globe.png @@ -1692,7 +1606,6 @@ GtkLabel label-company - True GTK_JUSTIFY_CENTER False @@ -1720,9 +1633,9 @@ GtkButton button-fulladdr - True True + GTK_RELIEF_NORMAL 5 7 @@ -1744,7 +1657,6 @@ GtkLabel Notebook:tab label15 - True GTK_JUSTIFY_CENTER False @@ -1758,7 +1670,6 @@ GtkTable table-contact-editor-details 7 - True 9 6 False @@ -1768,7 +1679,6 @@ GtkLabel label-department - True GTK_JUSTIFY_CENTER False @@ -1796,7 +1706,6 @@ GtkLabel label-office - True GTK_JUSTIFY_CENTER False @@ -1824,7 +1733,6 @@ GtkLabel label-profession - True GTK_JUSTIFY_CENTER False @@ -1852,7 +1760,6 @@ GtkLabel label-nickname - True GTK_JUSTIFY_CENTER False @@ -1880,7 +1787,6 @@ GtkLabel label-spouse - True GTK_JUSTIFY_CENTER False @@ -1908,7 +1814,6 @@ GtkLabel label-birthday - True GTK_JUSTIFY_CENTER False @@ -1935,7 +1840,6 @@ GtkLabel label-assistant - True GTK_JUSTIFY_CENTER False @@ -1963,7 +1867,6 @@ GtkLabel label-manager - True GTK_JUSTIFY_CENTER False @@ -1991,7 +1894,6 @@ GtkLabel label-anniversary - True GTK_JUSTIFY_CENTER False @@ -2018,7 +1920,6 @@ GtkEntry entry-spouse - True True True True @@ -2043,7 +1944,6 @@ GtkEntry entry-department - True True True True @@ -2068,7 +1968,6 @@ GtkEntry entry-office - True True True True @@ -2093,7 +1992,6 @@ GtkEntry entry-profession - True True True True @@ -2118,7 +2016,6 @@ GtkEntry entry-nickname - True True True True @@ -2140,60 +2037,9 @@ - - GnomeDateEdit - dateedit-anniversary - True - False - False - False - 7 - 19 - - 4 - 6 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GnomeDateEdit - dateedit-birthday - True - False - False - False - 7 - 19 - - 4 - 6 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - GtkEntry entry-assistant - True True True True @@ -2218,7 +2064,6 @@ GtkEntry entry-manager - True True True True @@ -2243,7 +2088,6 @@ GtkHSeparator hseparator7 - True 0 6 @@ -2263,7 +2107,6 @@ GtkLabel label-comments - True GTK_JUSTIFY_CENTER False @@ -2290,7 +2133,6 @@ GtkHSeparator hseparator8 - True 0 6 @@ -2310,7 +2152,6 @@ Custom custom7 - True e_create_image_widget briefcase.png @@ -2336,7 +2177,6 @@ Custom custom8 - True e_create_image_widget malehead.png @@ -2362,7 +2202,6 @@ GtkScrolledWindow scrolledwindow2 - True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_UPDATE_CONTINUOUS @@ -2385,7 +2224,6 @@ GtkText text-comments - True True True @@ -2395,7 +2233,6 @@ Custom custom9 - True e_create_image_widget globe.png @@ -2417,13 +2254,58 @@ True + + + Custom + dateedit-anniversary + e_contact_editor_create_date + 0 + 0 + Tue, 05 Jun 2001 02:36:32 GMT + + 4 + 6 + 5 + 6 + 0 + 0 + True + False + False + False + True + True + + + + + Custom + dateedit-birthday + e_contact_editor_create_date + 0 + 0 + Tue, 05 Jun 2001 02:36:27 GMT + + 4 + 6 + 4 + 5 + 0 + 0 + True + False + False + False + True + True + + GtkLabel Notebook:tab label16 - True GTK_JUSTIFY_CENTER False @@ -2439,7 +2321,6 @@ GnomeAppBar GnomeApp:appbar appbar1 - True True True diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index f4ebc9c68d..e9ad99283f 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -39,9 +38,12 @@ #include #include +#include + #include "addressbook/printing/e-contact-print.h" #include "addressbook/printing/e-contact-print-envelope.h" #include "e-util/e-gui-utils.h" +#include "widgets/misc/e-dateedit.h" #include "e-contact-editor.h" #include "e-contact-editor-address.h" @@ -592,6 +594,7 @@ categories_clicked(GtkWidget *button, EContactEditor *editor) GnomeDialog *dialog; int result; GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories"); + ECategoriesMasterList *ecml; if (entry && GTK_IS_ENTRY(entry)) categories = e_utf8_gtk_entry_get_text(GTK_ENTRY(entry)); else if (editor->card) @@ -599,9 +602,12 @@ categories_clicked(GtkWidget *button, EContactEditor *editor) "categories", &categories, NULL); dialog = GNOME_DIALOG(e_categories_new(categories)); + ecml = e_categories_master_list_wombat_new (); gtk_object_set(GTK_OBJECT(dialog), "header", _("This contact belongs to these categories:"), + "ecml", ecml, NULL); + gtk_object_unref (GTK_OBJECT (ecml)); gtk_widget_show(GTK_WIDGET(dialog)); result = gnome_dialog_run (dialog); g_free (categories); @@ -1973,30 +1979,29 @@ fill_in_info(EContactEditor *editor) editor->name = e_card_name_copy(name); widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (anniversary && widget && GNOME_IS_DATE_EDIT(widget)) { - struct tm time_struct = {0,0,0,0,0,0,0,0,0}; - time_t time_val; - GnomeDateEdit *dateedit; - - time_struct.tm_mday = anniversary->day; - time_struct.tm_mon = anniversary->month - 1; - time_struct.tm_year = anniversary->year - 1900; - time_val = mktime(&time_struct); - dateedit = GNOME_DATE_EDIT(widget); - gnome_date_edit_set_time(dateedit, time_val); + if (widget && E_IS_DATE_EDIT(widget)) { + EDateEdit *dateedit; + dateedit = E_DATE_EDIT(widget); + if (anniversary) + e_date_edit_set_date (dateedit, + anniversary->year, + anniversary->month, + anniversary->day); + else + e_date_edit_set_time (dateedit, -1); } widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (bday && widget && GNOME_IS_DATE_EDIT(widget)) { - 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 - 1; - time_struct.tm_year = bday->year - 1900; - time_val = mktime(&time_struct); - dateedit = GNOME_DATE_EDIT(widget); - gnome_date_edit_set_time(dateedit, time_val); + if (widget && E_IS_DATE_EDIT(widget)) { + EDateEdit *dateedit; + dateedit = E_DATE_EDIT(widget); + if (bday) + e_date_edit_set_date (dateedit, + bday->year, + bday->month, + bday->day); + else + e_date_edit_set_time (dateedit, -1); } set_fields(editor); @@ -2052,10 +2057,8 @@ extract_info(EContactEditor *editor) { ECard *card = editor->card; if (card) { - ECardDate *anniversary; - ECardDate *bday; - struct tm time_struct; - time_t time_val; + ECardDate anniversary; + ECardDate bday; int i; GtkWidget *widget; GList *list; @@ -2087,31 +2090,35 @@ extract_info(EContactEditor *editor) NULL); widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && GNOME_IS_DATE_EDIT(widget)) { - time_val = gnome_date_edit_get_date(GNOME_DATE_EDIT(widget)); - gmtime_r(&time_val, - &time_struct); - anniversary = g_new(ECardDate, 1); - anniversary->day = time_struct.tm_mday; - anniversary->month = time_struct.tm_mon + 1; - anniversary->year = time_struct.tm_year + 1900; - gtk_object_set(GTK_OBJECT(card), - "anniversary", anniversary, - NULL); + if (widget && E_IS_DATE_EDIT(widget)) { + if (e_date_edit_get_date (E_DATE_EDIT (widget), + &anniversary.year, + &anniversary.month, + &anniversary.day)) { + g_print ("%d %d %d\n", anniversary.year, anniversary.month, anniversary.day); + gtk_object_set(GTK_OBJECT(card), + "anniversary", &anniversary, + NULL); + } else + gtk_object_set(GTK_OBJECT(card), + "anniversary", NULL, + NULL); } widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && GNOME_IS_DATE_EDIT(widget)) { - time_val = gnome_date_edit_get_date(GNOME_DATE_EDIT(widget)); - gmtime_r(&time_val, - &time_struct); - bday = g_new(ECardDate, 1); - bday->day = time_struct.tm_mday; - bday->month = time_struct.tm_mon + 1; - bday->year = time_struct.tm_year + 1900; - gtk_object_set(GTK_OBJECT(card), - "birth_date", bday, - NULL); + if (widget && E_IS_DATE_EDIT(widget)) { + if (e_date_edit_get_date (E_DATE_EDIT (widget), + &bday.year, + &bday.month, + &bday.day)) { + g_print ("%d %d %d\n", bday.year, bday.month, bday.day); + gtk_object_set(GTK_OBJECT(card), + "birth_date", &bday, + NULL); + } else + gtk_object_set(GTK_OBJECT(card), + "birth_date", NULL, + NULL); } } } @@ -2127,3 +2134,21 @@ e_contact_editor_raise (EContactEditor *editor) { gdk_window_raise (GTK_WIDGET (editor->app)->window); } + +GtkWidget * +e_contact_editor_create_date(gchar *name, + gchar *string1, gchar *string2, + gint int1, gint int2); + +GtkWidget * +e_contact_editor_create_date(gchar *name, + gchar *string1, gchar *string2, + gint int1, gint int2) +{ + GtkWidget *widget = e_date_edit_new (); + e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), + TRUE); + e_date_edit_set_show_time (E_DATE_EDIT (widget), FALSE); + e_date_edit_set_time (E_DATE_EDIT (widget), -1); + return widget; +} -- cgit v1.2.3