summaryrefslogtreecommitdiff
path: root/flatpak-evolution-wrapper.sh.in
blob: 1b42f20ca17037d251657c10fda0acc8ae3e1b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

if [ "$1" = "--quit" -o "$1" = "--force-shutdown" ]; then
   /app/bin/evolution.bin "$@"
else
   export BOGOFILTER_DIR="${XDG_DATA_HOME}/bogofilter/"
   export GIO_USE_NETWORK_MONITOR=base
   export WEBKIT_FORCE_SANDBOX=0
   gsettings reset org.gnome.evolution-data-server network-monitor-gio-name

   LINES=$(gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep @SOURCES_SERVICE@ | wc -l)
   if [ "${LINES}" = "0" ]; then
      /app/libexec/evolution-source-registry &
      gdbus wait --session --timeout=1@TIMEOUTMULT@ @SOURCES_SERVICE@
   fi

   LINES=$(gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep @ADDRESSBOOK_SERVICE@ | wc -l)
   if [ "${LINES}" = "0" ]; then
      /app/libexec/evolution-addressbook-factory -r &
      gdbus wait --session --timeout=1@TIMEOUTMULT@ @ADDRESSBOOK_SERVICE@
   fi

   LINES=$(gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep @CALENDAR_SERVICE@ | wc -l)
   if [ "${LINES}" = "0" ]; then
      /app/libexec/evolution-calendar-factory -r &
      gdbus wait --session --timeout=1@TIMEOUTMULT@ @CALENDAR_SERVICE@
   fi

   /app/bin/evolution.bin "$@"
fi