[balsa/gtk4: 67/76] Merge branch 'stop-using-dialog-run' into gtk4
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4: 67/76] Merge branch 'stop-using-dialog-run' into gtk4
- Date: Fri, 9 Oct 2020 02:53:15 +0000 (UTC)
commit 0bcf75cde1dd68061c1dcd245210c8505d752401
Merge: 0471f3287 78923e963
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Oct 7 11:15:25 2020 -0400
Merge branch 'stop-using-dialog-run' into gtk4
libbalsa/autocrypt.c | 79 ++++++++++---------
libbalsa/identity.c | 84 ++++++++++++++------
libbalsa/libbalsa-gpgme-cb.c | 180 +++++++++++++++++++++++++++++++++----------
libbalsa/libbalsa-gpgme.c | 5 +-
libbalsa/libbalsa.c | 150 +++++++++++++++++++++---------------
src/balsa-message.c | 2 +-
src/filter-edit-dialog.c | 20 ++---
src/information-dialog.c | 55 +++++++++----
src/sendmsg-window.c | 160 ++++++++++++++++++++++++++------------
src/sendmsg-window.h | 2 +
10 files changed, 501 insertions(+), 236 deletions(-)
---
diff --cc libbalsa/autocrypt.c
index de5101219,99df24ad6..799d9c465
--- a/libbalsa/autocrypt.c
+++ b/libbalsa/autocrypt.c
@@@ -415,6 -415,16 +415,16 @@@ autocrypt_recommendation(InternetAddres
return result;
}
+ static void
+ main_dialog_response_cb(GtkDialog *dialog,
+ int response_id,
+ gpointer user_data)
+ {
+ GList *keys = user_data;
+
+ g_list_free_full(keys, (GDestroyNotify) g_bytes_unref);
- gtk_widget_destroy(GTK_WIDGET(dialog));
++ gtk_window_destroy(GTK_WINDOW(dialog));
+ }
/* documentation: see header file */
void
@@@ -517,10 -527,10 +527,9 @@@ autocrypt_db_dialog_run(const gchar *da
column = gtk_tree_view_column_new_with_attributes(_("Prefer encryption"), renderer, "active", 3,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_widget_show_all(vbox);
- g_signal_connect(dialog, "response", G_CALLBACK(gtk_window_destroy), NULL);
- gtk_widget_show(dialog);
- g_list_free_full(keys, (GDestroyNotify) g_bytes_unref);
+ g_signal_connect(dialog, "response", G_CALLBACK(main_dialog_response_cb), keys);
+ gtk_widget_show(dialog);
}
@@@ -786,37 -795,37 +794,38 @@@ row_activated_cb(GtkTreeView *tre
/* note: silently ignore all errors below... */
model = gtk_tree_view_get_model(tree_view);
if (gtk_tree_model_get_iter(model, &iter, path)) {
-- gpgme_ctx_t ctx;
--
-- ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, NULL);
-- if (ctx != NULL) {
-- gchar *temp_dir = NULL;
--
-- if (libbalsa_mktempdir(&temp_dir)) {
-- GBytes *key;
-- GList *keys = NULL;
-- gboolean success;
--
-- gtk_tree_model_get(model, &iter, AC_KEY_PTR_COLUMN, &key, -1);
-- success = libbalsa_gpgme_ctx_set_home(ctx, temp_dir, NULL) &&
-- libbalsa_gpgme_import_bin_key(ctx, key, NULL, NULL) &&
-- libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, FALSE, FALSE, TRUE,
NULL);
-- if (success && (keys != NULL)) {
-- GtkWindow *window = user_data;
-- GtkWidget *dialog;
--
-- dialog = libbalsa_key_dialog(window, GTK_BUTTONS_CLOSE, (gpgme_key_t)
keys->data, GPG_SUBKEY_CAP_ALL,
-- NULL, NULL);
- g_signal_connect(dialog, "response", G_CALLBACK(gtk_window_destroy), NULL);
- gtk_widget_show(dialog);
- g_list_free_full(keys, (GDestroyNotify) gpgme_key_release);
- g_list_free_full(keys, (GDestroyNotify) gpgme_key_release);
- g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
- gtk_widget_show(dialog);
-- }
-- libbalsa_delete_directory_contents(temp_dir);
-- g_rmdir(temp_dir);
-- }
--
-- gpgme_release(ctx);
-- }
++ gpgme_ctx_t ctx;
++
++ ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, NULL);
++ if (ctx != NULL) {
++ gchar *temp_dir = NULL;
++
++ if (libbalsa_mktempdir(&temp_dir)) {
++ GBytes *key;
++ GList *keys = NULL;
++ gboolean success;
++
++ gtk_tree_model_get(model, &iter, AC_KEY_PTR_COLUMN, &key, -1);
++ success = libbalsa_gpgme_ctx_set_home(ctx, temp_dir, NULL)
++ && libbalsa_gpgme_import_bin_key(ctx, key, NULL, NULL)
++ && libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, FALSE, FALSE, TRUE, NULL);
++
++ if (success && (keys != NULL)) {
++ GtkWindow *window = user_data;
++ GtkWidget *dialog;
++
++ dialog = libbalsa_key_dialog(window, GTK_BUTTONS_CLOSE, (gpgme_key_t) keys->data,
++ GPG_SUBKEY_CAP_ALL, NULL, NULL);
++ g_signal_connect(dialog, "response", G_CALLBACK(gtk_window_destroy), NULL);
++ g_list_free_full(keys, (GDestroyNotify) gpgme_key_release);
++ gtk_widget_show(dialog);
++ }
++ libbalsa_delete_directory_contents(temp_dir);
++ g_rmdir(temp_dir);
++ }
++
++ gpgme_release(ctx);
++ }
}
}
diff --cc libbalsa/libbalsa-gpgme-cb.c
index d06aef9eb,310d06521..21d1d128c
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@@ -303,12 -335,36 +335,37 @@@ select_key_idle(gpointer user_data
gtk_container_add(GTK_CONTAINER(scrolled_window), tree_view);
g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), dialog);
- gtk_widget_show_all(content_area);
+ g_signal_connect(dialog, "response", G_CALLBACK(select_key_response), info->use_key);
+ g_free(info);
- gtk_widget_show_all(dialog);
+
- if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK) {
- use_key = NULL;
- }
- gtk_widget_destroy(dialog);
++ gtk_widget_show(dialog);
+
+ return G_SOURCE_REMOVE;
+ }
+
+ gpgme_key_t
+ lb_gpgme_select_key(const gchar * user_name, lb_key_sel_md_t mode, GList * keys,
+ gpgme_protocol_t protocol, GtkWindow * parent)
+ {
+ gpgme_key_t use_key = NULL;
+ select_key_info *info;
+
+ g_return_val_if_fail(libbalsa_am_i_subthread(), NULL);
+
+ info = g_new(select_key_info, 1);
+ info->user_name = user_name;
+ info->mode = mode;
+ info->keys = keys;
+ info->parent = parent;
+ info->use_key = &use_key;
+
+ g_idle_add(select_key_idle, info);
+
+ g_mutex_lock(&select_key.lock);
+ select_key.done = FALSE;
+ while (!select_key.done)
+ g_cond_wait(&select_key.cond, &select_key.lock);
+ g_mutex_unlock(&select_key.lock);
return use_key;
}
diff --cc libbalsa/libbalsa.c
index e4c76d5e0,8bc163a0b..4edb0807a
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@@ -429,23 -466,11 +466,11 @@@ ask_cert_real(void *data
gtk_widget_set_margin_top(cert_widget, 1);
gtk_widget_set_margin_bottom(cert_widget, 1);
gtk_container_add(GTK_CONTAINER(content_area), cert_widget);
- gtk_widget_show_all(cert_widget);
- switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
- case 0:
- i = CERT_ACCEPT_SESSION;
- break;
- case 1:
- i = CERT_ACCEPT_PERMANENT;
- break;
- case GTK_RESPONSE_CANCEL:
- default:
- i = CERT_ACCEPT_NO;
- break;
- }
- gtk_widget_destroy(dialog);
- g_free(acd->explanation);
- return i;
+ g_signal_connect(dialog, "response", G_CALLBACK(ask_cert_real_response), acd);
- gtk_widget_show_all(dialog);
++ gtk_widget_show(dialog);
+
+ return G_SOURCE_REMOVE;
}
diff --cc src/balsa-message.c
index 92f402d80,6f26c141d..f7cd77d14
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@@ -1007,17 -793,7 +1007,17 @@@ balsa_message_init(BalsaMessage * balsa
balsa_message->find_bar = bm_find_bar_new(balsa_message);
gtk_container_add(GTK_CONTAINER(vbox), balsa_message->find_bar);
- gtk_widget_show_all(GTK_WIDGET(balsa_message));
+ /* The context menu that is popped up when more than one part is selected */
+ balsa_message_add_actions(balsa_message, "message-menu");
+
+ menu = g_menu_new();
+ g_menu_append(menu, _("Save selected as…"), "save-selected");
+ g_menu_append(menu, _("Save selected to folder…"), "save-selected-to-folder");
+ balsa_message->save_all_popup =
+ libbalsa_popup_widget_new(balsa_message->treeview, G_MENU_MODEL(menu), "message-menu");
+ g_object_unref(menu);
+
- gtk_widget_show_all(GTK_WIDGET(balsa_message));
++ gtk_widget_show(GTK_WIDGET(balsa_message));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]