Show
Ignore:
Timestamp:
05/04/08 18:42:55 (4 years ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

reverted char[] to String

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/widgets/FileDialog.d

    r200 r238  
    4444 */ 
    4545public class FileDialog : Dialog { 
    46     char[] [] filterNames; 
    47     char[] [] filterExtensions; 
    48     char[] filterPath = ""; 
    49     char[] fileName = ""; 
    50     char[][] fileNames; 
    51     char[] fullPath = ""; 
     46    String [] filterNames; 
     47    String [] filterExtensions; 
     48    String filterPath = ""; 
     49    String fileName = ""; 
     50    String[] fileNames; 
     51    String fullPath = ""; 
    5252    GtkWidget* handle; 
    5353    static final char SEPARATOR = tango.io.FileConst.FileConst.PathSeparatorChar; 
     
    9898    checkSubclass (); 
    9999} 
    100 char[] computeResultChooserDialog () { 
     100String computeResultChooserDialog () { 
    101101    /* MULTI is only valid if the native dialog's action is Open */ 
    102102    fullPath = null; 
     
    104104        auto list = OS.gtk_file_chooser_get_filenames (handle); 
    105105        int listLength = OS.g_slist_length (list); 
    106         fileNames = new char[] [listLength]; 
     106        fileNames = new String [listLength]; 
    107107        auto current = list; 
    108108        int writePos = 0; 
     
    122122        } 
    123123        if (writePos !is 0 && writePos !is listLength) { 
    124             char[] [] validFileNames = new char[] [writePos]; 
     124            String [] validFileNames = new String [writePos]; 
    125125            System.arraycopy (fileNames, 0, validFileNames, 0, writePos); 
    126126            fileNames = validFileNames; 
     
    135135            if (utf8Ptr !is null) { 
    136136                fullPath = utf8Ptr[ 0 .. items_written ].dup; 
    137                 fileNames = new char[] [1]; 
     137                fileNames = new String [1]; 
    138138                int start = tango.text.Util.locatePrior( fullPath, SEPARATOR); 
    139139                if( start == fullPath.length ) start = -1; 
     
    151151    return fullPath; 
    152152} 
    153 char[] computeResultClassicDialog () { 
     153String computeResultClassicDialog () { 
    154154    GtkFileSelection* selection = cast(GtkFileSelection*)handle; 
    155155    auto entry = selection.selection_entry; 
    156156    auto entryText = OS.gtk_entry_get_text (entry); 
    157     char[] txt = tango.stdc.stringz.fromStringz( entryText ); 
     157    String txt = tango.stdc.stringz.fromStringz( entryText ); 
    158158    if (txt.length is 0) { 
    159159        auto fileList = selection.file_list; 
     
    185185    uint items_written; 
    186186    auto utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, &items_written, null); 
    187     char[] osAnswer = utf8Ptr[ 0 .. items_written ].dup; 
     187    String osAnswer = utf8Ptr[ 0 .. items_written ].dup; 
    188188    OS.g_free (utf8Ptr); 
    189189 
     
    193193    if (separatorIndex+1 is osAnswer.length ) return null; 
    194194 
    195     char[] answer = fullPath = osAnswer; 
     195    String answer = fullPath = osAnswer; 
    196196    fileName = fullPath[ separatorIndex+1 .. $ ]; 
    197197    filterPath = fullPath[ 0 .. separatorIndex ]; 
     
    207207            namePtr = namesPtr1[length_]; 
    208208        } 
    209         fileNames = new char[][](length_); 
     209        fileNames = new String[](length_); 
    210210        for (int i = 0; i < length_; i++) { 
    211211            utf8Ptr = OS.g_filename_to_utf8 (namesPtr [i], -1, null, &items_written, null); 
    212             char[] name = utf8Ptr[ 0 .. items_written ].dup; 
     212            String name = utf8Ptr[ 0 .. items_written ].dup; 
    213213            int start = tango.text.Util.locatePrior( name, SEPARATOR); 
    214214            if( start == name.length ) start = -1; 
     
    227227 * @return the relative path of the file 
    228228 */ 
    229 public char[] getFileName () { 
     229public String getFileName () { 
    230230    return fileName; 
    231231} 
     
    236236 * @return the relative paths of the files 
    237237 */ 
    238 public char[] [] getFileNames () { 
     238public String [] getFileNames () { 
    239239    return fileNames; 
    240240} 
     
    245245 * @return the file extensions filter 
    246246 */ 
    247 public char[] [] getFilterExtensions () { 
     247public String [] getFilterExtensions () { 
    248248    return filterExtensions; 
    249249} 
     
    254254 * @return the list of filter names 
    255255 */ 
    256 public char[] [] getFilterNames () { 
     256public String [] getFilterNames () { 
    257257    return filterNames; 
    258258} 
     
    266266 * @see #setFilterExtensions 
    267267 */ 
    268 public char[] getFilterPath () { 
     268public String getFilterPath () { 
    269269    return filterPath; 
    270270} 
     
    281281 * </ul> 
    282282 */ 
    283 public char[] open () { 
     283public String open () { 
    284284    bool useChooserDialog = OS.GTK_VERSION >= OS.buildVERSION (2, 4, 10); 
    285285    if (useChooserDialog) { 
     
    289289    } 
    290290} 
    291 char[] openChooserDialog () { 
     291String openChooserDialog () { 
    292292    char* titleBytes = tango.stdc.stringz.toStringz( title ); 
    293293    int action = (style & DWT.SAVE) !is 0 ? 
     
    309309    Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); 
    310310    display.addIdleProc (); 
    311     char[] answer = null; 
     311    String answer = null; 
    312312    if (OS.gtk_dialog_run (handle) is OS.GTK_RESPONSE_OK) { 
    313313        answer = computeResultChooserDialog (); 
     
    317317    return answer; 
    318318} 
    319 char[] openClassicDialog () { 
     319String openClassicDialog () { 
    320320    char* titleBytes = tango.stdc.stringz.toStringz( title ); 
    321321    handle = OS.gtk_file_selection_new (titleBytes); 
     
    332332    Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); 
    333333    display.addIdleProc (); 
    334     char[] answer = null; 
     334    String answer = null; 
    335335    if (OS.gtk_dialog_run (handle) is OS.GTK_RESPONSE_OK) { 
    336336        answer = computeResultClassicDialog (); 
     
    412412            int index = tango.text.Util.locate( filterExtensions [i], EXTENSION_SEPARATOR ); 
    413413            while (index !is filterExtensions [i].length ) { 
    414                 char[] current = filterExtensions [i][ start .. index ]; 
     414                String current = filterExtensions [i][ start .. index ]; 
    415415                char* filterString = tango.stdc.stringz.toStringz(current); 
    416416                OS.gtk_file_filter_add_pattern (filter, filterString); 
     
    418418                index = tango.text.Util.locate( filterExtensions [i], EXTENSION_SEPARATOR, start); 
    419419            } 
    420             char[] current = filterExtensions [i][ start .. $ ]; 
     420            String current = filterExtensions [i][ start .. $ ]; 
    421421            char* filterString = tango.stdc.stringz.toStringz(current); 
    422422            OS.gtk_file_filter_add_pattern (filter, filterString); 
     
    465465 * @param string the file name 
    466466 */ 
    467 public void setFileName (char[] string) { 
     467public void setFileName (String string) { 
    468468    fileName = string; 
    469469} 
     
    483483 * names corresponding to the extensions 
    484484 */ 
    485 public void setFilterExtensions (char[] [] extensions) { 
     485public void setFilterExtensions (String [] extensions) { 
    486486    filterExtensions = extensions; 
    487487} 
     
    500500 * @see #setFilterExtensions 
    501501 */ 
    502 public void setFilterNames (char[] [] names) { 
     502public void setFilterNames (String [] names) { 
    503503    filterNames = names; 
    504504} 
     
    520520 * @see #setFilterExtensions 
    521521 */ 
    522 public void setFilterPath (char[] string) { 
     522public void setFilterPath (String string) { 
    523523    filterPath = string; 
    524524}