Add a debug level spinner at the end of Preferences > Advanced.
authorLaurent Monin <geeqie@norz.org>
Thu, 3 Apr 2008 17:15:49 +0000 (17:15 +0000)
committerLaurent Monin <geeqie@norz.org>
Thu, 3 Apr 2008 17:15:49 +0000 (17:15 +0000)
One can now enable debug mode without restarting geeqie.
A possibility to disable all debugging code and related options
at compile time was added.

src/format_raw.c
src/globals.c
src/gqview.h
src/main.c
src/preferences.c

index e39115f..15990df 100644 (file)
 #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 {
index 19317ef..6506456 100644 (file)
@@ -105,7 +105,9 @@ gchar *fullscreen_info = NULL;
 
 gint dupe_custom_threshold = 99;
 
+#ifdef DEBUG
 gint debug = FALSE;
+#endif
 
 /* layout */
 gchar *layout_order = NULL;
index f8a96d6..5efa1ea 100644 (file)
 #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 gchar *fullscreen_info;
 
 extern gint dupe_custom_threshold;
 
+#ifdef DEBUG
 extern gint debug;
+#endif
 
 extern gint recent_list_max;
 
index 1b52cee..b84473b 100644 (file)
@@ -914,12 +914,14 @@ static void parse_command_line(int argc, char *argv[], gchar **path, gchar **fil
                                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 @@ static void parse_command_line(int argc, char *argv[], gchar **path, gchar **fil
                                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"));
                                
index 69dc60c..e78a10b 100644 (file)
@@ -130,6 +130,10 @@ static gchar *fullscreen_info_c = NULL;
 
 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 @@ static void config_window_apply(void)
        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 @@ static void config_window_create(void)
                         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);