diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-04-12 12:03:36 -0500 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-07-06 00:38:36 +0200 |
commit | ad95b394c94c9ba958d54c5243f376e7854683b8 (patch) | |
tree | 1fadaa1cf8e7fbfcc2ee351ded51c8faab8da8f9 /src/main.cpp | |
parent | 5c53bbf1552457307fecb8099e0623f078bd68fb (diff) | |
download | ayatana-indicator-datetime-ad95b394c94c9ba958d54c5243f376e7854683b8.tar.gz ayatana-indicator-datetime-ad95b394c94c9ba958d54c5243f376e7854683b8.tar.bz2 ayatana-indicator-datetime-ad95b394c94c9ba958d54c5243f376e7854683b8.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.cpp | 14 |
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; } |