aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--CMakeLists.txt1
-rw-r--r--data/CMakeLists.txt20
-rw-r--r--data/com.canonical.indicator.datetime2
-rw-r--r--data/indicator-datetime.conf.in3
-rw-r--r--data/indicator-datetime.desktop.in4
-rw-r--r--data/indicator-datetime.upstart.desktop.in9
-rw-r--r--debian/control11
-rwxr-xr-xdebian/rules7
-rw-r--r--src/actions.cpp5
-rw-r--r--src/menu.cpp25
-rw-r--r--src/planner-upcoming.cpp4
-rw-r--r--tests/test-actions.cpp14
13 files changed, 70 insertions, 36 deletions
diff --git a/.bzrignore b/.bzrignore
index 5bca87f..691f1e2 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -17,3 +17,4 @@ data/com.canonical.indicator.datetime.gschema.valid
src/libdatetime_la-utils.lo
data/indicator-datetime.conf
data/indicator-datetime.desktop
+data/indicator-datetime.upstart.desktop
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b468a5..378dc03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,6 @@ include (FindPkgConfig)
pkg_check_modules (SERVICE_DEPS REQUIRED
glib-2.0>=2.36
gio-unix-2.0>=2.36
- geoclue>=0.12
libical>=0.48
libecal-1.2>=3.5
libedataserver-1.2>=3.5
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index c45e1f9..5d9e545 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -48,6 +48,26 @@ configure_file ("${XDG_AUTOSTART_FILE_IN}" "${XDG_AUTOSTART_FILE}")
install (FILES "${XDG_AUTOSTART_FILE}"
DESTINATION "${XDG_AUTOSTART_DIR}")
+##
+## Upstart XDG Autostart Override
+##
+
+# where to install
+set (UPSTART_XDG_AUTOSTART_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/upstart/xdg/autostart")
+message (STATUS "${UPSTART_XDG_AUTOSTART_DIR} is the Upstart XDG autostart override dir")
+
+set (UPSTART_XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.upstart.desktop")
+set (UPSTART_XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${UPSTART_XDG_AUTOSTART_NAME}")
+set (UPSTART_XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${UPSTART_XDG_AUTOSTART_NAME}.in")
+
+# build it
+set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
+configure_file ("${UPSTART_XDG_AUTOSTART_FILE_IN}" "${UPSTART_XDG_AUTOSTART_FILE}")
+
+# install it
+install (FILES "${UPSTART_XDG_AUTOSTART_FILE}"
+ DESTINATION "${UPSTART_XDG_AUTOSTART_DIR}"
+ RENAME "${XDG_AUTOSTART_NAME}")
##
## Unity Indicator File
diff --git a/data/com.canonical.indicator.datetime b/data/com.canonical.indicator.datetime
index b9de626..1df0d33 100644
--- a/data/com.canonical.indicator.datetime
+++ b/data/com.canonical.indicator.datetime
@@ -16,5 +16,5 @@ ObjectPath=/com/canonical/indicator/datetime/desktop_greeter
ObjectPath=/com/canonical/indicator/datetime/phone
[phone_greeter]
-ObjectPath=/com/canonical/indicator/datetime/desktop_greeter
+ObjectPath=/com/canonical/indicator/datetime/phone_greeter
diff --git a/data/indicator-datetime.conf.in b/data/indicator-datetime.conf.in
index ab9cfd6..9b43b96 100644
--- a/data/indicator-datetime.conf.in
+++ b/data/indicator-datetime.conf.in
@@ -1,8 +1,9 @@
description "Indicator Date & Time Backend"
-start on indicators-loaded or indicator-services-start
+start on indicator-services-start
stop on desktop-end or indicator-services-end
respawn
+respawn limit 2 10
exec @pkglibexecdir@/indicator-datetime-service
diff --git a/data/indicator-datetime.desktop.in b/data/indicator-datetime.desktop.in
index 5362af9..4e56947 100644
--- a/data/indicator-datetime.desktop.in
+++ b/data/indicator-datetime.desktop.in
@@ -2,8 +2,8 @@
Type=Application
Name=Indicator Date & Time
Exec=@pkglibexecdir@/indicator-datetime-service
-NotShowIn=Unity;
+OnlyShowIn=Unity;GNOME;
NoDisplay=true
StartupNotify=false
Terminal=false
-
+AutostartCondition=GNOME3 unless-session gnome
diff --git a/data/indicator-datetime.upstart.desktop.in b/data/indicator-datetime.upstart.desktop.in
new file mode 100644
index 0000000..076d373
--- /dev/null
+++ b/data/indicator-datetime.upstart.desktop.in
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=Indicator Date & Time
+Exec=@pkglibexecdir@/indicator-datetime-service
+OnlyShowIn=Unity;
+NoDisplay=true
+StartupNotify=false
+Terminal=false
+Hidden=true
diff --git a/debian/control b/debian/control
index 84f76ca..30b71e9 100644
--- a/debian/control
+++ b/debian/control
@@ -9,23 +9,14 @@ Build-Depends: cmake,
python3-dbusmock,
debhelper (>= 9),
dh-translations,
- intltool (>= 0.35.0),
- gnome-common,
language-pack-en-base,
- libxorg-gtest-dev,
libgtest-dev,
libglib2.0-dev (>= 2.35.4),
libnotify-dev (>= 0.7.6),
libcanberra-dev,
- libido3-0.1-dev (>= 0.2.90),
- libgeoclue-dev (>= 0.12.0),
libecal1.2-dev (>= 3.5),
libical-dev (>= 1.0),
- libgtk-3-dev (>= 3.1.4),
- libcairo2-dev (>= 1.10),
- libpolkit-gobject-1-dev,
libedataserver1.2-dev (>= 3.5),
- libgconf2-dev (>= 2.31),
liburl-dispatcher1-dev,
libproperties-cpp-dev,
libdbustest1-dev,
@@ -42,11 +33,11 @@ Package: indicator-datetime
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
- geoclue-ubuntu-geoip | geoclue-provider,
systemd-services,
systemd-shim,
Recommends: indicator-applet | indicator-renderer,
evolution-data-server,
+ geoclue-ubuntu-geoip | geoclue-provider,
unity-control-center (>= 14.04.3) | ubuntu-system-settings,
Suggests: click,
Conflicts: indicator-datetime (<< 13.10.0)
diff --git a/debian/rules b/debian/rules
index 0e7a91f..d2889aa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,11 +6,6 @@ LDFLAGS += -Wl,-z,defs -Wl,--as-needed
dh $@ --with translations
override_dh_install:
- cd po; intltool-update --pot --verbose
dh_install --fail-missing
- # Language packs
- for d in $$(find debian/indicator-datetime -type f \( -name "*.desktop" -o -name "*.directory" \) ); do \
- sed -ri '/^(Name|GenericName|Comment|X-GNOME-FullName)\[/d' $$d; \
- echo "X-Ubuntu-Gettext-Domain=indicator-datetime" >> $$d; \
- done;
+
diff --git a/src/actions.cpp b/src/actions.cpp
index 31b3394..1b665cc 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -143,7 +143,10 @@ void on_calendar_activated(GSimpleAction * /*action*/,
g_return_if_fail(t != 0);
- static_cast<Actions*>(gself)->set_calendar_date(DateTime(t));
+ // the client gave us a date; remove the HMS component from the resulting DateTime
+ auto dt = DateTime(t);
+ dt = dt.add_full (0, 0, 0, -dt.hour(), -dt.minute(), -dt.seconds());
+ static_cast<Actions*>(gself)->set_calendar_date(dt);
}
GVariant* create_default_header_state()
diff --git a/src/menu.cpp b/src/menu.cpp
index 2768a2c..6cd1585 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -104,6 +104,9 @@ protected:
m_state->settings->show_events.changed().connect([this](bool){
update_section(Appointments); // showing events got toggled
});
+ m_state->calendar_upcoming->date().changed().connect([this](const DateTime&){
+ update_upcoming(); // our m_upcoming is planner->upcoming() filtered by time
+ });
m_state->calendar_upcoming->appointments().changed().connect([this](const std::vector<Appointment>&){
update_upcoming(); // our m_upcoming is planner->upcoming() filtered by time
});
@@ -138,18 +141,24 @@ protected:
void update_upcoming()
{
- // show upcoming appointments that occur after "calendar_next_minute",
- // where that is the wallclock time on the specified calendar day
- const auto calendar_day = m_state->calendar_month->month().get();
+ // The usual case is on desktop (and /only/ case on phone)
+ // is that we're looking at the current date and want to see
+ // "the next five calendar events, if any."
+ //
+ // However on the Desktop when the user clicks onto a different
+ // calendar date, show the next five calendar events starting
+ // from the beginning of that clicked day.
+ DateTime begin;
const auto now = m_state->clock->localtime();
- int y, m, d;
- calendar_day.ymd(y, m, d);
- const auto calendar_now = DateTime::Local(y, m, d, now.hour(), now.minute(), now.seconds());
- const auto calendar_next_minute = calendar_now.add_full(0, 0, 0, 0, 1, -now.seconds());
+ const auto calendar_day = m_state->calendar_month->month().get();
+ if ((profile() == Desktop) && !DateTime::is_same_day(now, calendar_day))
+ begin = calendar_day.add_full (0, 0, 0, -calendar_day.hour(), -calendar_day.minute(), -calendar_day.seconds());
+ else
+ begin = now.add_full (0, 0, 0, 0, 0, -now.seconds());
std::vector<Appointment> upcoming;
for(const auto& a : m_state->calendar_upcoming->appointments().get())
- if (calendar_next_minute <= a.begin)
+ if (begin <= a.begin)
upcoming.push_back(a);
if (m_upcoming != upcoming)
diff --git a/src/planner-upcoming.cpp b/src/planner-upcoming.cpp
index 4e5af6f..ed45955 100644
--- a/src/planner-upcoming.cpp
+++ b/src/planner-upcoming.cpp
@@ -33,8 +33,8 @@ UpcomingPlanner::UpcomingPlanner(const std::shared_ptr<RangePlanner>& range_plan
{
date().changed().connect([this](const DateTime& dt){
// set the range to the upcoming month
- const auto b = dt.add_full(0, 0, -1, 0, 0, 0);
- const auto e = dt.add_full(0, 1, 0, 0, 0, 0);
+ const auto b = dt.add_full(0, 0, -1, -dt.hour(), -dt.minute(), -dt.seconds());
+ const auto e = b.add_full(0, 1, 0, 0, 0, 0);
g_debug("%p setting date range to [%s..%s]", this, b.format("%F %T").c_str(), e.format("%F %T").c_str());
m_range_planner->range().set(std::pair<DateTime,DateTime>(b,e));
});
diff --git a/tests/test-actions.cpp b/tests/test-actions.cpp
index 252e192..9f7856c 100644
--- a/tests/test-actions.cpp
+++ b/tests/test-actions.cpp
@@ -264,7 +264,7 @@ TEST_F(ActionsFixture, SetCalendarDate)
EXPECT_NE (now, m_state->calendar_month->month().get());
auto v = g_variant_new_int64(now.to_unix());
g_action_group_activate_action (action_group, action_name, v);
- EXPECT_EQ (now, m_state->calendar_month->month().get());
+ EXPECT_TRUE(DateTime::is_same_day (now, m_state->calendar_month->month().get()));
}
TEST_F(ActionsFixture, ActivatingTheCalendarResetsItsDate)
@@ -282,22 +282,28 @@ TEST_F(ActionsFixture, ActivatingTheCalendarResetsItsDate)
const auto now = m_state->clock->localtime();
auto next_week = g_date_time_add_weeks(now.get(), 1);
const auto next_week_unix = g_date_time_to_unix(next_week);
- g_date_time_unref(next_week);
g_action_group_activate_action (action_group, "calendar", g_variant_new_int64(next_week_unix));
// confirm the planner and calendar action state moved a week into the future
// but that m_state->clock is unchanged
- EXPECT_EQ(next_week_unix, m_state->calendar_month->month().get().to_unix());
+ auto expected = g_date_time_add_full (next_week, 0, 0, 0, -g_date_time_get_hour(next_week),
+ -g_date_time_get_minute(next_week),
+ -g_date_time_get_seconds(next_week));
+ const auto expected_unix = g_date_time_to_unix(expected);
+ EXPECT_EQ(expected_unix, m_state->calendar_month->month().get().to_unix());
EXPECT_EQ(now, m_state->clock->localtime());
auto calendar_state = g_action_group_get_action_state(action_group, "calendar");
EXPECT_TRUE(calendar_state != nullptr);
EXPECT_TRUE(g_variant_is_of_type(calendar_state, G_VARIANT_TYPE_DICTIONARY));
auto v = g_variant_lookup_value(calendar_state, "calendar-day", G_VARIANT_TYPE_INT64);
EXPECT_TRUE(v != nullptr);
- EXPECT_EQ(next_week_unix, g_variant_get_int64(v));
+ EXPECT_EQ(expected_unix, g_variant_get_int64(v));
g_clear_pointer(&v, g_variant_unref);
g_clear_pointer(&calendar_state, g_variant_unref);
+ g_date_time_unref(expected);
+ g_date_time_unref(next_week);
+
///
/// Now the actual test.
/// We set the state of 'calendar-active' to true, which should reset the calendar date.