Ticket #1881: mc-4.7.0pre-auto-fix-codeset.patch

File mc-4.7.0pre-auto-fix-codeset.patch, 4.3 KB (added by vitalif, 15 years ago)

Patch

  • src/main.c

    diff -NaurpBb mc-4.7.0-pre1/src/main.c mc-4.7.0-pre1-orig/src/main.c
    old new int confirm_view_dir = 0; 
    239239/* This flag indicates if the pull down menus by default drop down */ 
    240240int drop_menus = 0; 
    241241 
    242 /* if auto_fix_codeset = 0 show warning about system and display codeset is different 
    243    if auto_fix_codeset = 1 don't show warning, don't fix it automatically 
    244    if auto_fix_codeset = 2 don't show warning, fix it automatically */ 
    245 int auto_fix_codeset = 0; 
     242/* if skip_check_codeset = 1 do not show warning about 
     243 * system and display codeset is different 
     244 */ 
     245int skip_check_codeset = 0; 
    246246 
    247247/* The dialog handle for the main program */ 
    248248Dlg_head *midnight_dlg = NULL; 
    static void check_codeset() 
    14621462    const char *_source_codepage = NULL; 
    14631463    const char *_display_codepage = NULL; 
    14641464    int profile_changed = 0; 
    1465     int dont_ask_again = 0; 
    1466     int st = 0; 
    14671465 
    14681466#define CONFY 16 
    14691467#define CONFX 54 
    14701468 
    1471     if ( auto_fix_codeset != 1 ) { 
     1469    if ( !skip_check_codeset ) { 
    14721470 
    14731471        QuickWidget ecs_widgets [] = { 
    14741472        { quick_button, 4, 6, 13, CONFY, N_("&Skip"), 
    static void check_codeset() 
    14761474        { quick_button, 1, 11, 13, CONFY, N_("&Fix it"), 
    14771475          0, B_ENTER, 0, 0, NULL , NULL, NULL}, 
    14781476        { quick_checkbox, 1, 13, 11, CONFY, N_("don't ask again"), 
    1479           11, 0, &dont_ask_again, NULL, NULL , NULL, NULL}, 
     1477          11, 0, &skip_check_codeset, NULL, NULL , NULL, NULL}, 
    14801478        { quick_label, 2, 30, 3, CONFY, N_("Chosen display charset (Settings->Display bits)\n" 
    14811479                                           "or source codeset (in mcedit ctrl-t) \n" 
    14821480                                           "does not match one set via locale. \n" 
    static void check_codeset() 
    15001498 
    15011499        if ( (strcmp (_system_codepage, _display_codepage)) || 
    15021500             (strcmp (_system_codepage, _source_codepage)) ) { 
    1503             if (!auto_fix_codeset) 
    1504             { 
    1505                 st = quick_dialog (&ecs); 
    1506                 if (dont_ask_again) 
    1507                 { 
    1508                     auto_fix_codeset = st == B_ENTER ? 2 : 1; 
    1509                     mc_config_set_int(mc_main_config, "Midnight-Commander", "auto_fix_codeset", auto_fix_codeset); 
    1510                     profile_changed = 1; 
    1511                 } 
    1512             } 
    1513             if (auto_fix_codeset == 2 || st == B_ENTER) { 
     1501            if (quick_dialog (&ecs) == B_ENTER){ 
    15141502                display_codepage = get_codepage_index (_system_codepage); 
    15151503                cp_display = get_codepage_id (display_codepage); 
    15161504                if ( !strcmp (cp_display, _system_codepage)) { 
    static void check_codeset() 
    15221510                    cp_source = cp_display; 
    15231511                    profile_changed = 1; 
    15241512                } 
     1513            } else { 
     1514                if ( skip_check_codeset ) { 
     1515                    mc_config_set_int(mc_main_config, "Midnight-Commander", "skip_check_codeset", 1); 
     1516                    profile_changed = 1; 
     1517                } 
    15251518            } 
    15261519        } 
    15271520        if ( profile_changed ) 
  • src/main.h

    diff -NaurpBb mc-4.7.0-pre1/src/main.h mc-4.7.0-pre1-orig/src/main.h
    old new extern int midnight_shutdown; 
    7979extern char cmd_buf [512]; 
    8080extern const char *shell; 
    8181extern int auto_fill_mkdir_name; 
    82 extern int auto_fix_codeset; 
     82extern int skip_check_codeset; 
    8383/* Ugly hack in order to distinguish between left and right panel in menubar */ 
    8484extern int is_right;            /* If the selected menu was the right */ 
    8585#define MENU_PANEL (is_right ? right_panel : left_panel) 
  • src/setup.c

    diff -NaurpBb mc-4.7.0-pre1/src/setup.c mc-4.7.0-pre1-orig/src/setup.c
    old new static const struct { 
    194194    { "xtree_mode", &xtree_mode }, 
    195195    { "num_history_items_recorded", &num_history_items_recorded }, 
    196196    { "file_op_compute_totals", &file_op_compute_totals }, 
    197     { "auto_fix_codeset", &auto_fix_codeset }, 
     197    { "skip_check_codeset", &skip_check_codeset }, 
    198198#ifdef USE_VFS 
    199199    { "vfs_timeout", &vfs_timeout }, 
    200200#ifdef USE_NETCODE