aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-04-12 12:03:36 -0500
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:37:39 +0200
commit3cd2c8e20343ef4b4efe7a34daba72f9af23205d (patch)
tree94a6f801ea67a438f7c23a5b06fbf8c32802f004 /src/main.cpp
parent32a1c8a2ff80533b7c5902b869fb4b889ded5736 (diff)
downloadayatana-indicator-datetime-3cd2c8e20343ef4b4efe7a34daba72f9af23205d.tar.gz
ayatana-indicator-datetime-3cd2c8e20343ef4b4efe7a34daba72f9af23205d.tar.bz2
ayatana-indicator-datetime-3cd2c8e20343ef4b4efe7a34daba72f9af23205d.zip
in TimedatedTimezone, take a GDBusConnection argument in the ctor to simplify state management
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0da55a2..bb77c0e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -71,7 +71,7 @@ namespace
{
// create the live objects
auto live_settings = std::make_shared<LiveSettings>();
- auto live_timezones = std::make_shared<LiveTimezones>(live_settings);
+ auto live_timezones = std::make_shared<LiveTimezones>(live_settings, timezone_);
auto live_clock = std::make_shared<LiveClock>(timezone_);
// create a full-month planner currently pointing to the current month
@@ -132,8 +132,17 @@ main(int /*argc*/, char** /*argv*/)
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
textdomain(GETTEXT_PACKAGE);
+ // get the system bus
+ GError* error {};
+ auto system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error);
+ if (error != nullptr) {
+ g_critical("Unable to get system bus: %s", error->message);
+ g_clear_error(&error);
+ return 0;
+ }
+
auto engine = create_engine();
- auto timezone_ = std::make_shared<TimedatedTimezone>();
+ auto timezone_ = std::make_shared<TimedatedTimezone>(system_bus);
auto state = create_state(engine, timezone_);
auto actions = std::make_shared<LiveActions>(state);
MenuFactory factory(actions, state);
@@ -171,5 +180,6 @@ main(int /*argc*/, char** /*argv*/)
g_main_loop_run(loop);
g_main_loop_unref(loop);
+ g_clear_object(&system_bus);
return 0;
}