File: EventSource.h

package info (click to toggle)
keyman 18.0.246-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,316 kB
  • sloc: python: 52,784; cpp: 21,289; sh: 7,633; ansic: 4,823; xml: 3,617; perl: 959; makefile: 139; javascript: 138
file content (27 lines) | stat: -rw-r--r-- 501 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef __EVENTSOURCE_H__
#define __EVENTSOURCE_H__

#include "config.h"
#include <glib.h>
#if DBUS_IMPLEMENTATION == SYSTEMD
#include <systemd/sd-bus.h>
#else
#include <basu/sd-bus.h>
#endif

// An event source used to poll sd-bus for messages
class EventSource {
public:
  static EventSource* Create(sd_bus* bus);
  static void Destroy(EventSource* source);

  gboolean Check() const;
  gboolean Dispatch();

private:
  GSource base;
  GPollFD pollFd;
  sd_bus* bus;
};

#endif // __EVENTSOURCE_H__