~joel-auterson/ubuntu/maverick/ibus/newmenuname

« back to all changes in this revision

Viewing changes to src/ibuspendingcall.h

  • Committer: Bazaar Package Importer
  • Author(s): LI Daobing
  • Date: 2009-10-05 20:45:18 UTC
  • mfrom: (1.1.5 upstream) (6.1.15 sid)
  • Revision ID: james.westby@ubuntu.com-20091005204518-069vlwrl3r8v7bbr
Tags: 1.2.0.20090927-2
* create po template when build (LP: #188690)
  - debian/rules: updated.
  - debian/clean: remove pot file when clean.
* debian/control: build depends on python-rsvg (LP: #432375)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
18
 * Boston, MA 02111-1307, USA.
19
19
 */
 
20
/**
 
21
 * SECTION: ibuspendingcall
 
22
 * @short_description: A DBusPendingCall in IBus.
 
23
 * @stability: Stable
 
24
 *
 
25
 * An IBusPendingCall is essentially a DBusPendingCall, which representing an expected reply.
 
26
 * A IBusPendingCall can be created when you send a message that should have a reply.
 
27
 *
 
28
 * Besides DBusPendingCall functions, An IBusPendingCall can be manipulated
 
29
 * with its own specific functions, which are defined in this section.
 
30
 */
20
31
#ifndef __IBUS_PENDING_CALL_H_
21
32
#define __IBUS_PENDING_CALL_H_
22
33
 
26
37
 
27
38
G_BEGIN_DECLS
28
39
 
 
40
/**
 
41
 * IBusPendingCall:
 
42
 *
 
43
 * An opaque data structure that represents IBusPendingCall.
 
44
 */
29
45
typedef DBusPendingCall IBusPendingCall;
 
46
 
 
47
/**
 
48
 * IBusPendingCallNotifyFunction:
 
49
 * @pending: An IBusPendingCall.
 
50
 * @user_data: User data for the callback function.
 
51
 *
 
52
 * Callback prototype of pending call notify function.
 
53
 */
30
54
typedef void (* IBusPendingCallNotifyFunction)(IBusPendingCall *pending, gpointer user_data);
31
55
 
32
 
 
 
56
/**
 
57
 * ibus_pending_call_ref:
 
58
 * @pending: An IBusPendingCall.
 
59
 * @returns: A reference of IBusPendingCall.
 
60
 *
 
61
 * Increases the reference count on a pending call.
 
62
 */
33
63
IBusPendingCall*    ibus_pending_call_ref           (IBusPendingCall                *pending);
 
64
 
 
65
/**
 
66
 * ibus_pending_call_unref:
 
67
 * @pending: An IBusPendingCall.
 
68
 *
 
69
 * Decreases the reference count on a pending call.
 
70
 */
34
71
void                ibus_pending_call_unref         (IBusPendingCall                *pending);
 
72
 
 
73
/**
 
74
 * ibus_pending_call_set_notify:
 
75
 * @pending: An IBusPendingCall.
 
76
 * @function: An pending call notify callback function.
 
77
 * @user_data: User data for the callback function.
 
78
 * @free_user_data: Callback to free the user_data.
 
79
 * @returns: TRUE if succeed; FALSE if not enough memory.
 
80
 *
 
81
 * Sets a notification function to be called when the reply is received or the pending call times out.
 
82
 */
35
83
gboolean            ibus_pending_call_set_notify    (IBusPendingCall                *pending,
36
84
                                                     IBusPendingCallNotifyFunction   function,
37
85
                                                     gpointer                        user_data,
38
86
                                                     GDestroyNotify                  free_user_data);
 
87
 
 
88
/**
 
89
 * ibus_pending_call_cancel:
 
90
 * @pending: An IBusPendingCall.
 
91
 *
 
92
 * Cancels the pending call, such that any reply or error received will just be ignored.
 
93
 *
 
94
 * Drops the dbus library's internal reference to the DBusPendingCall so will free the call
 
95
 * if nobody else is holding a reference.
 
96
 * But usually application owns a reference from dbus_connection_send_with_reply().
 
97
 *
 
98
 * Note that canceling a pending call will not simulate a timed-out call;
 
99
 * if a call times out, then a timeout error reply is received.
 
100
 * If you cancel the call, no reply is received unless the reply was already received before you canceled.
 
101
 */
39
102
void                ibus_pending_call_cancel        (IBusPendingCall                *pending);
 
103
 
 
104
/**
 
105
 * ibus_pending_call_get_completed:
 
106
 * @pending: An IBusPendingCall.
 
107
 * @returns: TRUE if pending call has received a reply; FALSE otherwise.
 
108
 *
 
109
 * Whether the pending call has received a reply or not.
 
110
 */
40
111
gboolean            ibus_pending_call_get_completed (IBusPendingCall                *pending);
 
112
 
 
113
/**
 
114
 * ibus_pending_call_steal_reply:
 
115
 * @pending: An IBusPendingCall.
 
116
 * @returns: Replied message; NULL if none has been received yet.
 
117
 *
 
118
 * Gets the reply, or returns NULL if none has been received yet.
 
119
 *
 
120
 * Ownership of the reply message passes to the caller.
 
121
 * This function can only be called once per pending call,
 
122
 * since the reply message is transferred to the caller.
 
123
 */
41
124
IBusMessage*        ibus_pending_call_steal_reply   (IBusPendingCall                *pending);
 
125
 
 
126
/**
 
127
 * ibus_pending_call_block:
 
128
 * @pending: An IBusPendingCall.
 
129
 *
 
130
 * Block until the pending call is completed.
 
131
 * The blocking is as with ibus_connection_send_with_reply_and_block();
 
132
 * it does not enter the main loop or process other messages,
 
133
 * it simply waits for the reply in question.
 
134
 *
 
135
 * If the pending call is already completed, this function returns immediately.
 
136
 */
42
137
void                ibus_pending_call_block         (IBusPendingCall                *pending);
 
138
 
 
139
/**
 
140
 * ibus_pending_call_wait:
 
141
 * @pending: An IBusPendingCall.
 
142
 *
 
143
 * Wait until the pending call is completed.
 
144
 *
 
145
 * See also: ibus_pending_call_get_completed().
 
146
 */
43
147
void                ibus_pending_call_wait          (IBusPendingCall                *pending);
 
148
 
 
149
/**
 
150
 * ibus_pending_call_allocate_data_slot:
 
151
 * @slot_p: Address of a global variable storing the slot.
 
152
 * @returns: TRUE if succeed; FALSE if insufficient memory.
 
153
 *
 
154
 * Allocates an integer ID to be used for storing application-specific data on any IBusPendingCall.
 
155
 *
 
156
 * The allocated ID may then be used with ibus_pending_call_set_data() and ibus_pending_call_get_data().
 
157
 * The passed-in slot must be initialized to -1, and is filled in with the slot ID.
 
158
 * If the passed-in slot is not -1, it's assumed to be already allocated, and
 
159
 * its reference count is increased.
 
160
 *
 
161
 * The allocated slot is global, i.e. all DBusPendingCall objects
 
162
 * will have a slot with the given integer ID reserved.
 
163
 */
44
164
gboolean            ibus_pending_call_allocate_data_slot
45
165
                                                    (gint                           *slot_p);
 
166
 
 
167
/**
 
168
 * ibus_pending_call_free_data_slot:
 
169
 * @slot_p: Address of a global variable storing the slot.
 
170
 *
 
171
 * Deallocates a global ID for IBusPendingCall data slots.
 
172
 *
 
173
 * ibus_pending_call_get_data() and ibus_pending_call_set_data() may no longer be used with this slot.
 
174
 * Existing data stored on existing IBusPendingCall objects will be freed when
 
175
 * the IBusPendingCall is finalized, but may not be retrieved
 
176
 * (and may only be replaced if someone else reallocates the slot).
 
177
 * When the reference count on the passed-in slot reaches 0, it is set to -1.
 
178
 */
46
179
void                ibus_pending_call_free_data_slot
47
180
                                                    (gint                           *slot_p);
 
181
 
 
182
/**
 
183
 * ibus_pending_call_set_data:
 
184
 * @pending: An IBusPendingCall.
 
185
 * @slot: The slot number.
 
186
 * @data: The data to store
 
187
 * @free_data_func: Callback to free the data.
 
188
 * @returns: TRUE if there was enough memory to store the data; FALSE otherwise.
 
189
 *
 
190
 * Stores a pointer on a IBusPendingCall, along with an optional function
 
191
 * to be used for freeing the data when the data is set again, or when the pending call is finalized.
 
192
 *
 
193
 * The slot number must have been allocated with ibus_pending_call_allocate_data_slot().
 
194
 */
48
195
gboolean            ibus_pending_call_set_data      (IBusPendingCall                *pending,
49
196
                                                     gint                            slot,
50
197
                                                     gpointer                        data,
51
198
                                                     GDestroyNotify                  free_data_func);
 
199
 
 
200
/**
 
201
 * ibus_pending_call_get_data:
 
202
 * @pending: An IBusPendingCall.
 
203
 * @slot: The slot number.
 
204
 * @returns: The stored data; NULL if no such data.
 
205
 *
 
206
 * Retrieves data previously set with ibus_pending_call_set_data().
 
207
 *
 
208
 * The slot must still be allocated (must not have been freed).
 
209
 */
52
210
gpointer            ibus_pending_call_get_data      (IBusPendingCall                *pending,
53
211
                                                     gint                            slot);
54
212