From b282c6f2f3a608b583a3ea345bf6489ee95fd6c0 Mon Sep 17 00:00:00 2001 From: TingPing Date: Fri, 22 Mar 2013 18:22:56 -0300 Subject: [PATCH] add confirm dialog to clearing ignores --- src/fe-gtk/ignoregui.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/fe-gtk/ignoregui.c b/src/fe-gtk/ignoregui.c index 6e8b4ff3..34a06837 100644 --- a/src/fe-gtk/ignoregui.c +++ b/src/fe-gtk/ignoregui.c @@ -273,13 +273,15 @@ ignore_store_new (int cancel, char *mask, gpointer data) } static void -ignore_clear_entry_clicked (GtkWidget * wid, gpointer unused) +ignore_clear_cb (GtkDialog *dialog, gint response) { GtkListStore *store = GTK_LIST_STORE (get_store ()); GtkTreeIter iter; char *mask; - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) + gtk_widget_destroy (GTK_WIDGET (dialog)); + + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter) && response == GTK_RESPONSE_OK) { /* remove from ignore_list */ do @@ -296,6 +298,20 @@ ignore_clear_entry_clicked (GtkWidget * wid, gpointer unused) } } +static void +ignore_clear_entry_clicked (GtkWidget * wid) +{ + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, + _("Are you sure you want to remove all ignores?")); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (ignore_clear_cb), NULL); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); + gtk_widget_show (dialog); +} + static void ignore_new_entry_clicked (GtkWidget * wid, struct session *sess) {