summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/window.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index 6a3b7ce..e7b7bac 100644
--- a/src/window.c
+++ b/src/window.c
@@ -46,6 +46,15 @@ configure_event_cb(GtkWindow G_GNUC_UNUSED *window, GdkEventConfigure *event,
}
static void
+close_confirm_warn_check_button_toggled_cb(GtkToggleButton *toggle_button,
+ MqWindow *window)
+{
+ mq_config_set_boolean(window->config, "tabs.warn-on-close",
+ gtk_toggle_button_get_active(toggle_button));
+ mq_config_save(window->config);
+}
+
+static void
close_confirm_response_cb(GtkWidget *dialog, gint response_id, MqWindow *window)
{
gtk_widget_destroy(dialog);
@@ -61,6 +70,7 @@ delete_event_cb(GtkWindow *widget, GdkEvent G_GNUC_UNUSED *event,
guint num_tabs;
gchar *message;
GtkWidget *message_label;
+ GtkWidget *check_button;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *dialog;
@@ -81,9 +91,21 @@ delete_event_cb(GtkWindow *widget, GdkEvent G_GNUC_UNUSED *event,
message_label = gtk_label_new(message);
g_free(message);
+ /* Check button */
+ check_button = gtk_check_button_new_with_mnemonic(
+ "_Warn When Closing Multiple Tabs or Windows");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button),
+ mq_config_get_boolean(window->config, "tabs.warn-on-close"));
+ /* Connect signal after setting initial toggle status, to avoid a
+ * spurious signal. */
+ g_signal_connect(check_button, "toggled",
+ G_CALLBACK(close_confirm_warn_check_button_toggled_cb),
+ window);
+
/* Right vertical box (message and check button) */
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start(GTK_BOX(vbox), message_label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0);
/* Horizontal box (icon and right vertical box) */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);