[balsa/gtk4: 111/283] Various: Adapt to gtk4




commit ce859d5a41cd38010146ab45fdb3aace164cd738
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Sep 28 14:14:19 2020 -0400

    Various: Adapt to gtk4

 libbalsa/autocrypt.c         | 21 ++++++++++-----------
 libbalsa/libbalsa-gpgme-cb.c |  4 ++--
 2 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/libbalsa/autocrypt.c b/libbalsa/autocrypt.c
index db4291f7e..756e2681b 100644
--- a/libbalsa/autocrypt.c
+++ b/libbalsa/autocrypt.c
@@ -440,18 +440,18 @@ autocrypt_db_dialog_run(const gchar *date_string, GtkWindow *parent)
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     gtk_widget_set_vexpand(vbox, TRUE);
-    gtk_container_add(GTK_CONTAINER(content_area), vbox);
+    gtk_box_append(GTK_BOX(content_area), vbox);
 
     label = gtk_label_new(_("Double-click key to show details"));
     gtk_widget_set_halign(label, GTK_ALIGN_START);
-    gtk_container_add(GTK_CONTAINER(vbox), label);
+    gtk_box_append(GTK_BOX(vbox), label);
 
-    scrolled_window = gtk_scrolled_window_new(NULL, NULL);
-    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_ETCHED_IN);
+    scrolled_window = gtk_scrolled_window_new();
+    gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(scrolled_window), TRUE);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, 
GTK_POLICY_AUTOMATIC);
     gtk_widget_set_vexpand(scrolled_window, TRUE);
     gtk_widget_set_valign(scrolled_window, GTK_ALIGN_FILL);
-    gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
+    gtk_box_append(GTK_BOX(vbox), scrolled_window);
 
     model = gtk_list_store_new(AC_DB_VIEW_COLUMNS, G_TYPE_STRING,      /* address */
        G_TYPE_STRING,                                                                                        
  /* formatted last seen timestamp */
@@ -463,7 +463,7 @@ autocrypt_db_dialog_run(const gchar *date_string, GtkWindow *parent)
 
     g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), dialog);
 
-    gtk_container_add(GTK_CONTAINER(scrolled_window), tree_view);
+    gtk_box_append(GTK_BOX(scrolled_window), tree_view);
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
     gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
 
@@ -517,10 +517,9 @@ autocrypt_db_dialog_run(const gchar *date_string, GtkWindow *parent)
        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);
 
-       (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);
        g_list_free_full(keys, (GDestroyNotify) g_bytes_unref);
 }
 
@@ -811,8 +810,8 @@ row_activated_cb(GtkTreeView       *tree_view,
 
                                dialog = libbalsa_key_dialog(window, GTK_BUTTONS_CLOSE, (gpgme_key_t) 
keys->data, GPG_SUBKEY_CAP_ALL,
                                        NULL, NULL);
-                               (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);
                                g_list_free_full(keys, (GDestroyNotify) gpgme_key_release);
                                }
                                libbalsa_delete_directory_contents(temp_dir);
diff --git a/libbalsa/libbalsa-gpgme-cb.c b/libbalsa/libbalsa-gpgme-cb.c
index d7435babb..d06aef9eb 100644
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@ -151,8 +151,8 @@ row_activated_cb(GtkTreeView       *tree_view,
 
         gtk_tree_model_get(model, &iter, GPG_KEY_PTR_COLUMN, &key, -1);
         dialog = libbalsa_key_dialog(window, GTK_BUTTONS_CLOSE, key, GPG_SUBKEY_CAP_ALL, NULL, NULL);
-        (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);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]