• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2013 Lars Uebernickel
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
16  *
17  * Authors: Lars Uebernickel <lars@uebernic.de>
18  */
19 
20 #ifndef __G_NOTIFICATION_BACKEND_H__
21 #define __G_NOTIFICATION_BACKEND_H__
22 
23 #include <gio/giotypes.h>
24 
25 G_BEGIN_DECLS
26 
27 #define G_TYPE_NOTIFICATION_BACKEND         (g_notification_backend_get_type ())
28 #define G_NOTIFICATION_BACKEND(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NOTIFICATION_BACKEND, GNotificationBackend))
29 #define G_IS_NOTIFICATION_BACKEND(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NOTIFICATION_BACKEND))
30 #define G_NOTIFICATION_BACKEND_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), G_TYPE_NOTIFICATION_BACKEND, GNotificationBackendClass))
31 #define G_NOTIFICATION_BACKEND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NOTIFICATION_BACKEND, GNotificationBackendClass))
32 
33 #define G_NOTIFICATION_BACKEND_EXTENSION_POINT_NAME "gnotification-backend"
34 
35 typedef struct _GNotificationBackend      GNotificationBackend;
36 typedef struct _GNotificationBackendClass GNotificationBackendClass;
37 
38 struct _GNotificationBackend
39 {
40   GObject parent_instance;
41 
42   GApplication    *application;
43   GDBusConnection *dbus_connection;
44 };
45 
46 struct _GNotificationBackendClass
47 {
48   GObjectClass parent_class;
49 
50   gboolean  (*is_supported)             (void);
51 
52   void      (*send_notification)        (GNotificationBackend *backend,
53                                          const gchar          *id,
54                                          GNotification        *notification);
55 
56   void      (*withdraw_notification)    (GNotificationBackend *backend,
57                                          const gchar          *id);
58 };
59 
60 GType                   g_notification_backend_get_type                 (void);
61 
62 GNotificationBackend *  g_notification_backend_new_default              (GApplication         *application);
63 
64 void                    g_notification_backend_send_notification        (GNotificationBackend *backend,
65                                                                          const gchar          *id,
66                                                                          GNotification        *notification);
67 
68 void                    g_notification_backend_withdraw_notification    (GNotificationBackend *backend,
69                                                                          const gchar          *id);
70 
71 G_END_DECLS
72 
73 #endif
74