* src/compose.[ch]
authorColin Leroy <colin@colino.net>
Tue, 5 Nov 2002 15:55:32 +0000 (15:55 +0000)
committerColin Leroy <colin@colino.net>
Tue, 5 Nov 2002 15:55:32 +0000 (15:55 +0000)
                add compose_draft()
        * src/crash.c
                add SIGTERM handler
        * src/main.[ch]
                add clean_quit() for the SIGTERM handler

ChangeLog.claws
configure.in
src/compose.c
src/compose.h
src/crash.c
src/main.c
src/main.h

index b485e58484af204667b14563971adb4d57431c2c..7b7d75443fe01d3c3e7b09b66e5ca5f2c623d71b 100644 (file)
@@ -1,3 +1,12 @@
+2002-11-05 [colin]     0.8.5claws74
+
+       * src/compose.[ch] 
+               add compose_draft()
+       * src/crash.c
+               add SIGTERM handler
+       * src/main.[ch]
+               add clean_quit() for the SIGTERM handler
+
 2002-11-05 [paul]      0.8.5claws73
        
        * po/es.po
index 3972f38ed83efe5a103f28b42e7d1c5299ef1935..2fc71d2c2f2ea7a89d5f573fdfbe6e3f43aa099e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws73
+EXTRA_VERSION=claws74
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 6430d8f43499daa44d748316fdda92239fd2ad01..58c1bc9e524b12dfcd537a886f1148e5672f2f7f 100644 (file)
@@ -6269,6 +6269,11 @@ static void compose_send_later_cb(gpointer data, guint action,
        if (!val) gtk_widget_destroy(compose->window);
 }
 
+void compose_draft (gpointer data) 
+{
+       compose_draft_cb(data, 0, NULL);        
+}
+
 static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
 {
        Compose *compose = (Compose *)data;
index b1c289823bffe0b66a767dc58b02865ec326b370..57dc9ec9615efb8ed08cb30df27e57b09b0dae82 100644 (file)
@@ -271,5 +271,6 @@ void compose_reflect_prefs_all                      (void);
 void compose_reflect_prefs_pixmap_theme        (void);
 
 void compose_destroy_all                (void);
+void compose_draft                     (gpointer data);
 
 #endif /* __COMPOSE_H__ */
index 8efa1b5ab50ec8596d6834673298400762f8f3f0..56181c8488ffa25aea3031a716dd1de2705188b0 100644 (file)
@@ -41,6 +41,9 @@
 #      include <gnu/libc-version.h>
 #endif
 
+#ifdef SIGTERM
+#include "main.h"
+#endif
 #include "intl.h"
 #include "crash.h"
 #include "utils.h"
@@ -115,6 +118,11 @@ void crash_install_handlers(void)
        sigaddset(&mask, SIGABRT);
 #endif
 
+#ifdef SIGTERM
+       signal(SIGTERM, crash_handler);
+       sigaddset(&mask, SIGTERM);
+#endif
+
        sigprocmask(SIG_UNBLOCK, &mask, 0);
 #endif /* CRASH_DIALOG */      
 }
@@ -503,6 +511,12 @@ static void crash_handler(int sig)
 
        crashed_++;
 
+#ifdef SIGTERM
+       if(sig == SIGTERM) {
+               clean_quit();
+       }
+#endif
+
        /*
         * gnome ungrabs focus, and flushes gdk. mmmh, good idea.
         */
index 14f7c573b2c27005a8deb9f87e6ae82ae9ac53da..610f84692efe91a39559cc40d44b4409aa260cc7 100644 (file)
@@ -158,6 +158,7 @@ _("File `%s' already exists.\n"
        } \
 }
 
+static MainWindow *static_mainwindow;
 int main(int argc, char *argv[])
 {
        gchar *userrc;
@@ -370,6 +371,7 @@ int main(int argc, char *argv[])
        if (cmd.online_mode == ONLINE_MODE_ONLINE)
                main_window_toggle_work_offline(mainwin, FALSE);
        
+       static_mainwindow = mainwin;
        gtk_main();
 
        addressbook_destroy();
@@ -505,6 +507,28 @@ static void initial_processing(FolderItem *item, gpointer data)
        main_window_cursor_normal(mainwin);
 }
 
+void clean_quit(void)  
+{
+       GList * compose_list = compose_get_compose_list();
+       GList * elem = NULL;
+       if(compose_list) {
+               for (elem = compose_list; elem != NULL && elem->data != NULL; elem = elem->next) {
+                       Compose *c = (Compose*)elem->data;
+                       compose_draft(c);
+               }
+       }
+       if (prefs_common.warn_queued_on_exit)
+       {       /* disable the popup */ 
+               prefs_common.warn_queued_on_exit = FALSE;       
+               app_will_exit(NULL, static_mainwindow);
+               prefs_common.warn_queued_on_exit = TRUE;
+               prefs_common_save_config();
+       } else {
+               app_will_exit(NULL, static_mainwindow);
+       }
+       exit(0);
+}
+
 void app_will_exit(GtkWidget *widget, gpointer data)
 {
        MainWindow *mainwin = data;
index 0fb8c56f07294e563fe25a610c0e74b7db329f21..3e07b17e3881baa35689721b57396df153e3b55f 100644 (file)
@@ -28,5 +28,6 @@ extern gchar *startup_dir;
 extern gboolean debug_mode;
 
 void app_will_exit     (GtkWidget *widget, gpointer data);
+void clean_quit                (void);
 
 #endif /* __MAIN_H__ */