diff --git a/THANKS b/THANKS index f35d8ada..0535b45b 100644 --- a/THANKS +++ b/THANKS @@ -33,9 +33,9 @@ Philipp Nordhus Andreas Obergrusberger Martin Olsson Robert Park -ritchiew Mario Sanchez Prada Tiago Quelhas +Viko Adi Rahmawan Didier Roche Janosch Rolles Gustavo Rubio @@ -46,4 +46,5 @@ Wolfgang Steitz Jakob Unterwurzacher Colin Walters Alexander Wilms +ritchiew diff --git a/cmake/FindIntltool.cmake b/cmake/FindIntltool.cmake index ac45ce99..85386749 100644 --- a/cmake/FindIntltool.cmake +++ b/cmake/FindIntltool.cmake @@ -26,5 +26,12 @@ if (INTLTOOL_MERGE_FOUND) ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/geary-autostart.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) endmacro (INTLTOOL_MERGE_AUTOSTART_DESKTOP desktop_id po_dir) + macro (INTLTOOL_MERGE_CONTRACT desktop_id po_dir) + add_custom_target (geary-attach.contract ALL + ${INTLTOOL_MERGE_EXECUTABLE} --desktop-style ${CMAKE_SOURCE_DIR}/${po_dir} + ${CMAKE_CURRENT_SOURCE_DIR}/${desktop_id}.contract.in ${desktop_id}.contract + ) + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/geary-attach.contract DESTINATION ${CMAKE_INSTALL_PREFIX}/share/contractor) + endmacro (INTLTOOL_MERGE_CONTRACT desktop_id po_dir) endif (INTLTOOL_MERGE_FOUND) diff --git a/configure b/configure index 4eb7e9d9..3fbbdbfd 100755 --- a/configure +++ b/configure @@ -38,6 +38,8 @@ configure_help() { Disable icon cache update. --disable-documentation Disable generating and installing translated help documentation. + --disable-contractor + Disable installing Contractor files. Some influential environment variables: PKG_CONFIG_PATH Adds directories to pkg-config's search path. @@ -117,6 +119,10 @@ do CMDLINE="${CMDLINE} -DTRANSLATE_HELP=OFF" ;; + --disable-contractor) + CMDLINE="${CMDLINE} -DDISABLE_CONTRACT=ON" + ;; + VALAC) [ ! $value ] && abort $1 VALAC=$value ;; diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt index e37988fe..127911f5 100644 --- a/desktop/CMakeLists.txt +++ b/desktop/CMakeLists.txt @@ -45,3 +45,20 @@ else () ) endif () +if (DISABLE_CONTRACT) + message (STATUS "Install Contractor contract: OFF") +else (DISABLE_CONTRACT) + message (STATUS "Install Contractor contract: ON") + if (INTLTOOL_MERGE_FOUND) + INTLTOOL_MERGE_CONTRACT (geary-attach po) + + if (DESKTOP_VALIDATE) + if (DESKTOP_FILE_VALIDATE_FOUND) + VALIDATE_DESKTOP_FILE (geary-attach) + else (DESKTOP_FILE_VALIDATE_FOUND) + message (FATAL_ERROR "desktop-file-validate must be installed to validate generated .desktop file") + endif (DESKTOP_FILE_VALIDATE_FOUND) + endif (DESKTOP_VALIDATE) + endif (INTLTOOL_MERGE_FOUND) + install (PROGRAMS geary-attach DESTINATION bin) +endif (DISABLE_CONTRACT) diff --git a/desktop/geary-attach b/desktop/geary-attach new file mode 100644 index 00000000..ebc750b5 --- /dev/null +++ b/desktop/geary-attach @@ -0,0 +1,31 @@ +#!/bin/bash + +# This is a wrapper script to attach several files to an email in Geary. +# Written by Viko Adi Rahmawan +# License: 3-clause BSD + +#TODO: define a Gettext domain + +# Disable history substitution on "!" symbols so we can have them in strings +set +H + +if [ -z "$1" ] || [ "$1" = '-h' ] || [ "$1" = '--help' ]; then + echo $"Usage: $0 /path/to/file [/path/to/another/file...] +Relative paths are also supported." + exit 1 # so that calling without parameters is counted as a failure +fi + +#we dont do file checking as geary is clever enough +ARG="mailto:?attachment=$1" #add first file +shift +while [ -n "$1" ]; do + ARG="$ARG&attachment=$1" #add more file if + shift +done + +if [ -n "$ARG" ]; then + # Finally execute geary + geary "${ARG}" +else + exit 1 +fi diff --git a/desktop/geary-attach.contract.in b/desktop/geary-attach.contract.in new file mode 100644 index 00000000..1ebd4f46 --- /dev/null +++ b/desktop/geary-attach.contract.in @@ -0,0 +1,6 @@ +[Contractor Entry] +_Name=Send by email +Icon=mail-send +_Description=Send files using Geary +MimeType=!inode; +Exec=geary-attach %F diff --git a/po/POTFILES.in b/po/POTFILES.in index 32ae9a41..92f9f889 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,7 @@ [encoding: UTF-8] desktop/geary.desktop.in desktop/geary-autostart.desktop.in +desktop/geary-attach.contract.in src/client/accounts/account-dialog-account-list-pane.vala src/client/accounts/account-dialog-add-edit-pane.vala src/client/accounts/account-dialog-pane.vala