Mercurial > projects > dwt-linux
diff dwt/widgets/DirectoryDialog.d @ 255:5a30aa9820f3
removed tango.stdc.stringz imports and allow null for arrays and string arguments.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 15 Jun 2008 22:32:20 +0200 |
parents | ce446666f5a2 |
children | c0d810de7093 |
line wrap: on
line diff
--- a/dwt/widgets/DirectoryDialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/DirectoryDialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -24,7 +24,6 @@ import dwt.widgets.Display; static import tango.io.FileConst; -static import tango.stdc.stringz; static import tango.text.Util; /** @@ -131,7 +130,7 @@ } } String openChooserDialog () { - char* titleBytes = tango.stdc.stringz.toStringz(title); + char* titleBytes = toStringz(title); auto shellHandle = parent.topHandle (); auto handle = OS.gtk_file_chooser_dialog_new2 ( titleBytes, @@ -154,7 +153,7 @@ else{ p = filterPath; } - char* buffer = tango.stdc.stringz.toStringz(p); + char* buffer = toStringz(p); /* * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6 * when setting a file name that is not a true canonical path. @@ -167,7 +166,7 @@ } } if (message.length > 0) { - char* buffer = tango.stdc.stringz.toStringz(message); + char* buffer = toStringz(message); auto box = OS.gtk_hbox_new (false, 0); if (box is null) error (DWT.ERROR_NO_HANDLES); auto label = OS.gtk_label_new (buffer); @@ -220,7 +219,7 @@ return answer; } String openClassicDialog () { - char* titleBytes = tango.stdc.stringz.toStringz(title); + char* titleBytes = toStringz(title); auto handle = OS.gtk_file_selection_new (titleBytes); if (parent !is null) { auto shellHandle = parent.topHandle (); @@ -237,7 +236,7 @@ if (path.length > 0 && path[ $-1 .. $ ] != SEPARATOR ) { path ~= SEPARATOR; } - char* fileNamePtr = OS.g_filename_from_utf8 (tango.stdc.stringz.toStringz(path), -1, null, null, null); + char* fileNamePtr = OS.g_filename_from_utf8 (toStringz(path), -1, null, null, null); OS.gtk_file_selection_set_filename (handle, fileNamePtr); OS.g_free (fileNamePtr); } @@ -247,7 +246,7 @@ OS.gtk_widget_hide (selection.file_list); OS.gtk_widget_hide (fileListParent); if (message.length > 0) { - auto labelHandle = OS.gtk_label_new (tango.stdc.stringz.toStringz(message)); + auto labelHandle = OS.gtk_label_new (toStringz(message)); OS.gtk_label_set_line_wrap (labelHandle, true); OS.gtk_misc_set_alignment (labelHandle, 0.0f, 0.0f); OS.gtk_container_add (selection.main_vbox, labelHandle); @@ -321,12 +320,10 @@ * * @param string the message * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> */ public void setMessage (String string) { - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string.dup; } }