utfutil: added simple upcase/locase checks and conversions for cyrillic UTF-8
[iv.d.git] / libnotify.d
blob794cf27e1858f0a926c08b5fb0dfc37d6f6be96b
1 /*
2 * Copyright (C) 2004-2006 Christian Hammond
3 * Copyright (C) 2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 module iv.libnotify /*is aliced*/;
21 pragma(lib, "notify");
23 import iv.alice;
24 //version = libnotify_new;
26 version(none) {
27 void fuckStdErr () {
28 import core.sys.posix.unistd : dup2;
29 import core.sys.posix.fcntl /*: open*/;
30 auto xfd = open("/dev/null", O_WRONLY, 0x1b6/*0o600*/);
31 if (xfd < 0) return;
32 dup2(xfd, 2); // fuck stderr
35 void main () {
36 fuckStdErr();
37 notify_init("test");
38 auto n = notify_notification_new("summary", "body", "none");
39 GError* ge;
40 notify_notification_show(n, &ge);
41 scope(success) notify_uninit();
45 extern(C) nothrow @nogc:
48 struct Version {
49 version(libnotify_new)
50 enum {
51 Major = 0,
52 Minor = 7,
53 Micro = 5,
55 else
56 enum {
57 Major = 0,
58 Minor = 5,
59 Micro = 2,
62 static enum check(int major, int minor, int micro) =
63 Major > major ||
64 (Major == major && Minor > minor) ||
65 (Major == major && Minor == minor && Micro >= micro);
69 alias GType = ulong;
70 alias void function (void*) GFreeFunc;
72 struct GError {
73 uint domain;
74 int code;
75 char* message;
78 struct GList {
79 void* data;
80 GList* next;
81 GList* prev;
84 // dummies
85 struct GdkPixbuf {}
86 struct GObject {}
87 struct GObjectClass {}
88 struct GVariant {}
89 struct GtkWidget {}
92 GType notify_urgency_get_type ();
95 /// special timeout values
96 enum Expiration {
97 Default = -1, /// The default expiration time on a notification.
98 Never = 0, /// The notification never expires. It stays open until closed by the calling API or the user.
102 // #define NOTIFY_TYPE_NOTIFICATION (notify_notification_get_type ())
103 // #define NOTIFY_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotification))
104 // #define NOTIFY_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
105 // #define NOTIFY_IS_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NOTIFY_TYPE_NOTIFICATION))
106 // #define NOTIFY_IS_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NOTIFY_TYPE_NOTIFICATION))
107 // #define NOTIFY_NOTIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
110 //struct NotifyNotificationPrivate;
111 struct NotifyNotification {
112 /*< private >*/
113 GObject parent_object;
114 /*NotifyNotificationPrivate*/void *priv;
118 struct NotifyNotificationClass {
119 GObjectClass parent_class;
120 /* Signals */
121 void function (NotifyNotification* notification) closed;
125 /// The urgency level of the notification.
126 enum NotifyUrgency {
127 Low, /// Low urgency. Used for unimportant notifications.
128 Normal, /// Normal urgency. Used for most standard notifications.
129 Critical, /// Critical urgency. Used for very important notifications.
133 * NotifyActionCallback:
134 * @notification:
135 * @action:
136 * @user_data:
138 * An action callback function.
140 alias NotifyActionCallback = void function (NotifyNotification* notification, char* action, void* user_data);
143 GType notify_notification_get_type ();
144 // there is no `attach` in newver versions
145 version(libnotify_new)
146 NotifyNotification* notify_notification_new (const(char)* summary, const(char)* body_, const(char)* icon);
147 else
148 NotifyNotification* notify_notification_new (const(char)* summary, const(char)* body_, const(char)* icon, GtkWidget* attach=null);
149 bool notify_notification_update (NotifyNotification* notification, const(char)* summary, const(char)* body_, const(char)* icon);
150 bool notify_notification_show (NotifyNotification* notification, GError** error);
151 void notify_notification_set_timeout (NotifyNotification* notification, int timeout);
152 void notify_notification_set_category (NotifyNotification* notification, const(char)* category);
153 void notify_notification_set_urgency (NotifyNotification* notification, NotifyUrgency urgency);
154 void notify_notification_set_image_from_pixbuf (NotifyNotification* notification, GdkPixbuf* pixbuf);
155 void notify_notification_set_icon_from_pixbuf (NotifyNotification* notification, GdkPixbuf* icon);
156 void notify_notification_set_hint_int32 (NotifyNotification* notification, const(char)* key, int value);
157 void notify_notification_set_hint_uint32 (NotifyNotification* notification, const(char)* key, uint value);
158 void notify_notification_set_hint_double (NotifyNotification* notification, const(char)* key, double value);
159 void notify_notification_set_hint_string (NotifyNotification* notification, const(char)* key, const(char)* value);
160 void notify_notification_set_hint_byte (NotifyNotification* notification, const(char)* key, ubyte value);
161 void notify_notification_set_hint_byte_array (NotifyNotification* notification, const(char)* key, const(ubyte)* value, ulong len);
162 //void notify_notification_set_hint (NotifyNotification* notification, const(char)* key, GVariant* value);
163 void notify_notification_set_app_name (NotifyNotification* notification, const(char)* app_name);
164 void notify_notification_clear_hints (NotifyNotification* notification);
165 void notify_notification_add_action (NotifyNotification* notification, const(char)* action, const(char)* label,
166 NotifyActionCallback callback, void* user_data, GFreeFunc free_func);
167 void notify_notification_clear_actions (NotifyNotification* notification);
168 bool notify_notification_close (NotifyNotification* notification, GError** error);
169 int notify_notification_get_closed_reason (const NotifyNotification* notification);
172 bool notify_init (const(char)* app_name);
173 void notify_uninit ();
174 bool notify_is_initted ();
176 const(char)* notify_get_app_name ();
177 void notify_set_app_name (const(char)* app_name);
179 GList *notify_get_server_caps ();
181 bool notify_get_server_info (char** ret_name, char** ret_vendor, char** ret_version, char** ret_spec_version);