new GTK assert dialog
Francesco Montorsi
f18m_cpp217828 at yahoo.it
Sun Dec 3 07:05:18 PST 2006
Vadim Zeitlin ha scritto:
> On Wed, 29 Nov 2006 20:11:18 +0100 Francesco Montorsi <f18m_cpp217828 at yah=
oo.it> wrote:
> =
> FM> > 1. I think "Continue suppressing" button label is inappropriate, th=
ere is
> FM> > nothing to be continued as currently the asserts are not suppres=
sed
> FM> > (otherwise you wouldn't see this dialog in the first place). It =
should
> FM> > be "Don't show this box again" or "Suppress in the future". Both=
are
> FM> > unfortunately a bit long so if someone has a shorter but still c=
lear
> FM> > label, it would be great.
> FM> in the attached patch I've changed it to be "Suppress in future". I =
> FM> agree "continue suppressing" maybe a bit misleading if you don't know=
it =
> FM> refers to "continue the program suppressing next assert messages".
> =
> I actually liked the idea of having a checkbox "[x] Show this dialog the
> next time", would it be more difficult to implement than a button?
No, it's not; attached is the patch which implements the checkbox...
Francesco
-------------- next part --------------
Index: include/wx/gtk/assertdlg_gtk.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pack/cvsroots/wxwidgets/wxWidgets/include/wx/gtk/assertdlg_gtk.h=
,v
retrieving revision 1.1
diff -bu2 -r1.1 include/wx/gtk/assertdlg_gtk.h
--- include/wx/gtk/assertdlg_gtk.h
+++ include/wx/gtk/assertdlg_gtk.h
@@ -38,4 +38,6 @@
GtkWidget *treeview;
=
+ GtkWidget *shownexttime;
+
/* callback for processing the stack frame */
GtkAssertDialogStackFrameCallback callback;
Index: src/gtk/assertdlg_gtk.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /pack/cvsroots/wxwidgets/wxWidgets/src/gtk/assertdlg_gtk.c,v
retrieving revision 1.3
diff -bu2 -r1.3 src/gtk/assertdlg_gtk.c
--- src/gtk/assertdlg_gtk.c
+++ src/gtk/assertdlg_gtk.c
@@ -72,5 +72,5 @@
}
=
-void gtk_assert_dialog_add_button (GtkAssertDialog *dlg, const gchar *labe=
l,
+GtkWidget *gtk_assert_dialog_add_button (GtkAssertDialog *dlg, const gchar=
*label,
const gchar *stock, gint response_id)
{
@@ -80,4 +80,6 @@
/* add the button to the dialog's action area */
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, response_id);
+
+ return button;
}
=
@@ -223,4 +225,13 @@
}
=
+void gtk_assert_dialog_continue_callback (GtkWidget *widget, GtkAssertDial=
og *dlg)
+{
+ gint response =3D
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dlg->shownexttime)=
) ?
+ GTK_ASSERT_DIALOG_CONTINUE : GTK_ASSERT_DIALOG_CONTINUE_SUPPRE=
SSING;
+
+ gtk_dialog_response (GTK_DIALOG(dlg), response);
+}
+
=
/* -----------------------------------------------------------------------=
-----
@@ -264,5 +275,5 @@
void gtk_assert_dialog_init(GtkAssertDialog *dlg)
{
- GtkWidget *vbox, *hbox, *image;
+ GtkWidget *vbox, *hbox, *image, *continuebtn;
=
/* start the main vbox */
@@ -358,11 +369,17 @@
}
=
- /* add the buttons */
+ /* 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_ASS=
ERT_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_S=
TOP);
=
+ /* add the continue button */
+ continuebtn =3D gtk_assert_dialog_add_button (dlg, "_Continue", GTK_ST=
OCK_YES, GTK_ASSERT_DIALOG_CONTINUE);
+ g_signal_connect (continuebtn, "clicked", G_CALLBACK(gtk_assert_dialog=
_continue_callback), dlg);
+
+ /* add the checkbutton */
+ dlg->shownexttime =3D gtk_check_button_new_with_mnemonic("Show this _d=
ialog the next time");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dlg->shownexttime), TR=
UE);
+ gtk_box_pack_end (GTK_BOX(GTK_DIALOG(dlg)->action_area), dlg->shownext=
time, FALSE, TRUE, 8);
+
/* complete creation */
dlg->callback =3D NULL;
More information about the wx-dev
mailing list