4
* Copyright 2013 Alex <alex@linuxonly.ru>
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 3 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef __MMGUINOTIFICATIONS_H__
21
#define __MMGUINOTIFICATIONS_H__
32
MMGUI_NOTIFICATIONS_URGENCY_LOW,
33
MMGUI_NOTIFICATIONS_URGENCY_NORMAL,
34
MMGUI_NOTIFICATIONS_URGENCY_CRITICAL,
36
} NotificationsUrgency;
38
typedef struct _ca_context ca_context;
39
typedef struct _ca_proplist ca_proplist;
41
typedef void (*ca_finish_callback_t)(ca_context *c, guint32 id, gint error_code, void *userdata);
43
/*libnotify function prototypes*/
44
typedef gboolean (*notify_init_func)(const gchar * app_name);
45
typedef gpointer (*notify_notification_new_func)(const char *summary, const char *body, const char *icon);
46
typedef void (*notify_notification_set_timeout_func)(gpointer notification, gint timeout);
47
typedef void (*notify_notification_set_hint_func)(gpointer notification, const char *key, GVariant *value);
48
typedef void (*notify_notification_set_image_from_pixbuf_func)(gpointer notification, gpointer pixbuf);
49
typedef void (*notify_notification_set_category_func)(gpointer notification, const char *category);
50
typedef void (*notify_notification_set_urgency_func)(gpointer notification, NotificationsUrgency urgency);
51
typedef void (*notify_notification_show_func)(gpointer notification, GError **error);
53
/*libcanberra function prototypes*/
54
typedef void (*ca_finish_callback_t)(ca_context *c, guint32 id, gint error_code, gpointer userdata);
55
typedef gint (*ca_context_create_func)(ca_context **);
56
typedef gint (*ca_context_destroy_func)(ca_context *);
57
typedef gint (*ca_context_play_func)(ca_context *c, guint32 id, ...);
58
typedef gint (*ca_context_change_props_func)(ca_context *c, ...);
59
typedef gint (*ca_proplist_create_func)(ca_proplist **);
60
typedef gint (*ca_proplist_destroy_func)(ca_proplist *);
61
typedef gint (*ca_proplist_sets_func)(ca_proplist *c, const gchar *key, const gchar *value);
62
typedef gint (*ca_context_play_full_func)(ca_context *c, guint32 id, ca_proplist *p, ca_finish_callback_t cb, gpointer userdata);
64
enum _mmgui_notifications_sound {
65
MMGUI_NOTIFICATIONS_SOUND_NONE = 0,
66
MMGUI_NOTIFICATIONS_SOUND_INFO,
67
MMGUI_NOTIFICATIONS_SOUND_MESSAGE
70
struct _mmgui_notifications {
72
GModule *notifymodule;
73
GModule *canberramodule;
75
notify_init_func notify_init;
76
notify_notification_new_func notify_notification_new;
77
notify_notification_set_timeout_func notify_notification_set_timeout;
78
notify_notification_set_hint_func notify_notification_set_hint;
79
notify_notification_set_image_from_pixbuf_func notify_notification_set_image_from_pixbuf;
80
notify_notification_set_category_func notify_notification_set_category;
81
notify_notification_set_urgency_func notify_notification_set_urgency;
82
notify_notification_show_func notify_notification_show;
83
//libcanberra functions
84
ca_context_create_func ca_context_create;
85
ca_context_destroy_func ca_context_destroy;
86
ca_context_play_func ca_context_play;
87
ca_context_change_props_func ca_context_change_props;
88
ca_proplist_create_func ca_proplist_create;
89
ca_proplist_destroy_func ca_proplist_destroy;
90
ca_proplist_sets_func ca_proplist_sets;
91
ca_context_play_full_func ca_context_play_full;
93
ca_context *cacontext;
96
typedef struct _mmgui_notifications *mmgui_notifications_t;
98
mmgui_notifications_t mmgui_notifications_new(mmgui_libpaths_cache_t libcache);
99
gboolean mmgui_notifications_show(mmgui_notifications_t notifications, gchar *caption, gchar *text, enum _mmgui_notifications_sound sound);
100
void mmgui_notifications_close(mmgui_notifications_t notifications);
102
#endif /* __MMGUI_NOTIFICATIONS_H__ */