Optional timer data in log window
authorColin Clark <colin.clark@cclark.uk>
Mon, 11 Sep 2017 17:19:46 +0000 (18:19 +0100)
committerColin Clark <colin.clark@cclark.uk>
Mon, 11 Sep 2017 17:19:46 +0000 (18:19 +0100)
src/debug.c
src/logwindow.c
src/options.c
src/options.h
src/preferences.c
src/rcfile.c
src/typedefs.h

index 851bb79..3f965b4 100644 (file)
@@ -97,7 +97,16 @@ void log_domain_print_debug(const gchar *domain, const gchar *file_name, const g
        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);
index 3d21cc1..21b7223 100644 (file)
@@ -44,6 +44,7 @@ struct _LogWindow
        GtkWidget *bar;
        GtkWidget *pause;
        GtkWidget *wrap;
+       GtkWidget *timer_data;
        GtkWidget *debug_level;
 };
 
@@ -99,6 +100,13 @@ static void log_window_line_wrap_cb(GtkWidget *widget, gpointer data)
                }
 }
 
+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 @@ static LogWindow *log_window_create(LayoutWindow *lw)
        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();
index a79dc28..a9d6b03 100644 (file)
@@ -173,6 +173,7 @@ ConfOptions *init_options(ConfOptions *options)
        options->log_window_lines = 1000;
        options->log_window.line_wrap = TRUE;
        options->log_window.paused = FALSE;
+       options->log_window.timer_data = FALSE;
 
        return options;
 }
index ac996dd..26bc003 100644 (file)
@@ -272,6 +272,7 @@ struct _ConfOptions
        struct {
                gboolean paused;
                gboolean line_wrap;
+               gboolean timer_data;
        } log_window;
 };
 
index 6c29cde..e01a61d 100644 (file)
@@ -2243,6 +2243,9 @@ static void config_tab_behavior(GtkWidget *notebook)
        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
index 9ed1342..460a46c 100644 (file)
@@ -336,6 +336,7 @@ static void write_global_attributes(GString *outstr, gint indent)
        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 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
                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;
index 7f05639..2aef558 100644 (file)
@@ -638,7 +638,6 @@ struct _LayoutOptions
                gint h;
                gint x;
                gint y;
-               gboolean paused;
        } log_window;
 
        gboolean tools_float;