changeset 227:41fc4bfc8b25

Add a debug level spinner at the end of Preferences > Advanced. One can now enable debug mode without restarting geeqie. A possibility to disable all debugging code and related options at compile time was added.
author zas_
date Thu, 03 Apr 2008 17:15:49 +0000
parents 3c89da4aef95
children 343e560f8e15
files src/format_raw.c src/globals.c src/gqview.h src/main.c src/preferences.c
diffstat 5 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/format_raw.c	Thu Apr 03 14:35:03 2008 +0000
+++ b/src/format_raw.c	Thu Apr 03 17:15:49 2008 +0000
@@ -35,10 +35,10 @@
 #include "format_nikon.h"
 #include "format_olympus.h"
 
-
+#ifdef DEBUG
 /* so that debugging is honored */
 extern gint debug;
-
+#endif
 
 typedef struct _FormatRawEntry FormatRawEntry;
 struct _FormatRawEntry {
--- a/src/globals.c	Thu Apr 03 14:35:03 2008 +0000
+++ b/src/globals.c	Thu Apr 03 17:15:49 2008 +0000
@@ -105,7 +105,9 @@
 
 gint dupe_custom_threshold = 99;
 
+#ifdef DEBUG
 gint debug = FALSE;
+#endif
 
 /* layout */
 gchar *layout_order = NULL;
--- a/src/gqview.h	Thu Apr 03 14:35:03 2008 +0000
+++ b/src/gqview.h	Thu Apr 03 17:15:49 2008 +0000
@@ -85,6 +85,14 @@
 #define DEFAULT_THUMB_WIDTH	96
 #define DEFAULT_THUMB_HEIGHT	72
 
+#if 1 /* set to 0 to disable debugging code and related options */
+# ifndef DEBUG
+# define DEBUG 1
+# endif
+#endif
+#ifndef DEBUG
+# define debug 0
+#endif
 
 #include "typedefs.h"
 
@@ -176,7 +184,9 @@
 
 extern gint dupe_custom_threshold;
 
+#ifdef DEBUG
 extern gint debug;
+#endif
 
 extern gint recent_list_max;
 
--- a/src/main.c	Thu Apr 03 14:35:03 2008 +0000
+++ b/src/main.c	Thu Apr 03 17:15:49 2008 +0000
@@ -914,12 +914,14 @@
 				parse_command_line_process_file(cmd_all, path, file,
 								&list, collection_list, &first_dir);
 				}
+#ifdef DEBUG
 			else if (strcmp(cmd_line, "--debug") == 0)
 				{
 				/* we now increment the debug state for verbosity */
 				debug++;
 				printf("debugging output enabled (level %d)\n", debug);
 				}
+#endif
 			else if (strcmp(cmd_line, "+t") == 0 ||
 				 strcmp(cmd_line, "--with-tools") == 0)
 				{
@@ -999,7 +1001,9 @@
 				print_term(_("      --geometry=GEOMETRY    set main window location\n"));
 				print_term(_("  -r, --remote               send following commands to open window\n"));
 				print_term(_("  -rh,--remote-help          print remote command list\n"));
+#ifdef DEBUG
 				print_term(_("  --debug                    turn on debug output\n"));
+#endif
 				print_term(_("  -v, --version              print version info\n"));
 				print_term(_("  -h, --help                 show this message\n\n"));
 				
--- a/src/preferences.c	Thu Apr 03 14:35:03 2008 +0000
+++ b/src/preferences.c	Thu Apr 03 17:15:49 2008 +0000
@@ -130,6 +130,10 @@
 
 static gint dupe_custom_threshold_c;
 
+#ifdef DEBUG
+static gint debug_c;
+#endif
+
 static GtkWidget *configwindow = NULL;
 static GtkWidget *startup_path_entry;
 static GtkListStore *filter_store = NULL;
@@ -317,6 +321,9 @@
 	dupe_custom_threshold = dupe_custom_threshold_c;
 
 	tree_descend_subdirs = tree_descend_subdirs_c;
+#ifdef DEBUG
+	debug = debug_c;
+#endif
 
 #ifdef HAVE_LCMS
 	for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
@@ -1474,6 +1481,13 @@
 			 GTK_FILL | GTK_EXPAND, 0, 0, 0);
 	gtk_widget_show(tabcomp);
 
+#ifdef DEBUG
+	group = pref_group_new(vbox, FALSE, _("Debugging"), GTK_ORIENTATION_VERTICAL);
+
+	pref_spin_new_int(group, _("Debug level:"), NULL,
+			  0, 9, 1, debug, &debug_c);
+#endif
+
 	gtk_widget_show(notebook);
 
 	gtk_widget_show(configwindow);