root/trunk/libnotify/libnotify/notification.h

Revision 3018 (checked in by chipx86, 2 months ago)

Patch by Colin Walters to add parameter names to NotifyActionCallback? for the introspection stuff.

Line 
1 /**
2  * @file libnotify/notification.h Notification object
3  *
4  * @Copyright (C) 2006 Christian Hammond
5  * @Copyright (C) 2006 John Palmieri
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA  02111-1307, USA.
21  */
22 #ifndef _NOTIFY_NOTIFICATION_H_
23 #define _NOTIFY_NOTIFICATION_H_
24
25 #include <glib.h>
26 #include <glib-object.h>
27 #include <gtk/gtk.h>
28
29 G_BEGIN_DECLS
30
31 #define NOTIFY_EXPIRES_DEFAULT -1
32 #define NOTIFY_EXPIRES_NEVER    0
33
34 #define NOTIFY_TYPE_NOTIFICATION (notify_notification_get_type ())
35 #define NOTIFY_NOTIFICATION(o) \
36     (G_TYPE_CHECK_INSTANCE_CAST ((o), NOTIFY_TYPE_NOTIFICATION, \
37                                  NotifyNotification))
38 #define NOTIFY_NOTIFICATION_CLASS(k) \
39     (G_TYPE_CHECK_CLASS_CAST((k), NOTIFY_TYPE_NOTIFICATION, \
40                              NotifyNotificationClass))
41 #define NOTIFY_IS_NOTIFICATION(o) \
42     (G_TYPE_CHECK_INSTANCE_TYPE ((o), NOTIFY_TYPE_NOTIFICATION))
43 #define NOTIFY_IS_NOTIFICATION_CLASS(k) \
44     (G_TYPE_CHECK_CLASS_TYPE ((k), NOTIFY_TYPE_NOTIFICATION))
45 #define NOTIFY_NOTIFICATION_GET_CLASS(o) \
46     (G_TYPE_INSTANCE_GET_CLASS ((o), NOTIFY_TYPE_NOTIFICATION, \
47                                 NotifyNotificationClass))
48
49
50 typedef struct _NotifyNotification        NotifyNotification;
51 typedef struct _NotifyNotificationClass   NotifyNotificationClass;
52 typedef struct _NotifyNotificationPrivate NotifyNotificationPrivate;
53
54 struct _NotifyNotification
55 {
56     GObject parent_object;
57     NotifyNotificationPrivate *priv;
58 };
59
60 struct _NotifyNotificationClass
61 {
62     GObjectClass parent_class;
63
64     /* Signals */
65     void (*closed)(NotifyNotification *notification);
66 };
67
68 /*
69  * Notification urgency levels.
70  */
71 typedef enum
72 {
73     NOTIFY_URGENCY_LOW,
74     NOTIFY_URGENCY_NORMAL,
75     NOTIFY_URGENCY_CRITICAL,
76
77 } NotifyUrgency;
78
79 typedef void (*NotifyActionCallback)(NotifyNotification *notification,
80                                      gchar *action,
81                                      gpointer user_data);
82
83 #define NOTIFY_ACTION_CALLBACK(func) ((NotifyActionCallback)(func))
84
85 GType notify_notification_get_type();
86
87 NotifyNotification *notify_notification_new(const gchar *summary,
88                                             const gchar *body,
89                                             const gchar *icon,
90                                             GtkWidget *attach);
91 #if GTK_CHECK_VERSION(2, 9, 2)
92 NotifyNotification *notify_notification_new_with_status_icon(
93     const gchar *summary, const gchar *body,
94     const gchar *icon, GtkStatusIcon *status_icon);
95 #endif
96
97 gboolean notify_notification_update(NotifyNotification *notification,
98                                     const gchar *summary,
99                                     const gchar *body,
100                                     const gchar *icon);
101
102 void notify_notification_attach_to_widget(NotifyNotification* notification,
103                                           GtkWidget *attach);
104
105 #if GTK_CHECK_VERSION(2, 9, 2)
106 void notify_notification_attach_to_status_icon(NotifyNotification *notification,
107                                                GtkStatusIcon *status_icon);
108 #endif
109
110 void notify_notification_set_geometry_hints(NotifyNotification *notification,
111                                             GdkScreen *screen,
112                                             gint x,
113                                             gint y);
114
115 gboolean notify_notification_show(NotifyNotification *notification,
116                                   GError **error);
117
118 void notify_notification_set_timeout(NotifyNotification *notification,
119                                      gint timeout);
120
121 void notify_notification_set_category(NotifyNotification *notification,
122                                       const char *category);
123
124 void notify_notification_set_urgency(NotifyNotification *notification,
125                                      NotifyUrgency urgency);
126
127 void notify_notification_set_icon_from_pixbuf(NotifyNotification *notification,
128                                               GdkPixbuf *icon);
129
130 void notify_notification_set_hint_int32(NotifyNotification *notification,
131                                         const gchar *key, gint value);
132 void notify_notification_set_hint_uint32(NotifyNotification *notification,
133                                         const gchar *key, guint value);
134
135 void notify_notification_set_hint_double(NotifyNotification *notification,
136                                          const gchar *key, gdouble value);
137
138 void notify_notification_set_hint_string(NotifyNotification *notification,
139                                          const gchar *key,
140                                          const gchar *value);
141
142 void notify_notification_set_hint_byte(NotifyNotification *notification,
143                                        const gchar *key, guchar value);
144
145 void notify_notification_set_hint_byte_array(NotifyNotification *notification,
146                                              const gchar *key,
147                                              const guchar *value, gsize len);
148
149 void notify_notification_clear_hints(NotifyNotification *notification);
150
151 void notify_notification_add_action(NotifyNotification *notification,
152                                     const char *action, const char *label,
153                                     NotifyActionCallback callback,
154                                     gpointer user_data, GFreeFunc free_func);
155
156 void notify_notification_clear_actions(NotifyNotification *notification);
157 gboolean notify_notification_close(NotifyNotification *notification,
158                                    GError **error);
159
160 gint notify_notification_get_closed_reason(
161     const NotifyNotification *notification);
162
163 G_END_DECLS
164
165 #endif /* NOTIFY_NOTIFICATION_H */
Note: See TracBrowser for help on using the browser.