[gtk/matthiasc/perf-tests: 1/2] widget-factory: Add a way to quit automatically
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/perf-tests: 1/2] widget-factory: Add a way to quit automatically
- Date: Tue, 21 Jan 2020 22:36:11 +0000 (UTC)
commit a6f300cefd2edfb7789e75565adb03f82a701530
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 21 16:57:20 2020 -0500
widget-factory: Add a way to quit automatically
This can be used to measure startup cost in tests.
demos/widget-factory/widget-factory.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 559fb82c87..d50143deda 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -2000,6 +2000,13 @@ toggle_action (GSimpleAction *action,
g_variant_new_boolean (!g_variant_get_boolean (state)));
}
+static gboolean
+quit_timeout (gpointer data)
+{
+ exit (0);
+ return G_SOURCE_REMOVE;
+}
+
int
main (int argc, char *argv[])
{
@@ -2065,6 +2072,9 @@ main (int argc, char *argv[])
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0, G_OPTION_ARG_NONE, "Show program
version", NULL);
+ if (g_getenv ("GTK_DEBUG_AUTO_QUIT"))
+ g_timeout_add (500, quit_timeout, NULL);
+
g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]