[git] GPA - branch, master, updated. gpa-0.9.7-6-g9599359

by Werner Koch cvs at cvs.gnupg.org
Sun Aug 30 19:10:19 CEST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Assistant".

The branch, master has been updated
       via  9599359bb8cdb24af704be03f0532b69523152df (commit)
       via  7060e840aff0a30a493f7f89646ff5641d6a7901 (commit)
       via  068b6da19025d1e18ce40af343c9b45e0a5e625b (commit)
      from  6f44c2b8a755c66a95264c141d066066e41718f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9599359bb8cdb24af704be03f0532b69523152df
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Aug 30 19:07:33 2015 +0200

    Print the GnuPP 2.1 style pubkey algo string in key details.
    
    * src/gpa-key-details.c (details_page_fill_key): Use new gpgme
    function if available to print that string.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpa-key-details.c b/src/gpa-key-details.c
index 38d5d3c..abb3b1a 100644
--- a/src/gpa-key-details.c
+++ b/src/gpa-key-details.c
@@ -38,7 +38,7 @@
 #include "certchain.h"
 #include "gpasubkeylist.h"
 #include "gpa-key-details.h"
-
+#include "gtktools.h"
 
 

 /* Object's class definition.  */
@@ -173,9 +173,17 @@ details_page_fill_key (GpaKeyDetails *kdt, gpgme_key_t key)
   gtk_label_set_text (GTK_LABEL (kdt->detail_key_trust),
                       gpa_key_validity_string (key));
 
+#if GPGME_VERSION_NUMBER >= 0x010601  /* GPGME >= 1.6.1 */
+  text = gpgme_pubkey_algo_string (key->subkeys);
+  gtk_label_set_text (GTK_LABEL (kdt->detail_key_type), text? text : "?");
+  gpgme_free (text);
+#endif  /* GPGME >= 1.6.1 */
+
   text = g_strdup_printf (_("%s %u bits"),
-			  gpgme_pubkey_algo_name (key->subkeys->pubkey_algo),
-			  key->subkeys->length);
+                          gpgme_pubkey_algo_name (key->subkeys->pubkey_algo)?
+                          gpgme_pubkey_algo_name (key->subkeys->pubkey_algo):
+                          (key->subkeys->curve? "ECC" : "?"),
+                          key->subkeys->length);
   if (key->subkeys->curve)
     {
       char *text2;
@@ -183,9 +191,14 @@ details_page_fill_key (GpaKeyDetails *kdt, gpgme_key_t key)
       g_free (text);
       text = text2;
     }
+#if GPGME_VERSION_NUMBER >= 0x010601  /* GPGME >= 1.6.1 */
+  gpa_add_tooltip (kdt->detail_key_type, text);
+#else
   gtk_label_set_text (GTK_LABEL (kdt->detail_key_type), text);
+#endif
   g_free (text);
 
+
   gtk_label_set_text (GTK_LABEL (kdt->detail_owner_trust),
                       gpa_key_ownertrust_string (key));
 

commit 7060e840aff0a30a493f7f89646ff5641d6a7901
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Aug 30 15:45:19 2015 +0200

    Truncate user ids in some dialogs.
    
    * src/gpa.h (GPA_MAX_UID_WIDTH): New.
    * src/gpawidgets.c (gpa_key_info_new): Truncate user ids and put the
    full user id into a tooltip.  Add a fingerprint line.
    * src/keysigndlg.c (gpa_key_sign_run_dialog): Ditto.
    --
    
    This helps to keep the window size at bay.  Without a trunctaion it
    could happen that a dialog window gets larger then the screen and thus
    hides the buttons.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpa.h b/src/gpa.h
index 56583fa..deebed1 100644
--- a/src/gpa.h
+++ b/src/gpa.h
@@ -46,6 +46,13 @@
 #include "options.h" /* ditto */
 
 
+/* Global constants.  */
+#define GPA_MAX_UID_WIDTH 50  /* # of chars after wich a user id is
+                                 truncated in dialog boxes.  */
+
+
+
+/* Some variable declarations.  */
 extern GtkWidget *global_windowMain;
 extern GtkWidget *global_windowTip;
 extern GList *global_defaultRecipients;
diff --git a/src/gpawidgets.c b/src/gpawidgets.c
index 131970d..20deb8c 100644
--- a/src/gpawidgets.c
+++ b/src/gpawidgets.c
@@ -32,7 +32,7 @@
 #include "convert.h"
 
 /* A table showing some basic information about the key, such as the
-   key id and the user name.  */ 
+   key id and the user name.  */
 GtkWidget *
 gpa_key_info_new (gpgme_key_t key)
 {
@@ -41,7 +41,7 @@ gpa_key_info_new (gpgme_key_t key)
   gchar *string;
   gpgme_user_id_t uid;
 
-  table = gtk_table_new (2, 2, FALSE);
+  table = gtk_table_new (3, 2, FALSE);
   gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
   gtk_table_set_row_spacing (GTK_TABLE (table), 0, 0);
 
@@ -61,7 +61,11 @@ gpa_key_info_new (gpgme_key_t key)
       uid = uid->next;
     }
   label = gtk_label_new (string);
+  gpa_add_tooltip (label, string);
   g_free (string);
+  gtk_label_set_max_width_chars (GTK_LABEL (label), GPA_MAX_UID_WIDTH);
+  gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+
   gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
 		    GTK_FILL, 0, 0, 0);
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
@@ -69,7 +73,7 @@ gpa_key_info_new (gpgme_key_t key)
   /* User Name */
   label = gtk_label_new (key->uids->next == NULL
 			 ? _("User Name:") : _("User Names:") );
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL,
                     0, 0);
   gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);
 
@@ -83,8 +87,19 @@ gpa_key_info_new (gpgme_key_t key)
 		    GTK_FILL|GTK_EXPAND, 0, 0, 0);
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 
+  /* Fingerprint */
+  label = gtk_label_new (_("Fingerprint:"));
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+
+  string = gpa_gpgme_key_format_fingerprint (key->subkeys->fpr);
+  label = gtk_label_new (string);
+  g_free (string);
+  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+
   return table;
-}      
+}
 
 /* A Frame to select an expiry date.  */
 
@@ -132,7 +147,7 @@ gpa_expiry_frame_after (GtkToggleButton * radioAfter, gpointer param)
   gtk_widget_set_sensitive (frame->entryAfter, TRUE);
   gtk_widget_set_sensitive (frame->comboAfter, TRUE);
 
-  gtk_widget_grab_focus (frame->entryAfter);  
+  gtk_widget_grab_focus (frame->entryAfter);
 }
 
 
@@ -152,7 +167,7 @@ static void
 expire_date_toggled_cb (GtkToggleButton *togglebutton, gpointer user_data)
 {
   GtkWidget *calendar = user_data;
-  
+
   gtk_widget_set_sensitive (calendar,
                             gtk_toggle_button_get_active (togglebutton));
 }
@@ -203,7 +218,7 @@ gpa_expiry_frame_new (GDate * expiryDate)
   comboAfter = gtk_combo_box_new_text ();
   frame->comboAfter = comboAfter;
   for (i = 3; i >= 0; i--)
-    gtk_combo_box_prepend_text (GTK_COMBO_BOX (comboAfter), 
+    gtk_combo_box_prepend_text (GTK_COMBO_BOX (comboAfter),
 				gpa_unit_expiry_time_string (i));
   gtk_combo_box_set_active (GTK_COMBO_BOX (comboAfter), 0);
   gtk_box_pack_start (GTK_BOX (hboxAfter), comboAfter, FALSE, FALSE, 0);
@@ -282,7 +297,7 @@ gpa_expiry_frame_get_expiration(GtkWidget * expiry_frame, GDate ** date,
                              &year, &month, &day);
       *date = g_date_new_dmy (day, month+1, year);
       result = TRUE;
-    } 
+    }
   else
     {
       /* this should never happen */
@@ -322,7 +337,7 @@ gpa_expiry_frame_validate(GtkWidget * expiry_frame)
     {
       /* This case is always correct.  */
       result = NULL;
-    } 
+    }
   return result;
 }
-    
+
diff --git a/src/keysigndlg.c b/src/keysigndlg.c
index 04f1bc2..868e282 100644
--- a/src/keysigndlg.c
+++ b/src/keysigndlg.c
@@ -89,7 +89,10 @@ gpa_key_sign_run_dialog (GtkWidget * parent, gpgme_key_t key,
 	  /* One user ID on each line.  */
 	  string = gpa_gpgme_key_get_userid (uid);
           label = gtk_label_new (string);
+          gpa_add_tooltip (label, string);
           g_free (string);
+          gtk_label_set_max_width_chars (GTK_LABEL (label), GPA_MAX_UID_WIDTH);
+          gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
           gtk_box_pack_start_defaults (GTK_BOX(uid_box), label);
           gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
         }
@@ -106,7 +109,7 @@ gpa_key_sign_run_dialog (GtkWidget * parent, gpgme_key_t key,
   label = gtk_label_new (_("Fingerprint:"));
   gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
   gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
-  
+
   string = gpa_gpgme_key_format_fingerprint (key->subkeys->fpr);
   label = gtk_label_new (string);
   g_free (string);
@@ -143,7 +146,7 @@ gpa_key_sign_run_dialog (GtkWidget * parent, gpgme_key_t key,
   response = gtk_dialog_run (GTK_DIALOG (window));
   if (response == GTK_RESPONSE_YES)
     {
-      *sign_locally = check && 
+      *sign_locally = check &&
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
       gtk_widget_destroy (window);
       return TRUE;

commit 068b6da19025d1e18ce40af343c9b45e0a5e625b
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Aug 30 13:50:34 2015 +0200

    Start off with the clipboard instead of the file manager.
    
    * src/gpa.c (main): Move default action setting after options
    reading.  Set default action to clipboard unless we are in simple mode
    and no key has yet been created.
    * src/options.c (gpa_options_have_default_key): New.
    * src/keymanager.c (key_manager_maybe_firsttime): New.
    (key_manager_mapped): Use gpa_options_have_default_key.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/configure.ac b/configure.ac
index afd8f17..78441de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ m4_define([mym4_betastring],
 m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
 
-AC_INIT([gpa],[mym4_full_version], [http://bugs.gnupg.org])
+AC_INIT([gpa],[mym4_full_version], [https://bugs.gnupg.org])
 
 NEED_GPG_ERROR_VERSION=1.12
 NEED_LIBASSUAN_API=2
diff --git a/doc/gpa.1 b/doc/gpa.1
index 454fe29..0245a19 100644
--- a/doc/gpa.1
+++ b/doc/gpa.1
@@ -18,7 +18,8 @@ signatures and to manage the private and public keys.
 .SH "OPTIONS"
 .TP
 .B \-c, \-\-clipboard
-Open the clipboard.
+Open the clipboard.  This is the \fIdefault\fP action if no arguments are
+given and a key has already been created.
 .TP
 .B \-C, \-\-card
 Start with the card-manager open.
@@ -47,7 +48,8 @@ Start with the file-manager open. This is the \fIdefault\fP if one or more
 \fIFILE(S)\fP are added to the command arguments.
 .TP
 .B \-k, \-\-keyring
-Start with the keyring editor. This is the \fIdefault\fP.
+Start with the keyring editor. This is the \fIdefault\fP for a new
+installation.
 .TP
 .B \-o, \-\-options=\fIFILE\fP
 Read options from the specified file instead of \fI~/.gnupg/gpa.conf\fP.
diff --git a/src/gpa.c b/src/gpa.c
index d9db079..80f4016 100644
--- a/src/gpa.c
+++ b/src/gpa.c
@@ -524,24 +524,10 @@ main (int argc, char *argv[])
      that the agent has been startet. */
   gpa_start_agent ();
 
-  /* Handle command line options.  */
-  cms_hack = !args.disable_x509;
-
-  /* Start the key manger by default.  */
-  if (!args.start_key_manager
-      && !args.start_file_manager
-      && !args.start_clipboard
-      && !args.start_settings
-      && !args.start_card_manager
-      )
-    args.start_key_manager = TRUE;
-
-  /* Note: We can not use GPGME's engine info, as that returns NULL
-     (default) for home_dir.  Consider improving GPGME to get it from
-     there, or using gpgconf (via GPGME).  */
   gnupg_homedir = default_homedir ();
-  /* FIXME: GnuPG can not create a key if its home directory is
-     missing.  We help it out here.  Should be fixed in GnuPG.  */
+
+  /* GnuPG can not create a key if its home directory is missing.  We
+     help it out here.  Should be fixed in GnuPG.  */
   if (! g_file_test (gnupg_homedir, G_FILE_TEST_IS_DIR))
     g_mkdir (gnupg_homedir, 0700);
 
@@ -562,6 +548,26 @@ main (int argc, char *argv[])
       return 0;
     }
 
+  /* Handle command line options.  */
+  cms_hack = !args.disable_x509;
+
+  /* Start the default component.  */
+  if (!args.start_key_manager
+      && !args.start_file_manager
+      && !args.start_clipboard
+      && !args.start_settings
+      && !args.start_card_manager
+      )
+    {
+      /* The default action is to start the clipboard.  However, if we
+         have not yet created a key we remind the user by starting
+         with the key manager dialog.  */
+      if (key_manager_maybe_firsttime ())
+        args.start_key_manager = TRUE;
+      else
+        args.start_clipboard = TRUE;
+    }
+
 
   /* Check whether we need to start a server or to simply open a
      window in an already running server.  */
diff --git a/src/keymanager.c b/src/keymanager.c
index d78eb94..2cef4ab 100644
--- a/src/keymanager.c
+++ b/src/keymanager.c
@@ -762,7 +762,7 @@ key_manager_mapped (gpointer param)
       /* FIXME: We assume that the only reason a user might not have a
          default key is because he has no private keys.  */
       if (! asked_about_key_generation
-          && ! gpa_options_get_default_key (gpa_options_get_instance()))
+          && ! gpa_options_have_default_key (gpa_options_get_instance()))
         {
 	  GtkWidget *dialog;
 	  GtkResponseType response;
@@ -787,7 +787,7 @@ key_manager_mapped (gpointer param)
       else if (!asked_about_key_backup
                && !gpa_options_get_backup_generated
 	       (gpa_options_get_instance ())
-               && !gpa_options_get_default_key (gpa_options_get_instance()))
+               && !gpa_options_have_default_key (gpa_options_get_instance()))
         {
 	  GtkWidget *dialog;
 	  GtkResponseType response;
@@ -1570,3 +1570,25 @@ gpa_key_manager_is_open (void)
 {
   return !!this_instance;
 }
+
+
+/* Return true if we should ask for a first time key generation.
+ *
+ * This function basically duplicates the conditions from
+ * key_manager_mapped.  However that function mus be used from a
+ * key_manager context and can't easily be used from other GPA
+ * components.  */
+gboolean
+key_manager_maybe_firsttime (void)
+{
+  if (!gpa_options_get_simplified_ui (gpa_options_get_instance ()))
+    return FALSE;
+
+  if (!gpa_options_have_default_key (gpa_options_get_instance()))
+    return TRUE;
+
+  if (!gpa_options_get_backup_generated (gpa_options_get_instance ()))
+    return TRUE;
+
+  return FALSE;
+}
diff --git a/src/keymanager.h b/src/keymanager.h
index 26ed0b5..c9d6197 100644
--- a/src/keymanager.h
+++ b/src/keymanager.h
@@ -14,7 +14,7 @@
  * 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/>. 
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef KEYMANAGER_H
@@ -52,5 +52,7 @@ GtkWidget *gpa_key_manager_get_instance (gboolean *r_created);
 
 gboolean gpa_key_manager_is_open (void);
 
+gboolean key_manager_maybe_firsttime (void);
+
 
 #endif /*KEYMANAGER_H*/
diff --git a/src/options.c b/src/options.c
index fc67c46..35ab58d 100644
--- a/src/options.c
+++ b/src/options.c
@@ -270,6 +270,17 @@ gpa_options_get_default_key (GpaOptions *options)
 }
 
 
+/* Return whether a default key is somehow known.  This is either the
+   default key's fingerprint from gpa.conf or the default key from the
+   options dialog.  */
+gboolean
+gpa_options_have_default_key (GpaOptions *options)
+{
+  return ((options->default_key_fpr && *options->default_key_fpr)
+          || options->default_key);
+}
+
+
 /* Return the default key gpg would use, or at least a first
  * approximation. Currently this means the first secret key in the keyring.
  * If there's no secret key at all, return NULL
diff --git a/src/options.h b/src/options.h
index 41ffdd4..6a8ee55 100644
--- a/src/options.h
+++ b/src/options.h
@@ -93,6 +93,9 @@ gpgme_key_t gpa_options_get_default_key (GpaOptions *options);
 /* Try to find a reasonable value for the default key if there wasn't one */
 void gpa_options_update_default_key (GpaOptions *options);
 
+/* Return whether a default key is known.  */
+gboolean gpa_options_have_default_key (GpaOptions *options);
+
 /* Specify the default keyserver */
 void gpa_options_set_default_keyserver (GpaOptions *options,
                                         const gchar *keyserver);

-----------------------------------------------------------------------

Summary of changes:
 configure.ac          |  2 +-
 doc/gpa.1             |  6 ++++--
 src/gpa-key-details.c | 19 ++++++++++++++++---
 src/gpa.c             | 40 +++++++++++++++++++++++-----------------
 src/gpa.h             |  7 +++++++
 src/gpawidgets.c      | 35 +++++++++++++++++++++++++----------
 src/keymanager.c      | 26 ++++++++++++++++++++++++--
 src/keymanager.h      |  4 +++-
 src/keysigndlg.c      |  7 +++++--
 src/options.c         | 11 +++++++++++
 src/options.h         |  3 +++
 11 files changed, 122 insertions(+), 38 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Assistant
http://git.gnupg.org




More information about the Gnupg-commits mailing list