// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////// */
+#include "wx/wxprec.h"
+
#include "wx/platform.h"
#include <gtk/gtk.h>
#include "wx/gtk/assertdlg_gtk.h"
+#include "wx/gtk/private/gtk2-compat.h"
+
+#include <stdio.h>
/* ----------------------------------------------------------------------------
Constants
in gtk_assert_dialog_create_backtrace_list_model() function
*/
#define STACKFRAME_LEVEL_COLIDX 0
-#define FUNCTION_NAME_COLIDX 1
+#define FUNCTION_PROTOTYPE_COLIDX 1
#define SOURCE_FILE_COLIDX 2
#define LINE_NUMBER_COLIDX 3
-#define FUNCTION_ARGS_COLIDX 4
-
-
-
/* ----------------------------------------------------------------------------
GtkAssertDialog helpers
GtkWidget *treeview;
/* create list store */
- store = gtk_list_store_new (5,
+ store = gtk_list_store_new (4,
G_TYPE_UINT, /* stack frame number */
- G_TYPE_STRING, /* function name */
+ G_TYPE_STRING, /* function prototype */
G_TYPE_STRING, /* source file name */
- G_TYPE_STRING, /* line number */
- G_TYPE_STRING); /* function arguments */
+ G_TYPE_STRING); /* line number */
/* create the tree view */
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store));
/* append columns */
gtk_assert_dialog_append_text_column(treeview, "#", STACKFRAME_LEVEL_COLIDX);
- gtk_assert_dialog_append_text_column(treeview, "Function name", FUNCTION_NAME_COLIDX);
- gtk_assert_dialog_append_text_column(treeview, "Function args", FUNCTION_ARGS_COLIDX);
+ gtk_assert_dialog_append_text_column(treeview, "Function Prototype", FUNCTION_PROTOTYPE_COLIDX);
gtk_assert_dialog_append_text_column(treeview, "Source file", SOURCE_FILE_COLIDX);
gtk_assert_dialog_append_text_column(treeview, "Line #", LINE_NUMBER_COLIDX);
/* toggle busy cursor */
gdk_window_set_cursor (parent, NULL);
+#ifdef __WXGTK3__
+ g_object_unref(cur);
+#else
gdk_cursor_unref (cur);
+#endif
}
-
-
extern "C" {
/* ----------------------------------------------------------------------------
GtkAssertDialog signal handlers
static void gtk_assert_dialog_init (GtkAssertDialog *self);
static void gtk_assert_dialog_class_init (GtkAssertDialogClass *klass);
-
GType gtk_assert_dialog_get_type()
{
static GType assert_dialog_type;
/* start the main vbox */
gtk_widget_push_composite_child ();
- vbox = gtk_vbox_new (FALSE, 8);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
gtk_container_set_border_width (GTK_CONTAINER(vbox), 8);
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))), vbox, true, true, 5);
/* add the icon+message hbox */
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
/* icon */
GtkWidget *vbox2, *info;
/* message */
- vbox2 = gtk_vbox_new (FALSE, 0);
+ vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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);
/* 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_signal_connect (dlg->expander, "activate",
G_CALLBACK(gtk_assert_dialog_expander_callback), dlg);
}
GtkWidget *hbox, *vbox, *button, *sw;
/* create expander's vbox */
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (dlg->expander), vbox);
/* add a scrollable window under the expander */
gtk_container_add (GTK_CONTAINER (sw), dlg->treeview);
/* create button's hbox */
- hbox = gtk_hbutton_box_new ();
+ hbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_end (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
gtk_button_box_set_layout (GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
dlg->callback = NULL;
dlg->userdata = NULL;
- /* the resizeable property of this window is modified by the expander:
- when it's collapsed, the window must be non-resizeable! */
+ /* the resizable property of this window is modified by the expander:
+ when it's collapsed, the window must be non-resizable! */
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
gtk_widget_pop_composite_child ();
gtk_widget_show_all (GTK_WIDGET(dlg));
}
-
-
/* ----------------------------------------------------------------------------
GtkAssertDialog public API
---------------------------------------------------------------------------- */
gchar *gtk_assert_dialog_get_backtrace (GtkAssertDialog *dlg)
{
- gchar *function, *arguments, *sourcefile, *linenum;
+ gchar *function, *sourcefile, *linenum;
guint count;
GtkTreeModel *model;
do
{
/* append this stack frame's info to the string */
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get(model, &iter,
STACKFRAME_LEVEL_COLIDX, &count,
- FUNCTION_NAME_COLIDX, &function,
- FUNCTION_ARGS_COLIDX, &arguments,
+ FUNCTION_PROTOTYPE_COLIDX, &function,
SOURCE_FILE_COLIDX, &sourcefile,
LINE_NUMBER_COLIDX, &linenum,
-1);
- g_string_append_printf (string, "[%u] %s(%s)",
- count, function, arguments);
+ g_string_append_printf(string, "[%u] %s",
+ count, function);
if (sourcefile[0] != '\0')
g_string_append_printf (string, " %s", sourcefile);
if (linenum[0] != '\0')
g_string_append (string, "\n");
g_free (function);
- g_free (arguments);
g_free (sourcefile);
g_free (linenum);
void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg,
const gchar *function,
- const gchar *arguments,
const gchar *sourcefile,
guint line_number)
{
gtk_list_store_append (GTK_LIST_STORE(model), &iter);
gtk_list_store_set (GTK_LIST_STORE(model), &iter,
STACKFRAME_LEVEL_COLIDX, count+1, /* start from 1 and not from 0 */
- FUNCTION_NAME_COLIDX, function,
- FUNCTION_ARGS_COLIDX, arguments,
+ FUNCTION_PROTOTYPE_COLIDX, function,
SOURCE_FILE_COLIDX, sourcefile,
LINE_NUMBER_COLIDX, linenum->str,
-1);