Changeset 3461 for trunk/jons-gtk2-gui

Show
Ignore:
Timestamp:
04/27/03 03:35:26 (6 years ago)
Author:
bostjanlah
Message:

Get those tabs sorted out

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jons-gtk2-gui/src/utilities.cpp

    r3432 r3461  
    2929{ 
    3030    if (input_text == NULL) 
    31     return NULL; 
    32    
    33   if (input_text[0] == 0) 
    34     return g_strdup(input_text); 
    35      
    36   size_t len = strlen(input_text); 
    37   if (!g_utf8_validate(input_text, len, NULL)) { 
    38     gsize b_in, b_out; 
     31        return NULL; 
     32     
     33    if (input_text[0] == 0) 
     34        return g_strdup(input_text); 
     35       
     36    size_t len = strlen(input_text); 
     37    if (!g_utf8_validate(input_text, len, NULL)) { 
     38        gsize b_in, b_out; 
    3939        if (input_enc != NULL && *input_enc != 0 &&  
    40             strcasecmp(input_enc, "UTF-8") != 0) 
    41             return g_convert(input_text, len, "UTF-8", input_enc, &b_in, &b_out, 
    42             NULL); 
     40                strcasecmp(input_enc, "UTF-8") != 0) 
     41            return g_convert(input_text, len, "UTF-8", input_enc, &b_in, &b_out, NULL); 
    4342        else { 
    4443            const char *cs; 
    4544            if (g_get_charset(&cs) || strcmp(cs, "ANSI_X3.4-1968") == 0)  
    46         // locale is either already utf8 or ASCII so conversion won't help  
     45                // locale is either already utf8 or ASCII so conversion won't help  
    4746                // - we use fallback character set - iso8859-1 
    4847                return g_convert(input_text, len, "UTF-8", "ISO8859-1", &b_in, &b_out, 
    49                 NULL); 
     48                NULL); 
    5049            else 
    5150                return g_convert(input_text, len, "UTF-8", cs, &b_in, &b_out, NULL); 
    5251        } 
    5352    } 
    54      
    5553    return g_strdup(input_text); 
    5654} 
     
    6058{ 
    6159    if (input_text == NULL) 
    62     return NULL; 
    63    
    64   if (input_text[0] == 0) 
    65     return g_strdup(input_text); 
    66      
    67   size_t len = strlen(input_text); 
     60        return NULL; 
     61     
     62    if (input_text[0] == 0) 
     63        return g_strdup(input_text); 
     64       
     65    size_t len = strlen(input_text); 
    6866 
    69   gsize b_in, b_out; 
    70     if (output_enc != NULL && *output_enc != 0 && 
     67    gsize b_in, b_out; 
     68    if (output_enc != NULL && *output_enc != 0 &&  
    7169            strcasecmp(output_enc, "UTF-8") != 0) 
    72         return g_convert(input_text, len,  
    73                 output_enc, "UTF-8", &b_in, &b_out, NULL); 
     70        return g_convert(input_text, len, output_enc, "UTF-8", &b_in, &b_out, NULL); 
    7471    else { 
    7572        const char *cs; 
    7673        if (g_get_charset(&cs))  
    77       // locale is already utf8 so conversion won't help - we use  
    78       // fallback character set - iso8859-1 
    79             return g_convert(input_text, len,   
    80                     "ISO8859-1", "UTF-8", &b_in, &b_out, NULL); 
     74            // locale is already utf8 so conversion won't help - we use  
     75            // fallback character set - iso8859-1 
     76            return g_convert(input_text, len,  "ISO8859-1", "UTF-8", &b_in, &b_out, 
     77                    NULL); 
    8178        else 
    82             return g_convert(input_text, len,  
    83                     cs, "UTF-8", &b_in, &b_out, NULL); 
     79            return g_convert(input_text, len, cs, "UTF-8", &b_in, &b_out, NULL); 
    8480    } 
    85      
    8681    return g_strdup(input_text); 
    8782} 
     
    125120{ 
    126121    GtkTextBuffer *tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)); 
    127   GtkTextIter b, e; 
    128   gtk_text_buffer_get_start_iter(tb, &b); 
    129   gtk_text_buffer_get_end_iter(tb, &e); 
    130      
     122    GtkTextIter b, e; 
     123    gtk_text_buffer_get_start_iter(tb, &b); 
     124    gtk_text_buffer_get_end_iter(tb, &e); 
    131125    gchar *txt = gtk_text_buffer_get_text(tb, &b, &e, FALSE); 
    132126    if (txt != NULL && *txt != 0) { 
     
    144138    gtk_button_box_set_layout(GTK_BUTTON_BOX(h_box), layout_style); 
    145139    gtk_box_set_spacing(GTK_BOX(h_box), spacing); 
    146    
    147   return h_box; 
     140     
     141    return h_box; 
    148142} 
    149143 
    150144encoding encodings[] = { 
    151   {"Unicode", "UTF-8"}, 
    152   {"Arabic", "ISO8859-6"}, 
    153   {"Arabic", "CP1256"}, 
    154   {"Baltic", "ISO8859-13"}, 
    155   {"Baltic", "CP1257"}, 
    156   {"Central European", "ISO8859-2"}, 
    157   {"Central European", "CP1250"}, 
    158   {"Chinese", "GBK"}, 
    159   {"Chinese Traditional", "Big5"}, 
    160   {"Cyrillic", "ISO8859-5"}, 
    161   {"Cyrillic", "KOI8-R"}, 
    162   {"Cyrillic", "CP1251"}, 
    163   {"Esperanto", "ISO8859-3"}, 
    164   {"Greek", "ISO8859-7"}, 
    165   {"Greek", "CP1253"}, 
    166   {"Hebrew", "ISO8859-8-I"}, 
    167   {"Hebrew", "CP1255"}, 
    168   {"Japanese", "Shift-JIS"}, 
    169   {"Japanese", "JIS7"}, 
    170   {"Japanese", "eucJP"}, 
    171   {"Korean", "eucKR"}, 
    172   {"Western European", "ISO8859-1"}, 
    173   {"Western European", "ISO8859-15"}, 
    174   {"Western European", "CP1252"}, 
    175   {"Tamil", "TSCII"}, 
    176   {"Thai", "TIS-620"}, 
    177   {"Turkish", "ISO8859-9"}, 
    178   {"Turkish", "CP1254"}, 
    179   {"Ukrainian", "KOI8-U"}, 
    180   {0, 0}}; // end marker 
     145    {"Unicode", "UTF-8"}, 
     146    {"Arabic", "ISO8859-6"}, 
     147    {"Arabic", "CP1256"}, 
     148    {"Baltic", "ISO8859-13"}, 
     149    {"Baltic", "CP1257"}, 
     150    {"Central European", "ISO8859-2"}, 
     151    {"Central European", "CP1250"}, 
     152    {"Chinese", "GBK"}, 
     153    {"Chinese Traditional", "Big5"}, 
     154    {"Cyrillic", "ISO8859-5"}, 
     155    {"Cyrillic", "KOI8-R"}, 
     156    {"Cyrillic", "CP1251"}, 
     157    {"Esperanto", "ISO8859-3"}, 
     158    {"Greek", "ISO8859-7"}, 
     159    {"Greek", "CP1253"}, 
     160    {"Hebrew", "ISO8859-8-I"}, 
     161    {"Hebrew", "CP1255"}, 
     162    {"Japanese", "Shift-JIS"}, 
     163    {"Japanese", "JIS7"}, 
     164    {"Japanese", "eucJP"}, 
     165    {"Korean", "eucKR"}, 
     166    {"Western European", "ISO8859-1"}, 
     167    {"Western European", "ISO8859-15"}, 
     168    {"Western European", "CP1252"}, 
     169    {"Tamil", "TSCII"}, 
     170    {"Thai", "TIS-620"}, 
     171    {"Turkish", "ISO8859-9"}, 
     172    {"Turkish", "CP1254"}, 
     173    {"Ukrainian", "KOI8-U"}, 
     174    {0, 0}}; // end marker