File: initialization.md

package info (click to toggle)
feedbackd 0.8.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,068 kB
  • sloc: ansic: 7,926; xml: 97; makefile: 31; sh: 27; python: 8
file content (34 lines) | stat: -rw-r--r-- 991 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
Title: Initialization
Slug: initialization

# Initialization

Before using libfeedback, it must be initialized. To use the library
call [func@Lfb.init]() with the id of your application (usually
the desktop file name without the .desktop extension). For that you
include the `libfeedback.h` header. Since the API is considered
unstable at this point in time you need to acknowledge this by
defining `LIBFEEDBACK_USE_UNSTABLE_API`:

```c
  #define LIBFEEDBACK_USE_UNSTABLE_API
  #include <libfeedback.h>

  int main(void)
  {
     g_autoptr (GError) *err = NULL;
     if (lfb_init ("com.example.appid", &err)) {
       g_error ("%s", err->message);
     }
     ...
     lfb_uninit ();
     return 0;
  }
```

You can also acknowledge this with the definition option of your C
compiler, like `-DFEEDBACK_USE_UNSTABLE_API`.

After initializing the library you can trigger feedback using
[class@Lfb.Event] objects.  When your application finishes call
[func@Lfb.uninit]() to free any resources: