]> Pileus Git - ~andy/gtk/commit
recent-manager: Coalesce multiple changes
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 22 Oct 2010 15:12:16 +0000 (16:12 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 22 Oct 2010 17:08:48 +0000 (18:08 +0100)
commitce5a29bc384542839a5f12061499c8ec706b1c34
tree68f193cd5169f1e07a02a15c1ff9af4d027fbf71
parent5ef2b46d64ebf0a460e92f60e7386a46c3540c9d
recent-manager: Coalesce multiple changes

Since the ::changed implementation of GtkRecentManager implies a
synchronous write operation, when we receive multiple requests to emit a
::changed signal we might end up blocking.

This change coalesces multiple ::changed emission requests using the
following sequence:

  • the first request will install a timeout in 250 ms, which will
    emit the ::changed signal

  • each further request while the timeout has not been emitted
    will increase a counter

      ‣ if the counter reaches 250 before the timeout has been
        emitted, then the RecentManager will remove the timeout
        source and force a signal emission and reset the counter

This sequence should guarantee that frequent ::changed emission requests
are coalesced, and also guarantee that we don't let them dangle for too
long.

https://bugzilla.gnome.org/show_bug.cgi?id=616997
gtk/gtkrecentmanager.c
gtk/tests/recentmanager.c