Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class DateTime.Indicator : Wingpanel.Indicator {
main_grid.margin_top = 12;
main_grid.attach (calendar, 0, 0);
main_grid.attach (scrolled_window, 1, 0);
main_grid.attach (new Wingpanel.Widgets.Separator (), 0, 2, 2);
main_grid.attach (new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, 2, 2);
main_grid.attach (settings_button, 0, 3, 2);

var size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
Expand Down
25 changes: 22 additions & 3 deletions src/Services/TimeManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
[DBus (name = "org.freedesktop.login1.Manager")]
interface Manager : Object {
public signal void prepare_for_sleep (bool sleeping);
public signal void user_new (string uid, ObjectPath object_path);
public signal void seat_new (string seat_id, ObjectPath object_path);
public signal void session_new (string session_id, ObjectPath object_path);
}

[DBus (name = "io.elementary.pantheon.AccountsService")]
Expand Down Expand Up @@ -66,11 +69,21 @@ public class DateTime.Services.TimeManager : Gtk.Calendar {
manager = Bus.get_proxy_sync (BusType.SYSTEM, "org.freedesktop.login1", "/org/freedesktop/login1");
manager.prepare_for_sleep.connect ((sleeping) => {
if (!sleeping) {
update_current_time ();
minute_changed ();
add_timeout ();
reset ();
}
});

manager.user_new.connect (() => {
reset ();
});

manager.seat_new.connect (() => {
reset ();
});

manager.session_new.connect (() => {
reset ();
});
} catch (Error e) {
warning (e.message);
}
Expand Down Expand Up @@ -119,6 +132,12 @@ public class DateTime.Services.TimeManager : Gtk.Calendar {
add_timeout (false);
}

private void reset () {
update_current_time ();
minute_changed ();
add_timeout ();
}

private void add_timeout (bool update_fast = false) {
uint interval;
if (update_fast || clock_show_seconds) {
Expand Down