diff options
author | Joey Hess <joey@kitenet.net> | 2013-07-09 20:50:41 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-07-09 20:50:41 -0400 |
commit | 68b3beefd87468204a8d8252d3487fae95b43f80 (patch) | |
tree | d43f937f543e7601e7952154fe434d9df148e36a /Assistant | |
parent | d6922be2d1cac20b58750e1a76a3db684b8cca01 (diff) |
linux standalone auto-install icons
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Install.hs | 5 | ||||
-rw-r--r-- | Assistant/Install/Menu.hs | 24 |
2 files changed, 23 insertions, 6 deletions
diff --git a/Assistant/Install.hs b/Assistant/Install.hs index 3c7d09698..dee1b5be3 100644 --- a/Assistant/Install.hs +++ b/Assistant/Install.hs @@ -49,8 +49,9 @@ ensureInstalled = go =<< standaloneAppBase #ifdef darwin_HOST_OS autostartfile <- userAutoStart osxAutoStartLabel #else - installMenu program - =<< desktopMenuFilePath "git-annex" <$> userDataDir + menufile <- desktopMenuFilePath "git-annex" <$> userDataDir + icondir <- iconDir <$> userDataDir + installMenu program menufile base icondir autostartfile <- autoStartPath "git-annex" <$> userConfigDir #endif installAutoStart program autostartfile diff --git a/Assistant/Install/Menu.hs b/Assistant/Install/Menu.hs index 940a2b32c..41ec855b6 100644 --- a/Assistant/Install/Menu.hs +++ b/Assistant/Install/Menu.hs @@ -9,14 +9,20 @@ module Assistant.Install.Menu where +import Common + import Utility.FreeDesktop -installMenu :: FilePath -> FilePath -> IO () -installMenu command file = +installMenu :: FilePath -> FilePath -> FilePath -> FilePath -> IO () +installMenu command menufile iconsrcdir icondir = do #ifdef darwin_HOST_OS return () #else - writeDesktopMenuFile (fdoDesktopMenu command) file + writeDesktopMenuFile (fdoDesktopMenu command) menufile + installIcon (iconsrcdir </> "logo.svg") $ + iconFilePath (iconBaseName ++ ".svg") "scalable" icondir + installIcon (iconsrcdir </> "favicon.png") $ + iconFilePath (iconBaseName ++ ".png") "16x16" icondir #endif {- The command can be either just "git-annex", or the full path to use @@ -27,5 +33,15 @@ fdoDesktopMenu command = genDesktopEntry "Track and sync the files in your Git Annex" False (command ++ " webapp") - (Just "git-annex") -- icon base name + (Just iconBaseName) ["Network", "FileTransfer"] + +installIcon :: FilePath -> FilePath -> IO () +installIcon src dest = do + createDirectoryIfMissing True (parentDir dest) + withBinaryFile src ReadMode $ \hin -> + withBinaryFile dest WriteMode $ \hout -> + hGetContents hin >>= hPutStr hout + +iconBaseName :: String +iconBaseName = "git-annex" |