Added dialog_response member to PrefsWindow.
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 27 Aug 2015 10:05:07 +0000 (12:05 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Fri, 28 Aug 2015 09:38:05 +0000 (11:38 +0200)
src/gtk/prefswindow.c
src/gtk/prefswindow.h

index 16ef9e3..dd910fd 100644 (file)
@@ -120,6 +120,8 @@ static void apply_button_clicked(GtkButton *button, gpointer user_data)
 {
        PrefsWindow *prefswindow = (PrefsWindow *) user_data;
 
+       prefswindow->dialog_response = PREFSWINDOW_RESPONSE_APPLY;
+
        save_all_pages(prefswindow->prefs_pages);
 #ifdef GENERIC_UMPC
        prefs_show_sections(prefswindow);
@@ -146,6 +148,8 @@ static void ok_button_clicked(GtkButton *button, gpointer user_data)
 {
        PrefsWindow *prefswindow = (PrefsWindow *) user_data;
 
+       prefswindow->dialog_response = PREFSWINDOW_RESPONSE_OK;
+
        if (query_can_close_all_pages(prefswindow->prefs_pages)) {
                save_all_pages(prefswindow->prefs_pages);
                close_prefs_window(prefswindow);
@@ -411,6 +415,7 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
        prefswindow->save_height = save_height;
        prefswindow->open_cb = open_cb;
        prefswindow->close_cb = close_cb;
+       prefswindow->dialog_response = PREFSWINDOW_RESPONSE_CANCEL;
 
        prefswindow->window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefswindow");
        gtk_window_set_title(GTK_WINDOW(prefswindow->window), title);
index 20db56d..c7e92a6 100644 (file)
@@ -77,6 +77,7 @@ struct _PrefsWindow
        gint *save_height;
        PrefsCloseCallbackFunc open_cb;
        PrefsCloseCallbackFunc close_cb;
+       gint dialog_response; /* Useful for close_cb callbacks */
 
        GtkWidget *empty_page;
 
@@ -85,6 +86,13 @@ struct _PrefsWindow
        GDestroyNotify func;
 };
 
+enum
+{
+       PREFSWINDOW_RESPONSE_CANCEL,
+       PREFSWINDOW_RESPONSE_OK,
+       PREFSWINDOW_RESPONSE_APPLY
+};
+
 struct _PrefsTreeNode
 {
        PrefsPage *page;