summaryrefslogtreecommitdiffstats
path: root/gedit/gedit-message-bus.h
blob: e8403e00ae4f7c860de32f6ab47e28f0d1e53ffd (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
 * gedit-message-bus.h
 * This file is part of gedit
 *
 * Copyright (C) 2008-2010 - Jesse van den Kieboom
 *
 * gedit is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * gedit is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gedit; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

#ifndef GEDIT_MESSAGE_BUS_H
#define GEDIT_MESSAGE_BUS_H

#include <glib-object.h>
#include <gedit/gedit-message.h>

G_BEGIN_DECLS

#define GEDIT_TYPE_MESSAGE_BUS			(gedit_message_bus_get_type ())
#define GEDIT_MESSAGE_BUS(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_MESSAGE_BUS, GeditMessageBus))
#define GEDIT_MESSAGE_BUS_CONST(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_MESSAGE_BUS, GeditMessageBus const))
#define GEDIT_MESSAGE_BUS_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_MESSAGE_BUS, GeditMessageBusClass))
#define GEDIT_IS_MESSAGE_BUS(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_MESSAGE_BUS))
#define GEDIT_IS_MESSAGE_BUS_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_MESSAGE_BUS))
#define GEDIT_MESSAGE_BUS_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_MESSAGE_BUS, GeditMessageBusClass))

typedef struct _GeditMessageBus		GeditMessageBus;
typedef struct _GeditMessageBusClass	GeditMessageBusClass;
typedef struct _GeditMessageBusPrivate	GeditMessageBusPrivate;

struct _GeditMessageBus
{
	GObject parent;

	GeditMessageBusPrivate *priv;
};

struct _GeditMessageBusClass
{
	GObjectClass parent_class;

	void (*dispatch)      (GeditMessageBus  *bus,
	                       GeditMessage     *message);
	void (*registered)    (GeditMessageBus  *bus,
	                       const gchar      *object_path,
	                       const gchar      *method);
	void (*unregistered)  (GeditMessageBus  *bus,
	                       const gchar      *object_path,
	                       const gchar      *method);
};

typedef void (* GeditMessageCallback)   (GeditMessageBus  *bus,
                                         GeditMessage     *message,
                                         gpointer          user_data);

typedef void (* GeditMessageBusForeach) (gchar const      *object_path,
                                         gchar const      *method,
                                         gpointer          user_data);

GType             gedit_message_bus_get_type           (void) G_GNUC_CONST;

GeditMessageBus  *gedit_message_bus_get_default        (void);
GeditMessageBus  *gedit_message_bus_new                (void);

GType             gedit_message_bus_lookup             (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method);

void              gedit_message_bus_register           (GeditMessageBus        *bus,
                                                        GType                   message_type,
                                                        const gchar            *object_path,
                                                        const gchar            *method);

void              gedit_message_bus_unregister         (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method);

void              gedit_message_bus_unregister_all     (GeditMessageBus        *bus,
                                                        const gchar            *object_path);

gboolean          gedit_message_bus_is_registered      (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method);

void              gedit_message_bus_foreach            (GeditMessageBus        *bus,
                                                        GeditMessageBusForeach  func,
                                                        gpointer                user_data);

guint             gedit_message_bus_connect            (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method,
                                                        GeditMessageCallback    callback,
                                                        gpointer                user_data,
                                                        GDestroyNotify          destroy_data);

void              gedit_message_bus_disconnect         (GeditMessageBus        *bus,
                                                        guint                   id);

void              gedit_message_bus_disconnect_by_func (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method,
                                                        GeditMessageCallback    callback,
                                                        gpointer                user_data);

void              gedit_message_bus_block              (GeditMessageBus        *bus,
                                                        guint                   id);
void              gedit_message_bus_block_by_func      (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method,
                                                        GeditMessageCallback    callback,
                                                        gpointer                user_data);

void              gedit_message_bus_unblock            (GeditMessageBus        *bus,
                                                        guint                   id);
void              gedit_message_bus_unblock_by_func    (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method,
                                                        GeditMessageCallback    callback,
                                                        gpointer                user_data);

void              gedit_message_bus_send_message       (GeditMessageBus        *bus,
                                                        GeditMessage           *message);
void              gedit_message_bus_send_message_sync  (GeditMessageBus        *bus,
                                                        GeditMessage           *message);

void              gedit_message_bus_send               (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method,
                                                        const gchar            *first_property,
                                                        ...) G_GNUC_NULL_TERMINATED;

GeditMessage     *gedit_message_bus_send_sync          (GeditMessageBus        *bus,
                                                        const gchar            *object_path,
                                                        const gchar            *method,
                                                        const gchar            *first_property,
                                                        ...) G_GNUC_NULL_TERMINATED;

G_END_DECLS

#endif /* GEDIT_MESSAGE_BUS_H */

/* ex:set ts=8 noet: */