gnome: add autostart functionality
Autostart is enabled by creating a symlink to gnome-ring.desktop
in $XDG_CONFIG_HOME/autostart (this is supported by all XDG
compliant desktop environments.
This is enabled by default and will be done the first time the
client is launched and the setting is checked on every launch.
This patch also adds a GSettings schema for the client to keep
track of the client settings (for now just the autostart enabled).
To support non-installed builds, the gschema is compiled to the
directory of the binary by default. The client first checks for
the .desktop and the compiled gschema in the local directory of
the binary.
A patch is required in the packaging branch to support the new
functionality.
Refs #74056
Change-Id: Ife9c8149e3225ab765dc1d2472ca0fd44ad35691
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d1a19f..a876fa6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,8 +25,9 @@
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
-# the GResources.cmake module isn't automatically detected
+# include custom cmake modules
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GResources.cmake)
+INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GSettings.cmake)
# make sure we're using Qt5
SET(ENABLE_QT5 true)
@@ -207,6 +208,8 @@
src/ringnotify.cpp
src/video/videowindow.h
src/video/videowindow.cpp
+ src/utils/files.h
+ src/utils/files.cpp
)
# compile glib resource files to c code
@@ -224,7 +227,10 @@
# FIND_PACKAGE ( Gettext REQUIRED )
# ADD_SUBDIRECTORY( po )
-ADD_EXECUTABLE(gnome-ring ${GLIB_RESOURCES_RING} ${SRC_FILES})
+# install and compile glib gsettings schema
+add_schema("cx.ring.RingGnome.gschema.xml" GSCHEMA_RING)
+
+ADD_EXECUTABLE(gnome-ring ${GLIB_RESOURCES_RING} ${GSCHEMA_RING} ${SRC_FILES})
IF(NOT ${ENABLE_STATIC} MATCHES false)
TARGET_LINK_LIBRARIES(gnome-ring
@@ -274,10 +280,23 @@
RUNTIME DESTINATION bin
)
+# install .desktop in XDG desktop dir so that it is recognized by the system
INSTALL(FILES ${PROJECT_BINARY_DIR}/gnome-ring.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
)
+# install .desktop in the gnome-ring data dir, so that it can be copied to the
+# autostart dir by the client
+INSTALL(FILES ${PROJECT_BINARY_DIR}/gnome-ring.desktop
+ DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/share/gnome-ring/
+ PERMISSIONS
+ WORLD_READ
+ OWNER_WRITE
+ OWNER_READ
+ GROUP_READ
+)
+
INSTALL(FILES pixmaps/ring.svg
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
)
@@ -302,7 +321,6 @@
WORLD_EXECUTE
)
-
# add a target to generate API documentation with Doxygen
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)