From b1d3178bba66089726e6f93a49af97371bdf5db8 Mon Sep 17 00:00:00 2001
From: Frederic Culot <calcurse@culot.org>
Date: Mon, 15 Dec 2008 20:02:00 +0000
Subject: small bugfixes and a major one (freeze when deleting an appointment's
 note, thanks Jan for reporting it)

---
 ChangeLog       | 25 ++++++++++++++++++++-----
 po/calcurse.pot | 10 +++++-----
 po/de.po        | 12 ++++++------
 po/en.po        | 12 ++++++------
 po/es.po        | 12 ++++++------
 po/fr.po        | 12 ++++++------
 po/nl.po        | 12 ++++++------
 src/apoint.c    | 11 ++++++-----
 src/day.c       | 12 ++++++++----
 src/keys.c      |  4 ++--
 src/todo.c      |  6 +++---
 src/utils.c     |  4 ++--
 12 files changed, 76 insertions(+), 56 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a38c0bc..7a97fa8 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-12-15  Frederic Culot  <frederic@culot.org>
+
+	* src/todo.c (todo_delete)
+	* src/day.c (day_edit_item): fixed a bug that prevented from
+	editing an item
+
+	* src/keys.c: generic-escape renamed into generic-cancel
+
+	* src/utils.c (getstring): make the escape key work again to
+	cancel editing
+
+	* src/apoint.c (apoint_delete_bynum)	
+	* src/day.c (day_erase_item): fixed a possible freeze when
+	deleting an appointment's note
+	
 2008-12-14  Frederic Culot  <frederic@culot.org>
 
 	* === Released 2.4_beta ===
@@ -9,11 +24,11 @@
 	* src/recur.c (foreach_date_dump): exception dates are now
 	properly taken into account
 
-	* src/apoint.c: 
-	* src/calendar.c:
-	* src/custom.c: 
-	* src/event.c:
-	* src/io.c:
+	* src/apoint.c
+	* src/calendar.c
+	* src/custom.c
+	* src/event.c
+	* src/io.c
 	* src/recur.c: make use of error handling macros
 
 	* src/utils.c (status_bar): do not show 'credits' key binding
diff --git a/po/calcurse.pot b/po/calcurse.pot
index f06193d..5b50730 100755
--- a/po/calcurse.pot
+++ b/po/calcurse.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: calcurse 2.4_beta\n"
 "Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-12-14 16:48+0100\n"
+"POT-Creation-Date: 2008-12-15 20:53+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -45,19 +45,19 @@ msgstr ""
 msgid "Do you really want to delete this item ?"
 msgstr ""
 
-#: src/apoint.c:276
+#: src/apoint.c:274
 msgid "no such type"
 msgstr ""
 
-#: src/apoint.c:385 src/recur.c:247
+#: src/apoint.c:383 src/recur.c:247
 msgid "date error in appointment"
 msgstr ""
 
-#: src/apoint.c:406 src/recur.c:856 src/recur.c:880 src/recur.c:916
+#: src/apoint.c:404 src/recur.c:856 src/recur.c:880 src/recur.c:916
 msgid "item not found"
 msgstr ""
 
-#: src/apoint.c:450 src/apoint.c:610
+#: src/apoint.c:451 src/apoint.c:611
 msgid "no such appointment"
 msgstr ""
 
diff --git a/po/de.po b/po/de.po
index ade340a..4621160 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,4 +1,4 @@
-# 	$calcurse: de.po,v 1.21 2008/12/14 15:54:50 culot Exp $
+# 	$calcurse: de.po,v 1.22 2008/12/15 20:02:00 culot Exp $
 #
 # German translations for calcurse package.
 # Copyright (C) 2006-2007 Michael Schulz <bloodshower@web.de>
@@ -9,7 +9,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: calcurse 1.9\n"
 "Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-12-14 16:48+0100\n"
+"POT-Creation-Date: 2008-12-15 20:53+0100\n"
 "PO-Revision-Date: 2007-09-02 18:06+0200\n"
 "Last-Translator: Michael\n"
 "Language-Team:  Michael Schulz <bloodshower@freenet.de>\n"
@@ -52,20 +52,20 @@ msgstr "[EINGABE]-Taste um fortzufahren"
 msgid "Do you really want to delete this item ?"
 msgstr "M�chten Sie wirklich diesen Eintrag l�schen ?"
 
-#: src/apoint.c:276
+#: src/apoint.c:274
 msgid "no such type"
 msgstr ""
 
-#: src/apoint.c:385 src/recur.c:247
+#: src/apoint.c:383 src/recur.c:247
 #, fuzzy
 msgid "date error in appointment"
 msgstr "n�chster Termin :\n"
 
-#: src/apoint.c:406 src/recur.c:856 src/recur.c:880 src/recur.c:916
+#: src/apoint.c:404 src/recur.c:856 src/recur.c:880 src/recur.c:916
 msgid "item not found"
 msgstr ""
 
-#: src/apoint.c:450 src/apoint.c:610
+#: src/apoint.c:451 src/apoint.c:611
 #, fuzzy
 msgid "no such appointment"
 msgstr "n�chster Termin :\n"
diff --git a/po/en.po b/po/en.po
index fa9079e..fb7ce50 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1,4 +1,4 @@
-# 	$calcurse: en.po,v 1.16 2008/12/14 15:54:50 culot Exp $
+# 	$calcurse: en.po,v 1.17 2008/12/15 20:02:00 culot Exp $
 #
 # English/GB translation of calcurse.
 # Copyright (C) 2006 Copyright (c) Frederic Culot <frederic@culot.org>
@@ -11,7 +11,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: calcurse 1.4\n"
 "Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-12-14 16:48+0100\n"
+"POT-Creation-Date: 2008-12-15 20:53+0100\n"
 "PO-Revision-Date: 2006-07-03 00:05+0100\n"
 "Last-Translator: Neil Williams <linux@codehelp.co.uk>\n"
 "Language-Team: English/GB <en_GB@li.org>\n"
@@ -49,20 +49,20 @@ msgstr "Press [Enter] to continue"
 msgid "Do you really want to delete this item ?"
 msgstr "Do you really want to delete this item ?"
 
-#: src/apoint.c:276
+#: src/apoint.c:274
 msgid "no such type"
 msgstr ""
 
-#: src/apoint.c:385 src/recur.c:247
+#: src/apoint.c:383 src/recur.c:247
 #, fuzzy
 msgid "date error in appointment"
 msgstr "Appointment :"
 
-#: src/apoint.c:406 src/recur.c:856 src/recur.c:880 src/recur.c:916
+#: src/apoint.c:404 src/recur.c:856 src/recur.c:880 src/recur.c:916
 msgid "item not found"
 msgstr ""
 
-#: src/apoint.c:450 src/apoint.c:610
+#: src/apoint.c:451 src/apoint.c:611
 #, fuzzy
 msgid "no such appointment"
 msgstr "Appointment :"
diff --git a/po/es.po b/po/es.po
index 25490bd..9a5f429 100644
--- a/po/es.po
+++ b/po/es.po
@@ -1,4 +1,4 @@
-# 	$calcurse: es.po,v 1.17 2008/12/14 15:54:50 culot Exp $
+# 	$calcurse: es.po,v 1.18 2008/12/15 20:02:00 culot Exp $
 #
 # Spanish translations for calcurse package.
 # Copyright (c) Jose Lopez <testinground@gmail.com> 2006 Free Software Foundation, Inc.
@@ -9,7 +9,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Calcurse 1.8\n"
 "Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-12-14 16:48+0100\n"
+"POT-Creation-Date: 2008-12-15 20:53+0100\n"
 "PO-Revision-Date: 2006-09-10 08:06+0200\n"
 "Last-Translator: Jose Lopez <testinground@gmail.com>\n"
 "Language-Team: Jose Lopez <testinground@gmail.com>\n"
@@ -50,20 +50,20 @@ msgstr "Pulsa [INTRO] para continuar"
 msgid "Do you really want to delete this item ?"
 msgstr "�Seguro que quieres borrar este elemento?"
 
-#: src/apoint.c:276
+#: src/apoint.c:274
 msgid "no such type"
 msgstr ""
 
-#: src/apoint.c:385 src/recur.c:247
+#: src/apoint.c:383 src/recur.c:247
 #, fuzzy
 msgid "date error in appointment"
 msgstr "Proxima cita:\n"
 
-#: src/apoint.c:406 src/recur.c:856 src/recur.c:880 src/recur.c:916
+#: src/apoint.c:404 src/recur.c:856 src/recur.c:880 src/recur.c:916
 msgid "item not found"
 msgstr ""
 
-#: src/apoint.c:450 src/apoint.c:610
+#: src/apoint.c:451 src/apoint.c:611
 #, fuzzy
 msgid "no such appointment"
 msgstr "Proxima cita:\n"
diff --git a/po/fr.po b/po/fr.po
index 575647b..2213c9c 100755
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,4 +1,4 @@
-# 	$calcurse: fr.po,v 1.27 2008/12/14 15:54:51 culot Exp $
+# 	$calcurse: fr.po,v 1.28 2008/12/15 20:02:00 culot Exp $
 #
 # French translations for calcurse package.
 # Copyright (C) 2004-2008 Frederic Culot <frederic@culot.org>
@@ -9,7 +9,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: calcurse 2.1\n"
 "Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-12-14 16:48+0100\n"
+"POT-Creation-Date: 2008-12-15 20:53+0100\n"
 "PO-Revision-Date: 2008-09-23 19:21+0200\n"
 "Last-Translator: Frederic Culot <frederic@culot.org>\n"
 "Language-Team: French <calcurse-i18n@culot.org>\n"
@@ -50,21 +50,21 @@ msgstr "Appuyez sur [ENTREE] pour continuer"
 msgid "Do you really want to delete this item ?"
 msgstr "Voulez-vous vraiment effacer cet �lement ?"
 
-#: src/apoint.c:276
+#: src/apoint.c:274
 msgid "no such type"
 msgstr ""
 
-#: src/apoint.c:385 src/recur.c:247
+#: src/apoint.c:383 src/recur.c:247
 #, fuzzy
 msgid "date error in appointment"
 msgstr "prochain rendez-vous:\n"
 
-#: src/apoint.c:406 src/recur.c:856 src/recur.c:880 src/recur.c:916
+#: src/apoint.c:404 src/recur.c:856 src/recur.c:880 src/recur.c:916
 #, fuzzy
 msgid "item not found"
 msgstr "Fichier note non trouv�\n"
 
-#: src/apoint.c:450 src/apoint.c:610
+#: src/apoint.c:451 src/apoint.c:611
 #, fuzzy
 msgid "no such appointment"
 msgstr "prochain rendez-vous:\n"
diff --git a/po/nl.po b/po/nl.po
index ac7ff67..2026438 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -1,4 +1,4 @@
-# 	$calcurse: nl.po,v 1.15 2008/12/14 15:54:51 culot Exp $
+# 	$calcurse: nl.po,v 1.16 2008/12/15 20:02:00 culot Exp $
 #
 # Dutch translations for calcurse package.
 # Copyright (C) 2007-2008 Jeremy Roon <p.roon@chello.nl>
@@ -9,7 +9,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: calcurse 2.1\n"
 "Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-12-14 16:48+0100\n"
+"POT-Creation-Date: 2008-12-15 20:53+0100\n"
 "PO-Revision-Date: 2008-10-14 20:54+0200\n"
 "Last-Translator: Jeremy Roon\n"
 "Language-Team:  Jeremy Roon <p.roon@chello.nl>\n"
@@ -48,21 +48,21 @@ msgstr "Druk op [Enter] om door te gaan)"
 msgid "Do you really want to delete this item ?"
 msgstr "Wilt u werkelijk dit item wissen ?"
 
-#: src/apoint.c:276
+#: src/apoint.c:274
 msgid "no such type"
 msgstr ""
 
-#: src/apoint.c:385 src/recur.c:247
+#: src/apoint.c:383 src/recur.c:247
 #, fuzzy
 msgid "date error in appointment"
 msgstr "Volgende afspraak :\n"
 
-#: src/apoint.c:406 src/recur.c:856 src/recur.c:880 src/recur.c:916
+#: src/apoint.c:404 src/recur.c:856 src/recur.c:880 src/recur.c:916
 #, fuzzy
 msgid "item not found"
 msgstr "Noot-bestand niet gevonden\n"
 
-#: src/apoint.c:450 src/apoint.c:610
+#: src/apoint.c:451 src/apoint.c:611
 #, fuzzy
 msgid "no such appointment"
 msgstr "Volgende afspraak :\n"
diff --git a/src/apoint.c b/src/apoint.c
index 1b067ba..75b2235 100755
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,4 +1,4 @@
-/*	$calcurse: apoint.c,v 1.27 2008/12/14 15:54:51 culot Exp $	*/
+/*	$calcurse: apoint.c,v 1.28 2008/12/15 20:02:00 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -269,9 +269,7 @@ apoint_delete (conf_t *conf, unsigned *nb_events, unsigned *nb_apoints)
 	      to_be_removed = 3;
 	    }
 	  else if (deleted_item_type == 0)
-	    {
-	      to_be_removed = 0;
-	    }
+            return;
 	  else
             EXIT (_("no such type"));
 	  /* NOTREACHED */
@@ -425,7 +423,10 @@ apoint_delete_bynum (long start, unsigned num, erase_flag_e flag)
 	  if (n == num)
 	    {
 	      if (flag == ERASE_FORCE_ONLY_NOTE)
-		erase_note (&i->note, flag);
+                {
+                  erase_note (&i->note, flag);
+                  pthread_mutex_unlock (&(alist_p->mutex));
+                }
 	      else
 		{
 		  if (notify_bar ())
diff --git a/src/day.c b/src/day.c
index c727cf2..884fd3b 100755
--- a/src/day.c
+++ b/src/day.c
@@ -1,4 +1,4 @@
-/*	$calcurse: day.c,v 1.41 2008/12/12 20:44:50 culot Exp $	*/
+/*	$calcurse: day.c,v 1.42 2008/12/15 20:02:00 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -728,7 +728,7 @@ day_edit_item (conf_t *conf)
   p = day_get_item (item_num);
   date = calendar_get_slctd_day_sec ();
 
-  ch = 0;
+  ch = -1;
   switch (p->type)
     {
     case RECUR_EVNT:
@@ -819,9 +819,10 @@ day_erase_item (long date, int item_number, erase_flag_e flag)
 	"Delete (i)tem or just its (n)ote ?");
   char *note_choice = _("[i/n] ");
   char *erase_choice = _("[a/o] ");
-  int ch = 0, ans;
+  int ch, ans;
   unsigned delete_whole;
 
+  ch = -1;
   p = day_get_item (item_number);
   if (flag == ERASE_DONT_FORCE)
     {
@@ -877,7 +878,10 @@ day_erase_item (long date, int item_number, erase_flag_e flag)
 	  recur_apoint_erase (date, p->appt_pos, delete_whole, flag);
 	}
     }
-  return (p->type);
+  if (flag == ERASE_FORCE_ONLY_NOTE)
+    return 0;
+  else
+    return (p->type);
 }
 
 /* Returns a structure containing the selected item. */
diff --git a/src/keys.c b/src/keys.c
index 57fac95..790a03a 100755
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,4 +1,4 @@
-/*	$calcurse: keys.c,v 1.9 2008/12/12 20:44:50 culot Exp $	*/
+/*	$calcurse: keys.c,v 1.10 2008/12/15 20:02:00 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -49,7 +49,7 @@ static struct key_str_s *keys[NBKEYS];
 static keys_e actions[MAXKEYVAL];
 
 static struct keydef_s keydef[NBKEYS] = {
-  {"generic-escape", "ESC"},
+  {"generic-cancel", "ESC"},
   {"generic-select", "SPC"},
   {"generic-credits", "@"},
   {"generic-help", "?"},
diff --git a/src/todo.c b/src/todo.c
index 16c9a79..68d5eb5 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,4 +1,4 @@
-/*	$calcurse: todo.c,v 1.27 2008/12/12 20:44:50 culot Exp $	*/
+/*	$calcurse: todo.c,v 1.28 2008/12/15 20:02:00 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -239,7 +239,7 @@ todo_delete (conf_t *conf)
 	"Delete (t)odo or just its (n)ote ?");
   char *erase_choice = _("[t/n] ");
   bool go_for_todo_del = false;
-  int answer = 0, has_note;
+  int answer, has_note;
 
   if (conf->confirm_delete)
     {
@@ -264,7 +264,7 @@ todo_delete (conf_t *conf)
       return;
     }
 
-  answer = 0;
+  answer = -1;
   has_note = (todo_get_item (hilt)->note != NULL) ? 1 : 0;
   if (has_note == 0)
     answer = 't';
diff --git a/src/utils.c b/src/utils.c
index 147229e..f4d82fe 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/*	$calcurse: utils.c,v 1.59 2008/12/14 15:54:51 culot Exp $	*/
+/*	$calcurse: utils.c,v 1.60 2008/12/15 20:02:00 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -329,7 +329,7 @@ getstring (WINDOW *win, char *str, int l, int x, int y)
 	    newpos++;
 	  break;
 
-	case KEY_GENERIC_CANCEL:	/* cancel editing */
+	case ESCAPE:	/* cancel editing */
 	  return (GETSTRING_ESC);
 	  break;
 
-- 
cgit v1.2.3-70-g09d2