Add Ring systray icon

This adds an icon in the notification areas (systray) by default.
The icon also has a popup menu which allows the user to show or hide
the main widow and to quit Ring.

It uses 2 systray icon implementations:
- AppIndicator from Canonical
- GtkStatusIcon from Gtk, but deprecated

A CMakeLists option is added "USE_APPINDICATOR" and is ON by default.
However this adds a dependency on appindicator3-0.1. If the option is
set to OFF or the dependency is not found then we fallback on using
GtkStatusIcon.

AppIndicator is prefered so that the status icon appears for Unity
users, as unity does not support GtkStatusIcon by default.

Additionaly, the GSettings schema has been modified slightly. The
general Ring settings menu also now says has the option "Show Ring
icon in the notification area (systray)" instead of of "Hide Ring
on close instead of quitting". This mimics other gtk app behavior,
such as Transmission. When the systray is enabled, closing the main
window will not quit Ring. When the systray is disabled closing the
main window will quit Ring so that it doesn't continue to run
withou the user being aware.

Tuleap: #370
Change-Id: I9f5c2811e135d20b0b6c81ab4a80be748f6a1be3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7090cd9..0622c8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,7 @@
    FIND_PACKAGE(LibRingClient REQUIRED)
 ENDIF(LibRingClient_PROJECT_DIR)
 
+OPTION(USE_APPINDICATOR "Use AppIndicator instead of GtkStatusIcon for the systray (if appindicator3-0.1 is found)" ON)
 
 # find packages
 FIND_PACKAGE(PkgConfig REQUIRED)
@@ -78,6 +79,17 @@
 FIND_PACKAGE(Gettext) #optional for translations
 PKG_CHECK_MODULES(LIBQRENCODE libqrencode>=3.4)
 
+IF(USE_APPINDICATOR)
+    PKG_CHECK_MODULES(APPINDICATOR appindicator3-0.1) #optional
+    IF(APPINDICATOR_FOUND)
+        SET(HAVE_APPINDICATOR 1)
+    ELSE()
+        SET(HAVE_APPINDICATOR 0)
+    ENDIF()
+ELSE()
+    SET(HAVE_APPINDICATOR 0)
+ENDIF(USE_APPINDICATOR)
+
 IF( LIBQRENCODE_FOUND )
     MESSAGE(STATUS "Found libqrencode version >= 3.4: " ${LIBQRENCODE_VERSION})
 ELSE()
@@ -106,6 +118,7 @@
 INCLUDE_DIRECTORIES(${CLUTTERGTK_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${EBOOK_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${LIBNOTIFY_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${APPINDICATOR_INCLUDE_DIRS})
 
 # link libs
 LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
@@ -115,6 +128,7 @@
 LINK_DIRECTORIES(${CLUTTERGTK_LIBRARY_DIRS})
 LINK_DIRECTORIES(${EBOOK_LIBRARY_DIRS})
 LINK_DIRECTORIES(${LIBNOTIFY_LIBRARY_DIRS})
+LINK_DIRECTORIES(${APPINDICATOR_LIBRARY_DIRS})
 
 # lib compiler flags
 ADD_DEFINITIONS(${GTK3_CFLAGS})
@@ -125,6 +139,7 @@
 ADD_DEFINITIONS(${CLUTTERGTK_CFLAGS})
 ADD_DEFINITIONS(${EBOOK_CFLAGS})
 ADD_DEFINITIONS(${LIBNOTIFY_CFLAGS})
+ADD_DEFINITIONS(${APPINDICATOR_CFLAGS})
 
 IF(NOT ${ENABLE_STATIC} MATCHES false)
   SET(QT5_MODULE_PATH ${QT5_PATH}/lib/cmake)
@@ -351,6 +366,7 @@
    ${CLUTTERGTK_LIBRARIES}
    ${EBOOK_LIBRARIES}
    ${LIBNOTIFY_LIBRARIES}
+   ${APPINDICATOR_LIBRARIES}
    -lpthread
    -lrt
    -lqrencode
@@ -364,6 +380,7 @@
    ${CLUTTERGTK_LIBRARIES}
    ${EBOOK_LIBRARIES}
    ${LIBNOTIFY_LIBRARIES}
+   ${APPINDICATOR_LIBRARIES}
    -lqrencode
    )
 ENDIF()