Added a NotifyIcon struct and the beginnings of the API.
This commit is contained in:
parent
0f58a300f2
commit
f722bacff3
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Jun 29 19:26:58 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
|
||||||
|
|
||||||
|
* libnotify/notify.c:
|
||||||
|
* libnotify/notify.h:
|
||||||
|
- Added a NotifyIcon struct and the beginnings of the API.
|
||||||
|
|
||||||
Tue Jun 29 18:49:38 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
|
Tue Jun 29 18:49:38 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
|
||||||
|
|
||||||
* libnotify/notify.c:
|
* libnotify/notify.c:
|
||||||
|
|
|
@ -63,6 +63,14 @@ struct _NotifyHandle
|
||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _NotifyIcon
|
||||||
|
{
|
||||||
|
char *uri;
|
||||||
|
|
||||||
|
size_t raw_len;
|
||||||
|
guchar *raw_data;
|
||||||
|
};
|
||||||
|
|
||||||
static DBusConnection *_dbus_conn = NULL;
|
static DBusConnection *_dbus_conn = NULL;
|
||||||
static gboolean _initted = FALSE;
|
static gboolean _initted = FALSE;
|
||||||
static gboolean _filters_added = FALSE;
|
static gboolean _filters_added = FALSE;
|
||||||
|
@ -395,6 +403,57 @@ notify_close(NotifyHandle *handle)
|
||||||
dbus_message_unref(message);
|
dbus_message_unref(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Icon API
|
||||||
|
**************************************************************************/
|
||||||
|
NotifyIcon *
|
||||||
|
notify_icon_new(const char *icon_uri)
|
||||||
|
{
|
||||||
|
NotifyIcon *icon;
|
||||||
|
|
||||||
|
g_return_val_if_fail(icon_uri != NULL, NULL);
|
||||||
|
g_return_val_if_fail(*icon_uri != '\0', NULL);
|
||||||
|
|
||||||
|
icon = g_new0(NotifyIcon, 1);
|
||||||
|
|
||||||
|
icon->uri = g_strdup(icon_uri);
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
NotifyIcon *
|
||||||
|
notify_icon_new_with_data(size_t icon_len, const guchar *icon_data)
|
||||||
|
{
|
||||||
|
NotifyIcon *icon;
|
||||||
|
|
||||||
|
g_return_val_if_fail(icon_len > 0, NULL);
|
||||||
|
g_return_val_if_fail(icon_data != NULL, NULL);
|
||||||
|
|
||||||
|
icon = g_new0(NotifyIcon, 1);
|
||||||
|
|
||||||
|
icon->raw_len = icon_len;
|
||||||
|
icon->raw_data = g_memdup(icon_data, icon_len);
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
notify_icon_destroy(NotifyIcon *icon)
|
||||||
|
{
|
||||||
|
g_return_if_fail(icon != NULL);
|
||||||
|
|
||||||
|
if (icon->uri != NULL)
|
||||||
|
g_free(icon->uri);
|
||||||
|
|
||||||
|
if (icon->raw_data != NULL)
|
||||||
|
g_free(icon->raw_data);
|
||||||
|
|
||||||
|
g_free(icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Notifications API
|
||||||
|
**************************************************************************/
|
||||||
static NotifyHandle *
|
static NotifyHandle *
|
||||||
_notify_send_notification(NotifyUrgency urgency, const char *summary,
|
_notify_send_notification(NotifyUrgency urgency, const char *summary,
|
||||||
const char *detailed, const char *icon_uri,
|
const char *detailed, const char *icon_uri,
|
||||||
|
|
|
@ -47,6 +47,7 @@ typedef enum
|
||||||
} NotifyUrgency;
|
} NotifyUrgency;
|
||||||
|
|
||||||
typedef struct _NotifyHandle NotifyHandle;
|
typedef struct _NotifyHandle NotifyHandle;
|
||||||
|
typedef struct _NotifyIcon NotifyIcon;
|
||||||
|
|
||||||
typedef void (*NotifyCallback)(NotifyHandle *, guint32, gpointer);
|
typedef void (*NotifyCallback)(NotifyHandle *, guint32, gpointer);
|
||||||
|
|
||||||
|
@ -88,6 +89,40 @@ void notify_close(NotifyHandle *handle);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/** @name NotifyIcon API */
|
||||||
|
/**************************************************************************/
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an icon with the specified icon URI.
|
||||||
|
*
|
||||||
|
* @param icon_uri The icon URI.
|
||||||
|
*
|
||||||
|
* @return The icon.
|
||||||
|
*/
|
||||||
|
NotifyIcon *notify_icon_new(const char *icon_uri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an icon with the specified icon data.
|
||||||
|
*
|
||||||
|
* @param icon_len The icon data length.
|
||||||
|
* @param icon_data The icon data.
|
||||||
|
*
|
||||||
|
* @return The icon.
|
||||||
|
*/
|
||||||
|
NotifyIcon *notify_icon_new_with_data(size_t icon_len,
|
||||||
|
const guchar *icon_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys an icon.
|
||||||
|
*
|
||||||
|
* @param icon The icon to destroy.
|
||||||
|
*/
|
||||||
|
void notify_icon_destroy(NotifyIcon *icon);
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** @name Notifications API */
|
/** @name Notifications API */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue