newPackageDialog :: Window -> FilePath -> IO (Maybe NewPackage)
newPackageDialog parent workspaceDir = do
    dia                        <-   dialogNew
    set dia [ windowTransientFor := parent
            , windowTitle := (__ "Create New Package") ]
#ifdef MIN_VERSION_gtk3
    upper                      <-   dialogGetContentArea dia
#else
    upper                      <-   dialogGetUpper dia
#endif
    lower                      <-   dialogGetActionArea dia
    (widget,inj,ext,_)         <-   buildEditor (packageFields workspaceDir)
                                        (NewPackage "" workspaceDir Nothing)
    okButton <- dialogAddButton dia (__"Create Package") ResponseOk
    dialogAddButton dia (__"Cancel") ResponseCancel
    boxPackStart (castToBox upper) widget PackGrow 7
    set okButton [widgetCanDefault := True]
    widgetGrabDefault okButton
    widgetShowAll dia
    resp  <- dialogRun dia
    value <- ext (NewPackage "" workspaceDir Nothing)
    widgetDestroy dia
    --find
    case resp of
        ResponseOk    -> return value
        _             -> return Nothing
newPackageDialog :: Window -> FilePath -> IO (Maybe NewPackage)
newPackageDialog parent workspaceDir = do
    dia                        <-   dialogNew
    set dia [ windowTransientFor := parent
            , windowTitle := (__ "Create New Package") ]
#ifdef MIN_VERSION_gtk3
    upper                      <-   dialogGetContentArea dia
#else
    upper                      <-   dialogGetUpper dia
#endif
    lower                      <-   dialogGetActionArea dia
    (widget,inj,ext,_)         <-   buildEditor (packageFields workspaceDir)
                                        (NewPackage "" workspaceDir Nothing)
    okButton <- dialogAddButton dia (__"Create Package") ResponseOk
    dialogAddButton dia (__"Cancel") ResponseCancel
    boxPackStart (castToBox upper) widget PackGrow 7
    set okButton [widgetCanDefault := True]
    widgetGrabDefault okButton
    widgetShowAll dia
    resp  <- dialogRun dia
    value <- ext (NewPackage "" workspaceDir Nothing)
    widgetDestroy dia
    --find
    case resp of
        ResponseOk    -> return value
        _             -> return Nothing
newPackageDialog parent workspaceDir = do
    dia                        <-   dialogNew
    set dia [ windowTransientFor := parent
            , windowTitle := (__ "Create New Package") ]
#ifdef MIN_VERSION_gtk3
    upper                      <-   dialogGetContentArea dia
#else
    upper                      <-   dialogGetUpper dia
#endif
    lower                      <-   dialogGetActionArea dia
    (widget,inj,ext,_)         <-   buildEditor (packageFields workspaceDir)
                                        (NewPackage "" workspaceDir Nothing)
    okButton <- dialogAddButton dia (__"Create Package") ResponseOk
    dialogAddButton dia (__"Cancel") ResponseCancel
    boxPackStart (castToBox upper) widget PackGrow 7
    set okButton [widgetCanDefault := True]
    widgetGrabDefault okButton
    widgetShowAll dia
    resp  <- dialogRun dia
    value <- ext (NewPackage "" workspaceDir Nothing)
    widgetDestroy dia
    --find
    case resp of
        ResponseOk    -> return value
        _             -> return Nothing