[Gpa-commits] r933 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 16 17:51:08 CET 2009


Author: werner
Date: 2009-01-16 17:51:04 +0100 (Fri, 16 Jan 2009)
New Revision: 933

Added:
   trunk/src/convert.c
   trunk/src/convert.h
Removed:
   trunk/src/gpapastrings.c
   trunk/src/gpapastrings.h
Modified:
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/cardman.c
   trunk/src/clipboard.c
   trunk/src/encryptdlg.c
   trunk/src/expirydlg.c
   trunk/src/fileman.c
   trunk/src/gpafileencryptop.c
   trunk/src/gpafilesignop.c
   trunk/src/gpagenkeysimpleop.c
   trunk/src/gpastreamencryptop.c
   trunk/src/gpasubkeylist.c
   trunk/src/gpawidgets.c
   trunk/src/keyeditdlg.c
   trunk/src/keygendlg.c
   trunk/src/keygenwizard.c
   trunk/src/keylist.c
   trunk/src/keyring.c
   trunk/src/ownertrustdlg.c
   trunk/src/siglist.c
Log:
Renamed file and its header.
Add unfinished code to change a PIN.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/ChangeLog	2009-01-16 16:51:04 UTC (rev 933)
@@ -1,3 +1,18 @@
+2009-01-16  Werner Koch  <wk at g10code.com>
+
+	* gpapinchange.h, gpapinchange.c: New.
+	* Makefile.am (gpa_SOURCES): Add them
+
+	* convert.c (gpa_unit_expiry_time_string): Change retrun type to
+	const char.  Do bounds checks.
+	(gpa_time_unit_from_string): Take a const char * arg.  Make code
+	more robust.
+
+	* gpapastrings.c: Rename to convert.c.
+	* gpapastrings.h: Rename to convert.h.  Remove all includes.
+	* gpawidgets.c, keyring.c, gpafileencryptop.c, gpasubkeylist.c
+	* keyeditdlg.c:  Include convert.h.
+
 2009-01-14  Marcus Brinkmann  <marcus at g10code.de>
 
 	* cardman.c (construct_card_widget): Make frame label bold and

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/Makefile.am	2009-01-16 16:51:04 UTC (rev 933)
@@ -72,7 +72,6 @@
 	      keylist.c keylist.h \
 	      siglist.c siglist.h \
 	      gpasubkeylist.c gpasubkeylist.h \
-	      gpapastrings.c gpapastrings.h\
 	      gpl-text.c gpl-text.h \
 	      keyserver.c keyserver.h \
 	      hidewnd.c hidewnd.h \
@@ -118,6 +117,7 @@
 	      gpagenkeycardop.h gpagenkeycardop.c \
 	      gpabackupop.h gpabackupop.c \
 	      gpakeyselector.h gpakeyselector.c \
+	      gpapinchange.h gpapinchange.c \
 	      server.c \
 	      filewatch.c \
 	      options.c \
@@ -125,6 +125,7 @@
 	      gpa-marshal.c gpa-marshal.h \
 	      strlist.h strlist.c \
 	      gpg-stuff.h gpg-stuff.c \
+	      convert.c convert.h \
 	      utils.c $(gpa_w32_sources)
 
 

Modified: trunk/src/cardman.c
===================================================================
--- trunk/src/cardman.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/cardman.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -34,7 +34,6 @@
 #include <gtk/gtk.h>
 
 #include "gpa.h"   
-#include "gpapastrings.h"
 
 #include "gtktools.h"
 #include "gpawidgets.h"
@@ -545,6 +544,7 @@
   ADD_TABLE_ROW (general_table, rowidx, "Card Version: ", cardman->entryVersion);
 
   cardman->entryManufacturer = gtk_entry_new ();
+  gtk_entry_set_has_frame (GTK_ENTRY(cardman->entryManufacturer), FALSE);
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryManufacturer), FALSE);
   ADD_TABLE_ROW (general_table, rowidx, "Manufacturer: ", cardman->entryManufacturer);
 

Modified: trunk/src/clipboard.c
===================================================================
--- trunk/src/clipboard.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/clipboard.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -34,7 +34,6 @@
 #include <gtk/gtk.h>
 
 #include "gpa.h"   
-#include "gpapastrings.h"
 
 #include "gtktools.h"
 #include "gpgmetools.h"

Copied: trunk/src/convert.c (from rev 932, trunk/src/gpapastrings.c)
===================================================================
--- trunk/src/gpapastrings.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/convert.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -0,0 +1,110 @@
+/* convert.c - Conversion functions
+ *	Copyright (C) 2000, 2001 G-N-U GmbH.
+ *      Copyright (C) 2009 g10 Code GmbH
+ *
+ * This file is part of GPA
+ *
+ * GPA is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GPA is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.  
+ */
+
+#include <config.h>
+
+#include "gpa.h"
+#include "convert.h"
+
+
+static gchar *unit_expiry_time[4] = 
+  {
+    N_("days"),
+    N_("weeks"),
+    N_("months"),
+    N_("years")
+  };
+
+
+static gchar unit_time[4] = { 'd', 'w', 'm', 'y' };
+
+
+
+
+/*
+ * Helper functions to translate between readable strings and enums.
+ */
+
+/* Return a string describing the unit of time.  */
+const char *
+gpa_unit_expiry_time_string(int idx)
+{
+  if (idx < 0 || idx >= DIM(unit_expiry_time))
+    return "?";
+  return _(unit_expiry_time[idx]);
+}
+
+
+/* Return a char as abbreviation for the STRING.  STRING needs to be
+   the result of gpa_unit_expiry_time_string.  Returns space on
+   error.  */
+char
+gpa_time_unit_from_string (const char *string)
+{
+  gchar result = ' ';
+  gint i;
+
+  i = 0;
+  while (i < DIM(unit_expiry_time)
+         && !strcmp (string, unit_expiry_time[i]))
+    i++;
+  if (i < DIM(unit_expiry_time) && i < DIM(unit_time))
+    result = unit_time[i];
+  return result;
+} 
+
+
+char *
+gpa_expiry_date_string (unsigned long expiry_time)
+{
+  gchar date_buffer[256];
+  gchar *result;
+  GDate expiry_date;
+
+  if( expiry_time > 0 )
+    {
+      g_date_set_time_t (&expiry_date, (time_t) expiry_time);
+      g_date_strftime (date_buffer, 256, "%x", &expiry_date);
+      result = g_strdup (date_buffer);
+    }
+  else
+    result = g_strdup (_("never expires"));
+  return result;
+} 
+
+
+char *
+gpa_creation_date_string (unsigned long creation_time)
+{
+  gchar date_buffer[256];
+  gchar *result;
+  GDate creation_date;
+
+  if( creation_time > 0 )
+    {
+      g_date_set_time_t (&creation_date, (time_t) creation_time);
+      g_date_strftime (date_buffer, 256, "%x", &creation_date);
+      result = g_strdup (date_buffer);
+    }
+  else
+    result = g_strdup (_("unknown"));
+  return result;
+} 
+


Property changes on: trunk/src/convert.c
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/convert.h (from rev 932, trunk/src/gpapastrings.h)
===================================================================
--- trunk/src/gpapastrings.h	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/convert.h	2009-01-16 16:51:04 UTC (rev 933)
@@ -0,0 +1,28 @@
+/* convert.c - Conversion functions
+ *      Copyright (C) 2009 g10 Code GmbH
+ *
+ * This file is part of GPA
+ *
+ * GPA is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GPA is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.  
+ */
+
+#ifndef CONVERT_H
+#define CONVERT_H 1
+
+const char *gpa_unit_expiry_time_string (int idx);
+char gpa_time_unit_from_string (const char *string);
+char *gpa_expiry_date_string (unsigned long expiry_time);
+char *gpa_creation_date_string (unsigned long creation_time);
+
+#endif /*CONVERT_H*/


Property changes on: trunk/src/convert.h
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/src/encryptdlg.c
===================================================================
--- trunk/src/encryptdlg.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/encryptdlg.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -32,7 +32,6 @@
 #include "gtktools.h"
 #include "gpawidgets.h"
 #include "gpakeyselector.h"
-#include "gpapastrings.h"
 #include "encryptdlg.h"
 
 /* Internal functions */

Modified: trunk/src/expirydlg.c
===================================================================
--- trunk/src/expirydlg.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/expirydlg.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -22,8 +22,8 @@
 
 #include <gpgme.h>
 #include <gtk/gtk.h>
+
 #include "gpa.h"
-#include "gpapastrings.h"
 #include "gtktools.h"
 #include "expirydlg.h"
 

Modified: trunk/src/fileman.c
===================================================================
--- trunk/src/fileman.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/fileman.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -35,7 +35,6 @@
 #include <gtk/gtk.h>
 
 #include "gpa.h"   
-#include "gpapastrings.h"
 
 #include "gtktools.h"
 #include "gpawidgets.h"

Modified: trunk/src/gpafileencryptop.c
===================================================================
--- trunk/src/gpafileencryptop.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpafileencryptop.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -34,11 +34,11 @@
 
 #include "gpa.h"
 #include "gtktools.h"
+#include "convert.h"
 #include "gpgmetools.h"
 #include "gpafileencryptop.h"
 #include "encryptdlg.h"
 #include "gpawidgets.h"
-#include "gpapastrings.h"
 
 /* Internal functions */
 static void gpa_file_encrypt_operation_done_error_cb (GpaContext *context, 

Modified: trunk/src/gpafilesignop.c
===================================================================
--- trunk/src/gpafilesignop.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpafilesignop.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -38,7 +38,6 @@
 #include "gpafilesignop.h"
 #include "filesigndlg.h"
 #include "gpawidgets.h"
-#include "gpapastrings.h"
 
 /* Internal functions */
 static void gpa_file_sign_operation_done_error_cb (GpaContext *context, 

Modified: trunk/src/gpagenkeysimpleop.c
===================================================================
--- trunk/src/gpagenkeysimpleop.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpagenkeysimpleop.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -75,7 +75,7 @@
 				      construct_properties);
   op = GPA_GEN_KEY_SIMPLE_OPERATION (object);
 
-  /* Create progress dialog */
+  /* Create wizard dialog.  */
   op->wizard = gpa_keygen_wizard_new (GPA_OPERATION (op)->window,
 				      gpa_gen_key_simple_operation_generate,
 				      op);

Deleted: trunk/src/gpapastrings.c
===================================================================
--- trunk/src/gpapastrings.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpapastrings.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -1,97 +0,0 @@
-/* gpapastrings.c  -	 The GNU Privacy Assistant
- *	Copyright (C) 2000, 2001 G-N-U GmbH.
- *
- * This file is part of GPA
- *
- * GPA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include <config.h>
-
-#include "gpa.h"
-#include <config.h>
-#include "gpapastrings.h"
-
-/*
- *	Some helper functions to translate between readable strings and
- *	enums
- */
-
-static gchar *unit_expiry_time[4] = {
-  N_("days"),
-  N_("weeks"),
-  N_("months"),
-  N_("years")
-};
-
-
-static gchar unit_time[4] = { 'd', 'w', 'm', 'y' };
-
-gchar *
-gpa_unit_expiry_time_string(int idx)
-{
-  return _(unit_expiry_time[idx]);
-}
-
-gchar
-gpa_time_unit_from_string (gchar * string)
-{
-  gchar result = ' ';
-  gint i;
-
-  i = 0;
-  while (i < 4 && strcmp (string, unit_expiry_time[i]) != 0)
-    i++;
-  if (i < 4)
-    result = unit_time[i];
-  return result;
-} /* gpa_time_unit_from_string */
-
-gchar *
-gpa_expiry_date_string (unsigned long expiry_time)
-{
-  gchar date_buffer[256];
-  gchar *result;
-  GDate expiry_date;
-
-  if( expiry_time > 0 )
-    {
-      g_date_set_time_t (&expiry_date, (time_t) expiry_time);
-      g_date_strftime (date_buffer, 256, "%x", &expiry_date);
-      result = g_strdup (date_buffer);
-    }
-  else
-    result = g_strdup (_("never expires"));
-  return result;
-} /* gpa_expiry_data_string */
-
-gchar *
-gpa_creation_date_string (unsigned long creation_time)
-{
-  gchar date_buffer[256];
-  gchar *result;
-  GDate creation_date;
-
-  if( creation_time > 0 )
-    {
-      g_date_set_time_t (&creation_date, (time_t) creation_time);
-      g_date_strftime (date_buffer, 256, "%x", &creation_date);
-      result = g_strdup (date_buffer);
-    }
-  else
-    result = g_strdup (_("unknown"));
-  return result;
-} /* gpa_creation_data_string */
-

Deleted: trunk/src/gpapastrings.h
===================================================================
--- trunk/src/gpapastrings.h	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpapastrings.h	2009-01-16 16:51:04 UTC (rev 933)
@@ -1,37 +0,0 @@
-/* gpapastrings.h  -	 The GNU Privacy Assistant
- *	Copyright (C) 2000, 2001 G-N-U GmbH.
- *
- * This file is part of GPA
- *
- * GPA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-/*
- *	Some helper functions to translate between readable strings and
- *	enums
- */
-
-#ifndef GPAPASTRINGS_H
-#define GPAPASTRINGS_H
-
-#include <glib.h>
-#include <gpgme.h>
-
-gchar * gpa_unit_expiry_time_string(int idx);
-gchar gpa_time_unit_from_string (gchar * string);
-gchar * gpa_expiry_date_string (unsigned long expiry_time);
-gchar * gpa_creation_date_string (unsigned long creation_time);
-
-#endif /* GPAPASTRINGS_H */

Modified: trunk/src/gpastreamencryptop.c
===================================================================
--- trunk/src/gpastreamencryptop.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpastreamencryptop.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -24,7 +24,6 @@
 #include "gpgmetools.h"
 #include "recipientdlg.h"
 #include "gpawidgets.h"
-#include "gpapastrings.h"
 #include "gpastreamencryptop.h"
 
 

Modified: trunk/src/gpasubkeylist.c
===================================================================
--- trunk/src/gpasubkeylist.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpasubkeylist.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -21,8 +21,8 @@
 #include <config.h>
 
 #include "gpa.h"
+#include "convert.h"
 #include "gpasubkeylist.h"
-#include "gpapastrings.h"
 
 /*
  *  Implement a List showing the subkeys in a given key

Modified: trunk/src/gpawidgets.c
===================================================================
--- trunk/src/gpawidgets.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/gpawidgets.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -28,10 +28,9 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#include "gpapastrings.h"
 #include "gtktools.h"
+#include "convert.h"
 
-
 /* A table showing some basic information about the key, such as the
    key id and the user name.  */ 
 GtkWidget *

Modified: trunk/src/keyeditdlg.c
===================================================================
--- trunk/src/keyeditdlg.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/keyeditdlg.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -25,11 +25,12 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 #include <time.h>
+
 #include "gpa.h"
 #include "keyeditdlg.h"
 #include "gtktools.h"
 #include "gpawidgets.h"
-#include "gpapastrings.h"
+#include "convert.h"
 #include "keytable.h"
 #include "gpakeyexpireop.h"
 #include "gpakeypasswdop.h"

Modified: trunk/src/keygendlg.c
===================================================================
--- trunk/src/keygendlg.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/keygendlg.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -24,7 +24,6 @@
 #include <gtk/gtk.h>
 
 #include "gpa.h"
-#include "gpapastrings.h"
 #include "gpawidgets.h"
 #include "gtktools.h"
 #include "keygendlg.h"

Modified: trunk/src/keygenwizard.c
===================================================================
--- trunk/src/keygenwizard.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/keygenwizard.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -28,7 +28,6 @@
 #include <gpgme.h>
 
 #include "gpa.h"
-#include "gpapastrings.h"
 #include "icons.h"
 #include "gtktools.h"
 #include "gpawidgets.h"

Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/keylist.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -24,8 +24,8 @@
 
 #include "gpa.h"
 #include "keylist.h"
-#include "gpapastrings.h"
 #include "gpawidgets.h"
+#include "convert.h"
 #include "gtktools.h"
 #include "keytable.h"
 #include "icons.h"

Modified: trunk/src/keyring.c
===================================================================
--- trunk/src/keyring.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/keyring.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -35,7 +35,6 @@
 #include "gtktools.h"
 #include "icons.h"
 #include "helpmenu.h"
-#include "gpapastrings.h"
 #include "gpawidgets.h"
 #include "ownertrustdlg.h"
 #include "keysigndlg.h"
@@ -51,6 +50,7 @@
 #include "keytable.h"
 #include "server_access.h"
 #include "options.h"
+#include "convert.h"
 
 #include "gpasubkeylist.h"
 

Modified: trunk/src/ownertrustdlg.c
===================================================================
--- trunk/src/ownertrustdlg.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/ownertrustdlg.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -26,7 +26,6 @@
 #include "gpa.h"
 #include "gpawidgets.h"
 #include "gtktools.h"
-#include "gpapastrings.h"
 #include "gpgmeedit.h"
 
 /*

Modified: trunk/src/siglist.c
===================================================================
--- trunk/src/siglist.c	2009-01-14 17:36:35 UTC (rev 932)
+++ trunk/src/siglist.c	2009-01-16 16:51:04 UTC (rev 933)
@@ -20,12 +20,11 @@
 
 #include <config.h>
 
-#include "gpa.h"
 #include <stdlib.h>
 #include <string.h>
 #include <gtk/gtk.h>
-#include <config.h>
-#include "gpapastrings.h"
+
+#include "gpa.h"
 #include "siglist.h"
 
 /*



More information about the Gpa-commits mailing list