Commit fbbbadeb authored by Will Thompson's avatar Will Thompson

Merge branch 'placate-hlint' into 'master'

Placate hlint

See merge request !13
parents 4a69635d 370d9087
Pipeline #11440 passed with stages
in 24 minutes and 22 seconds
......@@ -93,23 +93,19 @@ getDestination (Detailed _ m _ _) = case m of
getErrorName :: Detailed a -> Maybe String
getErrorName (Detailed _ _ _ rm) = case rm of
(D.ReceivedMethodError _ (MethodError { methodErrorName = ErrorName en})) -> Just en
_ -> Nothing
getErrorMessage :: Detailed a
-> Maybe String
getErrorMessage (Detailed _ _ _ (D.ReceivedMethodError _ (MethodError _ _ _ _ body))) =
case D.fromVariant <$> body of
[message] -> message
_ -> Nothing
getErrorMessage _ = Nothing
D.ReceivedMethodError _ MethodError{ methodErrorName = ErrorName en} -> Just en
_ -> Nothing
formatMessage :: Detailed Message -> String
formatMessage (Detailed _ _ _ rm) =
formatArgs $ D.receivedMessageBody rm
case (rm, D.fromVariant <$> body) of
-- Special-case errors, which (are supposed to) have a single
-- human-readable string argument
(D.ReceivedMethodError _ _, [Just message]) -> message
_ -> formatted
where
formatArgs = intercalate "\n" . map (format_Variant VariantStyleSignature)
-- TODO: suppress escaping and type sig for errors, which are always (s)
body = D.receivedMessageBody rm
formatted = intercalate "\n" $ map (format_Variant VariantStyleSignature) body
detailsViewGetTop :: DetailsView -> Widget
detailsViewGetTop = toWidget . detailsGrid
......@@ -117,15 +113,13 @@ detailsViewGetTop = toWidget . detailsGrid
setOptionalRow :: OptionalRow
-> Maybe String
-> IO ()
setOptionalRow (caption, label) s_ = do
case s_ of
Just s -> do
labelSetText label s
widgetShow label
widgetShow caption
Nothing -> do
widgetHide label
widgetHide caption
setOptionalRow (caption, label) (Just s) = do
labelSetText label s
widgetShow label
widgetShow caption
setOptionalRow (caption, label) Nothing = do
widgetHide label
widgetHide caption
detailsViewUpdate :: DetailsView
-> Detailed Message
......@@ -143,8 +137,6 @@ detailsViewUpdate d m = do
labelSetText (detailsPath d) (maybe unknown (D.formatObjectPath . path) member_)
labelSetMarkup (detailsMember d) (maybe unknown getMemberMarkup member_)
textBufferSetText buf $ case getErrorMessage m of
Just message -> message
Nothing -> formatMessage m
textBufferSetText buf (formatMessage m)
where
unknown = ""
Name: bustle
Category: Network, Desktop
Version: 0.7.4
Version: 0.7.4.1
Cabal-Version: 2.0
Tested-With: GHC == 8.4.3
Synopsis: Draw sequence diagrams of D-Bus traffic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment