
###########################
# Lomiri-indicator-network service
###########################

set(
  INDICATOR_DIR
  "${CMAKE_INSTALL_DATADIR}/unity/indicators"
  CACHE FILEPATH "Indicator directory"
)

install(
  FILES "com.lomiri.indicator.network"
  DESTINATION "${INDICATOR_DIR}"
)

###########################
# Lomiri-indicator-network systemd jobs
###########################

# Uncomment when we drop Vivid
# pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)
set (SYSTEMD_USER_DIR "/usr/lib/systemd/user")
message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir")

set(
  AGENT_SERVICE
  "${CMAKE_INSTALL_FULL_LIBEXECDIR}/lomiri-indicator-network/lomiri-indicator-network-secret-agent"
)

configure_file (
  lomiri-indicator-network-secret-agent.service.in
  lomiri-indicator-network-secret-agent.service
  @ONLY
)

set(
  NETWORK_SERVICE
  "${CMAKE_INSTALL_FULL_LIBEXECDIR}/lomiri-indicator-network/lomiri-indicator-network-service"
)

configure_file (
  lomiri-indicator-network.service.in
  lomiri-indicator-network.service
  @ONLY
)

install (
  FILES "${CMAKE_CURRENT_BINARY_DIR}/lomiri-indicator-network-secret-agent.service"
  DESTINATION ${SYSTEMD_USER_DIR}
)

install (
  FILES "${CMAKE_CURRENT_BINARY_DIR}/lomiri-indicator-network.service"
  DESTINATION ${SYSTEMD_USER_DIR}
)

###########################
# GSettings
###########################

add_schema ("com.lomiri.indicator.network.gschema.xml")

###########################
# XDG Autostart File
###########################

# where to install
set (XDG_AUTOSTART_DIR "/etc/xdg/autostart")
message (STATUS "${XDG_AUTOSTART_DIR} is the DBus Service File install dir")

set (XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.desktop")
set (XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${XDG_AUTOSTART_NAME}")
set (XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${XDG_AUTOSTART_NAME}.in")

# build it
set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
configure_file ("${XDG_AUTOSTART_FILE_IN}" "${XDG_AUTOSTART_FILE}")

# install it
install (FILES "${XDG_AUTOSTART_FILE}"
         DESTINATION "${XDG_AUTOSTART_DIR}")
