00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __DBUSXX_GLIB_INTEGRATION_H
00026 #define __DBUSXX_GLIB_INTEGRATION_H
00027
00028 #include <glib.h>
00029
00030 #include "api.h"
00031 #include "dispatcher.h"
00032
00033 namespace DBus {
00034
00035 namespace Glib {
00036
00037 class BusDispatcher;
00038
00039 class DXXAPI BusTimeout : public Timeout
00040 {
00041 private:
00042
00043 BusTimeout(Timeout::Internal *, GMainContext *, int);
00044
00045 ~BusTimeout();
00046
00047 void toggle();
00048
00049 static gboolean timeout_handler(gpointer);
00050
00051 void _enable();
00052
00053 void _disable();
00054
00055 private:
00056
00057 GSource *_source;
00058 GMainContext *_ctx;
00059 int _priority;
00060
00061 friend class BusDispatcher;
00062 };
00063
00064 class DXXAPI BusWatch : public Watch
00065 {
00066 private:
00067
00068 BusWatch(Watch::Internal *, GMainContext *, int);
00069
00070 ~BusWatch();
00071
00072 void toggle();
00073
00074 static gboolean watch_handler(gpointer);
00075
00076 void _enable();
00077
00078 void _disable();
00079
00080 private:
00081
00082 GSource *_source;
00083 GMainContext *_ctx;
00084 int _priority;
00085
00086 friend class BusDispatcher;
00087 };
00088
00089 class DXXAPI BusDispatcher : public Dispatcher
00090 {
00091 public:
00092
00093 BusDispatcher();
00094 ~BusDispatcher();
00095
00096 void attach(GMainContext *);
00097
00098 void enter() {}
00099
00100 void leave() {}
00101
00102 Timeout *add_timeout(Timeout::Internal *);
00103
00104 void rem_timeout(Timeout *);
00105
00106 Watch *add_watch(Watch::Internal *);
00107
00108 void rem_watch(Watch *);
00109
00110 void set_priority(int priority);
00111
00112 private:
00113
00114 GMainContext *_ctx;
00115 int _priority;
00116 GSource *_source;
00117 };
00118
00119 }
00120
00121 }
00122
00123 #endif//__DBUSXX_GLIB_INTEGRATION_H