Siegfried Gevatter has proposed merging lp:~rainct/zeitgeist/ugly-as-hell into
lp:zeitgeist.
Requested reviews:
Zeitgeist Framework Team (zeitgeist)
For more details, see:
https://code.launchpad.net/~rainct/zeitgeist/ugly-as-hell/+merge/90847
--
https://code.launchpad.net/~rainct/zeitgeist/ugly-as-hell/+merge/90847
Your team Zeitgeist Framework Team is requested to review the proposed merge of
lp:~rainct/zeitgeist/ugly-as-hell into lp:zeitgeist.
=== modified file 'python/client.py'
--- python/client.py 2011-10-29 13:31:12 +
+++ python/client.py 2012-01-31 10:32:08 +
@@ -172,11 +172,15 @@
self._generic_callbacks = set()
# Listen to (dis)connection notifications, for connect_exit and connect_join
+ self._first_connection = True
def name_owner_changed(connection_name):
if connection_name == "":
callbacks = self._disconnect_callbacks
self.__methods = self.__signals = None
else:
+if self._first_connection:
+ self._first_connection = False
+ return
if not self._reconnect_when_needed:
return
self.reconnect()
=== modified file 'src/notify.vala'
--- src/notify.vala 2011-10-20 14:20:17 +
+++ src/notify.vala 2012-01-31 10:32:08 +
@@ -32,7 +32,7 @@
construct
{
monitors = new HashTable (str_hash, str_equal);
-connections = new HashTable>
+connections = new HashTable>
(str_hash, str_equal);
// FIXME: it'd be nice if this supported arg2
@@ -78,9 +78,47 @@
private TimeRange time_range;
private RemoteMonitor? proxy_object = null;
+private enum NotificationType
+{
+INSERTION,
+DELETION
+}
+[Compact]
+private class QueuedNotification {
+// (Compact classes don't support private fields)
+public NotificationType type;
+public Variant time_range;
+public Variant events; // for insertions
+public uint32[] event_ids; // for deletions
+
+public QueuedNotification.insertion (Variant time_range, Variant events)
+{
+type = NotificationType.INSERTION;
+this.time_range = time_range;
+this.events = events;
+}
+
+public QueuedNotification.deletion (Variant time_range, uint32[] event_ids)
+{
+type = NotificationType.DELETION;
+this.time_range = time_range;
+this.event_ids = event_ids;
+}
+
+public void send (RemoteMonitor proxy_object)
+{
+if (type == NotificationType.INSERTION)
+proxy_object.notify_insert (time_range, events);
+else
+proxy_object.notify_delete (time_range, event_ids);
+}
+}
+private SList queued_notifications;
+
public Monitor (BusName peer, string object_path,
TimeRange tr, GenericArray templates)
{
+queued_notifications = new SList ();
Bus.get_proxy (BusType.SESSION, peer,
object_path, DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
@@ -94,6 +132,15 @@
{
warning ("%s", err.message);
}
+
+// Process queued notifications...
+queued_notifications.reverse ();
+foreach (unowned QueuedNotification notification
+in queued_notifications)
+{
+notification.send (proxy_object);
+}
+queued_notifications = null;
});
time_range = tr;
event_templates = templates;
@@ -113,15 +160,13 @@
return false;
}
-// FIXME: we need to queue the notification if proxy_object == null
public void notify_insert (TimeRange time_range, GenericArray events)
-requires (proxy_object != null)
{
var intersect_tr = time_range.intersect (this.time_range);
if (intersect_tr != null)
{
var matching_events = new GenericArray ();
-for (int i=0; i= intersect_tr.start
@@ -132,24 +177,46 @@
}
if (matching_events.length > 0)
{
-DBusProxy p = (DBusProxy) proxy_object;
-debug ("Notifying %s about %d insertions",
-p.get_name (), matching_events.length);