~ubuntu-branches/ubuntu/trusty/modem-manager-gui/trusty-backports

« back to all changes in this revision

Viewing changes to src/notifications.h

  • Committer: Package Import Robot
  • Author(s): Graham Inggs
  • Date: 2013-07-30 12:51:59 UTC
  • Revision ID: package-import@ubuntu.com-20130730125159-flzv882fhuzhmfmi
Tags: upstream-0.0.16
ImportĀ upstreamĀ versionĀ 0.0.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      notifications.h
 
3
 *      
 
4
 *      Copyright 2013 Alex <alex@linuxonly.ru>
 
5
 *      
 
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.
 
10
 *      
 
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.
 
15
 *      
 
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/>.
 
18
 */
 
19
 
 
20
#ifndef __MMGUINOTIFICATIONS_H__
 
21
#define __MMGUINOTIFICATIONS_H__
 
22
 
 
23
#include <stdlib.h>
 
24
#include <stdio.h>
 
25
#include <glib.h>
 
26
#include <gmodule.h>
 
27
 
 
28
#include "libpaths.h"
 
29
 
 
30
typedef enum
 
31
{
 
32
        MMGUI_NOTIFICATIONS_URGENCY_LOW,
 
33
        MMGUI_NOTIFICATIONS_URGENCY_NORMAL,
 
34
        MMGUI_NOTIFICATIONS_URGENCY_CRITICAL,
 
35
 
 
36
} NotificationsUrgency;
 
37
 
 
38
typedef struct _ca_context ca_context;
 
39
typedef struct _ca_proplist ca_proplist;
 
40
 
 
41
typedef void (*ca_finish_callback_t)(ca_context *c, guint32 id, gint error_code, void *userdata);
 
42
 
 
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);
 
52
 
 
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);
 
63
 
 
64
enum _mmgui_notifications_sound {
 
65
        MMGUI_NOTIFICATIONS_SOUND_NONE = 0,
 
66
        MMGUI_NOTIFICATIONS_SOUND_INFO,
 
67
        MMGUI_NOTIFICATIONS_SOUND_MESSAGE
 
68
};
 
69
 
 
70
struct _mmgui_notifications {
 
71
        //Modules
 
72
        GModule *notifymodule;
 
73
        GModule *canberramodule;
 
74
        //libnotify functions
 
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;
 
92
        //libcanberra context
 
93
        ca_context *cacontext;
 
94
};
 
95
 
 
96
typedef struct _mmgui_notifications *mmgui_notifications_t;
 
97
 
 
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);
 
101
 
 
102
#endif /* __MMGUI_NOTIFICATIONS_H__ */