[balsa/gtk4: 226/311] mime-widget-crypto: Build with gtk4
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 226/311] mime-widget-crypto: Build with gtk4
- Date: Fri, 17 Dec 2021 19:54:25 +0000 (UTC)
commit b46641b448b8df2dca6aab92aeef5f6340a1e514
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Oct 22 20:09:43 2020 -0400
mime-widget-crypto: Build with gtk4
src/balsa-mime-widget-crypto.c | 53 ++++++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 23 deletions(-)
---
diff --git a/src/balsa-mime-widget-crypto.c b/src/balsa-mime-widget-crypto.c
index e9e45d546..54c0a57f7 100644
--- a/src/balsa-mime-widget-crypto.c
+++ b/src/balsa-mime-widget-crypto.c
@@ -52,7 +52,7 @@ balsa_mime_widget_new_signature(BalsaMessage * bm,
return NULL;
mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
- gtk_container_add(GTK_CONTAINER(mw),
+ gtk_box_append(GTK_BOX(mw),
balsa_mime_widget_signature_widget(mime_body, content_type));
return mw;
@@ -118,13 +118,13 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
label = gtk_label_new((lines[1] != NULL) ? lines[1] : lines[0]);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
gtk_widget_set_halign(label, GTK_ALIGN_START);
- gtk_container_add(GTK_CONTAINER(vbox), label);
+ gtk_box_append(GTK_BOX(vbox), label);
key = g_mime_gpgme_sigstat_key(mime_body->sig_info);
if (key != NULL) {
GtkWidget *key_widget;
key_widget = libbalsa_gpgme_key(key, g_mime_gpgme_sigstat_fingerprint(mime_body->sig_info),
0U, FALSE);
- gtk_container_add(GTK_CONTAINER(vbox), key_widget);
+ gtk_box_append(GTK_BOX(vbox), key_widget);
}
if (g_mime_gpgme_sigstat_protocol(mime_body->sig_info) == GPGME_PROTOCOL_OpenPGP) {
GtkWidget *hbox;
@@ -133,7 +133,7 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, BMW_HBOX_SPACE);
gtk_widget_set_vexpand(hbox, TRUE);
gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
- gtk_container_add(GTK_CONTAINER(vbox), hbox);
+ gtk_box_append(GTK_BOX(vbox), hbox);
if (g_mime_gpgme_sigstat_status(mime_body->sig_info) == GPG_ERR_NO_PUBKEY) {
#ifdef ENABLE_AUTOCRYPT
@@ -171,12 +171,15 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
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_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);
+ gtk_box_append(GTK_BOX(signature_widget), expander);
+ gtk_expander_set_child(GTK_EXPANDER(expander), vbox);
- gtk_container_set_border_width(GTK_CONTAINER(signature_widget), BMW_CONTAINER_BORDER);
+ gtk_widget_set_margin_top(signature_widget, BMW_CONTAINER_BORDER);
+ gtk_widget_set_margin_bottom(signature_widget, BMW_CONTAINER_BORDER);
+ gtk_widget_set_margin_start(signature_widget, BMW_CONTAINER_BORDER);
+ gtk_widget_set_margin_end(signature_widget, BMW_CONTAINER_BORDER);
g_strfreev(lines);
@@ -196,12 +199,12 @@ balsa_mime_widget_crypto_frame(LibBalsaMessageBody * mime_body, GtkWidget * chil
frame = gtk_frame_new(NULL);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, BMW_VBOX_SPACE);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
+ gtk_frame_set_child(GTK_FRAME(frame), vbox);
icon_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, BMW_VBOX_SPACE);
if (was_encrypted) {
- icon = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_ENCR), GTK_ICON_SIZE_MENU);
+ icon = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_ENCR));
gtk_widget_set_tooltip_text(icon, _("decrypted"));
- gtk_container_add(GTK_CONTAINER(icon_box), icon);
+ gtk_box_append(GTK_BOX(icon_box), icon);
}
if (!no_signature) {
LibBalsaMsgProtectState sig_state = libbalsa_message_body_protect_state(mime_body);
@@ -210,7 +213,7 @@ balsa_mime_widget_crypto_frame(LibBalsaMessageBody * mime_body, GtkWidget * chil
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);
+ icon = gtk_image_new_from_icon_name(balsa_icon_id(icon_name));
switch (sig_state) {
case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
gtk_widget_set_tooltip_text(icon, _("trusted signature"));
@@ -224,16 +227,19 @@ balsa_mime_widget_crypto_frame(LibBalsaMessageBody * mime_body, GtkWidget * chil
default:
gtk_widget_set_tooltip_text(icon, _("unknown signature status"));
}
- gtk_container_add(GTK_CONTAINER(icon_box), icon);
+ gtk_box_append(GTK_BOX(icon_box), icon);
}
gtk_frame_set_label_widget(GTK_FRAME(frame), icon_box);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), BMW_MESSAGE_PADDING);
- gtk_container_add(GTK_CONTAINER(vbox), child);
+ gtk_widget_set_margin_top(vbox, BMW_MESSAGE_PADDING);
+ gtk_widget_set_margin_bottom(vbox, BMW_MESSAGE_PADDING);
+ gtk_widget_set_margin_start(vbox, BMW_MESSAGE_PADDING);
+ gtk_widget_set_margin_end(vbox, BMW_MESSAGE_PADDING);
- if (signature) {
- gtk_container_add(GTK_CONTAINER(vbox), signature);
- }
+ gtk_box_append(GTK_BOX(vbox), child);
+
+ if (signature)
+ gtk_box_append(GTK_BOX(vbox), signature);
return frame;
}
@@ -319,8 +325,9 @@ on_key_import_button(GtkButton *button,
g_clear_error(&error);
}
g_free(import_info);
- (void) gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
+
+ g_signal_connect(dialog, "response", G_CALLBACK(gtk_window_destroy), NULL);
+ gtk_widget_show(dialog);
}
@@ -358,12 +365,12 @@ create_import_keys_widget(BalsaMimeWidget *mw, const gchar *key_buf, GError **er
success = FALSE;
} else {
key_widget = libbalsa_gpgme_key(this_key, NULL,
GPG_SUBKEY_CAP_ALL, FALSE);
- gtk_container_add(GTK_CONTAINER(mw), key_widget);
+ gtk_box_append(GTK_BOX(mw), key_widget);
import_btn = gtk_button_new_with_label(_("Import key into the
local key ring"));
g_object_set_data_full(G_OBJECT(import_btn), "keydata",
key_ascii, (GDestroyNotify) g_free);
g_signal_connect(import_btn, "clicked", (GCallback)
on_key_import_button, NULL);
- gtk_container_add(GTK_CONTAINER(mw), import_btn);
+ gtk_box_append(GTK_BOX(mw), import_btn);
if (item->next != NULL) {
GtkWidget *separator =
@@ -372,7 +379,7 @@ create_import_keys_widget(BalsaMimeWidget *mw, const gchar *key_buf, GError **er
BMW_VBOX_SPACE);
gtk_widget_set_margin_bottom(separator,
BMW_VBOX_SPACE);
- gtk_container_add(GTK_CONTAINER(mw), separator);
+ gtk_box_append(GTK_BOX(mw), separator);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]