[balsa/gtk4] Various: Clean up quit-on-close



commit 0a12d84209ebdd0d8f12dff33088e39eeee45c4b
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Oct 10 11:51:33 2020 -0400

    Various: Clean up quit-on-close
    
    BalsaSendmsg:quit_on_close is always FALSE, so we can drop it, and
    libbalsa_wait_for_sending_thread() with it.
    
    This code has likely been dead at least since Balsa was ported to GtkApplication;
    the exact commit has not been identified.
    
    libbalsa/libbalsa.h
    libbalsa/send.c
    src/main.c
    src/sendmsg-window.c
    src/sendmsg-window.h

 libbalsa/libbalsa.h  |  1 -
 libbalsa/send.c      | 28 ----------------------------
 src/main.c           |  1 -
 src/sendmsg-window.c |  8 --------
 src/sendmsg-window.h |  4 ----
 5 files changed, 42 deletions(-)
---
diff --git a/libbalsa/libbalsa.h b/libbalsa/libbalsa.h
index 0922c0bd5..897986c5a 100644
--- a/libbalsa/libbalsa.h
+++ b/libbalsa/libbalsa.h
@@ -119,7 +119,6 @@ void libbalsa_show_message_source(GtkApplication * application,
 gchar *libbalsa_guess_email_address(void);
 gchar *libbalsa_guess_mail_spool(void);
 gboolean libbalsa_is_sending_mail(void);
-void libbalsa_wait_for_sending_thread(gint max_seconds);
 
 gchar *libbalsa_guess_imap_server(void);
 gchar *libbalsa_guess_ldap_server(void);
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 834193034..c456f51dc 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -143,34 +143,6 @@ libbalsa_is_sending_mail(void)
 }
 
 
-/* libbalsa_wait_for_sending_thread:
-   wait for the sending thread but not longer than max_time seconds.
-   -1 means wait indefinetely (almost).
- */
-void
-libbalsa_wait_for_sending_thread(gint max_time)
-{
-    gint sleep_time = 0;
-#define DOZE_LENGTH (20 * 1000)
-    static const struct timespec req = {
-        0, DOZE_LENGTH * 1000
-    };   /*nanoseconds*/
-
-    if (max_time < 0) {
-        max_time = G_MAXINT;
-    } else {
-        max_time *= 1000000;  /* convert to microseconds */
-    }
-    while ((g_atomic_int_get(&sending_threads) > 0) && (sleep_time < max_time)) {
-        while (gtk_events_pending()) {
-            gtk_main_iteration_do(FALSE);
-        }
-        nanosleep(&req, NULL);
-        sleep_time += DOZE_LENGTH;
-    }
-}
-
-
 static MessageQueueItem *
 msg_queue_item_new(SendMessageInfo *smi)
 {
diff --git a/src/main.c b/src/main.c
index a745444a7..261ca9beb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -453,7 +453,6 @@ balsa_check_open_compose_window(void)
         gchar **attach;
 
         snd = sendmsg_window_compose();
-        snd->quit_on_close = FALSE;
 
         if (opt_compose_email != NULL) {
             if (g_ascii_strncasecmp(opt_compose_email, "mailto:";, 7) == 0)
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 7a5b2e99f..cbe8caf62 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -550,8 +550,6 @@ destroy_event_cb(GtkWidget * widget, gpointer data)
 static void
 balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
 {
-    gboolean quit_on_close;
-
     g_assert(bsmsg != NULL);
 
     if (balsa_app.main_window) {
@@ -590,7 +588,6 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
 
     g_debug("balsa_sendmsg_destroy_handler: Freeing bsmsg");
     gtk_widget_destroy(bsmsg->window);
-    quit_on_close = bsmsg->quit_on_close;
     g_free(bsmsg->fcc_url);
     g_free(bsmsg->in_reply_to);
     g_list_free_full(bsmsg->references, g_free);
@@ -620,10 +617,6 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
 
     g_free(bsmsg);
 
-    if (quit_on_close) {
-        libbalsa_wait_for_sending_thread(-1);
-       gtk_main_quit();
-    }
     g_debug("balsa_sendmsg_destroy(): Stop.");
 }
 
@@ -6914,7 +6907,6 @@ sendmsg_window_new()
     bsmsg->ident = g_object_ref(balsa_app.current_ident);
 
     bsmsg->update_config = FALSE;
-    bsmsg->quit_on_close = FALSE;
     bsmsg->state = SENDMSG_STATE_CLEAN;
 
     bsmsg->window = window =
diff --git a/src/sendmsg-window.h b/src/sendmsg-window.h
index 928d4ceb6..9092ce5ee 100644
--- a/src/sendmsg-window.h
+++ b/src/sendmsg-window.h
@@ -92,8 +92,6 @@ G_BEGIN_DECLS
        gboolean send_mp_alt;   /* send multipart/alternative (plain and html) */ 
        gboolean req_mdn;        /* send a MDN */
        gboolean req_dsn;        /* send a delivery status notification */
-       gboolean quit_on_close; /* quit balsa after the compose window */
-                               /* is closed.                          */
        guint gpg_mode;
        gboolean attach_pubkey;
 
@@ -140,8 +138,6 @@ G_BEGIN_DECLS
     BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
     void sendmsg_window_add_action_entries(GActionMap * action_map);
 
-#define SENDMSG_WINDOW_QUIT_ON_CLOSE(bsmsg) ((bsmsg)->quit_on_close=TRUE)
-
 G_END_DECLS
 
 #endif                         /* __BALSA_SENDMSG_H__ */


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