add confirm dialog to clearing ignores

This commit is contained in:
TingPing 2013-03-22 18:22:56 -03:00
parent d37ef26104
commit b282c6f2f3
1 changed files with 18 additions and 2 deletions

View File

@ -273,13 +273,15 @@ ignore_store_new (int cancel, char *mask, gpointer data)
} }
static void static void
ignore_clear_entry_clicked (GtkWidget * wid, gpointer unused) ignore_clear_cb (GtkDialog *dialog, gint response)
{ {
GtkListStore *store = GTK_LIST_STORE (get_store ()); GtkListStore *store = GTK_LIST_STORE (get_store ());
GtkTreeIter iter; GtkTreeIter iter;
char *mask; 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 */ /* remove from ignore_list */
do 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 static void
ignore_new_entry_clicked (GtkWidget * wid, struct session *sess) ignore_new_entry_clicked (GtkWidget * wid, struct session *sess)
{ {