From 70ff1dc3aa38918bd3b367613247473ece001c97 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 7 Sep 2011 12:06:03 +0300 Subject: [PATCH] Removed mc_global.args structure. Signed-off-by: Slava Zanko --- lib/global.c | 11 ++++------- lib/global.h | 24 ++++++++++-------------- lib/skin/colors.c | 2 +- lib/skin/common.c | 6 +++--- lib/skin/lines.c | 2 +- lib/tty/tty-slang.c | 2 +- lib/tty/tty.c | 2 +- src/args.c | 8 ++++---- src/main.c | 2 +- 9 files changed, 26 insertions(+), 33 deletions(-) diff --git a/lib/global.c b/lib/global.c index 0a55a361a..1456cdcf1 100644 --- a/lib/global.c +++ b/lib/global.c @@ -73,13 +73,7 @@ mc_global_t mc_global = { .is_right = FALSE, - .args = - { - .disable_colors = FALSE, - .skin = NULL, - .ugly_line_drawing = FALSE, - .old_mouse = FALSE, - }, + .skin = NULL, .widget = { @@ -107,6 +101,9 @@ mc_global_t mc_global = { .command_line_colors = NULL, .xterm_flag = FALSE, .slow_terminal = FALSE, + .disable_colors = FALSE, + .ugly_line_drawing = FALSE, + .old_mouse = FALSE, }, .vfs = diff --git a/lib/global.h b/lib/global.h index f62d08dd9..39600ac2d 100644 --- a/lib/global.h +++ b/lib/global.h @@ -203,20 +203,8 @@ typedef struct /* Set if the command is being run from the "Right" menu */ gboolean is_right; /* If the selected menu was the right */ - struct - { - /* Use the specified skin */ - char *skin; - - /* Set to force black and white display at program startup */ - gboolean disable_colors; - - /* If true use +, -, | for line drawing */ - gboolean ugly_line_drawing; - - /* Tries to use old highlight mouse tracking */ - gboolean old_mouse; - } args; + /* Use the specified skin */ + char *skin; struct { @@ -262,6 +250,14 @@ typedef struct /* If true lines are shown by spaces */ gboolean slow_terminal; + /* Set to force black and white display at program startup */ + gboolean disable_colors; + + /* If true use +, -, | for line drawing */ + gboolean ugly_line_drawing; + + /* Tries to use old highlight mouse tracking */ + gboolean old_mouse; } tty; struct diff --git a/lib/skin/colors.c b/lib/skin/colors.c index bcb168ab7..7daef9e4c 100644 --- a/lib/skin/colors.c +++ b/lib/skin/colors.c @@ -271,7 +271,7 @@ mc_skin_color_check_bw_mode (mc_skin_t * mc_skin) { gchar **groups, **orig_groups; - if (tty_use_colors () && !mc_global.args.disable_colors) + if (tty_use_colors () && !mc_global.tty.disable_colors) return; orig_groups = groups = mc_config_get_groups (mc_skin->config, NULL); diff --git a/lib/skin/common.c b/lib/skin/common.c index 148a9634b..c78cb3d66 100644 --- a/lib/skin/common.c +++ b/lib/skin/common.c @@ -67,8 +67,8 @@ mc_skin_get_default_name (void) char *tmp_str; /* from command line */ - if (mc_global.args.skin != NULL) - return g_strdup (mc_global.args.skin); + if (mc_global.skin != NULL) + return g_strdup (mc_global.skin); /* from envirovement variable */ tmp_str = getenv ("MC_SKIN"); @@ -185,7 +185,7 @@ mc_skin_deinit (void) gchar * mc_skin_get (const gchar * group, const gchar * key, const gchar * default_value) { - if (mc_global.args.ugly_line_drawing) + if (mc_global.tty.ugly_line_drawing) { return g_strdup (default_value); } diff --git a/lib/skin/lines.c b/lib/skin/lines.c index 75ea29600..32a4fe705 100644 --- a/lib/skin/lines.c +++ b/lib/skin/lines.c @@ -98,7 +98,7 @@ mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin) { if (mc_global.tty.slow_terminal) mc_skin_hardcoded_space_lines (mc_skin); - else if (mc_global.args.ugly_line_drawing) + else if (mc_global.tty.ugly_line_drawing) mc_skin_hardcoded_ugly_lines (mc_skin); /* single lines */ diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index 84447440f..4b55f800f 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -297,7 +297,7 @@ tty_init (gboolean mouse_enable, gboolean is_xterm) /* 255 = ignore abort char; XCTRL('g') for abort char = ^g */ SLang_init_tty (XCTRL ('g'), 1, 0); - if (mc_global.args.ugly_line_drawing) + if (mc_global.tty.ugly_line_drawing) SLtt_Has_Alt_Charset = 0; /* If SLang uses fileno(stderr) for terminal input MC will hang diff --git a/lib/tty/tty.c b/lib/tty/tty.c index 85e532118..c2b2fcda6 100644 --- a/lib/tty/tty.c +++ b/lib/tty/tty.c @@ -313,7 +313,7 @@ tty_init_xterm_support (gboolean is_xterm) /* Enable mouse unless explicitly disabled by --nomouse */ if (use_mouse_p != MOUSE_DISABLED) { - if (mc_global.args.old_mouse) + if (mc_global.tty.old_mouse) use_mouse_p = MOUSE_XTERM_NORMAL_TRACKING; else { diff --git a/src/args.c b/src/args.c index 61922b7ee..bc2ba2828 100644 --- a/src/args.c +++ b/src/args.c @@ -235,7 +235,7 @@ static const GOptionEntry argument_terminal_table[] = { { "stickchars", 'a', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE, - &mc_global.args.ugly_line_drawing, + &mc_global.tty.ugly_line_drawing, N_("Use stickchars to draw"), NULL }, @@ -277,7 +277,7 @@ static const GOptionEntry argument_color_table[] = { /* color options */ { "nocolor", 'b', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE, - &mc_global.args.disable_colors, + &mc_global.tty.disable_colors, N_("Requests to run in black and white"), NULL }, @@ -298,7 +298,7 @@ static const GOptionEntry argument_color_table[] = { { "skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING, - &mc_global.args.skin, + &mc_global.skin, N_("Show mc with specified skin"), "" }, @@ -604,7 +604,7 @@ mc_args_process (int argc, char *argv[]) } if (mc_args__force_colors) - mc_global.args.disable_colors = FALSE; + mc_global.tty.disable_colors = FALSE; #ifdef HAVE_SUBSHELL_SUPPORT if (mc_args__nouse_subshell) diff --git a/src/main.c b/src/main.c index 66e5a3bc2..51f0cf396 100644 --- a/src/main.c +++ b/src/main.c @@ -455,7 +455,7 @@ main (int argc, char *argv[]) macros_list = g_array_new (TRUE, FALSE, sizeof (macros_t)); - tty_init_colors (mc_global.args.disable_colors, mc_args__force_colors); + tty_init_colors (mc_global.tty.disable_colors, mc_args__force_colors); { GError *error2 = NULL; -- 2.11.4.GIT