Skip to content

Commit

Permalink
Add a debug level spinner at the end of Preferences > Advanced.
Browse files Browse the repository at this point in the history
One can now enable debug mode without restarting geeqie.
A possibility to disable all debugging code and related options
at compile time was added.
  • Loading branch information
Laurent Monin committed Apr 3, 2008
1 parent 7cc8e4c commit e10dc3f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/format_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ gchar *fullscreen_info = NULL;

gint dupe_custom_threshold = 99;

#ifdef DEBUG
gint debug = FALSE;
#endif

/* layout */
gchar *layout_order = NULL;
Expand Down
10 changes: 10 additions & 0 deletions src/gqview.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -176,7 +184,9 @@ extern gchar *fullscreen_info;

extern gint dupe_custom_threshold;

#ifdef DEBUG
extern gint debug;
#endif

extern gint recent_list_max;

Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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"));

Expand Down
14 changes: 14 additions & 0 deletions src/preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e10dc3f

Please sign in to comment.