[geary/geary-0.8] Contractor support: Bug #734717



commit 33a29bec8680d0033fa8bdb22b5b33dd8db60e3a
Author: Viko Adi Rahmawan <vikoadi gmail com>
Date:   Fri Oct 10 14:51:05 2014 -0700

    Contractor support: Bug #734717

 THANKS                           |    3 ++-
 cmake/FindIntltool.cmake         |    7 +++++++
 configure                        |    6 ++++++
 desktop/CMakeLists.txt           |   17 +++++++++++++++++
 desktop/geary-attach             |   31 +++++++++++++++++++++++++++++++
 desktop/geary-attach.contract.in |    6 ++++++
 po/POTFILES.in                   |    1 +
 7 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/THANKS b/THANKS
index f35d8ad..0535b45 100644
--- a/THANKS
+++ b/THANKS
@@ -33,9 +33,9 @@ Philipp Nordhus <philipp nhus de>
 Andreas Obergrusberger <tradiaz yahoo de>
 Martin Olsson <martin minimum se>
 Robert Park <rbpark exolucere ca>
-ritchiew <rawilson52 gmail com>
 Mario Sanchez Prada <msanchez igalia com>
 Tiago Quelhas <tiagoq gmail com>
+Viko Adi Rahmawan <vikoadi gmail com>
 Didier Roche <didrocks ubuntu com>
 Janosch Rolles <janosch rolles org>
 Gustavo Rubio <gus ahivamos net>
@@ -46,4 +46,5 @@ Wolfgang Steitz <wolfer7 web de>
 Jakob Unterwurzacher <jakobunt gmail com>
 Colin Walters <walters verbum org>
 Alexander Wilms <alexander wilms zoho com>
+ritchiew <rawilson52 gmail com>
 
diff --git a/cmake/FindIntltool.cmake b/cmake/FindIntltool.cmake
index ac45ce9..8538674 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 4eb7e9d..3fbbdbf 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 e37988f..127911f 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 0000000..ebc750b
--- /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 <vikoadi gmail com>
+# 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 0000000..1ebd4f4
--- /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 32ae9a4..92f9f88 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]