~ubuntu-branches/ubuntu/natty/cairo-dock/natty

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-notifications.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2011-03-17 14:08:48 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110317140848-b8efysl4ynhjm87k
Tags: 2.3.0~1-0ubuntu1
* New Upstream Version (LP: #723994)
* Upstream short ChangeLog:
 - Updated translations
 - Updated the integration of the new versions of kwin and compiz
 - Updated default theme
 - Fixed a few bugs
 - Updated the man
* debian/control:
 - Added suggests apps for cairo-dock-core (needed by the default theme)
 - Updated the description (from launchpad.net/cairo-dock)
 - Added cairo-dock-plug-ins as a new suggestion for cairo-dock-core
* debian/patches:
 - Updated the default theme to use default apps of Ubuntu Natty 
* Switch to dpkg-source 3.0 (quilt) format
* Removed the desktop-file-category patch (sync with debian packages)
* debian/rules:
 - Added a CMake flag to disable the gtk grip
 - No longer used simple-patchsys
* Updated the debian/watch

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
*/
19
19
 
20
 
 
21
20
#ifndef __CAIRO_DOCK_NOTIFICATIONS__
22
21
#define  __CAIRO_DOCK_NOTIFICATIONS__
23
22
 
28
27
 
29
28
/**
30
29
*@file cairo-dock-notifications.h This class defines the notification system. Each time an event occurs (like an icon being clicked), Cairo-Dock broadcasts the corresponding notification. Anybody that has registered to it will be called then.
 
30
Common objects that hold notifications are Managers, Icons, and Containers (and their derivatives Docks, Desklets, Dialogs, Flyings).
31
31
*/
32
32
 
33
33
/// Generic prototype of a notification callback.
38
38
        gpointer pUserData;
39
39
        } CairoDockNotificationRecord;
40
40
 
41
 
/// The list of all notifications.
42
 
typedef enum {
 
41
// The list of all notifications.
 
42
/*typedef enum {
43
43
        /// notification called when use clicks on an icon data : {Icon, CairoDock, int}
44
44
        CAIRO_DOCK_CLICK_ICON=0,
45
45
        /// notification called when the user double-clicks on an icon. data : {Icon, CairoDock}
149
149
        
150
150
        CAIRO_DOCK_NB_NOTIFICATIONS
151
151
        } CairoDockNotificationType;
 
152
*/
 
153
 
 
154
typedef guint CairoDockNotificationType;
152
155
 
153
156
/// prototype of the callback to the CAIRO_DOCK_CLICK_ICON notification.
154
157
typedef gboolean (* CairoDockClickIconFunc) (gpointer pUserData, Icon *pIcon, CairoContainer *pContainer, int iState);
209
212
typedef gboolean (* CairoDockLeaveContainerFunc) (gpointer pUserData, CairoContainer *pContainer, gboolean *bStartAnimation);
210
213
 
211
214
 
212
 
/// Use this in \ref cairo_dock_register_notification to be called before the dock.
 
215
/// Use this in \ref cairo_dock_register_notification_on_object to be called before the dock.
213
216
#define CAIRO_DOCK_RUN_FIRST TRUE
214
 
/// Use this in \ref cairo_dock_register_notification to be called after the dock.
 
217
/// Use this in \ref cairo_dock_register_notification_on_object to be called after the dock.
215
218
#define CAIRO_DOCK_RUN_AFTER FALSE
216
219
 
217
220
/// Return this in your callback to prevent the other callbacks from being called after you.
220
223
#define CAIRO_DOCK_LET_PASS_NOTIFICATION FALSE
221
224
 
222
225
 
223
 
GSList *cairo_dock_get_notifications_list (CairoDockNotificationType iNotifType);
224
 
 
225
 
/** Register an action to be called when a given notification is broadcasted.
226
 
*@param iNotifType type of the notification.
227
 
*@param pFunction callback.
228
 
*@param bRunFirst CAIRO_DOCK_RUN_FIRST to be called before Cairo-Dock, CAIRO_DOCK_RUN_AFTER to be called after.
229
 
*@param pUserData data to be passed as the first parameter of the callback.
230
 
*/
231
 
void cairo_dock_register_notification (CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData);
232
 
 
233
 
/** Register an action to be called when a given notification is broadcasted from a given icon.
234
 
*@param pIcon the icon.
235
 
*@param iNotifType type of the notification.
236
 
*@param pFunction callback.
237
 
*@param bRunFirst CAIRO_DOCK_RUN_FIRST to be called before Cairo-Dock, CAIRO_DOCK_RUN_AFTER to be called after.
238
 
*@param pUserData data to be passed as the first parameter of the callback.
239
 
*/
240
 
void cairo_dock_register_notification_on_icon (Icon *pIcon, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData);
241
 
 
242
 
/** Register an action to be called when a given notification is broadcasted from a given container.
243
 
*@param pContainer the container.
244
 
*@param iNotifType type of the notification.
245
 
*@param pFunction callback.
246
 
*@param bRunFirst CAIRO_DOCK_RUN_FIRST to be called before Cairo-Dock, CAIRO_DOCK_RUN_AFTER to be called after.
247
 
*@param pUserData data to be passed as the first parameter of the callback.
248
 
*/
249
 
void cairo_dock_register_notification_on_container (CairoContainer *pContainer, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData);
250
 
 
251
 
/** Remove a callback from the list of callbacks for a given notification and a given data.
252
 
*@param iNotifType type of the notification.
253
 
*@param pFunction callback.
254
 
*@param pUserData data that was registerd with the callback.
255
 
*/
256
 
void cairo_dock_remove_notification_func (CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData);
257
 
 
258
 
/** Remove a callback from the list of callbacks of a given icon for a given notification and a given data.
259
 
*@param pIcon the icon for which the action has been registered.
260
 
*@param iNotifType type of the notification.
261
 
*@param pFunction callback.
262
 
*@param pUserData data that was registerd with the callback.
263
 
*/
264
 
void cairo_dock_remove_notification_func_on_icon (Icon *pIcon, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData);
265
 
 
266
 
/** Remove a callback from the list of callbacks of a given container for a given notification and a given data.
267
 
*@param pContainer the container for which the action has been registered.
268
 
*@param iNotifType type of the notification.
269
 
*@param pFunction callback.
270
 
*@param pUserData data that was registerd with the callback.
271
 
*/
272
 
void cairo_dock_remove_notification_func_on_container (CairoContainer *pContainer, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData);
 
226
//GSList *cairo_dock_get_notifications_list (CairoDockNotificationType iNotifType);
 
227
 
 
228
/* Register an action to be called when a given notification is broadcasted.
 
229
*@param iNotifType type of the notification.
 
230
*@param pFunction callback.
 
231
*@param bRunFirst CAIRO_DOCK_RUN_FIRST to be called before Cairo-Dock, CAIRO_DOCK_RUN_AFTER to be called after.
 
232
*@param pUserData data to be passed as the first parameter of the callback.
 
233
*/
 
234
//void cairo_dock_register_notification (CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData);
 
235
 
 
236
/* Remove a callback from the list of callbacks for a given notification and a given data.
 
237
*@param iNotifType type of the notification.
 
238
*@param pFunction callback.
 
239
*@param pUserData data that was registerd with the callback.
 
240
*/
 
241
//void cairo_dock_remove_notification_func (CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData);
273
242
 
274
243
 
275
244
#define _cairo_dock_notify(pNotificationRecordList, bStop, ...) do {\
283
252
                        pElement = pNextElement; } }\
284
253
        } while (0)
285
254
 
286
 
/** Broadcast a notification.
 
255
/* Broadcast a notification.
287
256
*@param iNotifType type of the notification.
288
257
*@param ... parameters to be passed to the callbacks that has registerd to this notification.
289
258
*/
290
 
#define cairo_dock_notify(iNotifType, ...) do {\
 
259
/*#define cairo_dock_notify(iNotifType, ...) do {\
291
260
        gboolean bStop = FALSE;\
292
261
        GSList *pNotificationRecordList = cairo_dock_get_notifications_list (iNotifType);\
293
262
        _cairo_dock_notify(pNotificationRecordList, bStop, ##__VA_ARGS__);\
294
 
        } while (0)
 
263
        } while (0)*/
295
264
 
296
 
/** Broadcast a notification from a given icon.
 
265
/* Broadcast a notification from a given icon.
297
266
*@param pIcon the icon.
298
267
*@param iNotifType type of the notification.
299
268
*@param ... parameters to be passed to the callbacks that has registerd to this notification.
300
269
*/
301
 
#define cairo_dock_notify_on_icon(pIcon, iNotifType, ...) do {\
 
270
/*#define cairo_dock_notify_on_icon(pIcon, iNotifType, ...) do {\
302
271
        gboolean bStop = FALSE;\
303
272
        GSList *pNotificationRecordList = cairo_dock_get_notifications_list (iNotifType);\
304
273
        _cairo_dock_notify(pNotificationRecordList, bStop, ##__VA_ARGS__);\
305
 
        if (pIcon && pIcon->pNotificationsTab) {\
306
 
                GSList *pNotificationRecordList = g_ptr_array_index (pIcon->pNotificationsTab, iNotifType);\
307
 
                _cairo_dock_notify(pNotificationRecordList, bStop, ##__VA_ARGS__);}\
308
 
        } while (0)
 
274
        if (! bStop && pIcon) {\
 
275
                cairo_dock_notify_on_object (pIcon, iNotifType, ##__VA_ARGS__); }\
 
276
        } while (0)*/
309
277
 
310
 
/** Broadcast a notification from a given container.
 
278
/* Broadcast a notification from a given container.
311
279
*@param pContainer the container.
312
280
*@param iNotifType type of the notification.
313
281
*@param ... parameters to be passed to the callbacks that has registerd to this notification.
314
282
*/
315
 
#define cairo_dock_notify_on_container(pContainer, iNotifType, ...) do {\
 
283
/*#define cairo_dock_notify_on_container(pContainer, iNotifType, ...) do {\
316
284
        gboolean bStop = FALSE;\
317
285
        GSList *pNotificationRecordList = cairo_dock_get_notifications_list (iNotifType);\
318
286
        _cairo_dock_notify(pNotificationRecordList, bStop, ##__VA_ARGS__);\
319
 
        if (pContainer && pContainer->pNotificationsTab) {\
320
 
                GSList *pNotificationRecordList = g_ptr_array_index (pContainer->pNotificationsTab, iNotifType);\
321
 
                _cairo_dock_notify(pNotificationRecordList, bStop, ##__VA_ARGS__);}\
322
 
        } while (0)
 
287
        if (! bStop && pContainer) {\
 
288
                cairo_dock_notify_on_object (pContainer, iNotifType, ##__VA_ARGS__); }\
 
289
        } while (0)*/
323
290
 
324
291
 
325
292
void cairo_dock_free_notification_table (GPtrArray *pNotificationsTab);
326
293
 
327
294
 
 
295
#define cairo_dock_install_notifications_on_object(pObject, iNbNotifs) do {\
 
296
        GPtrArray **pNotificationsTabPtr = (GPtrArray**) pObject;\
 
297
        GPtrArray *pNotificationsTab = g_ptr_array_new ();\
 
298
        g_ptr_array_set_size (pNotificationsTab, iNbNotifs);\
 
299
        *pNotificationsTabPtr = pNotificationsTab; } while (0)
 
300
 
 
301
#define cairo_dock_clear_notifications_on_object(pObject) do {\
 
302
        GPtrArray **pNotificationsTabPtr = (GPtrArray**) pObject;\
 
303
        GPtrArray *pNotificationsTab = *pNotificationsTabPtr;\
 
304
        cairo_dock_free_notification_table (pNotificationsTab); } while (0)
 
305
 
 
306
/** Register an action to be called when a given notification is broadcasted from a given object.
 
307
*@param pObject the object (Icon, Container, Manager).
 
308
*@param iNotifType type of the notification.
 
309
*@param pFunction callback.
 
310
*@param bRunFirst CAIRO_DOCK_RUN_FIRST to be called before Cairo-Dock, CAIRO_DOCK_RUN_AFTER to be called after.
 
311
*@param pUserData data to be passed as the first parameter of the callback.
 
312
*/
 
313
void cairo_dock_register_notification_on_object (gpointer pObject, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData);
 
314
 
 
315
/** Remove a callback from the list of callbacks of a given object for a given notification and a given data.
 
316
*@param pObject the object (Icon, Container, Manager) for which the action has been registered.
 
317
*@param iNotifType type of the notification.
 
318
*@param pFunction callback.
 
319
*@param pUserData data that was registerd with the callback.
 
320
*/
 
321
void cairo_dock_remove_notification_func_on_object (gpointer pObject, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData);
 
322
 
 
323
/** Broadcast a notification on a given object.
 
324
*@param pObject the object (Icon, Container, Manager).
 
325
*@param iNotifType type of the notification.
 
326
*@param ... parameters to be passed to the callbacks that has registerd to this notification.
 
327
*@return whether the notification has been intercepted or not.
 
328
*/
 
329
#define cairo_dock_notify_on_object(pObject, iNotifType, ...) \
 
330
        __extension__ ({\
 
331
        gboolean _bStop = FALSE;\
 
332
        if (pObject != NULL) {\
 
333
                GPtrArray **pNotificationsTabPtr = (GPtrArray**) pObject;\
 
334
                GPtrArray *pNotificationsTab = *pNotificationsTabPtr;\
 
335
                if (pNotificationsTab && iNotifType < pNotificationsTab->len) {\
 
336
                        GSList *pNotificationRecordList = g_ptr_array_index (pNotificationsTab, iNotifType);\
 
337
                        _cairo_dock_notify (pNotificationRecordList, _bStop, ##__VA_ARGS__);} }\
 
338
        _bStop; })
 
339
 
328
340
G_END_DECLS
329
341
#endif