Re: gnome-pim confusion



rms39@columbia.edu (Russell Steinthal) writes:

> I'm willing to grant that not saving a property we load from disk is 
> a bug, and since the fix should be relatively simple, I'll accept 
> this as a bug fix, and not subject to the feature freeze.

What about about updating the property when things are changed?  Also
a simple fix (simpler than saving, actually, but I have a patch for
both).  

The deletion problem I can live with, but right now the gnomecard
conduit has a serious confusion with entering things on the PC
(namely, enter new and it gets synced, modify something and it will be
silently lost).  I've been using the conduit for two days now and it's
already bitten me.

Since the patch is puny, I'm attaching it below.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
268 days, 15 hours, 38 minutes, 47 till we run away.
So many women; so little nerve.
? rev
Index: card.c
===================================================================
RCS file: /cvs/gnome/gnome-pim/gnomecard/card.c,v
retrieving revision 1.32
diff -c -c -r1.32 card.c
*** card.c	2000/01/03 05:28:38	1.32
--- card.c	2000/02/17 00:03:09
***************
*** 845,851 ****
  		     ss = strtok (NULL, "-"), i++)
  		  switch (i) {
  		   case 0:
! 			  rev.tm.tm_year = atoi(ss);
  			  break;
  		   case 1:
  			  rev.tm.tm_mon = atoi(ss);
--- 845,851 ----
  		     ss = strtok (NULL, "-"), i++)
  		  switch (i) {
  		   case 0:
! 			  rev.tm.tm_year = atoi(ss) - 1900;
  			  break;
  		   case 1:
  			  rev.tm.tm_mon = atoi(ss);
***************
*** 1408,1413 ****
--- 1408,1434 ----
  	return str;
  }
  
+ char *card_rev_str(CardRev rev)
+ {
+ 	char *str;
+         size_t len;
+ 
+         len = 20;
+ 
+         if (rev.utc)
+             len += 1;           /* Use 'Z' for zone */
+         
+ 	str = malloc(len);
+ 	snprintf(str, 20, "%04d-%02d-%02dT%02d:%02d:%02d",
+                  rev.tm.tm_year+1900, rev.tm.tm_mon+1, rev.tm.tm_mday,
+                  rev.tm.tm_hour, rev.tm.tm_min, rev.tm.tm_sec);
+ 
+         if (rev.utc)
+             strcpy(str+19, "Z");
+         
+ 	return str;
+ }
+ 
  char *card_timezn_str(CardTimeZone timezn)
  {
  	char *str;
***************
*** 1460,1465 ****
--- 1481,1495 ----
  		vprop = addPropValue(vobj, VCBirthDateProp, date_str);
  		free(date_str);
  		add_CardProperty(vprop, &crd->bday.prop);
+ 	}
+ 
+ 	if (crd->rev.prop.used) {
+ 		char *date_str;
+ 		
+ 		date_str = card_rev_str(crd->rev);
+ 		vprop = addPropValue(vobj, VCLastRevisedProp, date_str);
+ 		free(date_str);
+ 		add_CardProperty(vprop, &crd->rev.prop);
  	}
  
  	if (crd->xtension.l) {
Index: card.h
===================================================================
RCS file: /cvs/gnome/gnome-pim/gnomecard/card.h,v
retrieving revision 1.20
diff -c -c -r1.20 card.h
*** card.h	1999/10/13 08:47:02	1.20
--- card.h	2000/02/17 00:03:09
***************
*** 266,271 ****
--- 266,272 ----
  extern char         *card_to_string (Card *card);
  
  extern char *card_bday_str (CardBDay bday);
+ extern char *card_rev_str(CardRev rev);
  extern char *card_timezn_str (CardTimeZone timezn);
  extern char *card_geopos_str (CardGeoPos geopos);
  
Index: dialog.c
===================================================================
RCS file: /cvs/gnome/gnome-pim/gnomecard/dialog.c,v
retrieving revision 1.38
diff -c -c -r1.38 dialog.c
*** dialog.c	1999/10/11 03:09:44	1.38
--- dialog.c	2000/02/17 00:03:09
***************
*** 197,202 ****
--- 197,209 ----
  	/* link to new phone list */
  	crd->phone.l = phonelist_get_entries (ce->phonelist);
  
+         /* Update revision */
+         tt = time(NULL);
+         tm = gmtime(&tt);
+         crd->rev.utc = 0;
+         crd->rev.tm = *tm;
+         crd->rev.prop.used = TRUE;
+         
  	/* key data */
          MY_FREE(crd->key.data);
  	


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]