File: gol.h

package info (click to toggle)
growl-for-linux 0.8.5-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,244 kB
  • sloc: sh: 4,121; ansic: 3,735; makefile: 74
file content (68 lines) | stat: -rw-r--r-- 1,718 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
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
#ifndef _gol_h_
#define _gol_h_

#include <glib.h>

#define GOL_PP_CAT_IMPL_(x, y) x ## y
#define GOL_PP_CAT(x, y) GOL_PP_CAT_IMPL_(x, y)

#if defined(__cplusplus)
# define GOL_INLINE inline
#elif defined(__GNUC__)
# define GOL_INLINE __attribute__((unused)) static
#else
# define GOL_INLINE static
#endif

#define GOL_UNUSED_ARG_IMPL_ GOL_PP_CAT(_gol_unused_argument_, __LINE__)
#if defined(__GNUC__)
# define GOL_UNUSED_ARG(n) GOL_PP_CAT(GOL_UNUSED_ARG_IMPL_, GOL_PP_CAT(_, n)) __attribute__((unused))
#else
# define GOL_UNUSED_ARG(n) GOL_PP_CAT(GOL_UNUSED_ARG_IMPL_, GOL_PP_CAT(_, n))
#endif

#if defined(DEBUG) && !defined(NDEBUG)
# define GOL_DEBUG_MESSAGE_TEMPLATE(func, message, ...) \
  func("%s(%d): %s: " message "%c", __FILE__, __LINE__, __func__, __VA_ARGS__)
#else
# define GOL_DEBUG_MESSAGE_TEMPLATE(...) ((void) 0)
#endif
# define gol_debug_message(...) GOL_DEBUG_MESSAGE_TEMPLATE(g_message, __VA_ARGS__, (char) 0)
# define gol_debug_warning(...) GOL_DEBUG_MESSAGE_TEMPLATE(g_warning, __VA_ARGS__, (char) 0)
# define gol_debug_critical(...) GOL_DEBUG_MESSAGE_TEMPLATE(g_ciritical, __VA_ARGS__, (char) 0)
# define gol_debug_debug(...) GOL_DEBUG_MESSAGE_TEMPLATE(g_debug, __VA_ARGS__, (char) 0)

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  gchar* title;
  gchar* text;
  gchar* icon;
  gchar* url;
  gboolean sticky;
  gboolean local;
  gint timeout;
} NOTIFICATION_INFO;

typedef struct {
  void (*show)(NOTIFICATION_INFO* ni);
} SUBSCRIPTOR_CONTEXT;

GOL_INLINE void
free_notification_info(NOTIFICATION_INFO* const ni) {
  if (!ni) return;
  g_free(ni->title);
  g_free(ni->text);
  g_free(ni->icon);
  g_free(ni->url);
  g_free(ni);
}

#ifdef __cplusplus
}
#endif

#endif /* _gol_h_ */