changeset 2596:9c435c86a296

Optional timer data in log window
author Colin Clark <colin.clark@cclark.uk>
date Mon, 11 Sep 2017 18:19:46 +0100
parents 7b75f6d95758
children e65df743a5a1
files src/debug.c src/logwindow.c src/options.c src/options.h src/preferences.c src/rcfile.c src/typedefs.h
diffstat 7 files changed, 28 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/debug.c	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/debug.c	Mon Sep 11 18:19:46 2017 +0100
@@ -97,7 +97,16 @@
 	message = g_strdup_vprintf(format, ap);
 	va_end(ap);
 
-	location = g_strdup_printf("%s:%s:%d:", file_name, function_name, line_number);
+	if (options && options->log_window.timer_data)
+		{
+		location = g_strdup_printf("%s:%s:%s:%d:", get_exec_time(), file_name,
+												function_name, line_number);
+		}
+	else
+		{
+		location = g_strdup_printf("%s:%s:%d:", file_name, function_name, line_number);
+		}
+
 	buf = g_strconcat(location, message, NULL);
 	log_domain_print_message(domain,buf);
 	g_free(location);
--- a/src/logwindow.c	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/logwindow.c	Mon Sep 11 18:19:46 2017 +0100
@@ -44,6 +44,7 @@
 	GtkWidget *bar;
 	GtkWidget *pause;
 	GtkWidget *wrap;
+	GtkWidget *timer_data;
 	GtkWidget *debug_level;
 };
 
@@ -99,6 +100,13 @@
 		}
 }
 
+static void log_window_timer_data_cb(GtkWidget *widget, gpointer data)
+{
+	LogWindow *logwin = data;
+
+	options->log_window.timer_data = !options->log_window.timer_data;
+}
+
 static void log_window_regexp_cb(GtkWidget *text_entry, gpointer data)
 {
 	gchar *new_regexp;
@@ -167,6 +175,9 @@
 	logwin->wrap = pref_button_new(hbox, NULL, "Line wrap", FALSE,
 					   G_CALLBACK(log_window_line_wrap_cb), logwin);
 
+	logwin->timer_data = pref_button_new(hbox, NULL, "Timer data", FALSE,
+					   G_CALLBACK(log_window_timer_data_cb), logwin);
+
 	pref_label_new(hbox, "Filter regexp");
 
 	textbox = gtk_entry_new();
--- a/src/options.c	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/options.c	Mon Sep 11 18:19:46 2017 +0100
@@ -173,6 +173,7 @@
 	options->log_window_lines = 1000;
 	options->log_window.line_wrap = TRUE;
 	options->log_window.paused = FALSE;
+	options->log_window.timer_data = FALSE;
 
 	return options;
 }
--- a/src/options.h	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/options.h	Mon Sep 11 18:19:46 2017 +0100
@@ -272,6 +272,7 @@
 	struct {
 		gboolean paused;
 		gboolean line_wrap;
+		gboolean timer_data;
 	} log_window;
 };
 
--- a/src/preferences.c	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/preferences.c	Mon Sep 11 18:19:46 2017 +0100
@@ -2243,6 +2243,9 @@
 	pref_spin_new_int(group, _("Debug level:"), NULL,
 			  DEBUG_LEVEL_MIN, DEBUG_LEVEL_MAX, 1, get_debug_level(), &debug_c);
 
+	pref_checkbox_new_int(group, _("Timer data"),
+			options->log_window.timer_data, &c_options->log_window.timer_data);
+
 	pref_spin_new_int(group, _("Log Window max. lines:"), NULL,
 			  1, 99999, 1, options->log_window_lines, &options->log_window_lines);
 #endif
--- a/src/rcfile.c	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/rcfile.c	Mon Sep 11 18:19:46 2017 +0100
@@ -336,6 +336,7 @@
 	WRITE_NL(); WRITE_BOOL(*options, tools_restore_state);
 
 	WRITE_NL(); WRITE_UINT(*options, log_window_lines);
+	WRITE_NL(); WRITE_BOOL(*options, log_window.timer_data);
 
 	/* File operations Options */
 	WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename);
@@ -632,6 +633,7 @@
 		if (READ_BOOL(*options, tools_restore_state)) continue;
 
 		if (READ_INT(*options, log_window_lines)) continue;
+		if (READ_BOOL(*options, log_window.timer_data)) continue;
 
 		/* Properties dialog options */
 		if (READ_CHAR(*options, properties.tabs_order)) continue;
--- a/src/typedefs.h	Sun Sep 10 19:24:20 2017 +0100
+++ b/src/typedefs.h	Mon Sep 11 18:19:46 2017 +0100
@@ -638,7 +638,6 @@
 		gint h;
 		gint x;
 		gint y;
-		gboolean paused;
 	} log_window;
 
 	gboolean tools_float;