forked from AuroraMiddleware/gtk
testgtk: Remove idle test
The test is broken, written like it's 1999 and testing a feature that I'm about to deprecate.
This commit is contained in:
parent
dd01e05ceb
commit
859805bda4
178
tests/testgtk.c
178
tests/testgtk.c
@ -9285,183 +9285,6 @@ create_timeout_test (GtkWidget *widget)
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* Idle Test
|
||||
*/
|
||||
|
||||
static int idle_id = 0;
|
||||
|
||||
static gint
|
||||
idle_test (GtkWidget *label)
|
||||
{
|
||||
static int count = 0;
|
||||
static char buffer[32];
|
||||
|
||||
sprintf (buffer, "count: %d", ++count);
|
||||
gtk_label_set_text (GTK_LABEL (label), buffer);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
start_idle_test (GtkWidget *widget,
|
||||
GtkWidget *label)
|
||||
{
|
||||
if (!idle_id)
|
||||
{
|
||||
idle_id = g_idle_add ((GSourceFunc) idle_test, label);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
stop_idle_test (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
if (idle_id)
|
||||
{
|
||||
g_source_remove (idle_id);
|
||||
idle_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_idle_test (GtkWidget *widget,
|
||||
GtkWidget **window)
|
||||
{
|
||||
stop_idle_test (NULL, NULL);
|
||||
|
||||
*window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_idle_container (GObject *button,
|
||||
GtkContainer *container)
|
||||
{
|
||||
gtk_container_set_resize_mode (container, GPOINTER_TO_INT (g_object_get_data (button, "user_data")));
|
||||
}
|
||||
|
||||
static void
|
||||
create_idle_test (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
GtkWidget *container;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *action_area, *content_area;
|
||||
GtkWidget *button2;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *box;
|
||||
|
||||
window = gtk_dialog_new ();
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (widget));
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (destroy_idle_test),
|
||||
&window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
action_area = gtk_dialog_get_action_area (GTK_DIALOG (window));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Idle Test");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
label = gtk_label_new ("count: 0");
|
||||
g_object_set (label, "margin", 10, NULL);
|
||||
gtk_widget_show (label);
|
||||
|
||||
container =
|
||||
g_object_new (GTK_TYPE_BOX,
|
||||
"visible", TRUE,
|
||||
/* "GtkContainer::child", g_object_new (GTK_TYPE_HBOX,
|
||||
* "GtkWidget::visible", TRUE,
|
||||
*/
|
||||
"child", label,
|
||||
/* NULL), */
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), container, TRUE, TRUE, 0);
|
||||
|
||||
frame =
|
||||
g_object_new (GTK_TYPE_FRAME,
|
||||
"border_width", 5,
|
||||
"label", "Label Container",
|
||||
"visible", TRUE,
|
||||
"parent", content_area,
|
||||
NULL);
|
||||
box =
|
||||
g_object_new (GTK_TYPE_BOX,
|
||||
"visible", TRUE,
|
||||
"parent", frame,
|
||||
"orientation", GTK_ORIENTATION_VERTICAL,
|
||||
NULL);
|
||||
button =
|
||||
g_object_connect (g_object_new (GTK_TYPE_RADIO_BUTTON,
|
||||
"label", "Resize-Parent",
|
||||
"user_data", (void*)GTK_RESIZE_PARENT,
|
||||
"visible", TRUE,
|
||||
"parent", box,
|
||||
NULL),
|
||||
"signal::clicked", toggle_idle_container, container,
|
||||
NULL);
|
||||
button = g_object_new (GTK_TYPE_RADIO_BUTTON,
|
||||
"label", "Resize-Queue",
|
||||
"user_data", (void*)GTK_RESIZE_QUEUE,
|
||||
"group", button,
|
||||
"visible", TRUE,
|
||||
"parent", box,
|
||||
NULL);
|
||||
g_object_connect (button,
|
||||
"signal::clicked", toggle_idle_container, container,
|
||||
NULL);
|
||||
button2 = g_object_new (GTK_TYPE_RADIO_BUTTON,
|
||||
"label", "Resize-Immediate",
|
||||
"user_data", (void*)GTK_RESIZE_IMMEDIATE,
|
||||
NULL);
|
||||
g_object_connect (button2,
|
||||
"signal::clicked", toggle_idle_container, container,
|
||||
NULL);
|
||||
g_object_set (button2,
|
||||
"group", button,
|
||||
"visible", TRUE,
|
||||
"parent", box,
|
||||
NULL);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
window);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("start");
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (start_idle_test),
|
||||
label);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("stop");
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (stop_idle_test),
|
||||
NULL);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* rc file test
|
||||
*/
|
||||
@ -9929,7 +9752,6 @@ struct {
|
||||
#if 0
|
||||
{ "styles", create_styles },
|
||||
#endif
|
||||
{ "test idle", create_idle_test },
|
||||
{ "test mainloop", create_mainloop, TRUE },
|
||||
{ "test scrolling", create_scroll_test },
|
||||
{ "test selection", create_selection_test },
|
||||
|
Loading…
Reference in New Issue
Block a user