Hi all,

I currently try to convince a colleague to use Balsa, and he mentioned some 
issues (more to come later) – here is a patch for a few more cosmetic ones 
which are easy to fix:

- If the signature status is /very/ long (as for an expired key in German 
translation), the message in the header box or in the expander label at the 
bottom may prevent the message from shrinking horizontally.  Solution: enable 
label line wrap
- In the signature status box at the bottom, if the labels in the 2nd column 
wrap, the label in the 1st column is vertically centred which looks ugly.  
Solution: use gtk_label_set_yalign()
- The wrapped label is centred in the column, not aligned at the left.  
Solution: use gtk_label_set_xalign()
- The meaning of the blue/green/yellow/red padlock icons is not obvious.  
Solution: add tooltip (this may be controversial as we didn't use tooltips yet, 
but it's an easy and intuitive solution).

The attached patch is suitable for both the master and gmime branches.  Note 
that it may produce offset warnings in combination with the “Bug fix: S/MIME 
cert chain broken in identity key selection” I sent earlier this evening, but 
should work anyway.

BTW, the gtk_label_set_xalign(…, 0.0F) trick might be helpful in several other 
places, too – e.g. for the message headers.  All long ones (like Received:) 
look really ugly!

Opinions?

Cheers,
Albrecht.

---
Patch details:
- libbalsa/libbalsa-gpgme-widgets.c: improve xalign and yalign properties of 
labels in signature and key details widgets
- src/balsa-mime-widget-crypto.c: balsa_mime_widget_signature_widget: 
wrap/align signature status in expander label; balsa_mime_widget_crypto_frame: 
add tooltips to padlock icons
- src/balsa-mime-widget-message.c: add_header_sigstate: wrap/align signature 
status in headers box
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index 70112e80b..0bdff701a 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -108,6 +108,7 @@ libbalsa_gpgme_key(const gpgme_key_t     key,
 			label = gtk_label_new(_("User ID:"));
 		}
 		gtk_widget_set_halign(label, GTK_ALIGN_START);
+		gtk_label_set_yalign(GTK_LABEL(label), 0.0F);
 		gtk_grid_attach(GTK_GRID(key_data), label, 0, row, 1, 1);
 
 		gtk_grid_attach(GTK_GRID(key_data), create_key_uid_widget(key->uids), 1, row++, 1, 1);
@@ -535,6 +542,7 @@ create_key_grid_row(GtkGrid     *grid,
 
 	label = gtk_label_new(key);
 	gtk_widget_set_halign(label, GTK_ALIGN_START);
+	gtk_label_set_yalign(GTK_LABEL(label), 0.0F);
 	gtk_grid_attach(GTK_GRID(grid), label, 0, row, 1, 1);
 
 	label = create_key_label_with_warn(value, warn);
@@ -604,6 +612,7 @@ create_key_label_with_warn(const gchar *text,
 		gtk_widget_set_hexpand(label, TRUE);
 		gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
 		gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+		gtk_label_set_xalign(GTK_LABEL(label), 0.0F);
 		gtk_box_pack_start(GTK_BOX(result), label, FALSE, TRUE, 0U);
 	} else {
 		result = gtk_label_new(text);
@@ -611,6 +620,7 @@ create_key_label_with_warn(const gchar *text,
 		gtk_widget_set_hexpand(result, TRUE);
 		gtk_label_set_selectable(GTK_LABEL(result), TRUE);
 		gtk_label_set_line_wrap(GTK_LABEL(result), TRUE);
+		gtk_label_set_xalign(GTK_LABEL(result), 0.0F);
 	}
 
 	return result;
diff --git a/src/balsa-mime-widget-crypto.c b/src/balsa-mime-widget-crypto.c
index 8e32d05f1..31fc160c2 100644
--- a/src/balsa-mime-widget-crypto.c
+++ b/src/balsa-mime-widget-crypto.c
@@ -161,6 +161,9 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
      * the label... */
     signature_widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     expander = gtk_expander_new(lines[0]);
+    label = gtk_expander_get_label_widget(GTK_EXPANDER(expander));
+    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+    gtk_label_set_xalign(GTK_LABEL(label), 0.0F);
     gtk_container_add(GTK_CONTAINER(signature_widget), expander);
     gtk_container_add(GTK_CONTAINER(expander), vbox);
 
@@ -180,26 +183,39 @@ balsa_mime_widget_crypto_frame(LibBalsaMessageBody * mime_body, GtkWidget * chil
     GtkWidget * frame;
     GtkWidget * vbox;
     GtkWidget * icon_box;
+    GtkWidget *icon;
 
     frame = gtk_frame_new(NULL);
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, BMW_VBOX_SPACE);
     gtk_container_add(GTK_CONTAINER(frame), vbox);
     icon_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, BMW_VBOX_SPACE);
-    if (was_encrypted)
-        gtk_box_pack_start(GTK_BOX(icon_box),
-                           gtk_image_new_from_icon_name
-                           (balsa_icon_id(BALSA_PIXMAP_ENCR),
-                            GTK_ICON_SIZE_MENU),
-                           FALSE, FALSE, 0);
+    if (was_encrypted) {
+    	icon = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_ENCR), GTK_ICON_SIZE_MENU);
+    	gtk_widget_set_tooltip_text(icon, _("decrypted"));
+        gtk_box_pack_start(GTK_BOX(icon_box), icon, FALSE, FALSE, 0);
+    }
     if (!no_signature) {
-	const gchar * icon_name =
-	    balsa_mime_widget_signature_icon_name(libbalsa_message_body_protect_state(mime_body));
-	if (!icon_name)
-	    icon_name = BALSA_PIXMAP_SIGN;
-        gtk_box_pack_start(GTK_BOX(icon_box),
-                           gtk_image_new_from_icon_name
-                           (balsa_icon_id(icon_name), GTK_ICON_SIZE_MENU),
-                           FALSE, FALSE, 0);
+    	LibBalsaMsgProtectState sig_state = libbalsa_message_body_protect_state(mime_body);
+    	const gchar *icon_name = balsa_mime_widget_signature_icon_name(sig_state);
+
+    	if (icon_name == NULL) {
+    		icon_name = BALSA_PIXMAP_SIGN;
+    	}
+		icon = gtk_image_new_from_icon_name(balsa_icon_id(icon_name), GTK_ICON_SIZE_MENU);
+    	switch (sig_state) {
+    	case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
+    		gtk_widget_set_tooltip_text(icon, _("trusted signature"));
+    		break;
+    	case LIBBALSA_MSG_PROTECT_SIGN_NOTRUST:
+    		gtk_widget_set_tooltip_text(icon, _("low trust signature"));
+    		break;
+    	case LIBBALSA_MSG_PROTECT_SIGN_BAD:
+    		gtk_widget_set_tooltip_text(icon, _("bad signature"));
+    		break;
+    	default:
+    		gtk_widget_set_tooltip_text(icon, _("unknown signature status"));
+    	}
+        gtk_box_pack_start(GTK_BOX(icon_box), icon, FALSE, FALSE, 0);
     }
     gtk_frame_set_label_widget(GTK_FRAME(frame), icon_box);
     gtk_container_set_border_width(GTK_CONTAINER(vbox), BMW_MESSAGE_PADDING);
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index 6d1e7e0e7..199ef49a9 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -868,6 +868,8 @@ add_header_sigstate(GtkGrid * grid, GMimeGpgmeSigstat * siginfo)
     gtk_label_set_markup(GTK_LABEL(label), msg);
     g_free(msg);
     gtk_widget_set_halign(label, GTK_ALIGN_START);
+    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+    gtk_label_set_xalign(GTK_LABEL(label), 0.0F);
     gtk_widget_show(label);
 
     gtk_grid_attach_next_to(grid, label, NULL, GTK_POS_BOTTOM, 2, 1);

Attachment: pgpnY3QLQ3L7M.pgp
Description: PGP signature

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list

Reply via email to