]> git.saurik.com Git - wxWidgets.git/commitdiff
replaced the button suppressing the assert dialog with a checkbox (a slightly modifie...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 3 Dec 2006 16:15:01 +0000 (16:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 3 Dec 2006 16:15:01 +0000 (16:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/assertdlg_gtk.h
src/gtk/assertdlg_gtk.c

index 228cf02433116cd7a3f37afdcbbdd2c87a7f3d09..ae3250a1c1b65bbef6b9b657751c6b8b8ed8f36c 100644 (file)
@@ -37,6 +37,8 @@ struct _GtkAssertDialog
     GtkWidget *message;
     GtkWidget *treeview;
 
+    GtkWidget *shownexttime;
+
     /* callback for processing the stack frame */
     GtkAssertDialogStackFrameCallback callback;
     void *userdata;
index 88dec90bb5f276373d28ca8384a76ebc0a93bd92..2118ab5f0020cff305a123581e07d62e15027145 100644 (file)
@@ -71,14 +71,16 @@ GtkWidget *gtk_assert_dialog_add_button_to (GtkBox *box, const gchar *label,
     return button;
 }
 
-void gtk_assert_dialog_add_button (GtkAssertDialog *dlg, const gchar *label,
-                                   const gchar *stock, gint response_id)
+GtkWidget *gtk_assert_dialog_add_button (GtkAssertDialog *dlg, const gchar *label,
+                                         const gchar *stock, gint response_id)
 {
     /* create the button */
     GtkWidget *button = gtk_assert_dialog_add_button_to (NULL, label, stock, response_id);
 
     /* add the button to the dialog's action area */
     gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, response_id);
+
+    return button;
 }
 
 void gtk_assert_dialog_append_text_column (GtkWidget *treeview, const gchar *name, int index)
@@ -222,6 +224,15 @@ void gtk_assert_dialog_copy_callback (GtkWidget *widget, GtkAssertDialog *dlg)
     g_string_free (str, TRUE);
 }
 
+void gtk_assert_dialog_continue_callback (GtkWidget *widget, GtkAssertDialog *dlg)
+{
+    gint response =
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dlg->shownexttime)) ?
+            GTK_ASSERT_DIALOG_CONTINUE : GTK_ASSERT_DIALOG_CONTINUE_SUPPRESSING;
+
+    gtk_dialog_response (GTK_DIALOG(dlg), response);
+}
+
 
 /* ----------------------------------------------------------------------------
    GtkAssertDialogClass implementation
@@ -234,7 +245,7 @@ static void     gtk_assert_dialog_class_init        (GtkAssertDialogClass *klass
 GtkType gtk_assert_dialog_get_type (void)
 {
     static GtkType assert_dialog_type = 0;
-    
+
     if (!assert_dialog_type)
     {
         static const GTypeInfo assert_dialog_info =
@@ -263,7 +274,7 @@ void gtk_assert_dialog_class_init(GtkAssertDialogClass *klass)
 
 void gtk_assert_dialog_init(GtkAssertDialog *dlg)
 {
-    GtkWidget *vbox, *hbox, *image;
+    GtkWidget *vbox, *hbox, *image, *continuebtn;
 
     /* start the main vbox */
     gtk_widget_push_composite_child ();
@@ -357,13 +368,19 @@ void gtk_assert_dialog_init(GtkAssertDialog *dlg)
         g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_copy_callback), dlg);
     }
 
-    /* add the buttons */
+    /* add the checkbutton */
+    dlg->shownexttime = gtk_check_button_new_with_mnemonic("Show this _dialog the next time");
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dlg->shownexttime), TRUE);
+    gtk_box_pack_end (GTK_BOX(GTK_DIALOG(dlg)->action_area), dlg->shownexttime, FALSE, TRUE, 8);
+
+    /* add the stop button */
     gtk_assert_dialog_add_button (dlg, "_Stop", GTK_STOCK_QUIT, GTK_ASSERT_DIALOG_STOP);
-    gtk_assert_dialog_add_button (dlg, "_Continue", GTK_STOCK_YES, GTK_ASSERT_DIALOG_CONTINUE);
-    gtk_assert_dialog_add_button (dlg, "Continue su_ppressing", GTK_STOCK_OK,
-                                  GTK_ASSERT_DIALOG_CONTINUE_SUPPRESSING);
     gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_ASSERT_DIALOG_STOP);
 
+    /* add the continue button */
+    continuebtn = gtk_assert_dialog_add_button (dlg, "_Continue", GTK_STOCK_YES, GTK_ASSERT_DIALOG_CONTINUE);
+    g_signal_connect (continuebtn, "clicked", G_CALLBACK(gtk_assert_dialog_continue_callback), dlg);
+
     /* complete creation */
     dlg->callback = NULL;
     dlg->userdata = NULL;