[balsa/gtk4: 201/311] Various: Build with gtk4




commit 6c81ad5379d8f2e4420f8d5d56201a7d91f74093
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Oct 10 15:35:03 2020 -0400

    Various: Build with gtk4
    
    libbalsa/address.c
    libbalsa/identity.c
    libbalsa/libbalsa-gpgme-cb.c
    libbalsa/libbalsa-gpgme-widgets.c
    libbalsa/server-config.c
    libbalsa/server-config.h
    libbalsa/smtp-server.c
    libbalsa/source-viewer.c
    libbalsa/x509-cert-widget.c
    libinit_balsa/assistant_page_defclient.c
    libinit_balsa/assistant_page_directory.c
    src/address-book-config.c
    src/balsa-mime-widget-message.c
    src/filter-edit-callbacks.c
    src/filter-edit-dialog.c
    src/folder-conf.c
    src/mailbox-conf.c
    src/pref-manager.c
    src/sendmsg-window.c

 libbalsa/address.c                       |   5 +-
 libbalsa/identity.c                      |   7 +-
 libbalsa/libbalsa-gpgme-cb.c             |  13 +-
 libbalsa/libbalsa-gpgme-widgets.c        |   7 +-
 libbalsa/server-config.c                 |  68 ++++++---
 libbalsa/server-config.h                 |   7 +-
 libbalsa/smtp-server.c                   |  61 ++++----
 libbalsa/source-viewer.c                 |  32 ++---
 libbalsa/x509-cert-widget.c              |   8 +-
 libinit_balsa/assistant_page_defclient.c |  14 +-
 libinit_balsa/assistant_page_directory.c |  23 +--
 src/address-book-config.c                | 240 ++++++++++++++++++++-----------
 src/balsa-mime-widget-message.c          |   9 +-
 src/filter-edit-callbacks.c              |  24 +++-
 src/filter-edit-dialog.c                 |  19 ++-
 src/folder-conf.c                        |   7 +-
 src/mailbox-conf.c                       |   5 +-
 src/pref-manager.c                       |  15 +-
 src/sendmsg-window.c                     |  14 +-
 19 files changed, 391 insertions(+), 187 deletions(-)
---
diff --git a/libbalsa/address.c b/libbalsa/address.c
index b7da172c7..7029a56c3 100644
--- a/libbalsa/address.c
+++ b/libbalsa/address.c
@@ -973,7 +973,10 @@ libbalsa_address_get_edit_widget(LibBalsaAddress *address,
 #define HIG_PADDING 6
     gtk_grid_set_row_spacing(GTK_GRID(grid), HIG_PADDING);
     gtk_grid_set_column_spacing(GTK_GRID(grid), HIG_PADDING);
-    g_object_set(grid, "margin", HIG_PADDING, NULL);
+    gtk_widget_set_margin_top(grid, HIG_PADDING);
+    gtk_widget_set_margin_bottom(grid, HIG_PADDING);
+    gtk_widget_set_margin_start(grid, HIG_PADDING);
+    gtk_widget_set_margin_end(grid, HIG_PADDING);
 
     for (cnt = 0; cnt < NUM_FIELDS; cnt++) {
         if (!labels[cnt])
diff --git a/libbalsa/identity.c b/libbalsa/identity.c
index 7094abdcd..5767e53ff 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -811,7 +811,12 @@ append_ident_notebook_page(GtkNotebook *notebook,
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     grid = libbalsa_create_grid();
-    g_object_set(grid, "margin", padding, NULL);
+
+    gtk_widget_set_margin_top(grid, padding);
+    gtk_widget_set_margin_bottom(grid, padding);
+    gtk_widget_set_margin_start(grid, padding);
+    gtk_widget_set_margin_end(grid, padding);
+
     gtk_box_append(GTK_BOX(vbox), grid);
     gtk_notebook_append_page(notebook, vbox, gtk_label_new(tab_label));
 
diff --git a/libbalsa/libbalsa-gpgme-cb.c b/libbalsa/libbalsa-gpgme-cb.c
index 5fbb6d5b7..d214b764a 100644
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@ -218,7 +218,11 @@ select_key_idle(gpointer user_data)
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     gtk_widget_set_vexpand (vbox, TRUE);
     gtk_box_append(GTK_BOX(content_area), vbox);
-    g_object_set(vbox, "margin", 12, NULL);
+
+    gtk_widget_set_margin_top(vbox, 12);
+    gtk_widget_set_margin_bottom(vbox, 12);
+    gtk_widget_set_margin_start(vbox, 12);
+    gtk_widget_set_margin_end(vbox, 12);
 
     switch (data->mode) {
        case LB_SELECT_PRIVATE_KEY:
@@ -494,7 +498,12 @@ get_passphrase_idle(gpointer data)
 #endif
 
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-    g_object_set(hbox, "margin", 12, NULL);
+
+    gtk_widget_set_margin_top(hbox, 12);
+    gtk_widget_set_margin_bottom(hbox, 12);
+    gtk_widget_set_margin_start(hbox, 12);
+    gtk_widget_set_margin_end(hbox, 12);
+
     gtk_box_append(GTK_BOX(content_area), hbox);
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index b04b43120..720ce6f3b 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -412,7 +412,12 @@ libbalsa_key_dialog(GtkWindow            *parent,
        content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
 
        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-       g_object_set(hbox, "margin", 6, NULL);
+
+    gtk_widget_set_margin_top(hbox, 6);
+    gtk_widget_set_margin_bottom(hbox, 6);
+    gtk_widget_set_margin_start(hbox, 6);
+    gtk_widget_set_margin_end(hbox, 6);
+
         gtk_widget_set_vexpand(hbox, TRUE);
         gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
        gtk_box_append(GTK_BOX(content_area), hbox);
diff --git a/libbalsa/server-config.c b/libbalsa/server-config.c
index 37360213d..22a84e9f9 100644
--- a/libbalsa/server-config.c
+++ b/libbalsa/server-config.c
@@ -28,7 +28,9 @@
 
 
 struct _LibBalsaServerCfg {
-        GtkNotebook parent;
+        GObject parent;
+
+        GtkWidget *notebook;
 
        /* "Basic" notebook page */
        GtkWidget *basic_grid;                  /* grid */
@@ -53,7 +55,7 @@ struct _LibBalsaServerCfg {
 };
 
 
-G_DEFINE_TYPE(LibBalsaServerCfg, libbalsa_server_cfg, GTK_TYPE_NOTEBOOK)
+G_DEFINE_TYPE(LibBalsaServerCfg, libbalsa_server_cfg, G_TYPE_OBJECT);
 
 
 static GtkWidget *server_cfg_add_entry(GtkWidget *grid, guint row, const gchar *label, const gchar *value, 
GCallback callback,
@@ -99,8 +101,12 @@ libbalsa_server_cfg_new(LibBalsaServer *server, const gchar *name)
     server_cfg->basic_grid = libbalsa_create_grid();
     server_cfg->basic_rows = 0U;
 
-    gtk_container_set_border_width(GTK_CONTAINER(server_cfg->basic_grid), HIG_PADDING);
-    gtk_notebook_append_page(GTK_NOTEBOOK(server_cfg), server_cfg->basic_grid, 
gtk_label_new_with_mnemonic(_("_Basic")));
+    gtk_widget_set_margin_top(server_cfg->basic_grid, HIG_PADDING);
+    gtk_widget_set_margin_bottom(server_cfg->basic_grid, HIG_PADDING);
+    gtk_widget_set_margin_start(server_cfg->basic_grid, HIG_PADDING);
+    gtk_widget_set_margin_end(server_cfg->basic_grid, HIG_PADDING);
+
+    gtk_notebook_append_page(GTK_NOTEBOOK(server_cfg->notebook), server_cfg->basic_grid, 
gtk_label_new_with_mnemonic(_("_Basic")));
 
     /* server descriptive name */
     server_cfg->name = server_cfg_add_entry(server_cfg->basic_grid, server_cfg->basic_rows++, 
_("_Descriptive Name:"), name,
@@ -142,8 +148,13 @@ libbalsa_server_cfg_new(LibBalsaServer *server, const gchar *name)
     /* notebook page with advanced options */
     server_cfg->advanced_grid = libbalsa_create_grid();
     server_cfg->advanced_rows = 0U;
-    gtk_container_set_border_width(GTK_CONTAINER(server_cfg->advanced_grid), HIG_PADDING);
-    gtk_notebook_append_page(GTK_NOTEBOOK(server_cfg), server_cfg->advanced_grid, 
gtk_label_new_with_mnemonic(_("_Advanced")));
+
+    gtk_widget_set_margin_top(server_cfg->advanced_grid, HIG_PADDING);
+    gtk_widget_set_margin_bottom(server_cfg->advanced_grid, HIG_PADDING);
+    gtk_widget_set_margin_start(server_cfg->advanced_grid, HIG_PADDING);
+    gtk_widget_set_margin_end(server_cfg->advanced_grid, HIG_PADDING);
+
+    gtk_notebook_append_page(GTK_NOTEBOOK(server_cfg->notebook), server_cfg->advanced_grid, 
gtk_label_new_with_mnemonic(_("_Advanced")));
 
     /* client certificate and passphrase */
     server_cfg->require_cert = server_cfg_add_check(server_cfg->advanced_grid, server_cfg->advanced_rows++, 
_("Server _requires client certificate"),
@@ -154,7 +165,9 @@ libbalsa_server_cfg_new(LibBalsaServer *server, const gchar *name)
 
     cert_file = libbalsa_server_get_cert_file(server);
     if (cert_file != NULL) {
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(server_cfg->cert_file), cert_file);
+        GFile *file = g_file_new_for_path(cert_file);
+        gtk_file_chooser_set_file(GTK_FILE_CHOOSER(server_cfg->cert_file), file, NULL);
+        g_object_unref(file);
     }
     g_signal_connect(server_cfg->cert_file, "file-set", G_CALLBACK(on_server_cfg_changed), server_cfg);
 
@@ -259,7 +272,7 @@ const gchar *
 libbalsa_server_cfg_get_name(LibBalsaServerCfg *server_cfg)
 {
        g_return_val_if_fail(LIBBALSA_IS_SERVER_CFG(server_cfg), FALSE);
-       return gtk_entry_get_text(GTK_ENTRY(server_cfg->name));
+       return gtk_editable_get_text(GTK_EDITABLE(server_cfg->name));
 }
 
 
@@ -267,6 +280,7 @@ libbalsa_server_cfg_get_name(LibBalsaServerCfg *server_cfg)
 void
 libbalsa_server_cfg_assign_server(LibBalsaServerCfg *server_cfg, LibBalsaServer *server)
 {
+    GFile *file;
         gchar *cert_file;
 
        g_return_if_fail(LIBBALSA_IS_SERVER_CFG(server_cfg) && LIBBALSA_IS_SERVER(server));
@@ -274,7 +288,7 @@ libbalsa_server_cfg_assign_server(LibBalsaServerCfg *server_cfg, LibBalsaServer
 
        /* host, post and security */
     libbalsa_server_set_security(server, (NetClientCryptMode) 
(gtk_combo_box_get_active(GTK_COMBO_BOX(server_cfg->security)) + 1));
-    libbalsa_server_set_host(server, gtk_entry_get_text(GTK_ENTRY(server_cfg->host_port)), 
libbalsa_server_get_security(server));
+    libbalsa_server_set_host(server, gtk_editable_get_text(GTK_EDITABLE(server_cfg->host_port)), 
libbalsa_server_get_security(server));
 
     /* authentication stuff */
     if (server_cfg->require_auth != NULL) {
@@ -282,18 +296,21 @@ libbalsa_server_cfg_assign_server(LibBalsaServerCfg *server_cfg, LibBalsaServer
     } else {
         libbalsa_server_set_try_anonymous(server, FALSE);
     }
-    libbalsa_server_set_username(server, gtk_entry_get_text(GTK_ENTRY(server_cfg->username)));
-    libbalsa_server_set_password(server, gtk_entry_get_text(GTK_ENTRY(server_cfg->password)), FALSE);
+    libbalsa_server_set_username(server, gtk_editable_get_text(GTK_EDITABLE(server_cfg->username)));
+    libbalsa_server_set_password(server, gtk_editable_get_text(GTK_EDITABLE(server_cfg->password)), FALSE);
     libbalsa_server_set_remember_password(server, 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(server_cfg->remember_pass)));
 
     /* client certificate */
     libbalsa_server_set_client_cert(server, 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(server_cfg->require_cert)));
 
-    cert_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(server_cfg->cert_file));
+    file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(server_cfg->cert_file));
+    cert_file = g_file_get_path(file);
+    g_object_unref(file);
+
     libbalsa_server_set_cert_file(server, cert_file);
     g_free(cert_file);
 
-    libbalsa_server_set_password(server, gtk_entry_get_text(GTK_ENTRY(server_cfg->cert_pass)), TRUE);
+    libbalsa_server_set_password(server, gtk_editable_get_text(GTK_EDITABLE(server_cfg->cert_pass)), TRUE);
     libbalsa_server_set_remember_cert_passphrase(server, 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(server_cfg->remember_cert_pass)));
 }
 
@@ -309,7 +326,7 @@ libbalsa_server_cfg_class_init(LibBalsaServerCfgClass *klass)
 static void
 libbalsa_server_cfg_init(LibBalsaServerCfg *self)
 {
-    /* Nothing to do */
+    self->notebook = gtk_notebook_new();
 }
 
 
@@ -321,7 +338,7 @@ server_cfg_add_entry(GtkWidget *grid, guint row, const gchar *label, const gchar
        new_entry = gtk_entry_new();
     server_cfg_add_widget(grid, row, label, new_entry);
     if (value != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(new_entry), value);
+        gtk_editable_set_text(GTK_EDITABLE(new_entry), value);
     }
     if (callback != NULL) {
         g_signal_connect(new_entry, "changed", callback, cb_data);
@@ -387,8 +404,8 @@ on_server_cfg_changed(GtkWidget *widget, LibBalsaServerCfg *server_cfg)
        gboolean sensitive;
 
        /* valid configuration only if a name and a host have been given */
-       server_cfg->cfg_valid = (*gtk_entry_get_text(GTK_ENTRY(server_cfg->name)) != '\0') &&
-               (*gtk_entry_get_text(GTK_ENTRY(server_cfg->host_port)) != '\0');
+       server_cfg->cfg_valid = (*gtk_editable_get_text(GTK_EDITABLE(server_cfg->name)) != '\0') &&
+               (*gtk_editable_get_text(GTK_EDITABLE(server_cfg->host_port)) != '\0');
 
        /* user name/password only if authentication is required */
        if (server_cfg->require_auth != NULL) {
@@ -401,7 +418,7 @@ on_server_cfg_changed(GtkWidget *widget, LibBalsaServerCfg *server_cfg)
        gtk_widget_set_sensitive(server_cfg->remember_pass, sensitive);
 
        /* invalid configuration if authentication is required, but no user name given */
-       if (sensitive && (*gtk_entry_get_text(GTK_ENTRY(server_cfg->username)) == '\0')) {
+       if (sensitive && (*gtk_editable_get_text(GTK_EDITABLE(server_cfg->username)) == '\0')) {
                server_cfg->cfg_valid = FALSE;
        }
 
@@ -418,7 +435,12 @@ on_server_cfg_changed(GtkWidget *widget, LibBalsaServerCfg *server_cfg)
 
        /* invalid configuration if a certificate is required, but no file name given */
        if (sensitive) {
-               gchar *cert_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(server_cfg->cert_file));
+            GFile *file;
+               gchar *cert_file;
+
+                file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(server_cfg->cert_file));
+                cert_file = g_file_get_path(file);
+                g_object_unref(file);
 
                if ((cert_file == NULL) || (cert_file[0] == '\0')) {
                        server_cfg->cfg_valid = FALSE;
@@ -428,3 +450,11 @@ on_server_cfg_changed(GtkWidget *widget, LibBalsaServerCfg *server_cfg)
 
        g_signal_emit(server_cfg, changed_sig, 0);
 }
+
+GtkWidget *
+libbalsa_server_cfg_get_notebook(LibBalsaServerCfg *server_cfg)
+{
+    g_return_val_if_fail(LIBBALSA_IS_SERVER_CFG(server_cfg), NULL);
+
+    return server_cfg->notebook;
+}
diff --git a/libbalsa/server-config.h b/libbalsa/server-config.h
index 3983001ed..73d5fc4fd 100644
--- a/libbalsa/server-config.h
+++ b/libbalsa/server-config.h
@@ -37,7 +37,7 @@ G_DECLARE_FINAL_TYPE(LibBalsaServerCfg,
                      libbalsa_server_cfg,
                      LIBBALSA,
                      SERVER_CFG,
-                     GtkNotebook)
+                     GObject)
 
 
 /** @brief Create a new server configuration widget
@@ -124,5 +124,10 @@ const gchar *libbalsa_server_cfg_get_name(LibBalsaServerCfg *server_cfg);
 void libbalsa_server_cfg_assign_server(LibBalsaServerCfg *server_cfg,
                                                                           LibBalsaServer    *server);
 
+/** @brief Get the server configuration's GtkNotebook
+ * @param server_cfg server configuration widget
+ */
+GtkWidget * libbalsa_server_cfg_get_notebook(LibBalsaServerCfg *server_cfg);
+
 
 #endif /* LIBBALSA_SERVER_CONFIG_H_ */
diff --git a/libbalsa/smtp-server.c b/libbalsa/smtp-server.c
index d1f3c1461..5d9dfa80b 100644
--- a/libbalsa/smtp-server.c
+++ b/libbalsa/smtp-server.c
@@ -205,7 +205,7 @@ struct smtp_server_dialog_info {
     gchar *old_name;
     LibBalsaSmtpServerUpdate update;
     GtkWidget *dialog;
-    LibBalsaServerCfg *notebook;
+    LibBalsaServerCfg *server_cfg;
     GtkWidget *split_button;
     GtkWidget *big_message;
 };
@@ -215,8 +215,8 @@ static void
 smtp_server_destroy_notify(struct smtp_server_dialog_info *sdi)
 {
     g_free(sdi->old_name);
-    if (sdi->dialog)
-        gtk_widget_destroy(sdi->dialog);
+    if (sdi->dialog != NULL)
+        gtk_window_destroy(GTK_WINDOW(sdi->dialog));
     g_free(sdi);
 }
 
@@ -229,28 +229,36 @@ smtp_server_weak_notify(struct smtp_server_dialog_info *sdi, GObject *dialog)
                       LIBBALSA_SMTP_SERVER_DIALOG_KEY, NULL);
 }
 
+static void
+smtp_server_help_finish(GObject      *source_object,
+                        GAsyncResult *result,
+                        gpointer      user_data)
+{
+    GtkWindow *parent = user_data;
+    GError *error = NULL;
+
+    if (!gtk_show_uri_full_finish(parent, result, &error)) {
+        libbalsa_information(LIBBALSA_INFORMATION_WARNING,
+                             _("Error displaying server help: %s\n"), error->message);
+        g_error_free(error);
+    }
+}
+
 static void
 smtp_server_response(GtkDialog * dialog, gint response,
                      struct smtp_server_dialog_info *sdi)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(sdi->smtp_server);
-    GError *error = NULL;
 
     switch (response) {
     case GTK_RESPONSE_HELP:
-        gtk_show_uri_on_window(GTK_WINDOW(dialog),
-                               "help:balsa/preferences-mail-options#smtp-server-config",
-                               gtk_get_current_event_time(), &error);
-        if (error) {
-            libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                                 _("Error displaying server help: %s\n"),
-                                 error->message);
-            g_error_free(error);
-        }
+        gtk_show_uri_full(GTK_WINDOW(dialog),
+                          "help:balsa/preferences-mail-options#smtp-server-config",
+                          GDK_CURRENT_TIME, NULL, smtp_server_help_finish, dialog);
         return;
     case GTK_RESPONSE_OK:
-        libbalsa_smtp_server_set_name(sdi->smtp_server, libbalsa_server_cfg_get_name(sdi->notebook));
-        libbalsa_server_cfg_assign_server(sdi->notebook, server);
+        libbalsa_smtp_server_set_name(sdi->smtp_server, libbalsa_server_cfg_get_name(sdi->server_cfg));
+        libbalsa_server_cfg_assign_server(sdi->server_cfg, server);
         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->split_button))) {
             /* big_message is stored in kB, but the widget is in MB. */
                sdi->smtp_server->big_message =
@@ -270,7 +278,7 @@ smtp_server_response(GtkDialog * dialog, gint response,
     sdi->update(sdi->smtp_server, response, sdi->old_name);
     g_object_unref(server);
 
-    gtk_widget_destroy(GTK_WIDGET(dialog));
+    gtk_window_destroy(GTK_WINDOW(dialog));
 }
 
 static void
@@ -278,7 +286,7 @@ smtp_server_changed(GtkWidget G_GNUC_UNUSED *widget,
                     struct smtp_server_dialog_info *sdi)
 {
        gboolean sensitive;
-       gboolean enable_ok = libbalsa_server_cfg_valid(sdi->notebook);
+       gboolean enable_ok = libbalsa_server_cfg_valid(sdi->server_cfg);
 
        /* split big messages */
        if ((sdi->big_message != NULL) && (sdi->split_button != NULL)) {
@@ -301,13 +309,13 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer * smtp_server,
     GtkWidget *dialog;
     GtkWidget *content_area;
     GtkWidget *label, *hbox;
+    GtkWidget *notebook;
 
     /* Show only one dialog at a time. */
     sdi = g_object_get_data(G_OBJECT(smtp_server),
                             LIBBALSA_SMTP_SERVER_DIALOG_KEY);
     if (sdi != NULL) {
-        gtk_window_present_with_time(GTK_WINDOW(sdi->dialog),
-                                     gtk_get_current_event_time());
+        gtk_window_present_with_time(GTK_WINDOW(sdi->dialog), GDK_CURRENT_TIME);
         return;
     }
 
@@ -341,8 +349,9 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer * smtp_server,
     gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK,
                                       FALSE);
 
-    sdi->notebook = libbalsa_server_cfg_new(server, smtp_server->name);
-    gtk_container_add(GTK_CONTAINER(content_area), GTK_WIDGET(sdi->notebook));
+    sdi->server_cfg = libbalsa_server_cfg_new(server, smtp_server->name);
+    notebook = libbalsa_server_cfg_get_notebook(sdi->server_cfg);
+    gtk_box_append(GTK_BOX(content_area), notebook);
 
 #define HIG_PADDING 12
 
@@ -352,9 +361,9 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer * smtp_server,
     sdi->big_message = gtk_spin_button_new_with_range(0.1, 100, 0.1);
     gtk_widget_set_hexpand(sdi->big_message, TRUE);
     gtk_widget_set_halign(sdi->big_message, GTK_ALIGN_FILL);
-    gtk_container_add(GTK_CONTAINER(hbox), sdi->big_message);
+    gtk_box_append(GTK_BOX(hbox), sdi->big_message);
     label = gtk_label_new(_("MB"));
-    gtk_container_add(GTK_CONTAINER(hbox), label);
+    gtk_box_append(GTK_BOX(hbox), label);
     if (smtp_server->big_message > 0) {
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sdi->split_button), TRUE);
         /* The widget is in MB, but big_message is stored in kB. */
@@ -364,12 +373,12 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer * smtp_server,
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sdi->split_button), FALSE);
         gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdi->big_message), 1);
     }
-    libbalsa_server_cfg_add_row(sdi->notebook, FALSE, sdi->split_button, hbox);
-    g_signal_connect(sdi->notebook, "changed", G_CALLBACK(smtp_server_changed), sdi);
+    libbalsa_server_cfg_add_row(sdi->server_cfg, FALSE, sdi->split_button, hbox);
+    g_signal_connect(sdi->server_cfg, "changed", G_CALLBACK(smtp_server_changed), sdi);
     g_signal_connect(sdi->split_button, "toggled", G_CALLBACK(smtp_server_changed), sdi);
     g_signal_connect(sdi->big_message, "changed", G_CALLBACK(smtp_server_changed), sdi);
 
     smtp_server_changed(NULL, sdi);
 
-    gtk_widget_show_all(dialog);
+    gtk_widget_show(dialog);
 }
diff --git a/libbalsa/source-viewer.c b/libbalsa/source-viewer.c
index 834317adf..3ec306821 100644
--- a/libbalsa/source-viewer.c
+++ b/libbalsa/source-viewer.c
@@ -55,16 +55,12 @@ lsv_copy_activated(GSimpleAction * action,
                    GVariant      * parameter,
                    gpointer        user_data)
 {
-    LibBalsaSourceViewerInfo *lsvi =
-        g_object_get_data(G_OBJECT(user_data), "lsvi");
+    LibBalsaSourceViewerInfo *lsvi = g_object_get_data(G_OBJECT(user_data), "lsvi");
     GtkTextView *text = GTK_TEXT_VIEW(lsvi->text);
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
-    GdkDisplay *display;
-    GtkClipboard *clipboard;
-
-    display = gtk_widget_get_display(GTK_WIDGET(text));
-    clipboard = gtk_clipboard_get_for_display(display, GDK_NONE);
+    GdkClipboard *clipboard;
 
+    clipboard = gtk_widget_get_clipboard(GTK_WIDGET(text));
     gtk_text_buffer_copy_clipboard(buffer, clipboard);
 }
 
@@ -198,7 +194,7 @@ libbalsa_show_message_source(GtkApplication  * application,
     css = libbalsa_font_string_to_css(font, BALSA_SOURCE_VIEWER);
 
     css_provider = gtk_css_provider_new();
-    gtk_css_provider_load_from_data(css_provider, css, -1, NULL);
+    gtk_css_provider_load_from_data(css_provider, css, -1);
     g_free(css);
 
     gtk_style_context_add_provider(gtk_widget_get_style_context(text) ,
@@ -209,15 +205,14 @@ libbalsa_show_message_source(GtkApplication  * application,
     gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
     gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD_CHAR);
 
-    interior = gtk_scrolled_window_new(NULL, NULL);
+    interior = gtk_scrolled_window_new();
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(interior),
                                    GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_ALWAYS);
-    gtk_container_add(GTK_CONTAINER(interior), GTK_WIDGET(text));
+    gtk_box_append(GTK_BOX(interior), GTK_WIDGET(text));
 
     window = gtk_application_window_new(application);
     gtk_window_set_title(GTK_WINDOW(window), _("Message Source"));
-    gtk_window_set_role(GTK_WINDOW(window), "message-source");
     geometry_manager_attach(GTK_WINDOW(window), "SourceView");
 
     menu_bar = libbalsa_window_get_menu_bar(GTK_APPLICATION_WINDOW(window),
@@ -238,14 +233,19 @@ libbalsa_show_message_source(GtkApplication  * application,
 #else
     gtk_widget_set_margin_top(menu_bar, 1);
     gtk_widget_set_margin_bottom(menu_bar, 1);
-    gtk_container_add(GTK_CONTAINER(vbox), menu_bar);
+    gtk_box_append(GTK_BOX(vbox), menu_bar);
 #endif
 
     gtk_widget_set_vexpand(interior, TRUE);
     gtk_widget_set_valign(interior, GTK_ALIGN_FILL);
-    g_object_set(interior, "margin", 2, NULL);
-    gtk_container_add(GTK_CONTAINER(vbox), interior);
-    gtk_container_add(GTK_CONTAINER(window), vbox);
+
+    gtk_widget_set_margin_top(interior, 2);
+    gtk_widget_set_margin_bottom(interior, 2);
+    gtk_widget_set_margin_start(interior, 2);
+    gtk_widget_set_margin_end(interior, 2);
+
+    gtk_box_append(GTK_BOX(vbox), interior);
+    gtk_box_append(GTK_BOX(window), vbox);
 
     lsvi = g_new(LibBalsaSourceViewerInfo, 1);
     lsvi->msg = g_object_ref(msg);
@@ -255,7 +255,7 @@ libbalsa_show_message_source(GtkApplication  * application,
     g_object_set_data_full(G_OBJECT(window), "lsvi", lsvi,
                            (GDestroyNotify) lsv_window_destroy_notify);
 
-    gtk_widget_show_all(window);
+    gtk_widget_show(window);
 
     escape_action = g_action_map_lookup_action(G_ACTION_MAP(window), "escape");
     lsv_escape_change_state(G_SIMPLE_ACTION(escape_action),
diff --git a/libbalsa/x509-cert-widget.c b/libbalsa/x509-cert-widget.c
index c4653586e..a65d593e4 100644
--- a/libbalsa/x509-cert-widget.c
+++ b/libbalsa/x509-cert-widget.c
@@ -162,16 +162,16 @@ create_chain_widget(GList *cert_list)
        gboolean is_root;
 
        vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-       scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+       scrolledwin = gtk_scrolled_window_new();
         gtk_widget_set_vexpand(scrolledwin, TRUE);
         gtk_widget_set_valign(scrolledwin, GTK_ALIGN_FILL);
         gtk_widget_set_margin_top(scrolledwin, 6U);
         gtk_widget_set_margin_bottom(scrolledwin, 6U);
-        gtk_container_add(GTK_CONTAINER(vbox), scrolledwin);
+        gtk_box_append(GTK_BOX(vbox), scrolledwin);
 
        store = gtk_tree_store_new(CERT_COLUMNS, G_TYPE_STRING, GTK_TYPE_WIDGET);
        tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
-       gtk_container_add(GTK_CONTAINER(scrolledwin), tree_view);
+       gtk_box_append(GTK_BOX(scrolledwin), tree_view);
        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes(NULL, renderer, "text", CERT_NAME_COLUMN, NULL);
        gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
@@ -185,7 +185,7 @@ create_chain_widget(GList *cert_list)
         gtk_widget_set_valign(stack, GTK_ALIGN_FILL);
         gtk_widget_set_margin_top(stack, 6U);
         gtk_widget_set_margin_bottom(stack, 6U);
-       gtk_container_add(GTK_CONTAINER(vbox), stack);
+       gtk_box_append(GTK_BOX(vbox), stack);
        g_signal_connect(tree_view, "row-activated", G_CALLBACK(cert_selected_cb), stack);
 
        is_root = TRUE;
diff --git a/libinit_balsa/assistant_page_defclient.c b/libinit_balsa/assistant_page_defclient.c
index 0ee710d71..0de20ab38 100644
--- a/libinit_balsa/assistant_page_defclient.c
+++ b/libinit_balsa/assistant_page_defclient.c
@@ -54,11 +54,11 @@ balsa_druid_page_defclient_init(BalsaDruidPageDefclient * defclient,
         GTK_LABEL(gtk_label_new
                   (_("Use Balsa as default email client?")));
     gtk_label_set_justify(label, GTK_JUSTIFY_CENTER);
-    gtk_label_set_line_wrap(label, TRUE);
+    gtk_label_set_wrap(label, TRUE);
 
-    yes = gtk_radio_button_new_with_mnemonic(NULL, _("_Yes"));
-    no = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(yes),
-                                                         _("_No"));
+    yes = gtk_toggle_button_new_with_mnemonic(_("_Yes"));
+    no  = gtk_toggle_button_new_with_mnemonic(_("_No"));
+    gtk_toggle_button_set_group(GTK_TOGGLE_BUTTON(no), GTK_TOGGLE_BUTTON(yes));
 
     g_signal_connect(yes, "toggled",
                        G_CALLBACK(balsa_druid_page_defclient_toggle),
@@ -69,21 +69,21 @@ balsa_druid_page_defclient_init(BalsaDruidPageDefclient * defclient,
     gtk_widget_set_valign(widget, GTK_ALIGN_FILL);
     gtk_widget_set_margin_top(widget, 8);
     gtk_widget_set_margin_bottom(widget, 8);
-    gtk_container_add(GTK_CONTAINER(page), widget);
+    gtk_box_append(GTK_BOX(page), widget);
 
     widget = GTK_WIDGET(yes);
     gtk_widget_set_vexpand(widget, TRUE);
     gtk_widget_set_valign(widget, GTK_ALIGN_FILL);
     gtk_widget_set_margin_top(widget, 2);
     gtk_widget_set_margin_bottom(widget, 2);
-    gtk_container_add(GTK_CONTAINER(page), widget);
+    gtk_box_append(GTK_BOX(page), widget);
 
     widget = GTK_WIDGET(no);
     gtk_widget_set_vexpand(widget, TRUE);
     gtk_widget_set_valign(widget, GTK_ALIGN_FILL);
     gtk_widget_set_margin_top(widget, 2);
     gtk_widget_set_margin_bottom(widget, 2);
-    gtk_container_add(GTK_CONTAINER(page), widget);
+    gtk_box_append(GTK_BOX(page), widget);
 
     return;
 }
diff --git a/libinit_balsa/assistant_page_directory.c b/libinit_balsa/assistant_page_directory.c
index c7e148dda..aa5e00f60 100644
--- a/libinit_balsa/assistant_page_directory.c
+++ b/libinit_balsa/assistant_page_directory.c
@@ -180,7 +180,7 @@ verify_mailbox_entry(GtkWidget * entry, const gchar * name,
     if (!*verify)
         return;
 
-    text = gtk_entry_get_text(GTK_ENTRY(entry));
+    text = gtk_editable_get_text(GTK_EDITABLE(entry));
     error = NULL;
     unconditional_mailbox(text, name, mailbox, &error);
 
@@ -195,8 +195,10 @@ verify_mailbox_entry(GtkWidget * entry, const gchar * name,
                                    _("Problem verifying path ā€œ%sā€:\n%s"),
                                    text, error);
         g_free(error);
-        gtk_dialog_run(GTK_DIALOG(dlg));
-        gtk_widget_destroy(dlg);
+
+        g_signal_connect(dlg, "response", G_CALLBACK(gtk_window_destroy), NULL);
+        gtk_widget_show(dlg);
+
         *verify = FALSE;
     }
 }
@@ -264,7 +266,7 @@ balsa_druid_page_directory_init(BalsaDruidPageDirectory * dir,
                                    "These will be created if necessary."));
     label = GTK_LABEL(label_widget);
     gtk_label_set_justify(label, GTK_JUSTIFY_RIGHT);
-    gtk_label_set_line_wrap(label, TRUE);
+    gtk_label_set_wrap(label, TRUE);
     gtk_widget_set_hexpand(label_widget, TRUE);
     gtk_widget_set_vexpand(label_widget, TRUE);
 
@@ -303,10 +305,9 @@ balsa_druid_page_directory_init(BalsaDruidPageDirectory * dir,
 
     gtk_widget_set_vexpand(GTK_WIDGET(grid), TRUE);
     gtk_widget_set_valign(GTK_WIDGET(grid), GTK_ALIGN_FILL);
-    gtk_container_add(GTK_CONTAINER(page), GTK_WIDGET(grid));
-    gtk_widget_show_all(GTK_WIDGET(grid));
+    gtk_box_append(GTK_BOX(page), GTK_WIDGET(grid));
 
-    gtk_container_add(GTK_CONTAINER(page), verify_button(dir));
+    gtk_box_append(GTK_BOX(page), verify_button(dir));
 
     g_signal_connect(druid, "prepare",
                      G_CALLBACK(balsa_druid_page_directory_prepare),
@@ -360,22 +361,22 @@ balsa_druid_page_directory_prepare(GtkAssistant * druid,
     if (!dir->paths_locked) {
         buf = g_build_filename(balsa_app.local_mail_directory, "outbox",
                                NULL);
-        gtk_entry_set_text(GTK_ENTRY(dir->outbox), buf);
+        gtk_editable_set_text(GTK_EDITABLE(dir->outbox), buf);
         g_free(buf);
 
         buf = g_build_filename(balsa_app.local_mail_directory, "sentbox",
                                NULL);
-        gtk_entry_set_text(GTK_ENTRY(dir->sentbox), buf);
+        gtk_editable_set_text(GTK_EDITABLE(dir->sentbox), buf);
         g_free(buf);
 
         buf = g_build_filename(balsa_app.local_mail_directory, "draftbox",
                                NULL);
-        gtk_entry_set_text(GTK_ENTRY(dir->draftbox), buf);
+        gtk_editable_set_text(GTK_EDITABLE(dir->draftbox), buf);
         g_free(buf);
 
         buf = g_build_filename(balsa_app.local_mail_directory, "trash",
                                NULL);
-        gtk_entry_set_text(GTK_ENTRY(dir->trash), buf);
+        gtk_editable_set_text(GTK_EDITABLE(dir->trash), buf);
         g_free(buf);
     }
 
diff --git a/src/address-book-config.c b/src/address-book-config.c
index 685fee9f0..459525037 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -63,6 +63,9 @@ struct _AddressBookConfig {
     LibBalsaAddressBook *address_book;
     BalsaAddressBookCallback *callback;
     GtkWindow* parent;
+
+    GtkWidget *dialog;
+    int response_id;
 };
 
 static GtkWidget *create_dialog_from_type(AddressBookConfig * abc);
@@ -143,30 +146,48 @@ balsa_address_book_config_new_from_type(GType type,
     abc->window = create_dialog_from_type(abc);
     g_object_weak_ref(G_OBJECT(abc->window), (GWeakNotify) g_free, abc);
 
-    gtk_widget_show_all(GTK_WIDGET(abc->window));
+    gtk_widget_show(GTK_WIDGET(abc->window));
 }
 
-static void
-edit_book_response(GtkWidget * dialog, gint response,
-                   AddressBookConfig * abc)
+static void *
+edit_book_thread(gpointer user_data)
 {
-    switch (response) {
-    case GTK_RESPONSE_HELP:
-        help_button_cb(abc);
-        return;
+    AddressBookConfig *abc = user_data;
+
+    switch (abc->response) {
     case GTK_RESPONSE_APPLY:
         if (handle_close(abc))
             break;
         else
-            return;
+            return NULL;
     default:
         break;
     }
 
-    if (abc->address_book)
+    if (abc->address_book != NULL)
         g_object_set_data(G_OBJECT(abc->address_book), "balsa-abc", NULL);
 
-    gtk_widget_destroy(dialog);
+    gidle_add((GSourceFunc) gtk_window_destroy, abc->dialog);
+
+    return NULL;
+}
+
+static void
+edit_book_response(GtkWidget * dialog, gint response,
+                   AddressBookConfig * abc)
+{
+    GThread *thread;
+
+    if (response == GTK_RESPONSE_HELP) {
+        help_button_cb(abc);
+        return;
+    }
+
+    abc->dialog = dialog;
+    abc->response = response;
+
+    thread = g_thread_new("edit-book-thread", edit_book_thread, abc);
+    g_thread_unref(thread);
 }
 
 /* Radio buttons */
@@ -259,10 +280,14 @@ create_local_dialog(AddressBookConfig * abc, const gchar * type)
     if (ab) {
         LibBalsaAddressBookText *abt = (LibBalsaAddressBookText *) ab;
         const gchar *path = libbalsa_address_book_text_get_path(abt);
+        GFile *file;
         gchar *folder;
         gchar *utf8name;
 
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), path);
+        file = g_file_new_for_path(path);
+        gtk_file_chooser_set_file(GTK_FILE_CHOOSER(dialog), file, NULL);
+        g_object_unref(file);
+
         /* Name entry will be blank unless we set it. */
         folder = g_path_get_basename(path);
         utf8name = g_filename_to_utf8(folder, -1, NULL, NULL, NULL);
@@ -399,7 +424,7 @@ create_osmo_dialog(AddressBookConfig *abc)
 
     grid = libbalsa_create_grid();
     content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
-    gtk_container_add(GTK_CONTAINER(content_area), grid);
+    gtk_box_append(GTK_BOX(content_area), grid);
     label = libbalsa_create_grid_label(_("A_ddress Book Name:"), grid, 0);
     gtk_size_group_add_widget(size_group, label);
     abc->name_entry =
@@ -462,18 +487,20 @@ create_externq_dialog(AddressBookConfig * abc)
     add_radio_buttons(grid, 3, abc);
 
     if (ab_externq != NULL) {
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER
-                                      (abc->ab_specific.externq.load),
-                                      libbalsa_address_book_externq_get_load(ab_externq));
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER
-                                      (abc->ab_specific.externq.save),
-                                      libbalsa_address_book_externq_get_save(ab_externq));
+        GFile *file;
+
+        file = g_file_new_for_path(libbalsa_address_book_externq_get_load(ab_externq));
+        gtk_file_chooser_set_file(GTK_FILE_CHOOSER(GTK_FILE_CHOOSER(abc->ab_specific.externq.load)), file, 
NULL);
+        g_object_unref(file);
+
+        file = g_file_new_for_path(libbalsa_address_book_externq_get_save(ab_externq));
+        gtk_file_chooser_set_file(GTK_FILE_CHOOSER(GTK_FILE_CHOOSER(abc->ab_specific.externq.save)), file, 
NULL);
+        g_object_unref(file);
     }
 
     dialog = create_generic_dialog(abc, "Extern");
-    gtk_container_add(GTK_CONTAINER
-                      (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                      grid);
+    gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), grid);
+
     return dialog;
 }
 
@@ -520,7 +547,7 @@ create_ldap_dialog(AddressBookConfig * abc)
     abc->ab_specific.ldap.passwd = 
        libbalsa_create_grid_entry(grid, NULL, NULL, 4, 
                     ab ? libbalsa_address_book_ldap_get_passwd(ab) : "", label);
-    gtk_entry_set_visibility(GTK_ENTRY(abc->ab_specific.ldap.passwd), FALSE);
+    gtk_editable_set_visibility(GTK_EDITABLE(abc->ab_specific.ldap.passwd), FALSE);
 
     label = libbalsa_create_grid_label(_("_User Address Book DN"), grid, 5);
     abc->ab_specific.ldap.book_dn = 
@@ -540,7 +567,7 @@ create_ldap_dialog(AddressBookConfig * abc)
     g_free(host);
     
     dialog = create_generic_dialog(abc, "LDAP");
-    gtk_container_add(GTK_CONTAINER
+    gtk_box_append(GTK_BOX
                       (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
                       grid);
     return dialog;
@@ -573,9 +600,7 @@ create_gpe_dialog(AddressBookConfig * abc)
     add_radio_buttons(grid, 1, abc);
 
     dialog = create_generic_dialog(abc, "GPE");
-    gtk_container_add(GTK_CONTAINER
-                      (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                      grid);
+    gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), grid);
     return dialog;
 }
 #endif
@@ -589,22 +614,29 @@ create_rubrica_dialog(AddressBookConfig * abc)
 #endif
 
 static void
-help_button_cb(AddressBookConfig * abc)
+help_button_finish(GObject      *source_object,
+                   GAsyncResult *result,
+                   gpointer      user_data)
 {
-    GError *err = NULL;
-
-    gtk_show_uri_on_window(GTK_WINDOW(abc->window),
-                           "help:balsa/preferences-address-books",
-                           gtk_get_current_event_time(), &err);
-
-    if (err) {
-        libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             _("Error displaying help: %s\n"),
-                             err->message);
-        g_error_free(err);
+    GtkWindow *parent = user_data;
+    GError *error = NULL;
+
+    if (!gtk_show_uri_full_finish(parent, result, &error)) {
+       libbalsa_information(LIBBALSA_INFORMATION_WARNING,
+                             _("Error displaying help: %s"),
+                             error->message);
+        g_error_free(error);
     }
 }
 
+static void
+help_button_cb(AddressBookConfig * abc)
+{
+    gtk_show_uri_full(GTK_WINDOW(abc->window),
+                      "help:balsa/preferences-address-books",
+                      GDK_CURRENT_TIME, NULL, help_button_finish, abc->window);
+}
+
 
 enum {
     ADDRESS_BOOK_CONFIG_PATH_FILE,
@@ -623,7 +655,18 @@ enum {
 static gboolean
 chooser_bad_path(GtkFileChooser * chooser, GtkWindow * window, gint type)
 {
-    return bad_path(gtk_file_chooser_get_filename(chooser), window, type);
+    GFile *file;
+    char *path;
+    gboolean bad;
+
+    file = gtk_file_chooser_get_file(chooser);
+    path = g_file_get_path(file);
+    g_object_unref(file);
+
+    bad = bad_path(path, window, type);
+    g_free(path);
+
+    return bad;
 }
 
 static gboolean
@@ -691,42 +734,61 @@ static gboolean
 create_book(AddressBookConfig * abc)
 {
     LibBalsaAddressBook *address_book = NULL;
-    const gchar *name = gtk_entry_get_text(GTK_ENTRY(abc->name_entry));
+    const gchar *name = gtk_editable_get_text(GTK_EDITABLE(abc->name_entry));
 
     if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD) {
-        gchar *path =
-            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
-        if (path != NULL)
+        GFile *file;
+        gchar *path;
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->window));
+        path = g_file_get_path(file);
+        g_object_unref(file);
+
+        if (path != NULL) {
             address_book = libbalsa_address_book_vcard_new(name, path);
-        g_free(path);
+            g_free(path);
+        }
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ) {
-#define GET_FILENAME(chooser) \
-  gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser))
-        gchar *load = GET_FILENAME(abc->ab_specific.externq.load);
-        gchar *save = GET_FILENAME(abc->ab_specific.externq.save);
+        GFile *file;
+        gchar *load;
+        gchar *save;
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->ab_specific.externq.load));
+        load = g_file_get_path(file);
+        g_object_unref(file);
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->ab_specific.externq.save));
+        save = g_file_get_path(file);
+        g_object_unref(file);
+
         if (load != NULL && save != NULL)
-            address_book =
-                libbalsa_address_book_externq_new(name, load, save);
+            address_book = libbalsa_address_book_externq_new(name, load, save);
         g_free(load);
         g_free(save);
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
-        gchar *path =
-            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
-        if (path != NULL)
+        GFile *file;
+        gchar *path;
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->window));
+        path = g_file_get_path(file);
+        g_object_unref(file);
+
+        if (path != NULL) {
             address_book = libbalsa_address_book_ldif_new(name, path);
-        g_free(path);
+            g_free(path);
+        }
 #ifdef ENABLE_LDAP
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDAP) {
         const gchar *host =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.host));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.host));
         const gchar *base_dn =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.base_dn));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.base_dn));
         const gchar *bind_dn =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.bind_dn));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.bind_dn));
         const gchar *passwd =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.passwd));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.passwd));
         const gchar *book_dn =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.book_dn));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.book_dn));
         gboolean enable_tls =
             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                          (abc->ab_specific.ldap.enable_tls));
@@ -742,11 +804,17 @@ create_book(AddressBookConfig * abc)
 #endif
 #ifdef HAVE_RUBRICA
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA) {
-        gchar *path =
-            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
-        if (path != NULL)
+        GFile *file;
+        gchar *path;
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->window));
+        path = g_file_get_path(file);
+        g_object_unref(file);
+
+        if (path != NULL) {
             address_book = libbalsa_address_book_rubrica_new(name, path);
-        g_free(path);
+            g_free(path);
+        }
 #endif
 #ifdef HAVE_OSMO
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
@@ -772,7 +840,7 @@ modify_book(AddressBookConfig * abc)
     LibBalsaAddressBook *address_book = abc->address_book;
 
     libbalsa_address_book_set_name(address_book,
-        gtk_entry_get_text(GTK_ENTRY(abc->name_entry)));
+        gtk_editable_get_text(GTK_EDITABLE(abc->name_entry)));
 
     if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD
         || abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF
@@ -780,21 +848,31 @@ modify_book(AddressBookConfig * abc)
         || abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA
 #endif /* HAVE_RUBRICA */
         ) {
-        LibBalsaAddressBookText *ab_text =
-            LIBBALSA_ADDRESS_BOOK_TEXT(address_book);
-        gchar *path =
-            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
+        LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(address_book);
+        GFile *file;
+        gchar *path;
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->window));
+        path = g_file_get_path(file);
+        g_object_unref(file);
 
-        if (path != NULL)
+        if (path != NULL) {
             libbalsa_address_book_text_set_path(ab_text, path);
+            g_free(path);
+        }
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERNQ) {
         LibBalsaAddressBookExternq *ab_externq;
-        gchar *load =
-            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                           (abc->ab_specific.externq.load));
-        gchar *save =
-            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                           (abc->ab_specific.externq.save));
+        GFile *file;
+        gchar *load;
+        gchar *save;
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->ab_specific.externq.load));
+        load = g_file_get_path(file);
+        g_object_unref(file);
+
+        file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(abc->ab_specific.externq.save));
+        save = g_file_get_path(file);
+        g_object_unref(file);
 
         ab_externq = LIBBALSA_ADDRESS_BOOK_EXTERNQ(address_book);
         if (load) {
@@ -809,15 +887,15 @@ modify_book(AddressBookConfig * abc)
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDAP) {
         LibBalsaAddressBookLdap *ldap;
         const gchar *host =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.host));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.host));
         const gchar *base_dn =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.base_dn));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.base_dn));
         const gchar *bind_dn =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.bind_dn));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.bind_dn));
         const gchar *passwd =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.passwd));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.passwd));
         const gchar *book_dn =
-            gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.book_dn));
+            gtk_editable_get_text(GTK_EDITABLE(abc->ab_specific.ldap.book_dn));
         gboolean enable_tls =
             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                          (abc->ab_specific.ldap.enable_tls));
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index 16389be8d..8ca067f4f 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -159,8 +159,13 @@ balsa_mime_widget_new_message(BalsaMessage * bm,
 
         gtk_widget_set_valign(header_widget, GTK_ALIGN_START);
         gtk_widget_set_vexpand(header_widget, FALSE);
-        g_object_set(header_widget, "margin", 5, NULL);
-       gtk_container_add(GTK_CONTAINER(widget), header_widget);
+
+        gtk_widget_set_margin_top(header_widget, 5);
+        gtk_widget_set_margin_bottom(header_widget, 5);
+        gtk_widget_set_margin_start(header_widget, 5);
+        gtk_widget_set_margin_end(header_widget, 5);
+
+       gtk_frame_set_child(GTK_FRAME(widget), header_widget);
        bmw_message_set_headers(bm, mw, mime_body, TRUE);
     }
 
diff --git a/src/filter-edit-callbacks.c b/src/filter-edit-callbacks.c
index 285d5776d..6ec4c1782 100644
--- a/src/filter-edit-callbacks.c
+++ b/src/filter-edit-callbacks.c
@@ -1003,7 +1003,12 @@ build_type_notebook()
     gtk_grid_set_column_spacing(GTK_GRID(grid), 5);
 
     box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
-    g_object_set(box, "margin", 5, NULL);
+
+    gtk_widget_set_margin_top(box, 5);
+    gtk_widget_set_margin_bottom(box, 5);
+    gtk_widget_set_margin_start(box, 5);
+    gtk_widget_set_margin_end(box, 5);
+
     gtk_widget_set_vexpand(grid, TRUE);
     gtk_widget_set_valign(grid, GTK_ALIGN_FILL);
     gtk_box_append(GTK_BOX(box), grid);
@@ -1030,7 +1035,10 @@ build_type_notebook()
 
     /* The regex page of the type notebook */
     box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
-    g_object_set(box, "margin", 5, NULL);
+    gtk_widget_set_margin_top(box, 5);
+    gtk_widget_set_margin_bottom(box, 5);
+    gtk_widget_set_margin_start(box, 5);
+    gtk_widget_set_margin_end(box, 5);
 
     gtk_notebook_append_page(GTK_NOTEBOOK(fe_type_notebook), box, NULL);
 
@@ -1109,7 +1117,11 @@ build_type_notebook()
     page = gtk_grid_new();
     gtk_grid_set_row_spacing(GTK_GRID(page), 5);
     gtk_grid_set_column_spacing(GTK_GRID(page), 5);
-    g_object_set(page, "margin", 5, NULL);
+
+    gtk_widget_set_margin_top(page, 5);
+    gtk_widget_set_margin_bottom(page, 5);
+    gtk_widget_set_margin_start(page, 5);
+    gtk_widget_set_margin_end(page, 5);
 
     gtk_notebook_append_page(GTK_NOTEBOOK(fe_type_notebook), page, NULL);
 
@@ -1141,7 +1153,11 @@ build_type_notebook()
     gtk_widget_set_vexpand(page, TRUE);
     gtk_grid_set_row_spacing(GTK_GRID(page), 5);
     gtk_grid_set_column_spacing(GTK_GRID(page), 5);
-    g_object_set(page, "margin", 5, NULL);
+
+    gtk_widget_set_margin_top(page, 5);
+    gtk_widget_set_margin_bottom(page, 5);
+    gtk_widget_set_margin_start(page, 5);
+    gtk_widget_set_margin_end(page, 5);
 
     gtk_notebook_append_page(GTK_NOTEBOOK(fe_type_notebook), page, NULL);
     fe_type_flag_label =
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 71df631b6..d5fc3ebce 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -251,7 +251,11 @@ build_match_page()
     page = gtk_grid_new();
     gtk_grid_set_row_spacing(GTK_GRID(page), 5);
     gtk_grid_set_column_spacing(GTK_GRID(page), 5);
-    g_object_set(page, "margin", 5, NULL);
+
+    gtk_widget_set_margin_top(page, 5);
+    gtk_widget_set_margin_bottom(page, 5);
+    gtk_widget_set_margin_start(page, 5);
+    gtk_widget_set_margin_end(page, 5);
 
     /* The name entry */
 
@@ -383,7 +387,11 @@ build_action_page(GtkWindow * window)
     frame = gtk_frame_new(_("Notification:"));
     gtk_frame_set_label_align(GTK_FRAME(frame), 0.0);
     gtk_box_append(GTK_BOX(page), frame);
-    g_object_set(frame, "margin", 3, NULL);
+
+    gtk_widget_set_margin_top(frame, 3);
+    gtk_widget_set_margin_bottom(frame, 3);
+    gtk_widget_set_margin_start(frame, 3);
+    gtk_widget_set_margin_end(frame, 3);
 
     grid = gtk_grid_new();
     gtk_grid_set_row_spacing(GTK_GRID(grid), 5);
@@ -437,7 +445,12 @@ build_action_page(GtkWindow * window)
 
     box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
     gtk_box_set_homogeneous(GTK_BOX(box), TRUE);
-    g_object_set(frame, "margin", 3, NULL);
+
+    gtk_widget_set_margin_top(frame, 3);
+    gtk_widget_set_margin_bottom(frame, 3);
+    gtk_widget_set_margin_start(frame, 3);
+    gtk_widget_set_margin_end(frame, 3);
+
     gtk_frame_set_child(GTK_FRAME(frame), box);
 
     fe_action_option_menu =
diff --git a/src/folder-conf.c b/src/folder-conf.c
index 285d05386..93beabcf0 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -445,6 +445,7 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     GtkWidget *box;
     GtkWidget *button;
     GtkWidget *content_area;
+    GtkWidget *notebook;
 
     /* Allow only one dialog per mailbox node, and one with mn == NULL
      * for creating a new folder. */
@@ -492,10 +493,12 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     }
 
     folder_data->server_cfg = libbalsa_server_cfg_new(folder_data->server, (mn != NULL) ? 
balsa_mailbox_node_get_name(mn) : NULL);
-    content_area = gtk_dialog_get_content_area(GTK_DIALOG(folder_data->common_data.dialog));
-    gtk_container_add(GTK_CONTAINER(content_area), GTK_WIDGET(folder_data->server_cfg));
     g_signal_connect(folder_data->server_cfg, "changed", G_CALLBACK(validate_folder), folder_data);
 
+    content_area = gtk_dialog_get_content_area(GTK_DIALOG(folder_data->common_data.dialog));
+    notebook = libbalsa_server_cfg_get_notebook(folder_data->server_cfg);
+    gtk_box_append(GTK_BOX(content_area), notebook);
+
     /* additional basic settings - subscription management */
     box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
 
diff --git a/src/mailbox-conf.c b/src/mailbox-conf.c
index c0cd54035..7350a9fc2 100644
--- a/src/mailbox-conf.c
+++ b/src/mailbox-conf.c
@@ -781,6 +781,7 @@ static GtkWidget *
 create_pop_mailbox_dialog(MailboxConfWindow *mcw)
 {
     GtkWidget *content_area;
+    GtkWidget *notebook;
        LibBalsaMailbox *mailbox = mcw->mailbox;
     LibBalsaMailboxPOP3 *mailbox_pop3 = LIBBALSA_MAILBOX_POP3(mailbox);
 
@@ -798,9 +799,11 @@ create_pop_mailbox_dialog(MailboxConfWindow *mcw)
     mcw->mb_data.pop3.server_cfg =
         libbalsa_server_cfg_new(LIBBALSA_MAILBOX_REMOTE_GET_SERVER(mailbox),
                                 libbalsa_mailbox_get_name(mailbox));
-    gtk_container_add(GTK_CONTAINER(content_area), GTK_WIDGET(mcw->mb_data.pop3.server_cfg));
     g_signal_connect(mcw->mb_data.pop3.server_cfg, "changed", G_CALLBACK(check_for_blank_fields), mcw);
 
+    notebook = libbalsa_server_cfg_get_notebook(mcw->mb_data.pop3.server_cfg);
+    gtk_box_append(GTK_BOX(content_area), notebook);
+
     /* toggle for deletion from server */
     mcw->mb_data.pop3.delete_from_server = libbalsa_server_cfg_add_check(mcw->mb_data.pop3.server_cfg, TRUE,
        _("_Delete messages from server after download"), 
libbalsa_mailbox_pop3_get_delete_from_server(mailbox_pop3), NULL, NULL);
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 47107072c..59804f779 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -1228,7 +1228,11 @@ pm_grid_new(void)
     gtk_grid_set_column_spacing((GtkGrid *) grid, COL_SPACING);
     gtk_grid_set_row_spacing((GtkGrid *) grid, ROW_SPACING);
     pm_grid_set_next_row(grid, 0);
-    g_object_set(grid, "margin", BORDER_WIDTH, NULL);
+
+    gtk_widget_set_margin_top(grid, BORDER_WIDTH);
+    gtk_widget_set_margin_bottom(grid, BORDER_WIDTH);
+    gtk_widget_set_margin_start(grid, BORDER_WIDTH);
+    gtk_widget_set_margin_end(grid, BORDER_WIDTH);
 
     return grid;
 }
@@ -3332,8 +3336,13 @@ open_preferences_manager(GtkWidget * widget, gpointer data)
                                GTK_TYPE_WIDGET  /* PM_CHILD_COL    */
             );
     pui->view = view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
-    g_object_set(view, "margin", BORDER_WIDTH, NULL);
-    gtk_container_add(GTK_CONTAINER(hbox), view);
+
+    gtk_widget_set_margin_top(view, BORDER_WIDTH);
+    gtk_widget_set_margin_bottom(view, BORDER_WIDTH);
+    gtk_widget_set_margin_start(view, BORDER_WIDTH);
+    gtk_widget_set_margin_end(view, BORDER_WIDTH);
+
+    gtk_box_append(GTK_BOX(hbox), view);
     gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
 
     renderer = gtk_cell_renderer_text_new();
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index a01d4fc67..564ceeded 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -2249,7 +2249,12 @@ create_email_or_string_entry(BalsaSendmsg * bsmsg,
     arr[0] = gtk_label_new_with_mnemonic(label);
     gtk_label_set_mnemonic_widget(GTK_LABEL(arr[0]), mnemonic_widget);
     gtk_widget_set_halign(arr[0], GTK_ALIGN_START);
-    g_object_set(arr[0], "margin", GNOME_PAD_SMALL, NULL);
+
+    gtk_widget_set_margin_top(arr[0], GNOME_PAD_SMALL);
+    gtk_widget_set_margin_bottom(arr[0], GNOME_PAD_SMALL);
+    gtk_widget_set_margin_start(arr[0], GNOME_PAD_SMALL);
+    gtk_widget_set_margin_end(arr[0], GNOME_PAD_SMALL);
+
     gtk_grid_attach(GTK_GRID(grid), arr[0], 0, y_pos, 1, 1);
 
     if (!balsa_app.use_system_fonts) {
@@ -2587,7 +2592,12 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     /* Attachment list */
     label = gtk_label_new_with_mnemonic(_("_Attachments:"));
     gtk_widget_set_halign(label, GTK_ALIGN_START);
-    g_object_set(label, "margin", GNOME_PAD_SMALL, NULL);
+
+    gtk_widget_set_margin_top(label, GNOME_PAD_SMALL);
+    gtk_widget_set_margin_bottom(label, GNOME_PAD_SMALL);
+    gtk_widget_set_margin_start(label, GNOME_PAD_SMALL);
+    gtk_widget_set_margin_end(label, GNOME_PAD_SMALL);
+
     gtk_grid_attach(GTK_GRID(grid), label, 0, 0, 1, 1);
 
     sw = gtk_scrolled_window_new(NULL, NULL);


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