X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4b5a7d3d092dd6d0aa7a1998ce0ed3e0c6ea50f1..1c60f644581df7bfc4b44d9ad68ee94ff728ceb5:/src/gtk/assertdlg_gtk.c diff --git a/src/gtk/assertdlg_gtk.c b/src/gtk/assertdlg_gtk.c index 5355e8b2f2..5684000a2d 100644 --- a/src/gtk/assertdlg_gtk.c +++ b/src/gtk/assertdlg_gtk.c @@ -23,10 +23,7 @@ extern "C" { /* For FILE */ #include - -#if GTK_CHECK_VERSION(2,4,0) #include -#endif /* ---------------------------------------------------------------------------- @@ -147,9 +144,6 @@ void gtk_assert_dialog_process_backtrace (GtkAssertDialog *dlg) GtkAssertDialog signal handlers ---------------------------------------------------------------------------- */ -/* GtkFileChooserDialog and GtkExpander are only available in GTK+ >= 2.4 */ -#if GTK_CHECK_VERSION(2,4,0) - void gtk_assert_dialog_expander_callback (GtkWidget *widget, GtkAssertDialog *dlg) { /* status is not yet updated so we need to invert it to get the new one */ @@ -202,7 +196,6 @@ void gtk_assert_dialog_save_backtrace_callback (GtkWidget *widget, GtkAssertDial gtk_widget_destroy (dialog); } -#endif /* GTK+ 2.4+ */ void gtk_assert_dialog_copy_callback (GtkWidget *widget, GtkAssertDialog *dlg) { @@ -280,57 +273,50 @@ void gtk_assert_dialog_class_init(GtkAssertDialogClass *klass) void gtk_assert_dialog_init(GtkAssertDialog *dlg) { - GtkWidget *vbox, *hbox, *image, *continuebtn; + GtkWidget *continuebtn; - /* start the main vbox */ - gtk_widget_push_composite_child (); - vbox = gtk_vbox_new (FALSE, 8); - gtk_container_set_border_width (GTK_CONTAINER(vbox), 8); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 5); + { + GtkWidget *vbox, *hbox, *image; + /* start the main vbox */ + gtk_widget_push_composite_child (); + vbox = gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER(vbox), 8); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 5); - /* add the icon+message hbox */ - hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - /* icon */ - image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); - gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 12); + /* add the icon+message hbox */ + hbox = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - { - GtkWidget *vbox2, *info; - - /* message */ - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); - info = gtk_label_new ("An assertion failed!"); - gtk_box_pack_start (GTK_BOX(vbox2), info, TRUE, TRUE, 8); - - /* assert message */ - dlg->message = gtk_label_new (NULL); - gtk_label_set_selectable (GTK_LABEL (dlg->message), TRUE); - gtk_label_set_line_wrap (GTK_LABEL (dlg->message), TRUE); - gtk_label_set_justify (GTK_LABEL (dlg->message), GTK_JUSTIFY_LEFT); - gtk_widget_set_size_request (GTK_WIDGET(dlg->message), 450, -1); - - gtk_box_pack_end (GTK_BOX(vbox2), GTK_WIDGET(dlg->message), TRUE, TRUE, 8); - } + /* icon */ + image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); + gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 12); - /* add the expander */ -#if GTK_CHECK_VERSION(2,4,0) - if (!gtk_check_version (2, 4, 0)) - { + { + GtkWidget *vbox2, *info; + + /* message */ + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); + info = gtk_label_new ("An assertion failed!"); + gtk_box_pack_start (GTK_BOX(vbox2), info, TRUE, TRUE, 8); + + /* assert message */ + dlg->message = gtk_label_new (NULL); + gtk_label_set_selectable (GTK_LABEL (dlg->message), TRUE); + gtk_label_set_line_wrap (GTK_LABEL (dlg->message), TRUE); + gtk_label_set_justify (GTK_LABEL (dlg->message), GTK_JUSTIFY_LEFT); + gtk_widget_set_size_request (GTK_WIDGET(dlg->message), 450, -1); + + gtk_box_pack_end (GTK_BOX(vbox2), GTK_WIDGET(dlg->message), TRUE, TRUE, 8); + } + + /* add the expander */ dlg->expander = gtk_expander_new_with_mnemonic ("Back_trace:"); gtk_box_pack_start (GTK_BOX(vbox), dlg->expander, TRUE, TRUE, 0); g_signal_connect (GTK_EXPANDER(dlg->expander), "activate", - G_CALLBACK(gtk_assert_dialog_expander_callback), dlg); - } - else -#endif - { - /* if GtkExpander is unavailable, then use a static frame instead */ - dlg->expander = gtk_frame_new ("Back_trace:"); - gtk_box_pack_start (GTK_BOX(vbox), dlg->expander, TRUE, TRUE, 0); + G_CALLBACK(gtk_assert_dialog_expander_callback), dlg); } { @@ -358,16 +344,10 @@ void gtk_assert_dialog_init(GtkAssertDialog *dlg) gtk_button_box_set_layout (GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); /* add the buttons */ -#if GTK_CHECK_VERSION(2,4,0) - if (!gtk_check_version (2, 4, 0)) - { - /* add this button only if GTK supports GtkFileChooserDialog */ - button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Save to _file", - GTK_STOCK_SAVE, GTK_RESPONSE_NONE); - g_signal_connect (button, "clicked", - G_CALLBACK(gtk_assert_dialog_save_backtrace_callback), dlg); - } -#endif + button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Save to _file", + GTK_STOCK_SAVE, GTK_RESPONSE_NONE); + g_signal_connect (button, "clicked", + G_CALLBACK(gtk_assert_dialog_save_backtrace_callback), dlg); button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Copy to clip_board", GTK_STOCK_COPY, GTK_RESPONSE_NONE); @@ -441,7 +421,7 @@ gchar *gtk_assert_dialog_get_backtrace (GtkAssertDialog *dlg) LINE_NUMBER_COLIDX, &linenum, -1); - g_string_append_printf (string, "[%d] %s(%s)", + g_string_append_printf (string, "[%u] %s(%s)", count, function, arguments); if (sourcefile[0] != '\0') g_string_append_printf (string, " %s", sourcefile); @@ -481,13 +461,6 @@ void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg, { assertdlg->callback = callback; assertdlg->userdata = userdata; - - if (gtk_check_version (2, 4, 0)) - { - /* we need to immediately process the stack trace as we're not using - an expander since GTK does not support it */ - gtk_assert_dialog_process_backtrace (assertdlg); - } } void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, @@ -509,7 +482,7 @@ void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, linenum = g_string_new(""); if ( line_number != 0 ) - g_string_printf (linenum, "%d", line_number); + g_string_printf (linenum, "%u", line_number); /* add data to the list store */ gtk_list_store_append (GTK_LIST_STORE(model), &iter);