Compare commits

...

472 Commits

Author SHA1 Message Date
Andre Klapper 80121a3b8c docs: Fix URL to Desktop Notification Spec
Fixes #29
2022-09-04 11:59:49 +02:00
Marco Trevisan (Treviño) 650f2f123e
Releasing version 0.8.1
Update NEWS.
2022-07-17 15:00:39 +02:00
Marco Trevisan (Treviño) a8374698c4 build: Hardcode API version to 0.7
Fixes: #27
2022-07-17 14:58:13 +02:00
Marco Trevisan (Treviño) 359443f70f
Releasing version 0.8.0
Update NEWS.
2022-07-14 17:18:41 +02:00
Marco Trevisan (Treviño) 3d81394cd2 NEWS: Fix style on previous announcement 2022-07-14 17:18:25 +02:00
Marco Trevisan (Treviño) 5e6a52fa4f README: Add reference to Portal Notification APIs 2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 532608248e build: Pre-release bump to 0.8.0 2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) adb3e0c7bf notification: Warn if trying to get the activation token outside activation
This API is intended to be used only during a NotifyActionCallback, so
ensure that this is the case, by warn in case it's not the case.
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 13718b6ea0 notify: Also try to use the flatpak app name as notify app 2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) f3eb807464 notification: Use Desktop Portal notification when running in sandbox
When an application is running from a snap or a flatpak, libnotify
should just work as a FDO Portal Notification wrapper.

As per this, make the library to try use the portal API in sandboxed
applications, by emulating the needed missing pieces.

Not everything can be achieved 1:1, but it's just safer to use in such
contexts.
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) c6534a144c build: Bump dependency on glib 2.38
It's almost 10 years old, so I think we can safely depend on that to
support the features we're optionally depending on, plus the ones we're
going to add
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 543d636153 notification: Move action activation and closing in separate functions
Move handling of such events in different functions so that can be
re-used
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 9e9cb423b9 Notification: Add NotifyClosedReason enum to define closed reasons
We don't change the formal type of notify_notification_get_closed_reason
but it's safe enough to compare the two returned values.
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) cc30d8b8dd notify: Support passing a NULL application name to notify_init()
We can find its name in some scenarios, so make it clearer from in the API.

Also, ensure that notify_set_app_name() is not used with a NULL App
name.
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) e8ea0c39d0 notify: Use lazy snap readings and once per notify instance
An application under snap confinement won't have a way of escaping from
it, so we can just initialize the snap variables at the global notify
scope once and just re-use them when needed.
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 74f87250a3 notify-send: Handle Ctrl+C by closing the notification before exiting
Avoid leaving notifications we're waiting for around on SIGNINT
2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 07a2b2e32c notify-send: Add debug logs about the notification daemon 2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 8ce5daac4f notification: Add docs description for NotifyNotification 2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 9d28fa3600 notification: Document get_activation_token argument 2022-06-07 03:18:38 +02:00
Marco Trevisan (Treviño) 4e40a460ce notification: Fix documentation and transfer info for NotifyActionCallback 2022-06-07 03:18:38 +02:00
Logan Rathbone 8162b1d397 Bump version to 0.7.12
Update NEWS.
2022-05-05 12:03:27 -04:00
Logan Rathbone 4d68baf5ef Merge branch 'fix-electron-crash' into 'master'
Closes #25

See merge request GNOME/libnotify!26
2022-05-05 02:10:25 +00:00
Logan Rathbone 596d09a78f notification: Bookend calling NotifyActionCallback with temporary ref
Starting with d0778595, we access the Notification object after the
NotifyActionCallback; some clients (eg, Electron) have historically
unref'd the object at the end of the NotifyActionCallback. They probably
should not have been doing so, but this hotfix adds an additional ref
before and after the callback so that we don't break existing code.

Fixes #25
2022-05-04 21:04:25 -04:00
Logan Rathbone f5b9619b2f doap: Add self as co-maintainer; remove chammond and mccann
Per:
- Discussions on #release-team
- No response to email to mccann in over 10 days
- Email response from chammond confirming he should no longer be listed
  as maintainer

See also: afef1e98
Closes: #14
2022-05-04 11:36:37 -04:00
Marco Trevisan (Treviño) afef1e98b3 Adding myself as maintainer
As discussed on #release-team:

  21:12:18 <ebassi> Trevinho: You could already add yourself to the DOAP file
2022-05-04 16:22:23 +02:00
Marco Trevisan (Treviño) ecb1d4ec08 libnotify.doap: Add missing description field 2022-05-04 16:22:23 +02:00
Patrick Griffis 6d8e38bc69 Merge branch 'pgriffis/delete-unused-file' into 'master'
Delete unused notifynotification.xml

See merge request GNOME/libnotify!25
2022-05-03 20:37:41 +00:00
Patrick Griffis 6e6d52340b Delete unused notifynotification.xml 2022-05-03 20:35:50 +00:00
Marco Trevisan (Treviño) 1fba04bc03 notification: Include sender-pid hint by default if not provided
It's used by various daemons including GNOME Shell to figure out the
parent application.
2022-04-28 01:06:58 +02:00
Marco Trevisan (Treviño) a674e610ee notify-send: Add debug message about server not supporting persistence
In case a transient notification is requested but persistence is not
supported, it's not an error but it is useful to show a debug message
to clarify that.
2022-04-27 21:32:56 +02:00
Marco Trevisan (Treviño) c99aacdb91 notify-send: Move server capabilities check to a separate function 2022-04-27 21:32:30 +02:00
Marco Trevisan (Treviño) 997115b459 docs/notify-send: Add --transient option to manpage 2022-04-27 21:25:10 +02:00
Marco Trevisan (Treviño) e8a57f7245
Bump version to 0.7.11
Update NEWS.
2022-04-27 21:05:49 +02:00
Marco Trevisan (Treviño) ed43da3479 notify-send: Add explicit option to create transient notifications 2022-04-27 20:52:48 +02:00
Marco Trevisan (Treviño) 02f2f91c3d notify-send: Support passing any hint value, by parsing variant strings 2022-04-27 20:45:06 +02:00
Marco Trevisan (Treviño) d6f4734adf notify-send: Add support for boolean hints
Boolean hints are used for some common parameters such as "transient".

Original bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636343
2022-04-27 20:33:40 +02:00
Marco Trevisan (Treviño) 6e871a4047 cleanup: Do not use GLIB_CHECK_VERSION
It's not supported by GLib 2.26.0, the minimum version we required
2022-04-27 20:18:48 +02:00
Marco Trevisan (Treviño) 59553a5af2 NEWS: Add --wait feature to last release 2022-04-27 20:16:49 +02:00
Marco Trevisan (Treviño) 2674c76f53
Bump version to 0.7.10
Update NEWS.
2022-04-27 19:00:44 +02:00
Marco Trevisan (Treviño) d138596c78 CI: Also install the built files and expose docs and logs 2022-04-27 18:29:47 +02:00
Marco Trevisan (Treviño) d07785959c notification: Add support for getting actions activation token
Notification actions can now be activated with an activation token
containing platform data. So update the notification-spec to include
latest version of the specification, and expose the activation token
during an action activation.

Not to change the API, by modifying the type of NotifyActionCallback
it's just better to provide a function to fetch the activation token
during activation only, so that this can be retro-compatible.

Reference: https://gitlab.freedesktop.org/xdg/xdg-specs/-/commit/b9a4700
2022-04-27 18:02:20 +02:00
Marco Trevisan (Treviño) 47400a2ff7 notify-send: Clear errors that could be re-used
We're using error variable multiple times, and this may lead to problems
when trying to set it again. So let's just clear once it's used.
2022-04-25 22:23:40 +02:00
Marco Trevisan (Treviño) 1da6996491 notify: Use the application ID if available to set the fallback app name 2022-04-25 22:23:40 +02:00
Ben Blain e05030875e docs/notify-send: Add missing --app-name description to manual 2022-04-25 22:23:40 +02:00
Ben Blain 12d4b90623 notify-send: Check for notification server actions capability support 2022-04-25 22:23:40 +02:00
Ben Blain 6c707d2dfd notify-send: Add support for notification actions and responses
The activated action name is written to stdout and the notification is closed
when a valid action has been selected.
2022-04-25 22:23:37 +02:00
Ben Blain a396dd9af9 notify-send: Add option to wait until notification has been closed
If an expiration timeout is set, the notification is not waited longer
than such time.
2022-04-25 22:15:50 +02:00
Matthias Sweertvaegher 00a7e74774 docs/notify-send: Add print/replace-id arguments to man page 2022-04-25 19:43:12 +02:00
Paul Collins 652b4d6911 notify-send: Support for replacing an existing notification
Support printing and overriding notification ID, so that it's possible
to replace a notification that is currently showing with an updated
content.

Based on patch as provided by Paul Collins in the following bug
report:
  https://bugs.launchpad.net/ubuntu/+source/libnotify/+bug/257135/comments/8

Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>

Fixes #19
2022-04-25 19:42:13 +02:00
Marco Trevisan (Treviño) f9c1cf1b71 notification: Keep converted URIs as such when we prepend a path 2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) 997e2e374a notification: Do not duplicate calls on parse functions 2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) 0d86d8c8d5 notification: Improve debug logs when rewriting paths 2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) b2d6712b15 notification: Avoid creating a new hint variant when nothing has changed 2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) 961f45f44c notification: Use snap name and app name as fallback desktop-entry
Snaps use desktop IDs based on the snap name and the application name
inside the snap, so if we're in a such container, we need to compute the
desktop-entry using those values. We can figure them out from the snap
cgroup they're in.

In such case, don't even try to use the GApplication ID as that is
likely wrong in a snapped environment.
2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) e72396e8ca notification: Preserve snap details into the private struct
We may need to use them in various places, so there's no point to repeat
the same in multiple places, this way we can also use some shortcuts for
non-snap setups.
2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) d21b8140a8 notification: Do not try to append snap name to desktop when it's a path 2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) c4d5ea8baf notification: Do not prepend SNAP prefix when is already present
We used to just add it again, to eventually figure out that the file
did not exists, but may not work properly in some scenarios.

Also always fill the path_filename when using a file-name only, as that
may be refer to something under the SNAP path, and in such case we want
to try check if that exists before giving up.
2022-04-25 19:13:22 +02:00
Marco Trevisan (Treviño) d348a36a05 build: Do not require g-ir-scanner on introspection=auto 2022-04-21 23:53:44 +02:00
Marco Trevisan (Treviño) d5a888fa31 notification: Use g_memdup2 when available
It's not really an issue here, as we use a properly typed len, but
better not to use a deprecated and potentially dangerous API.
2022-04-21 23:53:44 +02:00
Marco Trevisan (Treviño) 736fcea1d0 build: Avoid warnings or mis-behavior in recent meson versions
In future meson will check the run_command result by default, while it's
fine for us, it would cause our nicer error message not to work.
2022-04-21 23:53:44 +02:00
Marco Trevisan (Treviño) 2accd4ceab Revert "Revert "Merge branch 'readme' into 'master'""
This reverts commit 1ad4630107.

As per: https://gitlab.gnome.org/GNOME/libnotify/-/commit/1ad46301#note_1434358
2022-04-21 18:51:13 +02:00
Corentin Noël 333f7c5d32 Send the application ID when possible 2022-04-21 16:35:38 +02:00
David King 7f31e29e62 docs: Use consistent IDs in spec build
This avoids differences between IDs for separate builds of the
specification.
2022-04-21 14:37:58 +02:00
Logan Rathbone 1ad4630107 Revert "Merge branch 'readme' into 'master'"
This reverts merge request !21
2022-03-21 22:19:32 +00:00
Logan Rathbone e35921f10f Merge branch 'readme' into 'master'
Add README clarifying status of libnotify

See merge request GNOME/libnotify!21
2022-03-21 22:15:16 +00:00
Maximiliano Sandoval R edb1dc8394
Add README clarifying status of libnotify
See discussions at https://gitlab.gnome.org/GNOME/libnotify/-/issues/20.

Based off https://gitlab.gnome.org/GNOME/libnotify/-/merge_requests/19
2022-03-14 17:50:55 +01:00
Ray Strode a228f1e84d notify-send: Give failing exit code if showing notification fails
Right now notify-send will quietly return a successful exit status
even if showing the notification fails.

This commit changes the behavior to instead fail on failure.

https://gitlab.gnome.org/GNOME/libnotify/-/merge_requests/13
2021-05-14 13:55:53 -04:00
Marco Trevisan 05112e2a5b Merge branch 'update_documenation' into 'master'
Update documenation (generated man file) to express that plasma notification...

See merge request GNOME/libnotify!14
2021-04-06 11:59:19 +00:00
Alberts Muktupāvels 39575f7c6f Merge branch 'master' into 'master'
notify-send: Support commas in icon filenames

See merge request GNOME/libnotify!15
2021-03-26 15:57:33 +00:00
Thorsten Wißmann dfaa76109e notify-send: Support commas in icon filenames
Do not cut off an icon filename (passed to -i) at the first comma
character. The original motivation probably was to support a list of
icon names in -i separated by comma. However, this has never been
implemented and the help text for -i also only mentions "an icon".

Hence, no functionality is lost by this change. In contrast, -i now
supports commas in icon filepaths.

https://gitlab.gnome.org/GNOME/libnotify/-/issues/16
2021-03-26 16:52:49 +01:00
Alberts Muktupāvels 48e64c39bc Merge branch 'fix-ci' into 'master'
fix CI build stuck on TZ data config

See merge request GNOME/libnotify!16
2020-12-24 18:34:29 +00:00
Matthias Sweertvaegher 698a05fcc4 fix CI build stuck on TZ data config
when pushing a new commit, I noticed the CI build gets stuck on:

Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
  1. Africa   3. Antarctica  5. Arctic  7. Atlantic  9. Indian    11. US
  2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. Etc
Geographic area:
2020-12-14 17:44:11 +01:00
Boris Shtrasman 50cf335a34 Take Marco Trevisan text enhencment 2020-09-17 20:52:37 +03:00
Boris Shtrasman 4e2971be0c enhence text 2020-09-01 16:03:03 +03:00
Boris Shtrasman d9ba514b15 Update documenation (generated man file) to express that plasma notification system will ignore timeout value when level is in critical mode 2020-08-31 21:56:54 +03:00
Marco Trevisan (Treviño) 98a4bf483a release: 0.7.9 2020-02-26 20:06:01 +01:00
Marco Trevisan d30f73d628 Merge branch 'wip/jtojnar/manpage' into 'master'
Add notify-send manpage

Closes #4

See merge request GNOME/libnotify!6
2020-01-13 17:15:51 +00:00
Marco Trevisan ea61ec4301 Merge branch 'snap-paths-support' into 'master'
notification: use snap namespace and prefix whent launched inside snap

See merge request GNOME/libnotify!5
2020-01-13 17:11:47 +00:00
Marco Trevisan b95d41283e Merge branch 'wip/jtojnar/drop-autotools' into 'master'
Drop Autotools

See merge request GNOME/libnotify!11
2020-01-13 17:10:31 +00:00
Jan Tojnar edfd97f4a9
ci: Do not pass default flags to meson 2020-01-13 17:12:00 +01:00
Jan Tojnar a599a04de6
Drop Autotools 2020-01-13 17:09:17 +01:00
Jan Tojnar 162d195869
Add notify-send manpage
Taken from Debian, converted to Docbook and fixed some issues.

Closes: https://gitlab.gnome.org/GNOME/libnotify/issues/4
2020-01-13 16:41:31 +01:00
Iain Lane 2e8ed8add3 notification: Handle snap applications
When a non-relocatable application is packaged as a snap, its resources
will be visible under `${SNAP}`. We can discover these resources by
probing paths that are given to us and trying the same path under
`${SNAP}` if the probe fails.

Snap packages have desktop files namespaced by the snap name. This name
is available inside the snap environment as `${SNAP_NAME}`. Also probe
desktop files and try this form of mangled name if the referenced
desktop file is not found.
2019-08-14 15:43:43 +02:00
Jan Tojnar 55eb69247f
build: check supported linker args before build
MacOS linker does not support --version-script argument so we need
to only add it to ldflags when it is available.
2019-04-26 20:20:22 +02:00
Florian Müllner 44f9222212 Bump version to 0.7.8
Update NEWS.
2019-03-28 19:24:26 +01:00
Florian Müllner f5a845dd00 build: Don't use absolute path with 'subdir' keyword
Newer meson versions expect a relative path (to the includedir option)
there and reject passing an absolute path.

https://gitlab.gnome.org/GNOME/libnotify/merge_requests/8
2019-03-28 19:06:26 +01:00
Iain Lane d3277ac331 Merge branch 'notify-send-support-file-proto' into 'master'
notify-send: allow passing colon as hint value

See merge request GNOME/libnotify!4
2019-02-15 13:35:36 +00:00
Marco Trevisan (Treviño) 9862ab85e8
notify-send: allow passing colon as hint value
While some hints like image-path or sound-file supports parameters using the
file:// protocol, it's impossible to pass such hints to notify-send, because
it splits the passed argument so that it can have an unlimited number of colons,
while only 3 should be there (as per TYPE:NAME:VALUE format).

So, make `g_strsplit` to accept only 3 tokens as maximum, while pass the
remaining parameters all-together.

So now it's possible to do
  notify-send -h string:image-path:file:///usr/share/icons/foo.png
2019-02-15 12:54:39 +00:00
Abderrahim Kitouni 3f71a3b3ba meson.build: fix pkg-config generation
The code was previously using glib_dep.version() as a version for gio which
generates an invalid version like "gio-2.0 2.59.1" in the pkg-config file.
2019-02-01 14:21:14 +01:00
Marco Trevisan b7351a39fb Merge branch 'wip/3v1n0/meson' into 'master'
Build with meson and add CI

See merge request GNOME/libnotify!3
2019-01-31 17:15:27 +00:00
Marco Trevisan 593f260722 Build with meson and add CI 2019-01-31 17:15:27 +00:00
Jan Tojnar a1bedfa65e
docs: Fix spec build
Correct DTD and add config.xsl to EXTRA_DIST
2019-01-26 10:44:22 +01:00
Emmanuele Bassi 43aac613f1 Conditionall call g_type_init() after a version check
There's no need to call g_type_init() since GLib 2.36, so let's hide it
when building against newer versions of GLib.
2017-07-17 10:16:06 +01:00
Emmanuele Bassi 46e8b1cfad build: Update the list of headers in srcdir
The generated notify-features.h header lives in builddir, which means it
does not exist in srcdir, where glib-mkenums will look. It also contains
pre-processor symbols only, so it's not really useful.

As we removed it from the list of headers to be scanned by the
introspection parser, we also need to update the files rules for that.
2017-07-17 10:11:48 +01:00
Ting-Wei Lan 5398ecfe3f notify-send: Call setlocale in main function
It is required to correctly show translated messages on some locales.

https://bugzilla.gnome.org/show_bug.cgi?id=760438
2016-10-22 11:32:36 +08:00
Cosimo Cecchi c954cabaad release: prepare for 0.7.7 2016-10-13 15:44:18 -07:00
Quentin Glidic 6b03c47e04 build: Use ${PKG_CONFIG} instead of pkg-config
Some use cases (e.g. cross-compiling) require a prefixed pkg-config

https://bugzilla.gnome.org/show_bug.cgi?id=758322

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-06-14 16:07:31 +02:00
Quentin Glidic da7a6a229b build: Allow not to build tests
https://bugzilla.gnome.org/show_bug.cgi?id=634790

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-06-14 16:07:31 +02:00
Andre Klapper 2f2c5649ef doap: add <programming-language> 2014-08-01 23:32:16 +02:00
Olav Vitters dafa138886 doap category core 2014-07-30 20:31:31 +02:00
Evan Nemerson da49c8c599 NotifyNotification: fix set_hint_byte_array value annotation
https://bugzilla.gnome.org/show_bug.cgi?id=667904
2014-04-01 21:19:01 +02:00
Evan Nemerson 5a486c5490 Include C header information and exported packages in GIR
https://bugzilla.gnome.org/show_bug.cgi?id=667904
2014-04-01 21:02:56 +02:00
Ryan Lortie fc6cba771d Remove INSTALL from version control
This is getting updated by autoregen causing jhbuild to mistakenly
believe that the build is dirty.
2014-02-25 15:21:50 -05:00
Matthias Clasen f9355ca357 0.7.6 2013-09-02 21:47:23 -04:00
Giovanni Campagna 2b4ab4d22f NotifyNotification: fix annotation for add_action()
Using GFreeFunc instead of GDestroyNotify was a mistake, but
(scope async) is even a bigger mistake (one that can crash apps,
if an action is invoked multiple times)

https://bugzilla.gnome.org/show_bug.cgi?id=702390
2013-09-02 21:42:37 -04:00
Matthias Clasen 9128042026 Clarify docs of notify_notification_set_timeout
In response to
https://bugzilla.gnome.org/show_bug.cgi?id=701645
2013-06-07 20:28:10 -04:00
Matthias Clasen 6982957661 Bump version 2012-03-26 22:01:28 -04:00
Matthias Clasen 20721a3351 0.7.5 2012-03-26 22:00:54 -04:00
Colin Walters 5e3654b70b build: Also fix introspection when srcdir != builddir 2012-01-16 18:47:31 -05:00
Colin Walters b6e1f7f1a2 build: Another srcdir != builddir fix 2012-01-16 18:44:49 -05:00
Colin Walters bc612b9fc8 build: Fix srcdir != builddir 2012-01-16 18:42:58 -05:00
Jasper St. Pierre b873c61ecc notify-send: Add ability to set app name 2011-10-12 17:31:29 -04:00
Javier Jardón 6a63ae0e8a libnotify-sections.txt: Add some missing api 2011-10-09 13:16:07 -04:00
Javier Jardón 2fe1748295 notification.h: Add deprecation guards 2011-10-09 13:08:53 -04:00
Javier Jardón 34aa27f600 libnotify-docs.sgml: Add list of all and deprecated symbols 2011-10-09 12:56:25 -04:00
Matthias Clasen bd385da02a More D-Bus type clarifications
Only use conventional names where they uniquely identify
the wire type, and type signatures elsewhere. This replaces
DICT by a{sv}
ARRAY by as
STRING_ARRAY by as
2011-09-05 08:55:08 -04:00
Matthias Clasen 3a60c433fd Spec: Clarify types of hints
Most type names were clear, but 'int' could map to different
dbus types. Use conventional D-Bus type names througout.
2011-09-05 08:31:58 -04:00
Matthias Clasen f6638ebfb7 Post-release version bump 2011-08-27 18:56:22 -04:00
Matthias Clasen edfabdf078 0.7.4 2011-08-27 18:55:36 -04:00
William Jon McCann e8ecbfb036 Add simple test for notification removal 2011-06-16 14:46:52 -04:00
Javier Jardón 11d46bf9fd configure.ac: AC_SUBST "pkg_modules" as Its needed to generate the .pc file
This fixes commit fb7790f5b4
2011-05-04 07:04:26 +01:00
Javier Jardón fb7790f5b4 build: Update autotools configuration
Replace deprecated autoconf macros and use the new libtool syntax
2011-05-03 13:47:36 -04:00
Craig Keogh a5ad7b6063 Honor aclocal flags (GNOME bug 641461) 2011-05-03 13:43:55 -04:00
Colin Walters 52cb20bb53 spec: Explicitly document components of on image data
Since we're just passing it ultimately to gdk_pixbuf_new_from_data in
the server, we really should be documenting the restrictions here, such
as bits_per_sample always being 8.

https://bugzilla.gnome.org/show_bug.cgi?id=647672
2011-05-03 13:41:43 -04:00
Matthias Clasen d12145208a Update 2011-05-02 23:40:13 -04:00
Richard Hughes 1c40dfaff4 Add notify_notification_set_app_name() to set the application name for the notification
When a daemon like gnome-settings-daemon has multiple plugins, if a plugin uses
notify_set_app_name() then subsequent notifications get the wrong
'Application name' in the gnome-shell persistent message tray.

This new function is per-notification and is thus allows us to set a custom
application name without overwriting the application name stored by notify_init().

https://bugzilla.gnome.org/show_bug.cgi?id=648947
2011-05-02 23:36:52 -04:00
Matthias Clasen ae361b0d96 Bump version 2011-03-21 19:43:52 -04:00
Matthias Clasen 00203dda48 Really bump version 2011-03-21 19:39:34 -04:00
Matthias Clasen 9fd7ac3008 Update NEWS for 0.7.2 2011-03-21 19:33:03 -04:00
Matthias Clasen 10ea1f0e65 Allow properties to be set in any order
The code as written needlessly required summary to be set first.
https://bugzilla.gnome.org/show_bug.cgi?id=645222
2011-03-20 23:51:55 -04:00
William Jon McCann cdc6f37dd8 Add another test with symbolic icons 2011-03-15 00:09:25 -04:00
Olav Vitters b73380b586 DOAP: Fix userid 2011-01-28 16:14:24 +01:00
William Jon McCann 9fae742d43 Mark image_path as deprecated 2011-01-17 17:02:27 -05:00
William Jon McCann b20752a2e5 Use - instead of _ in hint names consistently 2011-01-17 16:57:31 -05:00
William Jon McCann a967c61e5b Add a way to set or change the application name
May be useful for presenting different message sources
within a single process.
2011-01-17 16:40:17 -05:00
Matthias Clasen 277f40c872 Bump version 2011-01-14 17:14:54 -05:00
Matthias Clasen ac3b072c74 Update NEWS for 0.7.1 2011-01-14 17:05:15 -05:00
Emilio Pozuelo Monfort 9d5e8582b3 Don't export private symbols in the shared library
https://bugzilla.gnome.org/show_bug.cgi?id=635958
2011-01-11 23:33:13 +00:00
Martin Pitt b2020b7f2a Add Python test script for GIR
https://bugzilla.gnome.org/show_bug.cgi?id=635169
2010-11-18 14:21:10 +01:00
Martin Pitt d3de00c14e Some more missing GIR annocations
https://bugzilla.gnome.org/show_bug.cgi?id=635169
2010-11-18 14:05:48 +01:00
Jonathan Matthew 2b6e827092 Generate gir and typelib for gobject-introspection 2010-11-18 00:13:14 -05:00
Jonathan Matthew 84958a7acb Fix some annotations 2010-11-18 00:11:29 -05:00
William Jon McCann 5e9614637d Make actions test more like a real scenario 2010-11-15 14:57:03 -05:00
William Jon McCann ff1941aa9e Make notify-send always die on warnings 2010-11-15 14:56:32 -05:00
William Jon McCann 54b6285006 Don't set NULL hint strings 2010-11-15 14:44:40 -05:00
William Jon McCann e6a4970a79 return NULL not FALSE 2010-11-15 14:41:25 -05:00
William Jon McCann ef744d75d0 Show a warning and assert if notify_init isn't called before show 2010-11-15 12:44:32 -05:00
William Jon McCann 1b33c07973 Remove function annotations from notify.h 2010-11-14 11:07:53 -05:00
Javier Jardón 2ae1dadfa9 docs: Some fixes
https://bugzilla.gnome.org/show_bug.cgi?id=634266
2010-11-14 11:00:57 -05:00
Javier Jardón 7d64b2b514 docs: Update libnotify-sections.txt
https://bugzilla.gnome.org/show_bug.cgi?id=634266
2010-11-14 10:52:47 -05:00
Javier Jardón 3acf1c14e0 docs: Do not generate template files
As we use inline comments now

https://bugzilla.gnome.org/show_bug.cgi?id=634266
2010-11-14 10:52:45 -05:00
Javier Jardón 560abf5c97 docs: Move documentation to inline comments: notify
https://bugzilla.gnome.org/show_bug.cgi?id=634266
2010-11-14 10:52:42 -05:00
Javier Jardón abb884af73 docs: Move documentation to inline comments: notification
https://bugzilla.gnome.org/show_bug.cgi?id=634266
2010-11-14 10:52:38 -05:00
William Jon McCann 59b6bff174 Use LGPL file header
Mistakenly used a GPL license header.
2010-11-14 10:42:10 -05:00
Guillaume Desmottes 49766bca28 notify_notification_set_image_from_pixbuf: ref the pixbuf (#633829) 2010-11-02 17:02:37 +01:00
William Jon McCann a096a24337 Add a negative case to the action-icons test 2010-10-29 19:07:21 -04:00
William Jon McCann 8ae0b6e908 Add test for action-icons 2010-10-29 18:32:46 -04:00
William Jon McCann 1fdab39d65 [spec] Add action-icons hint and server capability
https://bugzilla.gnome.org/show_bug.cgi?id=633510
2010-10-29 18:17:11 -04:00
William Jon McCann 714c29afcc Enhance the resident test 2010-10-29 18:16:31 -04:00
William Jon McCann 4026faf46b Add tests for transient and resident 2010-10-28 14:55:08 -04:00
William Jon McCann 4fa4cedd2e Remove some outdated text in abstract 2010-10-28 14:33:36 -04:00
William Jon McCann dfcf661b80 Add spec versions to transient and resident hints 2010-10-28 14:29:15 -04:00
William Jon McCann a0bab8e3d0 Bump spec version and update authors 2010-10-28 14:26:33 -04:00
William Jon McCann 31dd7c3f7c Add transient hint
https://bugzilla.gnome.org/show_bug.cgi?id=633312
2010-10-28 14:21:59 -04:00
William Jon McCann 015131721c Add persistence server capability 2010-10-28 14:19:32 -04:00
William Jon McCann 487297e072 Add resident hint to the spec.
https://bugzilla.gnome.org/show_bug.cgi?id=633313
2010-10-28 14:14:09 -04:00
William Jon McCann 5a41ef5a09 Post release bump 2010-10-16 22:13:04 -04:00
William Jon McCann fb53f2b8f6 Add news 2010-10-16 22:11:13 -04:00
William Jon McCann 5b1a862c59 Bump version and .so number 2010-10-16 19:16:03 -04:00
William Jon McCann d82ad1b225 Remove silly old dbus version comments in the docs 2010-10-15 00:14:24 -04:00
William Jon McCann cff2c03c51 use the non-deprecated api in the test 2010-10-15 00:13:14 -04:00
William Jon McCann 0c34eb565e Use a less hacky way to get a stock pixbuf 2010-10-15 00:11:58 -04:00
Christian Persch f63e8ab8b1 Port to gdbus
Bug #622891.
2010-10-12 15:57:33 +02:00
William Jon McCann ccff2c5b24 Oops forgot to post release version bump 2010-10-11 23:39:06 -04:00
William Jon McCann f4e06fb372 Replace missing AC_SUBST to fix .pc file 2010-10-09 02:19:31 -04:00
William Jon McCann db7eb0180c Use notify-features.h instead of features.h 2010-10-09 01:26:38 -04:00
William Jon McCann cb6f92ce5b Port to gtk3 for the tests 2010-10-09 01:26:38 -04:00
William Jon McCann b6c1835fcf Don't need to fuss with gtk symbols since we don't use gtk at all anymore 2010-10-09 00:32:31 -04:00
William Jon McCann 7acabe0741 Add a macro for determining the version of the library 2010-10-08 23:29:30 -04:00
William Jon McCann 27e05d0f95 Remove the ability to attach notifications to widgets or positions 2010-10-08 22:47:06 -04:00
William Jon McCann 3f14ad4c71 Remove the ability to attach to a status icon
This technique is replaced by the use of notification persistence.
2010-10-08 22:31:40 -04:00
William Jon McCann 8c180aa49e Add a test for the persistence server capability 2010-10-08 21:29:28 -04:00
William Jon McCann 2c8d865b4f Prepare NEWS for release 2010-10-02 02:20:21 -04:00
William Jon McCann f56ef989e7 Remove obsolete dbus define 2010-10-02 02:20:03 -04:00
Jonny Lamb 4830863bab Use correct variable in NULL check
If you pass NULL as the fourth argument to notify_get_server_info it
segfaults.

https://bugzilla.gnome.org/show_bug.cgi?id=623096
2010-07-01 20:46:04 -04:00
William Jon McCann d69f0a2c83 Unstable branch is now at 0.6 2010-07-01 20:42:20 -04:00
Martin Pitt 1a103f1eee Fix assertion when uniniting without any notifications
The lazy initialization from commit 3dc04fa caused a small regression: When a
process would init and uninit libnotify without ever sending a notification,
_proxy was still NULL, which caused an assertion

(process:20953): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

Bug-Ubuntu: https://bugs.launchpad.net/bugs/570462
2010-07-01 14:32:57 +02:00
Bastien Nocera c8d987d5f2 Post release version bump 2010-06-29 14:53:52 +01:00
Bastien Nocera c56f4855b1 0.5.1 2010-06-29 14:51:11 +01:00
Bastien Nocera 0eb56b2fcf Don't link against a particular version of GTK+
Instead, open ourselves through GModule, and check whether
we have all the GTK+ and GDK functions required for us to
work correctly.

This means that the front-end application cannot rely on
libnotify linking against GTK+, which would only be a problem
for edge-cases.

https://bugzilla.gnome.org/show_bug.cgi?id=622550
2010-06-28 23:34:50 +01:00
William Jon McCann 1fb351b531 Post release version bump 2010-06-28 17:23:38 -04:00
William Jon McCann 0e04cf94cb Update NEWS for release 2010-06-28 17:20:49 -04:00
William Jon McCann 96dc90a8db Doc template changes bs 2010-06-24 04:30:21 -04:00
William Jon McCann 5be65318a4 Disconnect the proxy destroy signal handler 2010-06-24 04:29:55 -04:00
William Jon McCann 27a6e38bbf Only make .bz2 files 2010-06-24 04:05:49 -04:00
William Jon McCann ae09053601 Add -I m4 to flags 2010-06-24 04:03:54 -04:00
William Jon McCann 7b7cf7319e Use m4 dir 2010-06-24 03:33:12 -04:00
William Jon McCann afb6e6a1f3 Remove checks for old GTK+ 2010-06-24 02:56:51 -04:00
William Jon McCann eca356030f Various cleanups 2010-06-24 02:53:16 -04:00
William Jon McCann 55c87b2ead API was added since the last release 2010-06-24 02:50:08 -04:00
William Jon McCann 4ede5fbb6b Use 0.5.0 version series 2010-06-24 02:48:44 -04:00
William Jon McCann 6471bfe9f4 Remove dbus version checks for > 0.60
We already require 0.78 in configure anyway
2010-06-24 02:21:44 -04:00
William Jon McCann 23d7fc296a Don't leak an error 2010-06-24 02:19:07 -04:00
William Jon McCann 87ced33981 Don't g_message when dbus calls fail
It may be annoying in some cases.

https://bugzilla.gnome.org/show_bug.cgi?id=608086
2010-06-24 02:16:58 -04:00
William Jon McCann dedef26ef9 Various cleanups 2010-06-24 02:12:40 -04:00
William Jon McCann d6476d362b Don't try to use the proxy after it is destroyed
https://bugzilla.gnome.org/show_bug.cgi?id=608089
2010-06-24 02:11:53 -04:00
William Jon McCann eed6a066cf Add a never expires test case 2010-06-23 23:16:00 -04:00
Bastien Nocera 1f85092c96 Use g_object_get() to get pixbuf properties
Instead of 7 separate gdk_pixbuf function calls.

https://bugzilla.gnome.org/show_bug.cgi?id=622550
2010-06-24 01:50:34 +01:00
William Jon McCann 9fae4e8c01 Sending NULL body is allowed 2010-06-23 20:28:59 -04:00
William Jon McCann 3b3dbab544 Don't claim that notify_init connects to the server
https://bugzilla.gnome.org/show_bug.cgi?id=608086
2010-06-23 20:28:59 -04:00
Bastien Nocera 9a822e1af9 Fix compile-time warning 2010-06-24 00:12:06 +01:00
Bastien Nocera 5cfe9aaba7 Fix compile warnings for the C marshal file
And quiet down the enum and marshal generations
2010-06-24 00:12:06 +01:00
William Jon McCann d521157ec6 Add test-rtl.c
Missing from 3de71571ea
2010-06-23 19:06:42 -04:00
Andre Klapper 180b2a9244 Bump gtk+ requirement to 2.18 for 5b3f2617d2 2010-04-11 01:40:42 +02:00
William Jon McCann 3806c8e7f9 Replace escape characters with g_strcompress in body
https://bugzilla.gnome.org/show_bug.cgi?id=613999
2010-04-02 20:20:24 -04:00
William Jon McCann 5b3f2617d2 Fix building with GSEAL enabled
https://bugzilla.gnome.org/show_bug.cgi?id=612720
2010-04-02 20:10:29 -04:00
William Jon McCann 597ba8d292 Removed unused code 2010-04-02 19:54:40 -04:00
Martin Pitt 3dc04fac90 lazily start the daemon
notify_init() caused the daemon to be D-Bus activated already, even if the
program that calls it doesn't send an actual notification for a long time (or
potentially not at all).

In order to optimize desktop startup speed, and to avoid unnecessary
processes, launch the daemon on demand only.

https://bugzilla.gnome.org/show_bug.cgi?id=610880
2010-04-02 19:43:35 -04:00
William Jon McCann 3de71571ea Add rtl test case
https://bugzilla.gnome.org/show_bug.cgi?id=608082
2010-04-02 19:20:53 -04:00
William Jon McCann 0fbdd79e9a Improve configure summary 2010-01-31 16:51:52 -05:00
William Jon McCann 3a7e52c9b9 [spec] Add html output 2010-01-31 16:45:01 -05:00
Aurélien Gâteau 4497c99f85 [spec] Update for version 1.1 2010-01-31 16:17:24 -05:00
A. Walton b6c250fcb9 [spec] Clarify image_data/path precidence
Image Data should be considered before Image Path if both are
present (which they shouldn't be, but isn't a hard error).
2010-01-31 15:43:10 -05:00
A. Walton b42a41d5ec [spec] Add sound-name hint 2010-01-31 15:36:28 -05:00
A. Walton 5a08fb1ab7 [spec] Deprecate icon_data in favor of image_data and image_path hints
As discussed on the XDG list.
http://lists.freedesktop.org/archives/xdg/2009-June/010524.html
http://lists.freedesktop.org/archives/xdg/2009-June/010568.html
2010-01-31 15:36:28 -05:00
William Jon McCann 9bc1f5d983 [spec] Fix typo in desktop-entry 2010-01-31 15:36:28 -05:00
William Jon McCann 25b3a73e3d [spec] Fix icon_data typo in 1.0 version 2010-01-31 15:36:14 -05:00
William Jon McCann 80952af10e Add pango's .gitignore generation foo 2010-01-31 14:33:46 -05:00
William Jon McCann 8bf33e6826 [spec] Add 1.0 to released version of the spec 2010-01-31 12:49:26 -05:00
William Jon McCann b71b7beb1a [doc] Add the previously release specs to git
Originally here
 http://trac.galago-project.org/browser/trunk/web/htdocs/specs/notification
2010-01-31 12:44:25 -05:00
Aurélien Gâteau e2fcc5e0dd Fix memory leaks 2010-01-29 06:01:50 -05:00
Aurélien Gâteau 117a582b9b Introduce notify_notification_set_image_from_pixbuf
Same as notify_notification_set_icon_from_pixbuf, but with a more explicit name.
notify_notification_set_icon_from_pixbuf is marked as deprecated.
2010-01-29 05:58:38 -05:00
Aurélien Gâteau 6c1231835d Support for image_data hint
Add support for the image_data hint from version 1.1 of the spec.
2010-01-29 05:50:49 -05:00
William Jon McCann 86b806c71e Add two more cases to basic test
Add summary only and long summary
2010-01-29 04:43:07 -05:00
William Jon McCann 4db61ddb45 Use a consistent style 2010-01-29 04:35:35 -05:00
William Jon McCann ac8fe12f9a Fix mode lines 2010-01-29 03:46:42 -05:00
William Jon McCann 5d5a284ca6 Use consistent style in the tests 2010-01-29 02:59:26 -05:00
William Jon McCann a8524aed6a Use gnome-autogen 2010-01-09 14:32:06 -05:00
William Jon McCann c974b465af Use notify instead of galago 2010-01-09 14:24:44 -05:00
William Jon McCann 0eb01a806e Use silent builds 2010-01-09 14:20:34 -05:00
William Jon McCann fcec1feb2c Add more warnings to build 2010-01-09 13:37:14 -05:00
William Jon McCann 7b4a0ce00b Allow to compile on Hurd
From http://trac.galago-project.org/ticket/166
2010-01-09 13:19:21 -05:00
Matthias Clasen 4b11bb71cf Fix has_nondefault_actions never getting set
Due to an oversight in the condition, has_nondefault_actions is
never set to true.  Not sure this makes a _big_ difference in practice.

http://trac.galago-project.org/ticket/194
2010-01-09 13:13:15 -05:00
William Jon McCann 732437ffc0 Depend on Gtk+ 2.10 for StatusIcon 2010-01-09 13:04:32 -05:00
William Jon McCann 8374438dcf Fix indentation 2010-01-09 13:00:58 -05:00
William Jon McCann 9607cf459f Use only single gtk include 2010-01-09 13:00:53 -05:00
William Jon McCann 4587b7d4de Add DOAP file 2010-01-07 19:05:19 -05:00
Christian Hammond 40781ff602 Patch by Andre Klapper to remove deprecated glib symbols. 2009-07-24 09:13:56 +00:00
Christian Hammond e95a435e80 Bump to version 0.4.5. 2008-11-20 11:17:14 +00:00
Christian Hammond dcd203d082 Patch by Colin Walters to add parameter names to NotifyActionCallback for the introspection stuff. 2008-10-23 21:39:04 +00:00
Christian Hammond d29c11ba8d And fix the registration of the signal. It's been way too long since I worked with gtk in C. Or not long enough. 2008-09-26 01:51:01 +00:00
Christian Hammond cf2f667318 Prevent a backwards-compatibility breakage introduced where the "reason" code was added to the "closed" signal. This meant that existing signal handlers that passed extra data would break. We now require that you call notify_notification_get_closed_reason() to get this data. 2008-09-26 01:46:40 +00:00
Christian Hammond d5addcc1f4 Added support for sending the status icon XID to the notification daemon. This will allow better position tracking for context notifications. Patch by Colin Walters. 2008-09-26 01:12:47 +00:00
Christian Hammond f4ff83ff20 Fixed a breakage where we were including gtkversion.h directly. Reported by Richard Hughes. 2008-09-26 01:07:01 +00:00
Christian Hammond 6b40617e90 Add support for sending the closed reason in the signal handler. Closes ticket #139. 2008-03-19 04:53:30 +00:00
Christian Hammond a94bdff41a - Add a spec_version return value for GetServerInformation.
- Bump to version 1.0. It's about time, and things are pretty solid now.
2007-08-26 01:26:29 +00:00
Christian Hammond b8b9eecf5c Relicense notify-send under the LGPL in order to keep licensing simple and to allow reuse in more projects. Fixes bug #124. 2007-08-26 01:08:34 +00:00
Christian Hammond 47a4bcae1e Bump to version 0.4.4.90. 2007-04-29 09:45:29 +00:00
Christian Hammond ac6030e40f Add Lucas Rocha to the contributors list. 2007-04-29 08:02:49 +00:00
Christian Hammond 8ee3f0d77b Patch by Lucas Rocha to add GObject property accessors for notification IDs. 2007-04-29 07:43:55 +00:00
Christian Hammond da3ef45d56 Bump to version 0.4.4. 2007-02-28 05:12:23 +00:00
Christian Hammond d84da37d79 Update with all the fixes in this release. 2007-02-15 11:10:55 +00:00
Christian Hammond 024008efc7 Prevent a crash when the handler for a notification's closed signal removes the last reference to the notification. We attempted to set the ID of the notification after emitting this signal, but the notification was destroyed already. So, keep a reference while doing all this. This fixes bug #116. 2007-02-15 10:45:40 +00:00
Christian Hammond d43f911108 Get rid of format_func. 2007-02-15 10:29:16 +00:00
Christian Hammond 89d870259f Fix some memory leaks when appending data to a message. Scary, horrible, traumatizing memory leaks. Actually it's pretty bad, though, so new release coming up soon. This fixes bug #112. 2007-02-15 10:10:32 +00:00
Christian Hammond f482d2ef94 Use a more common (I hope) icontheme icon for the test. 2007-02-15 09:59:13 +00:00
Christian Hammond c0c861e473 Fix a bug in notify_notification_add_action where the function to free the user data was never called, causing memory leaks. This fixes bug #119. 2007-02-15 08:54:39 +00:00
Christian Hammond bdf8640cab Added a test program that displays three notifications and then changes the amount of text in one of them. 2006-11-14 07:42:35 +00:00
Christian Hammond 9362dbd6bd Patch by Giacomo Lozito to fix a problem where the dbus proxy was not being freed on notify_uninit, which led to problems when libnotify was used in a loadable module. This fixes bug #92. 2006-11-05 20:07:37 +00:00
Christian Hammond c037f63ca9 Bump to version 0.4.3.90. 2006-11-05 19:54:20 +00:00
Christian Hammond 4eaae59a68 Patch by jylefort to only reset a notification's ID to 0 if it was the notification closed. This fixes bug #94. 2006-11-05 19:52:25 +00:00
Christian Hammond cfdf35c002 Woops. 2006-10-08 17:35:20 +00:00
Christian Hammond e4acc71f61 - Bump the version to 0.4.3.
- Add the release datestamp.
2006-10-08 17:23:30 +00:00
Christian Hammond 4d601b61b1 Patch by lucasr to fix an invalid assertion in notify_notification_new_with_status_icon. This closes bug #85. 2006-09-04 06:49:15 +00:00
Christian Hammond fead26f260 Patch by berndth to stop using g_atexit, as this can fail in the case of a dynamically loaded module. Applications should now call notify_uninit() on exit or on plugin unload. This closes bug #86. 2006-09-04 06:45:34 +00:00
Christian Hammond ed9bc42c6f Emit the property change notification for "status-icon" and not "attach-icon". This closes bug #81. 2006-08-01 02:40:51 +00:00
Christian Hammond b0dad66b71 Patch by Ed Catmur to reset a notification's ID if notify_notification_show() is called on a notification that had already been closed. This causes the notification to receive a new ID. This closes ticket #78. 2006-07-29 10:06:22 +00:00
Christian Hammond 761ad2b8c7 Patch by compnerd to check for glib 2.6+ during configure, as that is now required. This closes ticket #69. 2006-07-13 07:45:34 +00:00
Christian Hammond 1d95f7d3c3 - Patch by mderezynski to send an array of UCHARs as expected by notification-daemon rather than an array of CHARs. This closes ticket #68.
- Bump to version 0.4.2.90.
2006-07-13 07:43:50 +00:00
Christian Hammond f3cd7baba9 Bump to version 0.4.2. 2006-06-18 02:18:18 +00:00
Christian Hammond e447e0e186 Add G_BEGIN_DECLS and G_END_DECLS to notify.h, so that libnotify can be used in C++ applications properly. 2006-06-18 02:17:56 +00:00
Christian Hammond 87098904da Grr, timestamp. I always forget the timestamp. 2006-06-18 01:25:15 +00:00
Christian Hammond 4de529a056 - Fix make distcheck and remove the old RPM spec file.
- Update the news.
- Bump the version to 0.4.1.
2006-06-18 01:20:40 +00:00
Christian Hammond 02442e7e8c Fix a build error on gtk 2.9.2+. This fixes bug #65. 2006-06-15 09:15:02 +00:00
Christian Hammond 7b7b44e64e Shush. 2006-06-09 02:54:53 +00:00
Christian Hammond 304e0ab4a8 Small random fixes. 2006-06-06 19:45:19 +00:00
Christian Hammond bc0afaba4d More fixes.. 2006-06-06 09:17:21 +00:00
Christian Hammond ebda20522d Fix up some references to files. 2006-06-06 08:46:01 +00:00
Christian Hammond 629f6e08ca Provide more documentation. 2006-06-06 08:29:32 +00:00
Christian Hammond 2ef25f78f9 Update notify_notification_set_geometry_hints() to take a x, y instead of a GdkRectangle. We don't need the width and height information. 2006-06-06 07:28:21 +00:00
Christian Hammond cc13b1892f Add some gtk-doc documentation. 2006-06-06 07:14:42 +00:00
Christian Hammond d986aaf233 Patch by chpe to add support for using the new GtkStatusIcon in GTK+ 2.9.x. These functions are #ifdef'd to only be provided in supported versions of GTK. The patch also added support for GObject properties on the NotifyNotification objects. This closes ticket #60. 2006-06-05 00:48:56 +00:00
Christian Hammond 51ecbc7a2b Set _initted to FALSE in notify_uninit(), so that notify_is_initted() won't return TRUE. 2006-06-04 23:12:30 +00:00
Christian Hammond a70c8b7256 - Improve libnotify.pc by pushing dependencies into Requires: instead of Cflags: and Libs:. This closes ticket #58.
- Bump the version to 0.4.0.90.
2006-06-02 22:58:39 +00:00
Christian Hammond 575d12a3cf Add the release marker and the news timestamp. 2006-04-26 08:31:06 +00:00
Christian Hammond 58edddd670 Bundle applet-critical.png. 2006-04-26 08:15:30 +00:00
Christian Hammond 0e1236f8c6 Set the second, replaced notification to have a default expiration. 2006-04-26 08:07:54 +00:00
Christian Hammond d5bc37978f Shush. 2006-04-26 06:54:00 +00:00
Christian Hammond a42dbbb198 - Add GTypes for the enums.
- Bump to version 0.4.0.
2006-04-26 06:53:25 +00:00
Christian Hammond 870f6923ab Use fprintf instead of g_warning. 2006-04-21 22:35:52 +00:00
Christian Hammond 5d9fd84226 Add some names to the patch writers list. 2006-04-21 21:39:06 +00:00
Christian Hammond 26a32c06ee Patch by jensgr to fix some C99 usage in the tests code. 2006-04-21 21:36:21 +00:00
Christian Hammond d4768ac937 Patch by M.S. to switch notify-send to use GOption instead of popt, to add -v, --version, -h, and --hint options, and to rename -T, --type to -c, --category. This also fixes assertions when calling notify-send "". This closes ticket #41. 2006-04-21 21:27:46 +00:00
Christian Hammond 30961cc1a6 - Change the help for notify-send to indicate that --expire-timeout requires milliseconds, not seconds. This fixes bug #28.
- Fixed the short flag for --type to be -T. This fixes bug #18.
2006-03-20 22:17:10 +00:00
Christian Hammond 69547a286e Fix notify-send on PPC. 2006-03-18 22:48:08 +00:00
Christian Hammond cb2ee86909 Don't complain about an unknown action when the action is "default" 2006-02-05 01:18:54 +00:00
Christian Hammond d87a3fec52 Ignore test-xy-actions. 2006-02-04 21:29:50 +00:00
Christian Hammond 22ba935534 Add test-xy-actions. 2006-02-04 21:29:34 +00:00
Christian Hammond 8da44e5b1e Ignore test-urgency. 2006-02-04 20:43:29 +00:00
Christian Hammond 257aaf99d3 Running out of disk space is a critical notification. Set the urgency level in test-multi-actions. 2006-02-04 20:41:26 +00:00
Christian Hammond 931065204c It's a good thing to actually set the urgency levels in the urgency test. 2006-02-04 10:04:27 +00:00
Christian Hammond 8705b75a63 Add a test-urgency testcase. 2006-02-04 09:47:18 +00:00
Christian Hammond 626c43f126 More Doxygen happiness. Still no NotifyNotification docs yet though. 2006-01-29 21:26:57 +00:00
Christian Hammond ea9f0bc684 Make Doxygen happy. 2006-01-29 21:17:56 +00:00
Christian Hammond 47cde24c15 Fixed to actually be valid docbook. 2006-01-26 07:45:24 +00:00
Christian Hammond 2aabd35c72 This file shouldn't be here. 2006-01-26 07:22:59 +00:00
Christian Hammond 0d9ce313ef Forgot the release date :) 2006-01-23 09:39:29 +00:00
Christian Hammond 5fb96a7f24 Okay, release time. 2006-01-23 09:33:39 +00:00
Christian Hammond 58fb79f1bc Removed notify_notification_{ref,unref} from notification.h. 2006-01-23 09:33:21 +00:00
Christian Hammond 9fb6f33824 Make distcheck happy. 2006-01-23 09:31:05 +00:00
Christian Hammond 99048cde1a - Bumped the version to 0.3.2.
- Added news.
2006-01-23 09:20:57 +00:00
Christian Hammond 18d8f305d0 Make a best attempt at clearing away notifications that require actions or that exist until clicked when the calling application exits. This doesn't always work. 2006-01-23 09:10:55 +00:00
Christian Hammond df803f9d01 Fix some errors in the spec file. Some pieces were not updated when the specification was changed, and some pieces were invalid XML. 2006-01-23 07:47:03 +00:00
Christian Hammond 85d5df3cbd Raw images are broken in D-BUS versions less than 0.60. Don't crash under this case, and warn the user. 2006-01-22 21:22:27 +00:00
Christian Hammond c587295cdd Use one D-BUS connection, one GProxy, total. This is better than the one per notification, and fixes a few bugs. 2006-01-21 08:38:35 +00:00
Christian Hammond 9b1b095caf Some small code cleanups. 2006-01-21 04:49:43 +00:00
Christian Hammond 2676d3aa8b I have no clue what this function is. 2006-01-20 10:23:55 +00:00
Christian Hammond ab651643eb Remove notify_notification_show_and_forget(). It's less confusing to have one show function, and require that the user unref. It also simplifies the code quite a bit. 2006-01-20 10:19:44 +00:00
Christian Hammond 8297e321bf Implement per-action user data. 2006-01-20 10:11:23 +00:00
Christian Hammond 85342c8619 - Fix some weird argument ordering in the calls to dbus_g_proxy_call_*().
- Re-order the arguments as per the spec.
- Change NOTIFY_TIMEOUT_* to NOTIFY_EXPIRES_*.
- Update the spec to 0.9.
2006-01-20 10:00:32 +00:00
Christian Hammond a834c839fc - Clean up a lot of the API. Several functions returned gboolean when there was very little point in doing so.
- Add assertions to all the functions.
- Remove the notify_notification_{set,get}_user_data() functions. These are useless, since this is a GObject, and we get it for free.
2006-01-20 09:39:25 +00:00
Christian Hammond 78db57f7f2 Rename notify_notification_set_icon_data_from_pixbuf to notify_notification_set_icon_from_pixbuf. 2006-01-20 06:11:53 +00:00
Christian Hammond 3dac8b3d66 Do some rearranging of the files in libnotify, and include things properly so people can actually use the library without fudging with include paths. 2006-01-20 06:08:58 +00:00
Christian Hammond f351f656e5 Get rid of dbus-compat.h. 2006-01-20 05:56:49 +00:00
Christian Hammond fd53ececa2 Fixed the coding style. 2006-01-20 05:55:30 +00:00
Christian Hammond 3b0e8d2986 Make notify-send work again when a body isn't specified. 2006-01-19 09:35:17 +00:00
Christian Hammond 28e0463e75 Remove the config.h include from notifynotification.h. 2006-01-19 06:25:16 +00:00
Christian Hammond 85981b247c Add back notify_get_server_info() and notify_get_server_caps(). 2006-01-16 01:53:06 +00:00
John (J5) Palmieri 29b5c2b8ea Thu Jan 12 2006 John (J5) Palmieri <johnp@redhat.com>
* libnotify/notifynotification.c (notify_notification_set_user_data):
	fix free function addition
	(notify_notification_get_user_data): added method for actually
	getting the user data (fd.o bug# 5418)
	- patches provided by Duarte Henriques 
	<duarte.henriques at gmail dot com>
2006-01-12 22:29:16 +00:00
Christian Hammond f74c4465ce Move libnotify-ng to libnotify. 2006-01-11 07:48:56 +00:00
Christian Hammond 39f0b92be1 Require D-BUS 0.36+. 2006-01-11 07:33:55 +00:00
Christian Hammond 959eeb5bcd Fix some C99 usage. 2006-01-11 06:56:38 +00:00
Christian Hammond 9e586d627d Shush, SVN. 2006-01-11 06:49:50 +00:00
Christian Hammond 4ddb4eff82 Makefile.in should never have been in the repository. 2006-01-11 06:48:15 +00:00
Christian Hammond 8757fda576 Patch by David Trowbridge to make sure that marshal files actually get built. 2006-01-11 06:47:39 +00:00
Christian Hammond 1ea5eae50a Generate the marshal files automatically. We shouldn't be doing it by hand. 2006-01-09 19:14:10 +00:00
Christian Hammond fb513c854d Clean up lots of warnings. 2006-01-09 18:16:48 +00:00
John (J5) Palmieri 83f6529c18 - Add content to teh NEWS file 2005-12-14 23:10:41 +00:00
John (J5) Palmieri 5cd10607b1 * Release 0.3.0
* tests/Makefile.am, tools/Makefile.am: patch from Rodney
  Dawes <dobey at novell.com> fixing make distcheck

* tools/notify-send.c: use show_and_forget
2005-12-13 22:42:48 +00:00
Christian Hammond 2a094f4efe Reference the bug number for the notify-send fix. 2005-11-12 03:52:11 +00:00
Christian Hammond 68998f6250 - Call notify_icon_new_from_uri() and not notify_icon_new(), since notify_icon_new() doesn't actually take parameters.
- Fix the help for --type.
2005-11-09 08:52:25 +00:00
Christian Hammond 02b010b0bb Add applet-critical.png to EXTRA_DIST. 2005-11-07 00:33:52 +00:00
Christian Hammond d151e4116a Bump to version 0.2.2 and prepare for release. 2005-08-10 09:01:29 +00:00
Christian Hammond 1536cf6201 Hopefully properly grab hint values from the D-BUS message iter in a way that will work on AMD64 and PPC. 2005-08-10 08:38:13 +00:00
Christian Hammond 341489c738 Simplify notify-send a little, and nuke tools/test-replace. It doesn't belong there. 2005-08-10 08:16:16 +00:00
Christian Hammond a0273b6c37 Bump to version 0.2.1.90. 2005-08-10 08:15:16 +00:00
Christian Hammond e6b8d754ae Bump to version 0.2.1. 2005-07-28 18:27:34 +00:00
Christian Hammond c0b423d9ec Talk about variants as the dictionary values for hints. 2005-07-28 18:25:25 +00:00
Christian Hammond e09f929373 Use a variant type for the hint dictionary values. This let's us actually use various data types in D-BUS 0.3x. 2005-07-28 18:22:09 +00:00
Christian Hammond bf6d0d7d0b Tyop. 2005-07-28 08:57:57 +00:00
Christian Hammond 47b4f8bfb5 Forgot this ChangeLog entry.. Basically, we're releasing. 2005-07-28 08:57:15 +00:00
Christian Hammond 07e112a7ee Don't send all hint values as strings. Send as integers, booleans, or strings, depending on what the user set. 2005-07-28 08:54:18 +00:00
Christian Hammond b2b4e09eb6 Support setting boolean hints. 2005-07-28 06:10:32 +00:00
Christian Hammond f40ef57aae Disable animation support on D-BUS 0.3x, since arrays of arrays of a type seems broken. 2005-07-28 05:57:47 +00:00
Christian Hammond ca4d385fa6 - Flush the D-BUS connection queue on uninit so that messages go through and so we don't trigger this ugly little warning on D-BUS 0.3x.
- Fix a compiler warning on gcc4.
2005-07-28 05:53:37 +00:00
Christian Hammond a6949ef276 Actually set the expires flag in the notification handle so we don't just kill off all notifications as soon as we create them and exit. 2005-07-27 09:14:42 +00:00
Christian Hammond bd4f01f033 Handle SIGINT and SIGTERM When raised, we call notify_uninit. notify_uninit now checks if there are any non-expiring notifications and closes them. This is a best-effort to preventing stale notifications from a dead process from displaying on the screen. Of course, we can't handle SIGKILL, so we're stuck there. 2005-07-27 08:50:35 +00:00
Christian Hammond be828ca9ce Patch (bug #3050) by Duarte Henriques to prevent closing notifications we don't own. 2005-07-27 08:15:33 +00:00
Christian Hammond 12f74a149c Patch (bug #3734) by Duarte Henriques to provide a convenient way of integrating libnotify with the glib mainloop. Modifications by me to make it even easier. 2005-07-27 08:11:33 +00:00
Christian Hammond 56cdbb7087 Actually support our own spec and use the number of seconds until expiration instead of current time + number of seconds. That was creating all kinds of problems. 2005-07-27 07:54:15 +00:00
Christian Hammond 430eb532df Compile under D-BUS 0.2x again. 2005-07-27 07:33:37 +00:00
Christian Hammond 7fdc36d00e If the handle given in ActionInvoked is not found in the local table of handles, return from the ActionInvoked handler. Otherwise, every program using libnotify will crash when a notification is clicked. Oops! 2005-07-27 07:22:32 +00:00
Christian Hammond 057751cc69 Fix the key type for the dictionary for hints on D-BUS 0.3x. The notification-daemon side is still broken in this regard. 2005-07-17 01:29:30 +00:00
Christian Hammond 55d6f9dfcc Fixed a couple of D-BUS 0.3x bugs. Several remain though. 2005-07-17 01:25:52 +00:00
Christian Hammond 621266fc7b Update the AUTHORs file with our current contributors. 2005-07-12 19:30:49 +00:00
Christian Hammond edccbd1f40 Patch by Richard Hughes to fix make distcheck, and to provide a Fedora Core 4 RPM spec file. 2005-07-12 19:29:55 +00:00
Christian Hammond 711ba22be4 Decrease the wait time for the replacement notification. 2005-07-10 23:48:15 +00:00
Mike Hearn a2f80feafb Fill in handle->user_data in notify_send_notification_varg 2005-07-09 17:30:55 +00:00
Christian Hammond 635fc9d10a - Conditionally build gdk-dependent test apps if we have gdk.
- Added a X, Y stress test that will be used to help test accurately positioning the arrows.
2005-07-04 09:15:43 +00:00
Christian Hammond 7848ca6968 A few things I did on the way home:
- Added support for hints in the API.
- Don't install the test programs during make install.
2005-07-01 06:42:29 +00:00
Christian Hammond 81a5a510b7 Be a little better at not crashing. Just a bit better. There's still another crash I'm trying to track down. 2005-06-20 08:56:22 +00:00
Christian Hammond 7b16a860ff Close the right container in D-BUS 0.3x. 2005-06-20 07:58:00 +00:00
Christian Hammond 9802bab2b4 Add dbus-compat.h. 2005-06-20 06:33:27 +00:00
Christian Hammond 43e3261d36 Add support for compiling under D-BUS 0.3x. Actually running has not yet been tested! 2005-06-20 06:29:25 +00:00
Christian Hammond 88afc98c6e Updated for the 0.6 notification spec. 2005-04-01 17:30:08 +00:00
Christian Hammond d8c0864049 - Removed all references to NIL, and explained briefly how each parameter can be made empty.
- Bumped to version 0.6.
2005-04-01 17:12:51 +00:00
Mike Hearn 2d528a5351 spaces -> tabs 2004-11-08 23:01:20 +00:00
Mike Hearn 3d86854e83 spaces -> tabs 2004-11-08 23:01:03 +00:00
Christian Hammond a5720caff4 Move our TODO list to the Doxygen @todo commands, so we'll get it in a nice little page of its own in the API docs. 2004-11-06 23:42:20 +00:00
Christian Hammond 034a0598a4 Move the emacs mode string out of the Doxygen comment and into its own. 2004-11-06 23:36:18 +00:00
Christian Hammond 79c1adf73f Quiet svn a bit. 2004-11-06 23:17:55 +00:00
Christian Hammond 7415bbe964 Add a Doxyfile.in and update things so we can get doxygen docs. 2004-11-06 23:14:48 +00:00
Christian Hammond 43c819deaa Use glib's memory allocation stuff instead of libc's. 2004-11-04 07:50:16 +00:00
Christian Hammond 41d4a3e498 Patch from Mike Hearn to do a bunch of stuff, like handling icons and animations better. 2004-11-04 07:44:53 +00:00
Christian Hammond e9347e99f2 Fix make distcheck. 2004-11-03 09:21:23 +00:00
Christian Hammond e63e4a8141 - Added a "suppress-sound" hint.
- Added a "sound" capability.
- Renamed the "soundfile" hint to "sound-file."
- Bumped to version 0.5.
2004-10-02 06:45:31 +00:00
Christian Hammond 22b29718c5 Version 0.4. 2004-09-30 05:35:36 +00:00
Christian Hammond 8012961132 Don't flush the D-BUS connection, and make sure we disconnect from it. 2004-09-30 05:34:33 +00:00
Christian Hammond f4bce0d062 Updated to match the spec. 2004-09-30 04:53:30 +00:00
Christian Hammond 8ee064f00a Fixed to compile. 2004-09-25 19:59:43 +00:00
Mike Hearn 22e87adf07 add tests 2004-09-25 10:05:10 +00:00
Mike Hearn 5918a785f4 The libnotify side of things. Test cases will be checked in later 2004-09-25 09:54:53 +00:00
Christian Hammond 79889fefe6 - Added <img/> tag support in the markup section.
- Detailed what markup is and what it is not, and its restrictions.
- Removed the High urgency level.
- Gave a better categorization to notification type formats.
- Added new notification types.
- Fixed notification expiration so it's a timeout rather than a timestamp.
2004-09-25 07:23:17 +00:00
Christian Hammond 5b02b5e988 Let's comment out the winid and the table and surrounding paragraph for now, until we come up with some standard hints we'd want to use. 2004-09-12 07:07:32 +00:00
Christian Hammond a6e20f61f8 - Changed the app_icon parameter of Notify to take a byte array, string, or NIL, so that it's the same as loading a single frame of a set of images.
- Renamed "Icons and Sounds" to just "Icons."
- Changed the wording about the fallback in case the notification server can't do actions.
2004-09-04 05:28:05 +00:00
Christian Hammond b1b4fdb7ee Removed the sound information. Fixed several typos and references to KNotify. Removed the PID hint. Added some D-BUS Error stuff. 2004-09-02 16:19:28 +00:00
Christian Hammond 59f895bd42 Wrote the section about hints. 2004-09-02 08:19:24 +00:00
Christian Hammond 7681f73929 Wrote about urgency levels. 2004-09-02 08:05:12 +00:00
Christian Hammond 1c085e545e NotificationClosed now returns a reason of 3 when CloseNotification is called. 4 is now Undefined/Reserved. 2004-09-02 07:54:25 +00:00
Christian Hammond 9fe2dbeb18 Shush, svn. 2004-09-01 08:05:26 +00:00
Christian Hammond a538788cb2 Marked up parameters. 2004-09-01 08:05:02 +00:00
Christian Hammond b9dd64dce4 Moved the notification components into a table. 2004-09-01 07:51:10 +00:00
Christian Hammond 4188fb54d3 Moved specification and ChangeLog documentation. 2004-09-01 07:41:05 +00:00
Christian Hammond bed9226908 Added vertical alignment of top to the tables. 2004-09-01 07:39:17 +00:00
Christian Hammond 26439403c1 Finishing adding the rest of the signals to the spec. 2004-09-01 07:32:05 +00:00
Christian Hammond c9f2aac99a Added the notification spec in docbook format. It's not finished. I'm just tired of working on it. 2004-08-30 05:28:22 +00:00
Christian Hammond 63480ac2bd Many sections need to be filled out, but I've updated the notification spec a little to add some things I feel should be in there. I'll try to get to the details later, but I'm packing and getting ready to move. 2004-08-11 09:27:00 +00:00
Christian Hammond 748fba2408 Ignore the test-replace tool. 2004-08-09 20:46:43 +00:00
Christian Hammond eba0b16911 Slight code cleanups. 2004-07-30 01:31:32 +00:00
Mike Hearn f26e56113a First attempt at wording for default actions 2004-07-29 21:02:55 +00:00
Mike Hearn 392d030acf * libnotify/notify.c: Use pointers instead of GINT_TO_POINTER
* tools/test-replace.c: Test replacing notifications
2004-07-14 01:09:40 +00:00
Mike Hearn d513d0de37 State what the return of Notify is when replaces != NIL 2004-07-14 00:10:21 +00:00
Mike Hearn 2f45073df4 Tidy up spec a bit, fix code to set timeout in notify-send 2004-07-14 00:08:12 +00:00
Mike Hearn 6ba11f0bdb Add support for the "replaces" protocol field.
Update SPECIFICATION with clarifications from Maciej
2004-07-13 23:00:33 +00:00
Mike Hearn fa61f33b98 note about knotify 2004-07-06 21:26:03 +00:00
Mike Hearn bd9b91a53d Add a "replaces" field to the Notify request, add fallback to urgency field 2004-07-06 21:18:00 +00:00
Mike Hearn 0ab190f75e We decided NIDs are unique within a session 2004-07-06 20:48:50 +00:00
Mike Hearn 075e6dda7f treat expiry times < current time as timeouts from current instant, convenience for shell scripts 2004-07-04 23:10:25 +00:00
Mike Hearn 3ab64b8b15 fix warning 2004-07-04 23:05:06 +00:00
Mike Hearn c712f972cb Use a direct hash rather than an int hash 2004-07-04 21:52:26 +00:00
Christian Hammond 62c4728327 Don't make IDs of 0 bad. They just want to be loved, too. 2004-07-04 21:34:41 +00:00
Christian Hammond db56d94133 - Changed timeouts to expire times.
- Install notify-send.
2004-07-04 21:09:58 +00:00
Christian Hammond 216d1eaf74 Don't initialize the library until we're ready to talk to it. 2004-07-04 20:54:31 +00:00
Christian Hammond b7208624ca Don't initialize the library until we're ready to talk to it. 2004-07-04 20:46:56 +00:00
Christian Hammond b775f9946e Added the urgency level to the spec, and made it a byte. 2004-07-04 20:34:32 +00:00
Christian Hammond 4661df2654 Renamed tests to tools. 2004-07-04 20:29:23 +00:00
Christian Hammond f835814523 Added the notify-send tool. 2004-07-04 20:28:35 +00:00
Christian Hammond 45fede4d56 Added support for GetCapabilities. 2004-07-03 19:35:55 +00:00
Christian Hammond 3c6d135535 Add support for GetServerInformation. 2004-07-03 19:28:14 +00:00
Christian Hammond 85e21cf7b3 Remove the application info sent on calls to Notify for now, until/if something gets added to the spec about it. 2004-07-03 19:21:57 +00:00
Christian Hammond e6a9f0b27d - Removed the last of the request implementation.
- More work toward migrating the code to the specification.
- Simplified the action implementation a little bit.
2004-07-03 19:18:06 +00:00
Christian Hammond d10e4df0aa Cleaned up some things and updated some stuff to be compliant with the spec. More will come soon. 2004-07-03 18:26:53 +00:00
Christian Hammond 6c7864326f Added a notification ID to the ActionInvoked signal, and renamed a couple things for consistency. 2004-07-03 18:21:37 +00:00
Christian Hammond 8bb3453c72 Renaming EndNotify to CloseNotify 2004-07-01 23:17:04 +00:00
Mike Hearn a6bd8dab1f Add a couple of signals 2004-07-01 23:12:37 +00:00
Mike Hearn 7a564f9ce2 Add GetServerInformation message 2004-07-01 23:05:12 +00:00
Mike Hearn a0897d8451 rename CapsQuery to GetCapabilities 2004-07-01 23:03:12 +00:00
Mike Hearn 203f183810 add some protocol requests. change "buttons" in the overview to "actions". 2004-07-01 23:01:36 +00:00
Mike Hearn e52fa3acf3 Add info on icons/sounds, add CapsQuery protocol request. 2004-07-01 22:44:17 +00:00
Mike Hearn a3e3ba43a4 Update spec 2004-07-01 21:53:48 +00:00
Christian Hammond d4b24da04e Just some additions to the spec. Some of this really needs discussion, and one part should really have its own proposed spec at fd.o :) 2004-07-01 07:59:41 +00:00
Christian Hammond a52bde5491 Change the information about the timeout. If the timeout is 0, it's up to the server to determine what to do (which should be urgency and type-specific) 2004-06-30 18:58:41 +00:00
Christian Hammond 25e119c21b Trailing whitespace bad 2004-06-30 18:44:57 +00:00
Mike Hearn 6d4976e1d1 Initial version 2004-06-30 13:01:57 +00:00
Mike Hearn f4bab23735 change timestamp to standard format 2004-06-30 12:26:37 +00:00
Mike Hearn 52fa6a0bdf * libnotify/notify.[ch]: Add file variables for emacs to match the settings Christian is using. 2004-06-30 12:23:36 +00:00
Christian Hammond 896a99db9d Free up the handle memory for a closed notification. 2004-06-30 09:53:58 +00:00
Christian Hammond 5e153367b3 Due to the new icon struct, a lot of redundant functions have now been removed. 2004-06-30 02:34:10 +00:00
Christian Hammond f722bacff3 Added a NotifyIcon struct and the beginnings of the API. 2004-06-30 02:27:21 +00:00
Christian Hammond 0f58a300f2 Replaced the guint32 ID numbers that were passed around to represent notifications and requests and replaced them with an opaque data structure that abstracts that and other stuff. 2004-06-30 01:51:40 +00:00
Christian Hammond 071df6bfb7 Changed 8 space to 4 space tabs. 2004-06-30 01:21:33 +00:00
Christian Hammond 96276c9d43 Update the AUTHORS file. 2004-06-29 21:53:51 +00:00
Christian Hammond 13356532df Patch by Mike Hearn to add a print_error() function for dumping extra info when we have an error. 2004-06-29 21:53:12 +00:00
Christian Hammond a2cdc71421 Pass 0.0.1 as the version number to AC_INIT(). 2004-06-28 04:50:49 +00:00
Christian Hammond 29de19e1ac Added support for the NotificationClosed and RequestClosed signals, along with request callbacks. I wonder if any of this works. 2004-06-28 04:40:04 +00:00
Christian Hammond 755f81fbe9 Keep track of request IDs so that we can do callback stuff in a bit. 2004-06-28 03:24:08 +00:00
Christian Hammond eb30d19b88 Send the list of button texts as a string array, rather than appending each one individually. 2004-06-28 03:02:38 +00:00
Christian Hammond 26727e0933 - Split notify_close() into notify_close_notification() and notify_close_request().
- Implement notify_send_request() and notify_send_request_with_icon_data(), and add versions of those functions that take a va_list for the buttons.
2004-06-28 01:39:16 +00:00
Christian Hammond b47093bf2c - Added a utility function for doing most of the D-BUS message creation.
- Implemented notify_close_notification() and notify_close_request().
2004-06-27 23:47:17 +00:00
Christian Hammond 59b49141a0 Make sure we include our config.h if we have one. 2004-06-27 23:39:09 +00:00
Christian Hammond 8e32891f81 Added the initial header file and connection code. 2004-06-27 23:38:07 +00:00
Christian Hammond 4c8bd53e0d Added the initial libnotify library, for experimental work on this notification stuff TD and I are working on. 2004-06-27 22:28:52 +00:00
76 changed files with 11776 additions and 4698 deletions

37
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,37 @@
variables:
DEBIAN_FRONTEND: noninteractive
stages:
- build
build:ubuntu:
stage: build
image: ubuntu:devel
before_script:
- apt-get update &&
- apt-get install -q -y --no-install-recommends
gobject-introspection
gtk-doc-tools
libgdk-pixbuf2.0-dev
libgirepository1.0-dev
libglib2.0-dev
libgtk-3-dev
libpopt-dev
xmlto
ninja-build
python3-pip
python3-setuptools
xsltproc
docbook-xsl-ns
- pip3 install meson
script:
- meson _build -Ddocbook_docs=enabled
- ninja -C _build install
artifacts:
expose_as: "Build artifacts"
paths:
- _build/docs/notification-spec.html
- _build/docs/reference/html
- _build/docs/reference/html/index.html
- _build/meson-logs

20
AUTHORS
View File

@ -1,3 +1,17 @@
Christian Hammond <chipx86@chipx86.com> Developers:
Mike Hearn <mike@navi.cx>
John (J5) Palmieri <johnp@redhat.com> Christian Hammond <chipx86@chipx86.com>
Mike Hearn <mike@navi.cx>
John (J5) Palmieri <johnp@redhat.com>
Patch Writers:
Duarte Henriques <duarte.henriques@gmail.com>
Rodney Dawes <dobey@novell.com>
Tom Parker <debian@tevp.net>
jensgr@gmx.net
M.S.
mderezynski
Ed Catmur <ed@catmur.co.uk>
Lucas Rocha

379
ChangeLog
View File

@ -1,379 +0,0 @@
Fri Dec 09 2005 John (J5) Palmieri <johnp@redhat.com>
* libnotify/notifymarshal.[c|h]: new files where GLib callback
marshalers are added
* libnotify/notifynotification.c (notify_notifiaction_init): Add a
marshaller for signals with uint, string parameters
(_gslist_to_string_array): new internal method that coverts
a GSList to a NULL terminated array of strings
(_notify_notification_show_internal): send the actions list as an
array of strings, not a GSList which does not work with the bindings
* libnotify/Makefile.am: notifymarshal.[c|h] added
* tests/test-multi-actions.c: working example of using actions
Fri Dec 02 2005 John (J5) Palmieri <johnp@redhat.com>
* libnotify/notifynotification.c (notify_notification_add_action):
implement adding actions
(_action_signal_handler): handle actions coming from the server
(notify_notifcation_clear_actions): new method for clearning out
the actions list and hash
Fri Dec 02 2005 John (J5) Palmieri <johnp@redhat.com>
* libnotify/notifynotification.c (notify_notification_show_and_forget):
new method that shows and then unrefs the NotifyNotification object.
use this if you just want to fire off a quick notification.
* various compiler warning cleanups
Fri Dec 02 2005 John (J5) Palmieri <johnp@redhat.com>
* libnotify/notifynotification.c (SIGNAL_TYPE_CLOSED): "closed" glib
signal added
(notify_notification_clear_hints): New API for clearing out the
hints hash
(notify_notification_ref, notify_notification_unref): removed - use
g_object_ref/unref
* tests/*: Various changes to the test binaries
Thu Nov 10 14:00:00 EST 2005 John (J5) Palmieri <johnp@redhat.com>
* Complete rewrite and first import to libnotify-ng module in SVN
Mon Jul 04 02:13:56 PDT 2005 Christian Hammond <chipx86@chipx86.com>
* tests/Makefile.am:
* tests/test-markup.c:
A tests/test-xy-stress.c:
* configure.ac:
- Conditionally build gdk-dependent test apps if we have gdk.
- Added a X, Y stress test that will be used to help test
accurately positioning the arrows.
Thu Jun 30 21:09:18 PDT 2005 Christian Hammond <chipx86@chipx86.com>
* tests/Makefile.am:
- Don't install the test programs during make install.
Thu Jun 30 21:03:30 PDT 2005 Christian Hammond <chipx86@chipx86.com>
* libnotify/notify.c:
* libnotify/notify.h:
* tests/test-animation.c:
* tests/test-basic.c:
* tests/test-default-action.c:
* tests/test-error.c:
* tests/test-image.c:
* tests/test-markup.c:
* tests/test-multi-actions.c:
* tests/test-replace.c:
* tools/notify-send.c:
- Added support for hints in the API.
Mon Jun 20 06:13:02 PDT 2005 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Be a little better at not crashing. Just a bit better. There's
still another crash I'm trying to track down.
Mon Jun 20 04:53:29 PDT 2005 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Close the right container in D-BUS 0.3x.
Mon Jun 20 02:49:27 PDT 2005 Christian Hammond <chipx86@gnupdate.org>
* libnotify/Makefile.am:
A libnotify/dbus-compat.h:
- Add dbus-compat.h.
Mon Jun 20 02:43:26 PDT 2005 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* configure.ac:
- Add support for compiling under D-BUS 0.3x. Actually running
has not yet been tested!
Fri Apr 01 09:21:26 PST 2005 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Updated to work with 0.6 of the notification spec.
Sat Nov 06 15:40:48 PST 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.h:
- Move our TODO list to the Doxygen @todo commands, so we'll get it
in a nice little page of its own in the API docs.
Sat Nov 06 15:35:52 PST 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.h:
- Move the emacs mode string out of the Doxygen comment and into its
own.
Sat Nov 06 15:11:53 PST 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.h:
A Doxyfile.in:
* Makefile.am:
* configure.ac:
- Add a Doxyfile.in and update things so we can get doxygen
docs.
Wed Nov 03 23:39:23 PST 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Use glib's memory allocation stuff instead of libc's.
Wed Nov 03 23:34:10 PST 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
* tests/test-animation.c:
* tests/test-image.c:
- Patch from Mike Hearn to do a bunch of stuff, like handling icons
and animations better.
Wed Nov 03 01:19:42 PST 2004 Christian Hammond <chipx86@gnupdate.org>
* configure.ac:
A libnotify.spec.in:
- Fix make distcheck.
Wed Sep 29 22:34:03 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* tools/notify-send.c:
- Don't flush the D-BUS connection, and make sure we disconnect from it.
Wed Sep 29 21:53:15 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
* tests/test-animation.c:
* tests/test-basic.c:
* tests/test-default-action.c:
* tests/test-error.c:
* tests/test-image.c:
* tests/test-markup.c:
* tests/test-multi-actions.c:
* tests/test-replace.c:
* tools/notify-send.c:
- Updated to match the spec.
Sat Sep 25 12:59:26 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* tests/test-animation.c:
* tests/test-default-action.c:
- Fixed to compile.
Wed Sep 01 00:39:23 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* docs/ChangeLog:
* SPECIFICATION:
- Moved specification documentation.
- Moved specification ChangeLog.
Wed Sep 01 00:30:53 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* docs/notification-spec.xml:
- Finishing adding the rest of the signals to the spec.
Sun Aug 29 22:27:42 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
A docs/notification-spec.ps:
A docs/notification-spec.xml:
- Added the notification spec in docbook format. It's not finished.
I'm just tired of working on it.
Wed Jul 14 02:11:48 GMT 2004 Mike Hearn <mike@navi.cx>
* libnotify/notify.c: Use pointers instead of GINT_TO_POINTER
* tools/test-replace.c: Test replacing notifications
Tue Jul 13 23:58:54 GMT 2004 Mike Hearn <mike@navi.cx>
* SPECIFICATION: CloseNotification sends NotificationClosed signal.
Mon Jul 5 00:12:03 GMT 2004 Mike Hearn <mike@navi.cx>
* tools/notify-send.c (main): Treat expiry times < current time
as timeouts from current instant
Sun Jul 4 22:54:44 GMT 2004 Mike Hearn <mike@navi.cx>
* libnotify/notify.c: Use a direct hash rather than an int hash
Sun Jul 04 14:32:46 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Don't make IDs of 0 bad. They just want to be loved, too.
Sun Jul 04 14:08:59 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
* tools/notify-send.c:
* SPECIFICATION:
- Changed timeouts to expire times.
- Install notify-send.
Sun Jul 04 13:46:32 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* tools/notify-send.c:
- Don't initialize the library until we're ready to talk to it.
Sun Jul 04 13:34:14 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* SPECIFICATION:
- Added the urgency level to the spec, and made it a byte.
Sun Jul 04 13:28:51 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
A tools/:
R tests/:
* Makefile.am:
* configure.ac:
- Renamed tests to tools.
Sun Jul 04 13:28:00 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* tests/Makefile.am:
A tests/notify-send.c:
- Added the notify-send tool.
Sat Jul 03 12:35:35 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Added support for GetCapabilities.
Sat Jul 03 12:27:58 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Add support for GetServerInformation.
Sat Jul 03 12:21:05 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Remove the application info sent on calls to Notify for now,
until/if something gets added to the spec about it.
Sat Jul 03 12:14:48 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Removed the last of the request implementation.
- More work toward migrating the code to the specification.
- Simplified the action implementation a little bit.
Sat Jul 03 11:26:03 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Cleaned up some things and updated some stuff to be compliant with
the spec. More will come soon.
Thu Jul 1 23:46:28 GMT 2004 Mike Hearn <mike@navi.cx>
* SPECIFICATION: Add info on icons/sounds, add some
protocol requests. Change "buttons" in the overview to "actions".
Wed Jun 30 14:03:51 GMT 2004 Mike Hearn <mike@navi.cx>
* SPECIFICATION: Initial version
Wed Jun 30 13:28:18 GMT 2004 Mike Hearn <mike@navi.cx>
* libnotify/notify.[ch]: Add file variables for emacs to match
the settings Christian is using.
Wed Jun 30 02:53:36 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Free up the handle memory for a closed notification.
Tue Jun 29 19:33:43 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Due to the new icon struct, a lot of redundant functions have now
been removed.
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>
* libnotify/notify.c:
* libnotify/notify.h:
- Replaced the guint32 ID numbers that were passed around to represent
notifications and requests and replaced them with an opaque data
structure that abstracts that and other stuff.
Tue Jun 29 18:21:05 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Changed 8 space to 4 space tabs.
Tue Jun 29 14:49:51 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Patch by Mike Hearn to add a print_error() function for dumping
extra info when we have an error.
Sun Jun 27 21:50:33 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* configure.ac:
- Pass 0.0.1 as the version number to AC_INIT().
Sun Jun 27 21:39:13 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Added support for the NotificationClosed and RequestClosed signals,
along with request callbacks. I wonder if any of this works.
Sun Jun 27 20:23:00 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Keep track of request IDs so that we can do callback stuff in a bit.
Sun Jun 27 20:02:09 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Send the list of button texts as a string array, rather than appending
each one individually.
Sun Jun 27 18:30:19 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Split notify_close() into notify_close_notification() and
notify_close_request().
- Implement notify_send_request() and
notify_send_request_with_icon_data(), and add versions of those
functions that take a va_list for the buttons.
Sun Jun 27 16:46:32 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Added a utility function for doing most of the D-BUS message
creation.
- Implemented notify_close_notification() and notify_close_request().
Sun Jun 27 16:38:42 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
- Make sure we include our config.h if we have one.
Sun Jun 27 16:37:30 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
- Added the initial header file and connection code.

File diff suppressed because it is too large Load Diff

229
INSTALL
View File

@ -1,229 +0,0 @@
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -1,24 +0,0 @@
SUBDIRS = libnotify tools tests
pcdata_DATA = libnotify.pc
pcdatadir = $(libdir)/pkgconfig
EXTRA_DIST = \
AUTHORS NEWS INSTALL COPYING README \
ChangeLog \
Doxyfile.in \
autogen.sh \
configure.ac \
libnotify.pc.in \
libnotify.spec.in
dist-hook: libnotify.spec
cp libnotify.spec $(distdir)
$(OBJECTS): libtool
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
doxygen:
@echo "Running doxygen..."
@doxygen Doxyfile

275
NEWS
View File

@ -0,0 +1,275 @@
New in 0.8.1
============
* Keep version of bindings at 0.7 (#27) [Marco]
Contributors:
Marco Trevisan
New in 0.8.0
============
* Use Desktop Portal Notification when running confined (snap and flatpak)
Now the library acts like a wrapper in such scenario, with some limited
capabilities, but this will enforce security and user control over the
allowed notifications. [Marco]
* notify-send: Handles SIGINT gracefully, closing waiting notification [Marco]
* Use NotifyClosedReason enum as closed reason return value [Marco]
* Bump dependency on GLib 2.38 [Marco]
* Various introspection docs improvements and fixes [Marco]
Contributors:
Marco Trevisan
New in 0.7.12
=============
* docs/notify-send: Add --transient option to manpage [Marco]
* notify-send: Move server capabilities check to a separate function [Marco]
* notify-send: Add debug message about server not supporting persistence
[Marco]
* notification: Include sender-pid hint by default if not provided [Marco]
* Delete unused notifynotification.xml [Patrick; !25]
* notification: Bookend calling NotifyActionCallback with temporary ref
[Logan; #25, !26]
Contributors:
Marco Trevisan, Patrick Griffis, Logan Rathbone
New in 0.7.11
=============
* Fix potential build errors with old glib version we require
* notify-send: Add support for boolean hints
* notify-send: Support passing any hint value, by parsing variant strings
* notify-send: Add explicit option to create transient notifications
Contributors:
Marco Trevisan
New in 0.7.10
=============
* notify-send: Support commas in icon filenames [Thorsten; !15]
* notify-send: Give failing exit code if showing notification fails [Ray, !13]
* notify-send: Support for replacing an existing notification [Paul; !17]
* notify-send: Add option to wait until notification has been closed [Ben; !18]
* notify-send: Add support for notification actions and responses [Ben; !18]
* notification: Send the application ID when possible [Corentin; !1]
* notification: Use g_memdup2 when available [Marco; !22]
* notification: Improve SNAP detection and confined desktop ID [Marco; !23]
* notification: Add support for getting actions activation token [Marco; !24]
* notify: Use application ID if any to set the fallback app name [Marco; !18]
* Build fixes and improvements [Marco; !22]
* Docs updates [Boris, David; !14, !20]
Contributors:
Marco Trevisan, Boris Shtrasman, Matthias Sweertvaegher, Thorsten Wißmann,
Ray Strode, Maximiliano Sandoval R, David King, Corentin Noël, Paul Collins,
Matthias Sweertvaegher, Ben Blain
New in 0.7.9
============
* Fixed linking in darwin [Iain, Marco; !5]
* Added man page for notify-send [Jan; !6]
* Dropped autotools [Jan; !11]
Contributors:
Iain Lane, Jan Tojnar, Marco Trevisan
New in 0.7.8
============
* Support meson build system [Marco; !3]
* notify-send: Support full URLs as hint values [Marco; !4]
* Mic. bug fixes [Ting-Wei, Florian; #760438, !8]
Contributors:
Emmanuele Bassi, Abderrahim Kitouni, Ting-Wei Lan, Iain Lane, Florian Müllner,
Jan Tojnar, Marco Trevisan (Treviño), Marco Trevisan
New in 0.7.7
============
- Introspection fixes (Evan Nemerson)
- Allow to disable tests at build time (Quentin Glidic)
New in 0.7.6
============
- Fix annotation for add_action (Giovanni Campagna)
- Clarify documentation for set-timeout (Matthias Clasen)
New in 0.7.5
============
- Build fixes (Colin Walters)
- Documentation improvements (Javier Jardón)
- Spec clarifications (Matthias Clasen)
New in 0.7.4
============
- Improve documentation of supported image data formats (Colin Walters)
- Honor aclocal flags (Craig Keogh)
- Update autotools configuration (Javier Jardón)
- Test notification removal (William Jon McCann)
NEW in 0.7.3:
==============
- Add a way to change the application name for
individual notifications (Richard Hughes)
NEW in 0.7.2:
==============
- Add a way to change the application name (William Jon McCann)
- Mark image_path as deprecated (William Jon McCann)
- Allow properties to be set in any order (Matthias Clasen)
NEW in 0.7.1:
==============
- Don't export private symbols (Emilio Pozuelo Monfort)
- Introspection support and annotations (Jonathan Matthew, Martin Pitt)
- Documentation cleanups and fixes (Javier Jardón)
- Ref the pixbuf passed to set_image_from_pixbuf (Guillaume Desmottes)
- Add tests for new capabilities and hints (William Jon McCann)
- Update spec to mention "persistence" and "action-icons" server
capability and "action-icons", "transient" and "resident" hints.
Bump spec version to 1.2 (William Jon McCann)
NEW in 0.7.0:
==============
- Remove the ability to attach notifications to widgets or positions
- Add a test for the persistence server capability
- Port to use GBus instead of dbus-glib (Christian Persch)
- Add a macro to get library version number
- Remove GTK+ dependency from library
- Port tests to GTK+ 3
NEW in 0.6.0:
==============
The 0.5.1 release included changes that should not have been made on a
stable branch. It should have been a 0.6 series release. So here it is.
- Fixed #623096 Fix notify_get_server_info results
NEW in 0.5.1:
==============
- Remove explicit GTK+ 2.x linking, so that libnotify can link against
both GTK+ 2.x or GTK+ 3.x
NEW in 0.5.0:
==============
- Support for version 1.1 of notification spec (Aurélien Gâteau, A. Walton)
- Fixed #608089, Applications aborted at finalizing when the dbus session is being closed. (William Jon McCann)
- Fixed #608082, Arabic text is misplaced in bubbles (RTL) (William Jon McCann)
- Fixed #608086, wrong return value of notify_init() (William Jon McCann)
- Fixed #612720, Does not compile with -DGSEAL_ENABLE (William Jon McCann)
- Fixed #613999, Use g_strcompress in notify-send to parse \n from command line (William Jon McCann)
- Fixed #610880, lazily initialize the daemon (Martin Pitt)
version 0.4.5 (20-November-2008):
* Added GObject property accessors for notification IDs. Patch by Lucas
Rocha.
* Added support for sending the closed reason in the "closed" signal
handler. (Ticket #139)
* Added support for sending the status icon XID to the notification
daemon. This will allow better position tracking for context
notifications. Patch by Colin Walters.
* Fixed a breakage where we were including gtkversion.h directly.
version 0.4.4 (27-February-2007):
* Fixed a bug where a notification's ID could be reset when a different
notification was closed. Patch by jylefort. (Bug #94)
* Fixed a crash when the D-BUS proxy was not being freed on notify_uninit,
which was problematic when used in a loadable module. (Bug #92)
* Fixed a crash when a signal handler for the notification's closed signal
caused the notification to be destroyed. (Bug #116)
* Fixed memory leaks when creating notifications. (Bug #112)
* Fixed potential memory leaks where the function passed to
notify_notification_add_action to free the user data was not being
called. (Bug #119)
version 0.4.3 (8-October-2006):
* Fixed the raw image data support to send the correct array type.
Patch by mderezynski. (Bug #68)
* Fixed configure.ac to check for the required version of glib (2.6).
Patch by compnerd. (Bug #69)
* Fixed invalid notification IDs when notify_notification_show() is called
on a notification that had already been closed or had expired. Now,
the notification will receive a new ID. Patch by Ed Catmur. (Bug #78)
* Fixed the property change notification used when setting a GtkStatusIocn.
It was emitting "attach-icon" but should have been emitted "status-icon".
(Bug #81)
* Fixed an invalid assertion in notify_notification_new_with_status_icon.
Patch by lucasr. (Bug #85)
* notify_uninit is no longer called automatically at exit. Applications
and libraries should do this manually. Patch by berndth. (Bug #86)
version 0.4.2 (17-June-2006):
* Add G_BEGIN_DECLS and G_END_DECLS to notify.h, so that libnotify can
be used in C++ applications properly.
version 0.4.1 (17-June-2006):
* Added support for attaching to a GtkStatusIcon. Patch by chpe. (Bug #60)
* Added GObject properties to NotifyNotification. Patch by chpe. (Bug #60)
* Added API documentation, accessible through devhelp.
* Fixed up libnotify.pc to support dependencies correctly. (Bug #58)
* Fixed notify_uninit() to properly set _initted to FALSE after being
called. (Bug #56)
version 0.4.0 (26-April-2006):
* Patch by M.S. to switch notify-send to use GOption instead of popt,
to add -v, --version, -h, and --hint options, and to rename
-T, --type to -c, --category. This also fixes assertions when calling
notify-send "". (Bug #41)
* Fixed the short flag for --type to be -T in notify-send. (Bug #18)
* Fixed the help in notify-send to indicate that --expire-timeout
requires milliseconds, not seconds. (Bug #28)
* Fixed some C99 usage. Patch by jensgr. (Bug #44)
* Fixed notify-send on PPC.
version 0.3.2 (23-January-2006):
* Added back notify_get_server_info() and notify_get_server_caps().
* Fixed to work with D-BUS 0.36 and higher. However, it's best to note
that due to bugs in versions of the D-BUS GLib bindings before 0.60,
raw image data cannot be sent in notifications. A warning will be
outputted to the console.
* Added assertions to all of the API functions so that invalid data passed
won't crash the calling program.
* Added automatic notification removal for non-expiring notifications and
notifications with actions when the calling application closes.
* Fixed issues where the header files couldn't always be included in
some programs.
* Fixed a lot of compiler errors and warnings.
* Fixed C99 usage.
* Added the ability to set user data on action callbacks on a per-action
basis.
* Fixed notify-send to work without crashing.
* Fixed the library to send messages appropriate to the D-BUS
specification.
* Cleaned up the API a lot.
* Renamed NOTIFY_TIMEOUT_* to NOTIFY_EXPIRES_*.
* Removed notify_notification_show_and_forget().
* Internal changes to remove the number of DBusGProxy connections, and
make sure it's initialized before using any D-BUS GValue-related code.
This fixes raw image sending.
version 0.3.0:
* First release of the new GObject based API and simpler wire protocol
version 0.2.3:
* Fix notify-send to work with icon parameters (bug #4308)
version 0.2.2 (10-August-2005):
* Fixed many run-time issues with PPC and AMD64 (Martin Pitt)
version 0.2.1 (28-July-2005):
* Fixed hint support for D-BUS 0.3x.
version 0.2.0 (28-July-2005):
* Initial public release.

20
README.md Normal file
View File

@ -0,0 +1,20 @@
# libnotify
## Description
libnotify is a library for sending desktop notifications to a notification
daemon, as defined in the [org.freedesktop.Notifications][fdo-spec] Desktop
Specification. These notifications can be used to inform the user about an event
or display some form of information without getting in the user's way.
It is also a simple wrapper to send cross-desktop Notifications for sandboxed
applications using the [XDG Portal Notification API][portal].
## Notice
For GLib based applications the [GNotification][gnotif] API should be used
instead.
[fdo-spec]: https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html
[gnotif]: https://docs.gtk.org/gio/class.Notification.html
[portal]: https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.Notification.xml

View File

@ -1,58 +0,0 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
DIE=0
PACKAGE=libnotify
echo "Generating configuration files for $PACKAGE, please wait..."
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $PACKAGE."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $PACKAGE."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile $PACKAGE."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
[ $DIE -eq 1 ] && exit 1;
echo " libtoolize --copy --force"
libtoolize --copy --force
echo " aclocal $ACLOCAL_FLAGS"
aclocal $ACLOCAL_FLAGS
echo " autoheader"
autoheader
echo " automake --add-missing"
automake --add-missing
echo " autoconf"
autoconf
if [ -x config.status -a -z "$*" ]; then
./config.status --recheck
else
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish"
echo "to pass any to it, please specify them on the $0 command line."
echo "If you do not wish to run ./configure, press Ctrl-C now."
trap 'echo "configure aborted" ; exit 0' 1 2 15
sleep 1
fi
./configure "$@";
fi

4
config.h.meson Normal file
View File

@ -0,0 +1,4 @@
/* config.h.meson */
/* Version number of package */
#mesondefine VERSION

View File

@ -1,156 +0,0 @@
dnl Process this file with autoconf to create configure.
dnl ################################################################
dnl # Initialize autoconf
dnl ################################################################
AC_INIT(libnotify, 0.3.0, chipx86@gnupdate.org)
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(config.h.in)
AC_COPYRIGHT([Copyright 2004 Christian Hammond])
dnl ################################################################
dnl # Version information
dnl ################################################################
LIBGALAGO_MAJOR_VERSION=0
LIBGALAGO_MINOR_VERSION=3
LIBGALAGO_MICRO_VERSION=0
LIBGALAGO_DEVEL_VERSION=0
LIBGALAGO_VERSION=$LIBGALAGO_MAJOR_VERSION.$LIBGALAGO_MINOR_VERSION.$LIBGALAGO_MICRO_VERSION
if test "x$LIBGALAGO_DEVEL_VERSION" != "x0"; then
if test "x$LIBGALAGO_MICRO_VERSION" = "x0"; then
LIBGALAGO_MICRO_VERSION=$LIBGALAGO_DEVEL_VERSION
LIBGALAGO_VERSION=$LIBGALAGO_MAJOR_VERSION.$LIBGALAGO_MINOR_VERSION.$LIBGALAGO_DEVEL_VERSION
else
LIBGALAGO_VERSION=$LIBGALAGO_VERSION.$LIBGALAGO_DEVEL_VERSION
fi
fi
AC_DEFINE_UNQUOTED(LIBGALAGO_MAJOR_VERSION, $LIBGALAGO_MAJOR_VERSION,
[libnotify major version.])
AC_DEFINE_UNQUOTED(LIBGALAGO_MINOR_VERSION, $LIBGALAGO_MINOR_VERSION,
[libnotify minor version.])
AC_DEFINE_UNQUOTED(LIBGALAGO_MICRO_VERSION, $LIBGALAGO_MICRO_VERSION,
[libnotify micro version.])
AC_DEFINE_UNQUOTED(LIBGALAGO_VERSION, "$LIBGALAGO_VERSION",
[libnotify version.])
dnl ################################################################
dnl # libtool versioning
dnl ################################################################
dnl #
dnl # +1 : 0 : +1 == new interface that does not break old one.
dnl # +1 : 0 : 0 == removed an interface. Breaks old apps.
dnl # ? : +1 : ? == internal changes that doesn't break anything.
dnl #
dnl # CURRENT : REVISION : AGE
dnl #
LT_CURRENT=0
LT_REVISION=0
LT_AGE=0
LT_RELEASE=$LIBGALAGO_MAJOR_VERSION.$LIBGALAGO_MINOR_VERSION.$LIBGALAGO_MICRO_VERSION
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
dnl ################################################################
dnl # Initialize automake
dnl ################################################################
VERSION=$LIBGALAGO_VERSION
PACKAGE=libnotify
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl ################################################################
dnl # Specify a header configuration file
dnl ################################################################
AM_CONFIG_HEADER(config.h)
dnl ################################################################
dnl # Check for some standard stuff.
dnl ################################################################
AC_PROG_CC
#AC_ARG_PROGRAM
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_PROG_INSTALL
AC_C_CONST
AC_TYPE_SIZE_T
AC_EXEEXT
AM_PROG_LIBTOOL
AC_CHECK_LIB([popt], [poptGetArg], , AC_MSG_ERROR([Popt is required]))
pkg_modules="gtk+-2.0 >= 2.2.2 glib-2.0 >= 2.2.2, dbus-1 >= 0.35, dbus-glib-1 >= 0.35"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
gdk_modules="gdk-2.0 gdk-pixbuf-2.0"
PKG_CHECK_MODULES(GDK, [$gdk_modules], have_gdk=yes,
[
have_gdk=no
AC_WARN("Some test apps will not be built")
])
AM_CONDITIONAL(HAVE_GDK, test "x$have_gdk" = "xyes")
AC_SUBST(GDK_CFLAGS)
AC_SUBST(GDK_LIBS)
dnl
dnl Check the D-BUS version.
dnl
AC_MSG_CHECKING([dbus version])
DBUS_VERSION=`$PKG_CONFIG --modversion dbus-1`
DBUS_MAJOR_VER=`echo $DBUS_VERSION | cut -d. -f 1`
DBUS_MINOR_VER=`echo $DBUS_VERSION | cut -d. -f 2`
DBUS_MICRO_VER=`echo $DBUS_VERSION | cut -d. -f 3`
AC_MSG_RESULT($DBUS_VERSION)
AC_DEFINE_UNQUOTED(DBUS_MAJOR_VER, $DBUS_MAJOR_VER, [D-BUS major version.])
AC_DEFINE_UNQUOTED(DBUS_MINOR_VER, $DBUS_MINOR_VER, [D-BUS minor version.])
AC_DEFINE_UNQUOTED(DBUS_MICRO_VER, $DBUS_MICRO_VER, [D-BUS micro version.])
AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, ,DBUS API is subject to change)
dnl # Use wall if we have GCC
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall"
fi
AC_SUBST(CFLAGS)
dnl ################################################################
dnl # Output the Makefiles
dnl ################################################################
AC_CONFIG_FILES([
Doxyfile
Makefile
libnotify.pc
libnotify.spec
libnotify/Makefile
tests/Makefile
tools/Makefile
])
AC_OUTPUT
echo
echo $PACKAGE v$VERSION
echo
echo "Now type make to compile"
echo "Then su to root and type: make install"
echo

View File

@ -1,3 +1,20 @@
Sat Aug 25 18:25:02 PDT 2007 Christian Hammond <chipx86@chipx86.com>
* notification-spec.xml:
- Add a spec_version return value for GetServerInformation.
- Bump to version 1.0. It's about time, and things are pretty solid now.
Wed Jan 25 23:45:11 PST 2006 Christian Hammond <chipx86@chipx86.com>
* notification-spec.xml:
- Fixed to actually be valid docbook.
Mon Jan 23 01:18:23 PST 2006 Christian Hammond <chipx86@chipx86.com>
* notification-spec.xml:
- Simplified the protocol. Moved around a lot of functions and data.
- Bumped to version 0.9.
Fri Apr 01 09:11:38 PST 2005 Christian Hammond <chipx86@gnupdate.org> Fri Apr 01 09:11:38 PST 2005 Christian Hammond <chipx86@gnupdate.org>
* notification-spec.xml: * notification-spec.xml:

7
docs/config.xsl Normal file
View File

@ -0,0 +1,7 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:param name="html.stylesheet" select="'docbook.css'"/>
<xsl:param name="generate.consistent.ids" select="1"/>
</xsl:stylesheet>

40
docs/meson.build Normal file
View File

@ -0,0 +1,40 @@
docbook_docs = get_option('docbook_docs')
if not docbook_docs.disabled()
xmlto = find_program('xmlto', required: docbook_docs.enabled())
if xmlto.found()
spec_files = ['notification-spec']
foreach spec: spec_files
custom_target(spec + '.html',
output: spec + '.html',
input: spec + '.xml',
depend_files: 'config.xsl',
command: [xmlto,
'xhtml-nochunks',
'-m', join_paths(meson.current_source_dir(), 'config.xsl'),
'-o', '@OUTDIR@',
'@INPUT@'
],
install: true,
install_dir: join_paths(docdir, 'spec'))
endforeach
endif
endif
if get_option('gtk_doc')
subdir('reference')
endif
if get_option('man')
manpages = ['notify-send']
foreach page : manpages
custom_target(page + '-man',
input: page + '.xml',
output: page + '.1',
command: xsltproc_command,
install: true,
install_dir: man1dir)
endforeach
endif

View File

@ -1,13 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!DOCTYPE article PUBLIC "-//OASIS/DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<article id="index"> <article id="index">
<articleinfo> <articleinfo>
<title>Desktop Notifications Specification</title> <title>Desktop Notifications Specification</title>
<releaseinfo>Version 0.5</releaseinfo> <releaseinfo>Version 1.2</releaseinfo>
<date>2 October 2004</date> <date>28 October 2010</date>
<authorgroup> <authorgroup>
<author> <author>
<firstname>Mike</firstname> <firstname>Mike</firstname>
@ -27,62 +24,24 @@
</address> </address>
</affiliation> </affiliation>
</author> </author>
<author>
<firstname>William Jon</firstname>
<surname>McCann</surname>
<affiliation>
<address>
<email>jmccann@redhat.com</email>
</address>
</affiliation>
</author>
</authorgroup> </authorgroup>
<revhistory>
<revision>
<revnumber>0.6</revnumber>
<date>1 April 2005</date>
<authorinitials>cdh</authorinitials>
<revremark>
Updated to work with D-BUS 0.31+.
</revremark>
</revision>
<revision>
<revnumber>0.5</revnumber>
<date>2 October 2004</date>
<authorinitials>cdh</authorinitials>
<revremark>
Added a "suppress-sound" hint. Added a "sound" capability. Renamed the
"soundfile" hint to sound-file".
</revremark>
</revision>
<revision>
<revnumber>0.4</revnumber>
<date>29 September 2004</date>
<authorinitials>cdh</authorinitials>
<revremark>
Added image support in markup, and made the restrictions on markup more
clear. Removed the High urgency. Added new notification types. Fixed
notification expiration.
</revremark>
</revision>
<revision>
<revnumber>0.3</revnumber>
<date>15 September 2004</date>
<authorinitials>cdh</authorinitials>
<revremark>Added hint and notification type sections</revremark>
</revision>
<revision>
<revnumber>0.2</revnumber>
<date>foo</date>
<authorinitials>mh</authorinitials>
<revremark>Added replaces field to protocol</revremark>
</revision>
<revision>
<revnumber>0.1</revnumber>
<date>foo</date>
<authorinitials>mh</authorinitials>
<revremark>Initial version</revremark>
</revision>
</revhistory>
</articleinfo> </articleinfo>
<sect1 id="introduction"> <sect1 id="introduction">
<title>Introduction</title> <title>Introduction</title>
<para> <para>
This is a draft standard for a desktop notifications service, through This is a draft standard for a desktop notifications service,
which applications can generate passive popups (sometimes known as through which applications can generate passive popups to notify
"poptarts") to notify the user in an asynchronous manner of events. the user in an asynchronous manner of events.
</para> </para>
<para> <para>
This specification explicitly does not include other types of This specification explicitly does not include other types of
@ -93,13 +52,7 @@
Example use cases include: Example use cases include:
</para> </para>
<itemizedlist> <itemizedlist>
<listitem> <listitem><para>Messages from chat programs</para> </listitem>
<para>
Presence changes in IM programs: for instance, MSN Messenger on
Windows pioneered the use of passive popups to indicate presence
changes.
</para>
</listitem>
<listitem><para>Scheduled alarm</para></listitem> <listitem><para>Scheduled alarm</para></listitem>
<listitem><para>Completed file transfer</para></listitem> <listitem><para>Completed file transfer</para></listitem>
<listitem><para>New mail notification</para></listitem> <listitem><para>New mail notification</para></listitem>
@ -151,13 +104,6 @@
"fredapp-email-client." "fredapp-email-client."
</entry> </entry>
</row> </row>
<row>
<entry>Application Icon</entry>
<entry>
The application icon. This is represented either as a path or a name
in an icon theme.
</entry>
</row>
<row> <row>
<entry>Replaces ID</entry> <entry>Replaces ID</entry>
<entry> <entry>
@ -166,16 +112,9 @@
</entry> </entry>
</row> </row>
<row> <row>
<entry>Notification Type ID</entry> <entry>Notification Icon</entry>
<entry> <entry>
An optional ID representing the notification type. See The notification icon. See <xref linkend="icons-and-images-formats"/>.
<xref linkend="notification-types"/>.
</entry>
</row>
<row>
<entry>Urgency Level</entry>
<entry>
The urgency of the notification. See <xref linkend="urgency-levels"/>.
</entry> </entry>
</row> </row>
<row> <row>
@ -204,48 +143,56 @@
</para> </para>
</entry> </entry>
</row> </row>
<row>
<entry>Images</entry>
<entry>See <xref linkend="icons"/>.</entry>
</row>
<row> <row>
<entry>Actions</entry> <entry>Actions</entry>
<entry> <entry>
The actions send a request message back to the notification client <para>
when invoked. This functionality may not be implemented by the The actions send a request message back to the notification client
notification server, conforming clients should check if it is available when invoked. This functionality may not be implemented by the
before using it (see the GetCapabilities message in notification server, conforming clients should check if it is available
<xref linkend="protocol"/>. An implementation is free to ignore any before using it (see the GetCapabilities message in
requested by the client. As an example one possible rendering of <xref linkend="protocol"/>). An implementation is free to ignore any
actions would be as buttons in the notification popup. requested by the client. As an example one possible rendering of
actions would be as buttons in the notification popup.
</para>
<para>
Actions are sent over as a list of pairs. Each even element in the
list (starting at index 0) represents the identifier for the action.
Each odd element in the list is the localized string that will be
displayed to the user.
</para>
<para>
The default action (usually invoked my clicking the notification)
should have a key named <literal>"default"</literal>. The name can
be anything, though implementations are free not to display it.
</para>
</entry> </entry>
</row> </row>
<row> <row>
<entry>Hints</entry> <entry>Hints</entry>
<entry>See <xref linkend="hints"/>.</entry>
</row>
<row>
<entry>Expires</entry>
<entry> <entry>
<para> <para>
A boolean flag indicating whether or not this notification should Hints are a way to provide extra data to a notification server that
automatically expire. the server may be able to make use of.
</para> </para>
<para>See <xref linkend="hints"/> for a list of available hints.</para>
</entry> </entry>
</row> </row>
<row> <row>
<entry>Expiration Timeout</entry> <entry>Expiration Timeout</entry>
<entry> <entry>
<para> <para>
The timeout time in seconds since the display of the notification at The timeout time in milliseconds since the display of the notification
which the notification should automatically close. This is ignored at which the notification should automatically close.
if the expires flag is set to false.
</para> </para>
<para> <para>
If zero, the notification's expiration time is dependent on the If -1, the notification's expiration time is dependent on the
notification server's settings, and may vary for the type of notification server's settings, and may vary for the type of
notification. notification.
</para> </para>
<para>
If 0, the notification never expires.
</para>
</entry> </entry>
</row> </row>
</tbody> </tbody>
@ -395,80 +342,76 @@
</sect2> </sect2>
</sect1> </sect1>
<sect1 id="icons" xreflabel="Icons"> <sect1 id="icons-and-images" xreflabel="Icons and Images">
<title>Icons</title> <title>Icons and Images</title>
<para> <para>
A notification can optionally include an array of images for use as an A notification can optionally have an associated icon and/or image.
icon representing the notification. The array of images specifies frames
in an animation, which always loop. Implementations are free to ignore the
images data, and implementations that support images need not support
animation.
</para> </para>
<para> <para>
If the image array has more than one element, a "primary frame" can The icon is defined by the "app_icon" parameter.
be specified. If not specified, it defaults to the first frame. For The image can be defined by the "image-path", the "image-data" hint or the
implementations that support images but not animation, only the primary deprecated "icon_data" hint.
frame will be used.
</para> </para>
<para> <sect2>
Each element of the array must have the same type as the first <title>Priorities</title>
element. Mixtures of strings and blobs are not allowed. The element <para>
types can be one of the following: An implementation which only displays one image or icon must choose which one
to display using the following order:
<orderedlist>
<listitem><para>"image-data"</para></listitem>
<listitem><para>"image-path"</para></listitem>
<listitem><para>app_icon parameter</para></listitem>
<listitem><para>for compatibility reason, "icon_data"</para></listitem>
</orderedlist>
</para>
<para>
An implementation which can display both the image and icon must show the
icon from the "app_icon" parameter and choose which image to display using
the following order:
<orderedlist>
<listitem><para>"image-data"</para></listitem>
<listitem><para>"image-path"</para></listitem>
<listitem><para>for compatibility reason, "icon_data"</para></listitem>
</orderedlist>
</para>
</sect2>
<sect2 id="icons-and-images-formats" xreflabel="Icons and Images Formats">
<title>Formats</title>
<para>
The "image-data" and "icon_data" hints should be a DBus structure
of signature (iiibiiay). The components of this structure are as follows:
<orderedlist>
<listitem><para>width (i): Width of image in pixels</para></listitem>
<listitem><para>height (i): Height of image in pixels</para></listitem>
<listitem><para>rowstride (i): Distance in bytes between row starts</para></listitem>
<listitem><para>has_alpha (b): Whether the image has an alpha channel</para></listitem>
<listitem><para>bits_per_sample (i): Must always be 8</para></listitem>
<listitem><para>channels (i): If has_alpha is TRUE, must be 4, otherwise 3</para></listitem>
<listitem><para>data (ay): The image data, in RGB byte order</para></listitem>
</orderedlist>
This image format is derived from <ulink url="http://developer.gnome.org/gdk-pixbuf/stable/">gdk-pixbuf</ulink>.
</para> </para>
<informaltable> <para>
<tgroup cols="3"> The "app_icon" parameter and "image-path" hint should be either an URI
<thead> (file:// is the only URI schema supported right now) or a name in a
<row> freedesktop.org-compliant icon theme (not a GTK+ stock ID).
<entry>Element</entry> </para>
<entry>Type</entry> </sect2>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>Icon Theme Name</entry>
<entry>String</entry>
<entry>
Any string that does not begin with the <literal>/</literal>
character is assumed to be an icon theme name and is looked up
according to the spec. The best size to fit the servers chosen
presentation will be used. This is the recommended way of specifying
images.
</entry>
</row>
<row>
<entry>Absolute Path</entry>
<entry>String</entry>
<entry>
Any string that begins with a <literal>/</literal> will be used as
an absolute file path. Implementations should support at minimum
files of type image/png and image/svg.
</entry>
</row>
<row>
<entry>Image Data</entry>
<entry>Binary Data</entry>
<entry>
A data stream may be embedded in the message. This is assumed to be
of type image/png.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1> </sect1>
<sect1 id="notification-types" xreflabel="Notification Types"> <sect1 id="categories" xreflabel="Categories">
<title>Notification Types</title> <title>Categories</title>
<para> <para>
Notifications can optionally have a type indicator. Although neither Notifications can optionally have a type indicator. Although neither
client or nor server must support this, some may choose to. Those servers client or nor server must support this, some may choose to. Those servers
implementing notification types may use them to intelligently display implementing categories may use them to intelligently display
the notification in a certain way, or group notifications of similar the notification in a certain way, or group notifications of similar
types. types.
</para> </para>
<para> <para>
Notification types are in Categories are in
<literal><replaceable>class.specific</replaceable></literal> form. <literal><replaceable>class.specific</replaceable></literal> form.
<literal>class</literal> specifies the generic type of notification, and <literal>class</literal> specifies the generic type of notification, and
<literal>specific</literal> specifies the more specific type of <literal>specific</literal> specifies the more specific type of
@ -480,14 +423,14 @@
<literal><replaceable>class</replaceable></literal> is acceptable. <literal><replaceable>class</replaceable></literal> is acceptable.
</para> </para>
<para> <para>
Third parties, when defining their own notification types, should discuss Third parties, when defining their own categories, should discuss
the possibility of standardizing on the hint with other parties, preferably the possibility of standardizing on the hint with other parties, preferably
in a place such as the in a place such as the
<ulink url="http://freedesktop.org/mailman/listinfo/xdg">xdg</ulink> <ulink url="http://freedesktop.org/mailman/listinfo/xdg">xdg</ulink>
mailing list at mailing list at
<ulink url="http://freedesktop.org/">freedesktop.org</ulink>. If it <ulink url="http://freedesktop.org/">freedesktop.org</ulink>. If it
warrants a standard, it will be added to the table above. If no warrants a standard, it will be added to the table above. If no
consensus is reached, the notification type should be in the form of consensus is reached, the category should be in the form of
"<literal>x-<replaceable>vendor</replaceable>.<replaceable>class</replaceable>.<replaceable>name</replaceable></literal>." "<literal>x-<replaceable>vendor</replaceable>.<replaceable>class</replaceable>.<replaceable>name</replaceable></literal>."
</para> </para>
<para> <para>
@ -495,7 +438,7 @@
More will be added in time. More will be added in time.
</para> </para>
<table> <table>
<title>Notification Types</title> <title>Categories</title>
<tgroup cols="2"> <tgroup cols="2">
<thead> <thead>
<row> <row>
@ -694,6 +637,13 @@
consensus is reached, the hint name should be in the form of consensus is reached, the hint name should be in the form of
<literal>"x-<replaceable>vendor</replaceable>-<replaceable>name</replaceable>."</literal> <literal>"x-<replaceable>vendor</replaceable>-<replaceable>name</replaceable>."</literal>
</para> </para>
<para>
The value type for the hint dictionary in D-BUS is of the
<literal>DBUS_TYPE_VARIANT</literal> container type. This allows different
data types (string, integer, boolean, etc.) to be used for hints. When
adding a dictionary of hints, this type must be used, rather than putting
the actual hint value in as the dictionary value.
</para>
<para> <para>
The following table lists the standard hints as defined by this The following table lists the standard hints as defined by this
specification. Future hints may be proposed and added to this list specification. Future hints may be proposed and added to this list
@ -707,24 +657,160 @@
<entry>Name</entry> <entry>Name</entry>
<entry>Value Type</entry> <entry>Value Type</entry>
<entry>Description</entry> <entry>Description</entry>
<entry>Spec Version</entry>
</row> </row>
</thead> </thead>
<tbody valign="top"> <tbody valign="top">
<row>
<entry><literal>"action-icons"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
When set, a server that has the "action-icons" capability will
attempt to interpret any action identifier as a named icon.
The localized display name will be used to annotate the icon
for accessibility purposes. The icon name should be compliant
with the Freedesktop.org Icon Naming Specification.
</entry>
<entry>&gt;= 1.2</entry>
</row>
<row>
<entry><literal>"category"</literal></entry>
<entry>STRING</entry>
<entry>
The type of notification this is.
</entry>
<entry/>
</row>
<row>
<entry><literal>"desktop-entry"</literal></entry>
<entry>STRING</entry>
<entry>
This specifies the name of the desktop filename representing the
calling program. This should be the same as the prefix used for the
application's .desktop file. An example would be "rhythmbox" from
"rhythmbox.desktop". This can be used by the daemon to retrieve the
correct icon for the application, for logging purposes, etc.
</entry>
<entry/>
</row>
<row>
<entry><literal>"image-data"</literal></entry>
<entry>(iiibiiay)</entry>
<entry>
This is a raw data image format which describes the width, height,
rowstride, has alpha, bits per sample, channels and image data
respectively.
</entry>
<entry>&gt;= 1.2</entry>
</row>
<row>
<entry><literal>"image_data"</literal></entry>
<entry>(iiibiiay)</entry>
<entry>
<emphasis>Deprecated</emphasis>. Use image-data instead.
</entry>
<entry>= 1.1</entry>
</row>
<row>
<entry><literal>"image-path"</literal></entry>
<entry>STRING</entry>
<entry>
Alternative way to define the notification image. See <xref linkend="icons-and-images"/>.
</entry>
<entry>&gt;= 1.2</entry>
</row>
<row>
<entry><literal>"image_path"</literal></entry>
<entry>STRING</entry>
<entry>
<emphasis>Deprecated</emphasis>. Use image-path instead.
</entry>
<entry>= 1.1</entry>
</row>
<row>
<entry><literal>"icon_data"</literal></entry>
<entry>(iiibiiay)</entry>
<entry>
<emphasis>Deprecated</emphasis>. Use image-data instead.
</entry>
<entry>&lt; 1.1</entry>
</row>
<row>
<entry><literal>"resident"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
When set the server will not automatically remove the
notification when an action has been invoked. The notification
will remain resident in the server until it is explicitly
removed by the user or by the sender. This hint is likely only
useful when the server has the "persistence" capability.
</entry>
<entry>&gt;= 1.2</entry>
</row>
<row> <row>
<entry><literal>"sound-file"</literal></entry> <entry><literal>"sound-file"</literal></entry>
<entry>string</entry> <entry>STRING</entry>
<entry> <entry>
The path to a sound file to play when the notification pops up. The path to a sound file to play when the notification pops up.
</entry> </entry>
<entry/>
</row>
<row>
<entry><literal>"sound-name"</literal></entry>
<entry>STRING</entry>
<entry>
A themeable named sound from the freedesktop.org
<ulink url="http://0pointer.de/public/sound-naming-spec.html">sound naming specification</ulink>
to play when the notification pops up. Similar to icon-name, only for
sounds. An example would be "message-new-instant".
</entry>
<entry/>
</row> </row>
<row> <row>
<entry><literal>"suppress-sound"</literal></entry> <entry><literal>"suppress-sound"</literal></entry>
<entry>boolean</entry> <entry>BOOLEAN</entry>
<entry> <entry>
Causes the server to suppress playing any sounds, if it has that Causes the server to suppress playing any sounds, if it has that
ability. This is usually set when the client itself is going to ability. This is usually set when the client itself is going to
play its own sound. play its own sound.
</entry> </entry>
<entry/>
</row>
<row>
<entry><literal>"transient"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
When set the server will treat the notification as transient
and by-pass the server's persistence capability, if it should
exist.
</entry>
<entry>&gt;= 1.2</entry>
</row>
<row>
<entry><literal>"x"</literal></entry>
<entry>INT32</entry>
<entry>
Specifies the X location on the screen that the notification should
point to. The <literal>"y"</literal> hint must also be specified.
</entry>
<entry/>
</row>
<row>
<entry><literal>"y"</literal></entry>
<entry>INT32</entry>
<entry>
Specifies the Y location on the screen that the notification should
point to. The <literal>"x"</literal> hint must also be specified.
</entry>
<entry/>
</row>
<row>
<entry><literal>"urgency"</literal></entry>
<entry>BYTE</entry>
<entry>
The urgency level.
</entry>
<entry/>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@ -745,7 +831,7 @@
<title><literal>org.freedesktop.Notifications.GetCapabilities</literal></title> <title><literal>org.freedesktop.Notifications.GetCapabilities</literal></title>
<funcsynopsis> <funcsynopsis>
<funcprototype> <funcprototype>
<funcdef>STRING_ARRAY <funcdef>as
<function>org.freedesktop.Notifications.GetCapabilities</function> <function>org.freedesktop.Notifications.GetCapabilities</function>
</funcdef> </funcdef>
<void/> <void/>
@ -763,6 +849,14 @@
<title>Server Capabilities</title> <title>Server Capabilities</title>
<tgroup cols="2"> <tgroup cols="2">
<tbody valign="top"> <tbody valign="top">
<row>
<entry><literal>"action-icons"</literal></entry>
<entry>
Supports using icons instead of text for displaying actions.
Using icons for actions must be enabled on a per-notification
basis using the "action-icons" hint.
</entry>
</row>
<row> <row>
<entry><literal>"actions"</literal></entry> <entry><literal>"actions"</literal></entry>
<entry> <entry>
@ -816,6 +910,18 @@
server to specify both. server to specify both.
</entry> </entry>
</row> </row>
<row>
<entry><literal>"persistence"</literal></entry>
<entry>
The server supports persistence of notifications.
Notifications will be retained until they are acknowledged or
removed by the user or recalled by the sender. The presence
of this capability allows clients to depend on the server to
ensure a notification is seen and eliminate the need for
the client to display a reminding function (such as a status
icon) of its own.
</entry>
</row>
<row> <row>
<entry><literal>"sound"</literal></entry> <entry><literal>"sound"</literal></entry>
<entry> <entry>
@ -844,17 +950,13 @@
<function>org.freedesktop.Notifications.Notify</function> <function>org.freedesktop.Notifications.Notify</function>
</funcdef> </funcdef>
<paramdef>STRING <parameter>app_name</parameter></paramdef> <paramdef>STRING <parameter>app_name</parameter></paramdef>
<paramdef>BYTE_ARRAY_OR_STRING <parameter>app_icon</parameter></paramdef>
<paramdef>UINT32 <parameter>replaces_id</parameter></paramdef> <paramdef>UINT32 <parameter>replaces_id</parameter></paramdef>
<paramdef>STRING <parameter>notification_type</parameter></paramdef> <paramdef>STRING <parameter>app_icon</parameter></paramdef>
<paramdef>BYTE <parameter>urgency_level</parameter></paramdef>
<paramdef>STRING <parameter>summary</parameter></paramdef> <paramdef>STRING <parameter>summary</parameter></paramdef>
<paramdef>STRING <parameter>body</parameter></paramdef> <paramdef>STRING <parameter>body</parameter></paramdef>
<paramdef>ARRAY <parameter>images</parameter></paramdef> <paramdef>as <parameter>actions</parameter></paramdef>
<paramdef>DICT <parameter>actions</parameter></paramdef> <paramdef>a{sv} <parameter>hints</parameter></paramdef>
<paramdef>DICT <parameter>hints</parameter></paramdef> <paramdef>INT32 <parameter>expire_timeout</parameter></paramdef>
<paramdef>BOOL <parameter>expires</parameter></paramdef>
<paramdef>UINT32 <parameter>expire_timeout</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@ -879,15 +981,6 @@
Can be blank. Can be blank.
</entry> </entry>
</row> </row>
<row>
<entry><parameter>app_icon</parameter></entry>
<entry>BYTE_ARRAY or STRING</entry>
<entry>
The optional program icon of the calling application. This is in
the same format as an image frame. See <xref linkend="icons"/>.
Can be an empty string, indicating no icon.
</entry>
</row>
<row> <row>
<entry><parameter>replaces_id</parameter></entry> <entry><parameter>replaces_id</parameter></entry>
<entry>UINT32</entry> <entry>UINT32</entry>
@ -901,19 +994,13 @@
</entry> </entry>
</row> </row>
<row> <row>
<entry><parameter>notification_type</parameter></entry> <entry><parameter>app_icon</parameter></entry>
<entry>STRING</entry> <entry>STRING</entry>
<entry> <entry>
The optional notification type ID, for potential server The optional program icon of the calling application. See <xref linkend="icons-and-images"/>.
categorization and logging purposes. See Can be an empty string, indicating no icon.
<xref linkend="notification-types"/>. Can be empty.
</entry> </entry>
</row> </row>
<row>
<entry><parameter>urgency_level</parameter></entry>
<entry>BYTE</entry>
<entry>The urgency level. See <xref linkend="urgency-levels"/>.</entry>
</row>
<row> <row>
<entry><parameter>summary</parameter></entry> <entry><parameter>summary</parameter></entry>
<entry>STRING</entry> <entry>STRING</entry>
@ -924,28 +1011,19 @@
<entry>STRING</entry> <entry>STRING</entry>
<entry>The optional detailed body text. Can be empty.</entry> <entry>The optional detailed body text. Can be empty.</entry>
</row> </row>
<row>
<entry><parameter>images</parameter></entry>
<entry>ARRAY</entry>
<entry>
The optional array of images. See <xref linkend="icons"/>. Can
be empty.
</entry>
</row>
<row> <row>
<entry><parameter>actions</parameter></entry> <entry><parameter>actions</parameter></entry>
<entry>DICT</entry> <entry>as</entry>
<entry> <entry>
A dictionary key of actions. Each key is the localized name of the Actions are sent over as a list of pairs. Each even element in
action, as it should appear to the user, and maps to a UINT32 value the list (starting at index 0) represents the identifier for the
containing a program-specific action code. This code will be reported action. Each odd element in the list is the localized string
back to the program if the action is invoked by the user. Can be that will be displayed to the user.
empty.
</entry> </entry>
</row> </row>
<row> <row>
<entry><parameter>hints</parameter></entry> <entry><parameter>hints</parameter></entry>
<entry>DICT</entry> <entry>a{sv}</entry>
<entry> <entry>
Optional hints that can be passed to the server from the client Optional hints that can be passed to the server from the client
program. Although clients and servers should never assume each other program. Although clients and servers should never assume each other
@ -955,27 +1033,20 @@
empty. empty.
</entry> </entry>
</row> </row>
<row>
<entry><parameter>expires</parameter></entry>
<entry>BOOL</entry>
<entry>
A boolean flag indicating whether or not this notification should
automatically expire.
</entry>
</row>
<row> <row>
<entry><parameter>expire_timeout</parameter></entry> <entry><parameter>expire_timeout</parameter></entry>
<entry>UINT32</entry> <entry>INT32</entry>
<entry> <entry>
<para> <para>
The timeout time in seconds since the display of the notification at The timeout time in milliseconds since the display of the notification at
which the notification should automatically close. This is ignored which the notification should automatically close.
if the expires flag is set to false.
</para> </para>
<para> <para>
If zero, the notification's expiration time is dependent on the If -1, the notification's expiration time is dependent on the
notification server's settings, and may vary for the type of notification server's settings, and may vary for the type of
notification. notification.
If 0, never expire.
</para> </para>
</entry> </entry>
</row> </row>
@ -1033,6 +1104,7 @@
<paramdef>out STRING <parameter>name</parameter></paramdef> <paramdef>out STRING <parameter>name</parameter></paramdef>
<paramdef>out STRING <parameter>vendor</parameter></paramdef> <paramdef>out STRING <parameter>vendor</parameter></paramdef>
<paramdef>out STRING <parameter>version</parameter></paramdef> <paramdef>out STRING <parameter>version</parameter></paramdef>
<paramdef>out STRING <parameter>spec_version</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@ -1068,6 +1140,11 @@
<entry>STRING</entry> <entry>STRING</entry>
<entry>The server's version number.</entry> <entry>The server's version number.</entry>
</row> </row>
<row>
<entry><parameter>spec_version</parameter></entry>
<entry>STRING</entry>
<entry>The specification version the server is compliant with.</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
@ -1138,8 +1215,7 @@
<function>org.freedesktop.Notifications.ActionInvoked</function> <function>org.freedesktop.Notifications.ActionInvoked</function>
</funcdef> </funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef> <paramdef>UINT32 <parameter>id</parameter></paramdef>
<!-- <paramdef>BOOL <parameter>default_action</parameter></paramdef> --> <paramdef>STRING <parameter>action_key</parameter></paramdef>
<paramdef>UINT32 <parameter>action_id</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@ -1177,30 +1253,12 @@
The ID of the notification emitting the ActionInvoked signal. The ID of the notification emitting the ActionInvoked signal.
</entry> </entry>
</row> </row>
<!--
<row> <row>
<entry><parameter>default_action</parameter></entry> <entry><parameter>action_key</parameter></entry>
<entry>BOOL</entry> <entry>STRING</entry>
<entry> <entry>
<constant>TRUE</constant> if the default action was invoked. The key of the action invoked. These match the keys sent over
The default action is often a click on the notification. If this in the list of actions.
is <constant>TRUE</constant>, the <parameter>action_id</parameter>
parameter is ignored.
</entry>
</row>
-->
<row>
<entry><parameter>action_id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the action invoked. A value of 0 means that the default
action was invoked, i.e., clicking the notification itself.
IDs greater than zero are the action IDs as defined by the
calling application.
<!--
This is ignored if
<parameter>default_action</parameter> is <constant>TRUE</constant>.
-->
</entry> </entry>
</row> </row>
</tbody> </tbody>
@ -1214,6 +1272,65 @@
</para> </para>
</note> </note>
</sect3> </sect3>
<sect3 id="signal-activation-token">
<title><literal>org.freedesktop.Notifications.ActivationToken</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
<function>org.freedesktop.Notifications.ActivationToken</function>
</funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef>
<paramdef>STRING <parameter>activation_token</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
This signal can be emitted before a <literal>ActionInvoked</literal>
signal. It carries an activation token that can be used to activate a
toplevel.
</para>
<table>
<title>ActivationToken Parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the notification emitting the <literal>ActionInvoked</literal>
signal.
</entry>
</row>
<row>
<entry><parameter>activation_token</parameter></entry>
<entry>STRING</entry>
<entry>
An activation token. This can be either an X11-style startup ID (see
<ulink url="https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt">Startup notification protocol</ulink>)
or a
<ulink url="https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/xdg-activation">Wayland xdg-activation</ulink>
token.
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Clients should not assume the server will generate this signal. Some
servers may not support user interaction at all, or may not support
the concept of being able to generate an activation token for a
notification.
</para>
</note>
</sect3>
</sect2> </sect2>
</sect1> </sect1>
</article> </article>

138
docs/notify-send.xml Normal file
View File

@ -0,0 +1,138 @@
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
<info>
<date>November 2005</date>
<productname>libnotify</productname>
<authorgroup>
<author>
<personname>Andre Filipe de Assuncao e Brito</personname>
<email>decko@noisemakers.org</email>
<contrib>Original author</contrib>
</author>
<author>
<personname>Paul van Tilburg</personname>
<email>paulvt@debian.org</email>
<contrib>Original author</contrib>
</author>
<author>
<personname>Riccardo Setti</personname>
<email>giskard@debian.org</email>
<contrib>Original author</contrib>
</author>
</authorgroup>
</info>
<refmeta>
<refentrytitle>notify-send</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>notify-send</refname>
<refpurpose>a program to send desktop notifications</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>notify-send</command>
<arg choice="opt">
<replaceable>OPTIONS</replaceable>
</arg>
<arg choice="req">
<replaceable>summary</replaceable>
</arg>
<arg choice="opt">
<replaceable>body</replaceable>
</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection>
<info><title>Description</title></info>
<para>With <command>notify-send</command> you can send desktop notifications to the user via a notification daemon from the command line. These notifications can be used to inform the user about an event or display some form of information without getting in the users way.</para>
</refsection>
<refsection>
<info><title>Options</title></info>
<variablelist>
<varlistentry>
<term><option>-?</option>, <option>--help</option></term>
<listitem>
<para>Show help and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-a</option>, <option>--app-name</option>=<replaceable>APP_NAME</replaceable></term>
<listitem>
<para>Specifies the app name for the notification.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-A</option>, <option>--action</option>=[<replaceable>NAME</replaceable>=]<replaceable>Text...</replaceable></term>
<listitem>
<para>Specifies the actions to display to the user. Implies <option>--wait</option> to wait for user input. May be set multiple times. The <replaceable>NAME</replaceable> of the action is output to <literal>stdout</literal>. If <replaceable>NAME</replaceable> is not specified, the numerical index of the option is used (starting with <literal>1</literal>).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-u</option>, <option>--urgency</option>=<replaceable>LEVEL</replaceable></term>
<listitem>
<para>Specifies the urgency level (<literal>low</literal>, <literal>normal</literal>, <literal>critical</literal>).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-t</option>, <option>--expire-time</option>=<replaceable>TIME</replaceable>
</term>
<listitem>
<para>The duration, in milliseconds, for the notification to appear on screen.</para>
<para>Not all implementations use this parameter. GNOME Shell and Notify OSD always ignore it, while Plasma ignores it for notifications with the critical urgency level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-i</option>, <option>--icon</option>=<replaceable>ICON</replaceable>
</term>
<listitem>
<para>Specifies an icon filename or stock icon to display.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option>, <option>--category</option>=<replaceable>TYPE</replaceable>[,<replaceable>TYPE</replaceable>…]
</term>
<listitem>
<para>Specifies the notification category.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option>, <option>--hint</option>=<replaceable>TYPE</replaceable>:<replaceable>NAME</replaceable>:<replaceable>VALUE</replaceable> </term>
<listitem>
<para>Specifies basic extra data to pass. Valid types are <literal>BOOLEAN</literal>, <literal>INT</literal>, <literal>DOUBLE</literal>, <literal>STRING</literal>, <literal>BYTE</literal> and <literal>VARIANT</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p</option>, <option>--print-id</option></term>
<listitem>
<para>Print the notification ID.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-r</option>, <option>--replace-id</option>=<replaceable>REPLACE_ID</replaceable></term>
<listitem>
<para>The ID of the notification to replace.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-w</option>, <option>--wait</option></term>
<listitem>
<para>Wait for the notification to be closed before exiting. If the <option>expire-time</option> is set, it will be used as the maximum waiting time.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-e</option>, <option>--transient</option></term>
<listitem>
<para>Show a transient notification. Transient notifications by-pass the server's persistence capability, if any. And so it won't be preserved until the user acknowledges it.</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<info><title>See also</title></info>
<para>The Desktop Notification Spec on <link xlink:href="https://specifications.freedesktop.org/notification-spec/">https://specifications.freedesktop.org/notification-spec/</link>.</para>
</refsection>
</refentry>

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>Libnotify Reference Manual</title>
<releaseinfo>
The latest version of this documentation can be found on-line at
<ulink role="online-location" url="http://developer.gnome.org/libnotify/unstable/">http://developer.gnome.org/libnotify/unstable/</ulink>.
</releaseinfo>
</bookinfo>
<chapter>
<title>Libnotify</title>
<xi:include href="xml/notify.xml"/>
<xi:include href="xml/notification.xml"/>
</chapter>
<index id="api-index-full">
<title id="index-all">Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-deprecated" role="deprecated">
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>

View File

@ -0,0 +1,54 @@
<SECTION>
<FILE>notification</FILE>
NOTIFY_EXPIRES_DEFAULT
NOTIFY_EXPIRES_NEVER
<TITLE>NotifyNotification</TITLE>
NotifyNotification
NotifyClosedReason
NotifyUrgency
NotifyActionCallback
NOTIFY_ACTION_CALLBACK
notify_notification_new
notify_notification_update
notify_notification_show
notify_notification_set_app_name
notify_notification_set_timeout
notify_notification_set_category
notify_notification_set_urgency
notify_notification_set_icon_from_pixbuf
notify_notification_set_image_from_pixbuf
notify_notification_set_hint
notify_notification_set_hint_int32
notify_notification_set_hint_uint32
notify_notification_set_hint_double
notify_notification_set_hint_string
notify_notification_set_hint_byte
notify_notification_set_hint_byte_array
notify_notification_clear_hints
notify_notification_add_action
notify_notification_clear_actions
notify_notification_close
notify_notification_get_activation_token
notify_notification_get_closed_reason
<SUBSECTION Standard>
NotifyNotificationPrivate
NOTIFY_NOTIFICATION
NOTIFY_IS_NOTIFICATION
NOTIFY_TYPE_NOTIFICATION
notify_notification_get_type
NOTIFY_NOTIFICATION_CLASS
NOTIFY_IS_NOTIFICATION_CLASS
NOTIFY_NOTIFICATION_GET_CLASS
</SECTION>
<SECTION>
<FILE>notify</FILE>
notify_init
notify_uninit
notify_is_initted
notify_get_app_name
notify_set_app_name
notify_get_server_caps
notify_get_server_info
</SECTION>

View File

@ -0,0 +1,3 @@
#include <libnotify/notify.h>
notify_notification_get_type

View File

@ -0,0 +1,10 @@
gnome.gtkdoc(meson.project_name(),
mode: 'sgml',
main_sgml: meson.project_name() + '-docs.sgml',
src_dir: join_paths(meson.source_root(), meson.project_name()),
dependencies: libnotify_dep,
gobject_typesfile: meson.project_name() + '.types',
ignore_headers: ['notify-enum-types.h', 'notify-marshal.h', 'internal.h'],
scan_args: [ '--deprecated-guards=LIBNOTIFY_DISABLE_DEPRECATED' ],
install: true,
)

View File

@ -0,0 +1,977 @@
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<article id="index">
<articleinfo>
<title>Desktop Notifications Specification</title>
<releaseinfo>Version 0.3</releaseinfo>
<date>15 September 2004</date>
<authorgroup>
<author>
<firstname>Mike</firstname>
<surname>Hearn</surname>
<affiliation>
<address>
<email>mike@navi.cx</email>
</address>
</affiliation>
</author>
<author>
<firstname>Christian</firstname>
<surname>Hammond</surname>
<affiliation>
<address>
<email>chipx86@chipx86.com</email>
</address>
</affiliation>
</author>
</authorgroup>
<revhistory>
<revision>
<revnumber>0.3</revnumber>
<date>15 September 2004</date>
<authorinitials>cdh</authorinitials>
<revremark>Added hint and notification type sections</revremark>
</revision>
<revision>
<revnumber>0.2</revnumber>
<date>foo</date>
<authorinitials>mh</authorinitials>
<revremark>Added replaces field to protocol</revremark>
</revision>
<revision>
<revnumber>0.1</revnumber>
<date>foo</date>
<authorinitials>mh</authorinitials>
<revremark>Initial version</revremark>
</revision>
</revhistory>
</articleinfo>
<sect1 id="introduction">
<title>Introduction</title>
<para>
This is a draft standard for a desktop notifications service, through
which applications can generate passive popups (sometimes known as
"poptarts") to notify the user in an asynchronous manner of events.
</para>
<para>
This specification explicitly does not include other types of
notification presentation such as modal message boxes, window manager
decorations or window list annotations.
</para>
<para>
Example use cases include:
</para>
<itemizedlist>
<listitem>
<para>
Presence changes in IM programs: for instance, MSN Messenger on
Windows pioneered the use of passive popups to indicate presence
changes.
</para>
</listitem>
<listitem><para>Scheduled alarm</para></listitem>
<listitem><para>Completed file transfer</para></listitem>
<listitem><para>New mail notification</para></listitem>
<listitem><para>Low disk space/battery warnings</para></listitem>
</itemizedlist>
</sect1>
<sect1 id="basic-design">
<title>Basic Design</title>
<para>
In order to ensure that multiple notifications can easily be
displayed at once, and to provide a convenient implementation, all
notifications are controlled by a single session-scoped service which
exposes a D-BUS interface.
</para>
<para>
On startup, a conforming implementation should take the
<literal>org.freedesktop.Notifications</literal> service on
the session bus. This service will be referred to as the "notification
server" or just "the server" in this document. It can optionally be
activated automatically by the bus process, however this is not required
and notification server clients must not assume that it is available.
</para>
<para>
The server should implement the
<literal>org.freedesktop.Notifications</literal> interface on
an object with the path <literal>"/org/freedesktop/Notifications"</literal>.
This is the only interface required by this version of the specification.
</para>
<para>
A notification has the following components:
</para>
<table>
<title>Notification Components</title>
<tgroup cols="2">
<thead>
<row>
<entry>Component</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>Application Name</entry>
<entry>
This is the optional name of the application sending the notification.
This should be the application's formal name, rather than some sort
of ID. An example would be "FredApp E-Mail Client," rather than
"fredapp-email-client."
</entry>
</row>
<row>
<entry>Application Icon</entry>
<entry>
The application icon. This is represented either as a path or a name
in an icon theme.
</entry>
</row>
<row>
<entry>Replaces ID</entry>
<entry>
An optional ID of an existing notification that this
notification is intended to replace.
</entry>
</row>
<row>
<entry>Notification Type ID</entry>
<entry>
An optional ID representing the notification type. See
<xref linkend="notification-types"/>.
</entry>
</row>
<row>
<entry>Urgency Level</entry>
<entry>
The urgency of the notification. See <xref linkend="urgency-levels"/>.
</entry>
</row>
<row>
<entry>Summary</entry>
<entry>
This is a single line overview of the notification. For instance,
"You have mail" or "A friend has come online". It should generally
not be longer than 40 characters, though this is not a requirement,
and server implementations should word wrap if necessary. The summary
must be encoded using UTF-8.
</entry>
</row>
<row>
<entry>Body</entry>
<entry>
<para>
This is a multi-line body of text. Each line is a paragraph, server
implementations are free to word wrap them as they see fit.
</para>
<para>
The text may contain simple markup as specified in
<xref linkend="markup"/>. It must be encoded using UTF-8.
</para>
<para>
If the body is omitted just the summary is displayed.
</para>
</entry>
</row>
<row>
<entry>Images</entry>
<entry>See <xref linkend="icons"/>.</entry>
</row>
<row>
<entry>Actions</entry>
<entry>
The actions send a request message back to the notification client
when invoked. This functionality may not be implemented by the
notification server, conforming clients should check if it is available
before using it (see the GetCapabilities message in
<xref linkend="protocol"/>. An implementation is free to ignore any
requested by the client. As an example one possible rendering of
actions would be as buttons in the notification popup.
</entry>
</row>
<row>
<entry>Hints</entry>
<entry>See <xref linkend="hints"/>.</entry>
</row>
<row>
<entry>Expiration Time</entry>
<entry>
<para>
The timestamp in seconds since the epoch that the notification should
close. For example, if one wishes to have an expiration of 5 seconds
from now, they must grab the current timestamp and add 5 seconds to it.
</para>
<para>
If zero, the notification's expiration time is dependent on the
notification server's settings, and may vary for the type of
notification.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Each notification displayed is allocated a unique ID by the server.
This is unique within the session. While the notification server is
running, the ID will not be recycled unless the capacity of a uint32 is
exceeded.
</para>
<para>
This can be used to hide the notification before the expiration time
is reached. It can also be used to atomically replace the notification
with another. This allows you to (for instance) modify the contents of
a notification while it's on-screen.
</para>
</sect1>
<sect1 id="backwards-compat" xreflabel="Backwards Compatibility">
<title>Backwards Compatibility</title>
<para>
Clients should try and avoid making assumptions about the presentation and
abilities of the notification server. The message content is the most
important thing.
</para>
<para>
Clients can check with the server what capabilities are supported
using the <literal>GetCapabilities</literal> message. See
<xref linkend="protocol"/>.
</para>
<para>
If a client requires a response from a passive popup, it should be
coded such that a non-focus-stealing message box can be used in the
case that the notification server does not support this feature.
</para>
</sect1>
<sect1 id="markup" xreflabel="Markup">
<title>Markup</title>
<para>
Body text may contain markup. The markup is XML-based, and consists
of a small subset of HTML along with a few additional tags.
</para>
<para>
The following tags should be supported by the notification server.
Though it is optional, it is recommended. Notification servers that do
not support these tags should filter them out.
</para>
<informaltable>
<tgroup cols="2">
<tbody valign="top">
<row>
<entry>
<sgmltag class="starttag">b</sgmltag> ...
<sgmltag class="endtag">b</sgmltag>
</entry>
<entry>Bold</entry>
</row>
<row>
<entry>
<sgmltag class="starttag">i</sgmltag> ...
<sgmltag class="endtag">i</sgmltag>
</entry>
<entry>Italic</entry>
</row>
<row>
<entry>
<sgmltag class="starttag">u</sgmltag> ...
<sgmltag class="endtag">u</sgmltag>
</entry>
<entry>Underline</entry>
</row>
<row>
<entry>
<sgmltag class="starttag">a href="..."</sgmltag> ...
<sgmltag class="endtag">a</sgmltag>
</entry>
<entry>Hyperlink</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
<remark>
What else do we want here? We're going to want more tags
for sure.
</remark>
</para>
</sect1>
<sect1 id="icons" xreflabel="Icons">
<title>Icons</title>
<para>
A notification can optionally include an array of images. The array of
images specifies frames in an animation, which always loop.
Implementations are free to ignore the images data, and implementations
that support images need not support animation.
</para>
<para>
If the image array has more than one element, a "primary frame" can
be specified. If not specified, it defaults to the first frame. For
implementations that support images but not animation, only the primary
frame will be used.
</para>
<para>
Each element of the array must have the same type as the first
element. Mixtures of strings and blobs are not allowed. The element
types can be one of the following:
</para>
<informaltable>
<tgroup cols="3">
<thead>
<row>
<entry>Element</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>Icon Theme Name</entry>
<entry>String</entry>
<entry>
Any string that does not begin with the <literal>/</literal>
character is assumed to be an icon theme name and is looked up
according to the spec. The best size to fit the servers chosen
presentation will be used. This is the recommended way of specifying
images.
</entry>
</row>
<row>
<entry>Absolute Path</entry>
<entry>String</entry>
<entry>
Any string that begins with a <literal>/</literal> will be used as
an absolute file path. Implementations should support at minimum
files of type image/png and image/svg.
</entry>
</row>
<row>
<entry>Image Data</entry>
<entry>Binary Data</entry>
<entry>
A data stream may be embedded in the message. This is assumed to be
of type image/png.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
<sect1 id="notification-types" xreflabel="Notification Types">
<title>Notification Types</title>
<para>
Notifications can optionally have a type indicator. Although neither
client or nor server must support this, some may choose to. Those servers
implementing notification types may use them to intelligently display
the notification in a certain way, or group notifications of similar
types.
</para>
<para>
The following table lists standard notifications as defined by this spec.
More will be added in time.
</para>
<table>
<title>Notification Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><literal>"email"</literal></entry>
<entry>An e-mail notification.</entry>
</row>
<row>
<entry><literal>"im"</literal></entry>
<entry>A new IM notification.</entry>
</row>
<row>
<entry><literal>"device"</literal></entry>
<entry>A device-related notification, such as a USB device being
plugged in or unplugged.</entry>
</row>
<row>
<entry><literal>"presence"</literal></entry>
<entry>A presence change, such as a user going online or offline.</entry>
</row>
<row>
<entry><literal>"transfer-complete"</literal></entry>
<entry>A file transfer or download complete notification.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Third parties, when defining their own notification types, should discuss
the possibility of standardizing on the hint with other parties, preferably
in a place such as the
<ulink url="http://freedesktop.org/mailman/listinfo/xdg">xdg</ulink>
mailing list at
<ulink url="http://freedesktop.org/">freedesktop.org</ulink>. If it
warrants a standard, it will be added to the table above. If no
consensus is reached, the notification type should be in the form of
<literal>"x-<replaceable>vendor</replaceable>-<replaceable>name</replaceable>."</literal>
</para>
</sect1>
<sect1 id="urgency-levels" xreflabel="Urgency Levels">
<title>Urgency Levels</title>
<para>
Notifications have an urgency level associated with them. This defines
the importance of the notification. For example, "Your computer is on
fire" would be a critical urgency. "Joe Bob signed on" would be a low
urgency.
</para>
<para>Urgency levels are defined as follows:</para>
<table>
<title>Urgency Levels</title>
<tgroup cols="2">
<thead>
<row>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>0</entry>
<entry>Low</entry>
</row>
<row>
<entry>1</entry>
<entry>Medium (Normal)</entry>
</row>
<row>
<entry>2</entry>
<entry>High</entry>
</row>
<row>
<entry>3</entry>
<entry>Critical</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Developers must use their own judgement when deciding the urgency of a
notification. Typically, if the majority of programs are using the same
level for a specific type of urgency, other applications should follow
them.
</para>
<para>
For the most part, server implementations may use urgency information
how they see fit. The one exception is the Critical notification.
As Critical notifications are things that the user will most likely want
to know about, they should not be closed until the user dismisses them.
</para>
</sect1>
<sect1 id="hints" xreflabel="Hints">
<title>Hints</title>
<para>
Hints are a way to provide extra data to a notification server that
the server may be able to make use of.
</para>
<para>
Neither clients nor notification servers are required to support any
hints. Both sides should assume that hints are not passed, and should
ignore any hints they do not understand.
</para>
<!--
<para>
The following table lists the standard hints as defined by this
specification. Future hints may be proposed and added to this list
over time. Once again, implementations are not required to support these.
</para>
<table>
<title>Standard Hints</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Value Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><literal>"winid"</literal></entry>
<entry>UINT32</entry>
<entry>
The Window ID that sent the notification. This may be used,
for example, to flash the window.
</entry>
</row>
</tbody>
</tgroup>
</table>
-->
<para>
Third parties, when defining their own hints, should discuss the
possibility of standardizing on the hint with other parties, preferably
in a place such as the
<ulink url="http://freedesktop.org/mailman/listinfo/xdg">xdg</ulink>
mailing list at
<ulink url="http://freedesktop.org/">freedesktop.org</ulink>. If it
warrants a standard, it will be added to the table above. If no
consensus is reached, the hint name should be in the form of
<literal>"x-<replaceable>vendor</replaceable>-<replaceable>name</replaceable>."</literal>
</para>
</sect1>
<sect1 id="protocol" xreflabel="Protocol">
<title>D-BUS Protocol</title>
<para>
The following messages <emphasis>must</emphasis> be supported by all
implementations.
</para>
<sect2 id="commands">
<title>Message commands</title>
<sect3 id="command-get-capabilities">
<title><literal>org.freedesktop.Notifications.GetCapabilities</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>STRING_ARRAY
<function>org.freedesktop.Notifications.GetCapabilities</function>
</funcdef>
<void/>
</funcprototype>
</funcsynopsis>
<para>
This message takes no parameters.
</para>
<para>
It returns an array of strings. Each string describes an optional
capability implemented by the server. The following values are
defined by this spec:
</para>
<table>
<title>Server Capabilities</title>
<tgroup cols="2">
<tbody valign="top">
<row>
<entry><literal>"body"</literal></entry>
<entry>
Supports body text. Some implementations may only show the
summary (for instance, onscreen displays, marquee/scrollers)
</entry>
</row>
<row>
<entry><literal>"markup"</literal></entry>
<entry>
Supports markup in the body text. If marked up text is sent
to a server that does not give this cap, the markup will show
through as regular text so must be stripped clientside.
</entry>
</row>
<row>
<entry><literal>"static-image"</literal></entry>
<entry>
Supports display of exactly 1 frame of any given image array.
This value is mutually exclusive with
<literal>"multi-image"</literal>, it is a protocol error for the
server to specify both.
</entry>
</row>
<row>
<entry><literal>"multi-image"</literal></entry>
<entry>
The server will render an animation of all the frames in a given
image array. The client may still specify multiple frames even if
this cap and/or static-image is missing, however the server is
free to ignore them and use only the primary frame.
</entry>
</row>
<row>
<entry><literal>"actions"</literal></entry>
<entry>
The server will provide the specified actions to the user. Even if
this cap is missing, actions may still be specified by the client,
however the server is free to ignore them.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
New vendor-specific caps may be specified as long as they start with
<literal>"x-<replaceable>vendor</replaceable>"</literal>. For instance,
<literal>"x-gnome-foo-cap"</literal>. Capability names must not
contain spaces. They are limited to alpha-numeric characters and dashes
(<literal>"-"</literal>).
</para>
</sect3>
<sect3 id="command-notify">
<title><literal>org.freedesktop.Notifications.Notify</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>UINT32
<function>org.freedesktop.Notifications.Notify</function>
</funcdef>
<paramdef>STRING_OR_NIL <parameter>app_name</parameter></paramdef>
<paramdef>BYTE_ARRAY_OR_STRING_OR_NIL <parameter>app_icon</parameter></paramdef>
<paramdef>UINT32_OR_NIL <parameter>replaces_id</parameter></paramdef>
<paramdef>STRING_OR_NIL <parameter>notification_type</parameter></paramdef>
<paramdef>BYTE <parameter>urgency_level</parameter></paramdef>
<paramdef>STRING <parameter>summary</parameter></paramdef>
<paramdef>STRING_OR_NIL <parameter>body</parameter></paramdef>
<paramdef>ARRAY <parameter>images</parameter></paramdef>
<paramdef>DICT_OR_NIL <parameter>actions</parameter></paramdef>
<paramdef>DICT_OR_NIL <parameter>hints</parameter></paramdef>
<paramdef>UINT32_OR_NIL <parameter>expire_time</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Sends a notification to the notification server.
</para>
<table>
<title>Notify Parameters</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>app_name</parameter></entry>
<entry>STRING or NIL</entry>
<entry>
The optional name of the application sending the notification.
</entry>
</row>
<row>
<entry><parameter>app_icon</parameter></entry>
<entry>BYTE_ARRAY or STRING or NIL</entry>
<entry>
The optional program icon of the calling application. This is in
the same format as an image frame. See <xref linkend="icons"/>.
</entry>
</row>
<row>
<entry><parameter>replaces_id</parameter></entry>
<entry>UINT32 or NIL</entry>
<entry>
The optional notification ID that this notification replaces. The
server must atomically (ie with no flicker or other visual cues)
replace the given notification with this one. This allows clients to
effectively modify the notification while it's active.
</entry>
</row>
<row>
<entry><parameter>notification_type</parameter></entry>
<entry>STRING or NIL</entry>
<entry>
The optional notification type ID, for potential server
categorization and logging purposes. See
<xref linkend="notification-types"/>.
</entry>
</row>
<row>
<entry><parameter>urgency_level</parameter></entry>
<entry>BYTE</entry>
<entry>The urgency level. See <xref linkend="urgency-levels"/>.</entry>
</row>
<row>
<entry><parameter>summary</parameter></entry>
<entry>STRING</entry>
<entry>The summary text briefly describing the notification.</entry>
</row>
<row>
<entry><parameter>body</parameter></entry>
<entry>STRING or NIL</entry>
<entry>The optional detailed body text.</entry>
</row>
<row>
<entry><parameter>images</parameter></entry>
<entry>ARRAY or NIL</entry>
<entry>
The optional array of images. See <xref linkend="icons"/>.
</entry>
</row>
<row>
<entry><parameter>actions</parameter></entry>
<entry>DICT or NIL</entry>
<entry>
A dictionary key of actions. Each key is the localized name of the
action, as it should appear to the user, and maps to a UINT32 value
containing a program-specific action code. This code will be reported
back to the program if the action is invoked by the user.
</entry>
</row>
<row>
<entry><parameter>hints</parameter></entry>
<entry>DICT or NIL</entry>
<entry>
Optional hints that can be passed to the server from the client
program. Although clients and servers should never assume each other
supports any specific hints, they can be used to pass along
information, such as the process PID or window ID, that the server
may be able to make use of. See <xref linkend="hints"/>.
</entry>
</row>
<row>
<entry><parameter>expire_time</parameter></entry>
<entry>UINT32 or NIL</entry>
<entry>
The notification time-out time, represented as UNIX-time (seconds
since the epoch). If this is NIL, the notification
will never time out, and will only be closed when an action is
invoked. If non-NIL, this will specify a time at which the notification
will be automatically closed. If zero, the server's default
expiration time will be used.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
If <parameter>replaces_id</parameter> is NIL, the return value is a
UINT32 that represent the notification. It is unique, and will not be
reused unless a <constant>MAXINT</constant> number of notifications
have been generated. An acceptable implementation may just use an
incrementing counter for the ID. The returned ID is always greater than
zero. Servers must make sure not to return zero as an ID.
</para>
<para>
If <parameter>replaces_id</parameter> is not NIL, the returned value
is the same value as <parameter>replaces_id</parameter>.
</para>
</sect3>
<sect3 id="command-close-notification">
<title><literal>org.freedesktop.Notifications.CloseNotification</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>void
<function>org.freedesktop.Notifications.CloseNotification</function>
</funcdef>
<paramdef>UINT32 id</paramdef>
</funcprototype>
</funcsynopsis>
<para>
Causes a notification to be forcefully closed and removed from the user's
view. It can be used, for example, in the event that what the
notification pertains to is no longer relevant, or to cancel a
notification with no expiration time.
</para>
<para>
The <literal>NotificationClosed</literal> signal is emitted by this
method.
</para>
<para>
If the notification no longer exists, an empty D-BUS Error message is
sent back.
</para>
</sect3>
<sect3 id="command-get-server-information">
<title><literal>org.freedesktop.Notifications.GetServerInformation</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
void
<function>org.freedesktop.Notifications.GetServerInformation</function>
</funcdef>
<paramdef>out STRING <parameter>name</parameter></paramdef>
<paramdef>out STRING <parameter>vendor</parameter></paramdef>
<paramdef>out STRING <parameter>version</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
This message returns the information on the server. Specifically,
the server name, vendor, and version number.
</para>
<table>
<title>GetServerInformation Return Values</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>name</parameter></entry>
<entry>STRING</entry>
<entry>The product name of the server.</entry>
</row>
<row>
<entry><parameter>vendor</parameter></entry>
<entry>STRING</entry>
<entry>
The vendor name. For example, "KDE," "GNOME,"
"freedesktop.org," or "Microsoft."
</entry>
</row>
<row>
<entry><parameter>version</parameter></entry>
<entry>STRING</entry>
<entry>The server's version number.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3>
</sect2>
<sect2 id="signals">
<title>Signals</title>
<sect3 id="signal-notification-closed">
<title><literal>org.freedesktop.Notifications.NotificationClosed</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
<function>org.freedesktop.Notifications.NotificationClosed</function>
</funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef>
<paramdef>UINT32 <parameter>reason</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
A completed notification is one that has timed out, or has been
dismissed by the user.
</para>
<table>
<title>NotificationClosed Parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>id</parameter></entry>
<entry>UINT32</entry>
<entry>The ID of the notification that was closed.</entry>
</row>
<row>
<entry><parameter>reason</parameter></entry>
<entry>UINT32</entry>
<entry>
<para>The reason the notification was closed.</para>
<para>1 - The notification expired.</para>
<para>2 - The notification was dismissed by the user.</para>
<para>3 - The notification was closed by a call to
<literal>CloseNotification</literal>.</para>
<para>4 - Undefined/reserved reasons.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The ID specified in the signal is invalidated
<emphasis>before</emphasis> the signal is sent and may not be used
in any further communications with the server.
</para>
</sect3>
<sect3 id="signal-action-invoked">
<title><literal>org.freedesktop.Notifications.ActionInvoked</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
<function>org.freedesktop.Notifications.ActionInvoked</function>
</funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef>
<!-- <paramdef>BOOL <parameter>default_action</parameter></paramdef> -->
<paramdef>UINT32 <parameter>action_id</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
This signal is emitted when one of the following occurs:
</para>
<itemizedlist>
<listitem>
<para>
The user performs some global "invoking" action upon a notification.
For instance, clicking somewhere on the notification itself.
</para>
</listitem>
<listitem>
<para>
The user invokes a specific action as specified in the original
Notify request. For example, clicking on an action button.
</para>
</listitem>
</itemizedlist>
<table>
<title>ActionInvoked Parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the notification emitting the ActionInvoked signal.
</entry>
</row>
<!--
<row>
<entry><parameter>default_action</parameter></entry>
<entry>BOOL</entry>
<entry>
<constant>TRUE</constant> if the default action was invoked.
The default action is often a click on the notification. If this
is <constant>TRUE</constant>, the <parameter>action_id</parameter>
parameter is ignored.
</entry>
</row>
-->
<row>
<entry><parameter>action_id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the action invoked. A value of 0 means that the default
action was invoked, i.e., clicking the notification itself.
IDs greater than zero are the action IDs as defined by the
calling application.
<!--
This is ignored if
<parameter>default_action</parameter> is <constant>TRUE</constant>.
-->
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Clients should not assume the server will generate this signal. Some
servers may not support user interaction at all, or may not support
the concept of being able to "invoke" a notification.
</para>
</note>
</sect3>
</sect2>
</sect1>
</article>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS/DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<article id="index"> <article id="index">
<articleinfo> <articleinfo>
<title>Desktop Notifications Specification</title> <title>Desktop Notifications Specification</title>
<releaseinfo>Version 0.7</releaseinfo> <releaseinfo>Version 0.9</releaseinfo>
<date>28 July 2005</date> <date>15 January 2006</date>
<authorgroup> <authorgroup>
<author> <author>
<firstname>Mike</firstname> <firstname>Mike</firstname>
@ -26,6 +26,16 @@
</author> </author>
</authorgroup> </authorgroup>
<revhistory> <revhistory>
<revision>
<revnumber>0.9</revnumber>
<date>15 January 2006</date>
<authorinitials>cdh</authorinitials>
<revremark>
Clarify the naming for the application IDs.
Put back a number of things that probably shouldn't have been removed
from the spec.
</revremark>
</revision>
<revision> <revision>
<revnumber>0.8</revnumber> <revnumber>0.8</revnumber>
<date>23 September 2005</date> <date>23 September 2005</date>
@ -174,11 +184,11 @@
</entry> </entry>
</row> </row>
<row> <row>
<entry>Application Icon</entry> <entry>Notification Icon</entry>
<entry> <entry>
The application icon. This is represented either as a URI The notification icon. This is represented either as a URI
(file:// is the only location supported right now) (file:// is the only URI schema supported right now) or a name in
or a name in an icon theme. a freedesktop.org-compliant icon theme (not a GTK+ stock ID).
</entry> </entry>
</row> </row>
<row> <row>
@ -210,48 +220,74 @@
<row> <row>
<entry>Actions</entry> <entry>Actions</entry>
<entry> <entry>
The actions send a request message back to the notification client <para>
when invoked. This functionality may not be implemented by the The actions send a request message back to the notification client
notification server, conforming clients should check if it is available when invoked. This functionality may not be implemented by the
before using it (see the GetCapabilities message in notification server, conforming clients should check if it is available
<xref linkend="protocol"/>). An implementation is free to ignore any before using it (see the GetCapabilities message in
requested by the client. As an example one possible rendering of <xref linkend="protocol"/>). An implementation is free to ignore any
actions would be as buttons in the notification popup. requested by the client. As an example one possible rendering of
actions would be as buttons in the notification popup.
Actions are sent over as a list of pairs. Each even element in the list </para>
(starting at index 0) represents the identifier for the action. Each odd <para>
element in the list is the localized string that will be displayed to the user. Actions are sent over as a list of pairs. Each even element in the
list (starting at index 0) represents the identifier for the action.
Each odd element in the list is the localized string that will be
displayed to the user.
</para>
<para>
The default action (usually invoked my clicking the notification)
should have a key named <literal>"default"</literal>. The name can
be anything, though implementations are free not to display it.
</para>
</entry> </entry>
</row> </row>
<row> <row>
<entry>Hints</entry> <entry>Hints</entry>
<entry><para>See <xref linkend="hints"/>.</para></entry> <entry>
<para>See <xref linkend="hints"/>.</para>
<para>Beyond the core protocol is the hints table. A couple of core elements have <para>
been moved to hints mostly because in a huge number of cases their default values Beyond the core protocol is the hints table. A couple of core
would be sufficent. The elements moved to hints are:</para> elements have been moved to hints mostly because in a huge number
<para> of cases their default values would be sufficent. The elements moved
* Category ID - An optional ID representing the type of notification (the name has to hints are:
been changed from Notification Type ID in pervious versions). See <xref linkend="categories"/>.</para> </para>
<para> <segmentedlist>
* Urgency Level - The urgency of the notification. See <xref linkend="urgency-levels"/>. <title>Elements Moved to Hints</title>
(Defaults to 1 - Normal)</para> <segtitle>Element</segtitle>
<para> <segtitle>Description</segtitle>
* Icon Data - Instead of overloading the icon field we now have an icon_data field that <seglistitem>
is used when icon is blank.</para> <seg>Category ID</seg>
<seg>An optional ID representing the type of notification (the name
has been changed from Notification Type ID in pervious versions).
See <xref linkend="categories"/>.</seg>
</seglistitem>
<seglistitem>
<seg>Urgency Level</seg>
<seg>The urgency of the notification. See
<xref linkend="urgency-levels"/>. (Defaults to 1 - Normal)</seg>
</seglistitem>
<seglistitem>
<seg>Icon Data</seg>
<seg>Instead of overloading the icon field we now have an icon_data
field that is used when icon is blank.</seg>
</seglistitem>
</segmentedlist>
</entry>
</row> </row>
<row> <row>
<entry>Expiration Timeout</entry> <entry>Expiration Timeout</entry>
<entry> <entry>
<para> <para>
The timeout time in milliseconds since the display of the notification at The timeout time in milliseconds since the display of the notification
which the notification should automatically close. at which the notification should automatically close.
</para> </para>
<para> <para>
If -1, the notification's expiration time is dependent on the If -1, the notification's expiration time is dependent on the
notification server's settings, and may vary for the type of notification server's settings, and may vary for the type of
notification. notification.
</para>
<para>
If 0, the notification never expires. If 0, the notification never expires.
</para> </para>
</entry> </entry>
@ -406,13 +442,13 @@
<sect1 id="icons" xreflabel="Icons"> <sect1 id="icons" xreflabel="Icons">
<title>Icons</title> <title>Icons</title>
<para> <para>
A notification can optionaly have an icon specified by the Application Icon A notification can optionally have an icon specified by the Notification
field or by the icon_data hints field. Icon field or by the icon_data hint.
</para> </para>
<para> <para>
The icon_data field should be a raw image data structure of signature (iiibiiay) The icon_data field should be a raw image data structure of signature
which describes the width, height, rowstride, has alpha, bits per sample, channels (iiibiiay) which describes the width, height, rowstride, has alpha, bits
and image data respectively. per sample, channels and image data respectively.
</para> </para>
</sect1> </sect1>
@ -690,12 +726,23 @@
</entry> </entry>
</row> </row>
<row> <row>
<entry><literal>"image_data"</literal></entry> <entry><literal>"desktop-entry"</literal></entry>
<entry>string</entry>
<entry>
This specifies the name of the desktop filename representing the
calling program. This should be the same as the prefix used for the
application's .desktop file. An example would be "rhythmbox" from
"rhythmbox.desktop". This can be used by the daemon to retrieve the
correct icon for the application, for logging purposes, etc.
</entry>
</row>
<row>
<entry><literal>"icon_data"</literal></entry>
<entry>(iiibiiay)</entry> <entry>(iiibiiay)</entry>
<entry> <entry>
This is a raw data image format which describes the width, height, rowstride, This is a raw data image format which describes the width, height,
has alpha, bits per sample, channels and image data respectively. We use this rowstride, has alpha, bits per sample, channels and image data
value if the icon field is left blank. respectively. We use this value if the icon field is left blank.
</entry> </entry>
</row> </row>
<row> <row>
@ -913,9 +960,10 @@
<entry><parameter>actions</parameter></entry> <entry><parameter>actions</parameter></entry>
<entry>ARRAY</entry> <entry>ARRAY</entry>
<entry> <entry>
Actions are sent over as a list of pairs. Each even element in the list Actions are sent over as a list of pairs. Each even element in
(starting at index 0) represents the identifier for the action. Each odd the list (starting at index 0) represents the identifier for the
element in the list is the localized string that will be displayed to the user. action. Each odd element in the list is the localized string
that will be displayed to the user.
</entry> </entry>
</row> </row>
<row> <row>
@ -1106,8 +1154,7 @@
<function>org.freedesktop.Notifications.ActionInvoked</function> <function>org.freedesktop.Notifications.ActionInvoked</function>
</funcdef> </funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef> <paramdef>UINT32 <parameter>id</parameter></paramdef>
<!-- <paramdef>BOOL <parameter>default_action</parameter></paramdef> --> <paramdef>STRING <parameter>action_key</parameter></paramdef>
<paramdef>UINT32 <parameter>action_id</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@ -1145,30 +1192,12 @@
The ID of the notification emitting the ActionInvoked signal. The ID of the notification emitting the ActionInvoked signal.
</entry> </entry>
</row> </row>
<!--
<row> <row>
<entry><parameter>default_action</parameter></entry> <entry><parameter>action_key</parameter></entry>
<entry>BOOL</entry> <entry>STRING</entry>
<entry> <entry>
<constant>TRUE</constant> if the default action was invoked. The key of the action invoked. These match the keys sent over
The default action is often a click on the notification. If this in the list of actions.
is <constant>TRUE</constant>, the <parameter>action_id</parameter>
parameter is ignored.
</entry>
</row>
-->
<row>
<entry><parameter>action_id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the action invoked. A value of 0 means that the default
action was invoked, i.e., clicking the notification itself.
IDs greater than zero are the action IDs as defined by the
calling application.
<!--
This is ignored if
<parameter>default_action</parameter> is <constant>TRUE</constant>.
-->
</entry> </entry>
</row> </row>
</tbody> </tbody>

File diff suppressed because it is too large Load Diff

29
libnotify.doap Normal file
View File

@ -0,0 +1,29 @@
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gnome="http://api.gnome.org/doap-extensions#"
xmlns="http://usefulinc.com/ns/doap#">
<name xml:lang="en">Desktop notification library</name>
<shortname>libnotify</shortname>
<category rdf:resource="http://api.gnome.org/doap-extensions#core" />
<programming-language>C</programming-language>
<shortdesc xml:lang="en">libnotify is a library for sending desktop notifications</shortdesc>
<description>Library to send desktop notifications that follows the FDO
specifications:
https://gitlab.freedesktop.org/xdg/xdg-specs/-/blob/master/notification/notification-spec.xml</description>
<maintainer>
<foaf:Person>
<foaf:name>Marco Trevisan</foaf:name>
<foaf:mbox rdf:resource="mailto:mail@3v1n0.net" />
<gnome:userid>marcotrevi</gnome:userid>
</foaf:Person>
</maintainer>
<maintainer>
<foaf:Person>
<foaf:name>Logan Rathbone</foaf:name>
<foaf:mbox rdf:resource="mailto:poprocks@gmail.com" />
<gnome:userid>larathbone</gnome:userid>
</foaf:Person>
</maintainer>
</Project>

View File

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libnotify
Description: Notifications Library
Version: @VERSION@
Libs: -L${libdir} -lnotify @PACKAGE_LIBS@
Cflags: -I${includedir} @PACKAGE_CFLAGS@

View File

View File

@ -1,24 +0,0 @@
notifyincdir = $(includedir)/libnotify
lib_LTLIBRARIES = libnotify.la
notifyinc_HEADERS = \
notify.h \
notifynotification.h \
notifycommon.h \
notifymarshal.h
libnotify_la_SOURCES = \
dbus-compat.h \
notify.c \
notifynotification.c \
notifymarshal.c
libnotify_la_LIBADD = \
$(PACKAGE_LIBS)
libnotify_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
INCLUDES = \
$(PACKAGE_CFLAGS)

View File

@ -1,508 +0,0 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libnotify
DIST_COMMON = $(notifyinc_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(notifyincdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libnotify_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libnotify_la_OBJECTS = notify.lo notifynotification.lo \
notifymarshal.lo
libnotify_la_OBJECTS = $(am_libnotify_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libnotify_la_SOURCES)
DIST_SOURCES = $(libnotify_la_SOURCES)
notifyincHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(notifyinc_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GDK_CFLAGS = @GDK_CFLAGS@
GDK_LIBS = @GDK_LIBS@
HAVE_GDK_FALSE = @HAVE_GDK_FALSE@
HAVE_GDK_TRUE = @HAVE_GDK_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_CFLAGS = @PACKAGE_CFLAGS@
PACKAGE_LIBS = @PACKAGE_LIBS@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
notifyincdir = $(includedir)/libnotify
lib_LTLIBRARIES = libnotify.la
notifyinc_HEADERS = \
notify.h \
notifynotification.h \
notifycommon.h \
notifymarshal.h
libnotify_la_SOURCES = \
dbus-compat.h \
notify.c \
notifynotification.c \
notifymarshal.c
libnotify_la_LIBADD = \
$(PACKAGE_LIBS)
libnotify_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
INCLUDES = \
$(PACKAGE_CFLAGS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libnotify/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu libnotify/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libnotify.la: $(libnotify_la_OBJECTS) $(libnotify_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libnotify_la_LDFLAGS) $(libnotify_la_OBJECTS) $(libnotify_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notify.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notifymarshal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notifynotification.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-notifyincHEADERS: $(notifyinc_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(notifyincdir)" || $(mkdir_p) "$(DESTDIR)$(notifyincdir)"
@list='$(notifyinc_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(notifyincHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(notifyincdir)/$$f'"; \
$(notifyincHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(notifyincdir)/$$f"; \
done
uninstall-notifyincHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(notifyinc_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(notifyincdir)/$$f'"; \
rm -f "$(DESTDIR)$(notifyincdir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(notifyincdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-notifyincHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
uninstall-notifyincHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-man install-notifyincHEADERS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-info-am uninstall-libLTLIBRARIES \
uninstall-notifyincHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,144 +0,0 @@
/**
* @file libnotify/dbus-compat.h Private D-BUS Compatibility API
*
* @Copyright (C) 2005 Christian Hammond.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _NOTIFY_DBUS_COMPAT_H_
#define _NOTIFY_DBUS_COMPAT_H_
#define NOTIFY_CHECK_DBUS_VERSION(major, minor) \
(DBUS_MAJOR_VER > (major) || \
(DBUS_MAJOR_VER == (major) && DBUS_MINOR_VER >= (minor)))
#if NOTIFY_CHECK_DBUS_VERSION(0, 30)
# define _notify_dbus_message_iter_append_byte(iter, val) \
dbus_message_iter_append_basic((iter), DBUS_TYPE_BYTE, &(val))
# define _notify_dbus_message_iter_append_boolean(iter, val) \
dbus_message_iter_append_basic((iter), DBUS_TYPE_BOOLEAN, &(val))
# define _notify_dbus_message_iter_append_string(iter, val) \
dbus_message_iter_append_basic((iter), DBUS_TYPE_STRING, &(val))
# define _notify_dbus_message_iter_append_int32(iter, val) \
dbus_message_iter_append_basic((iter), DBUS_TYPE_INT32, &(val))
# define _notify_dbus_message_iter_append_uint32(iter, val) \
dbus_message_iter_append_basic((iter), DBUS_TYPE_UINT32, &(val))
# define _notify_dbus_message_iter_append_double(iter, val) \
dbus_message_iter_append_basic((iter), DBUS_TYPE_DOUBLE, &(val))
# define _notify_dbus_message_iter_append_byte_array(iter, data, len) \
dbus_message_iter_append_fixed_array((iter), DBUS_TYPE_BYTE, &(data), \
(len))
# define _notify_dbus_message_iter_append_boolean_array(iter, data, len) \
dbus_message_iter_append_fixed_array((iter), DBUS_TYPE_BOOLEAN, &(data), \
(len))
# define _notify_dbus_message_iter_append_int32_array(iter, data, len) \
dbus_message_iter_append_fixed_array((iter), DBUS_TYPE_INT32, &(data), \
(len))
# define _notify_dbus_message_iter_append_uint32_array(iter, data, len) \
dbus_message_iter_append_fixed_array((iter), DBUS_TYPE_UINT32, &(data), \
(len))
# define _notify_dbus_message_iter_append_string_array(iter, data, len) \
dbus_message_iter_append_fixed_array((iter), DBUS_TYPE_STRING, \
&(data), (len))
# define _notify_dbus_message_iter_get_byte(iter, retvar) \
dbus_message_iter_get_basic((iter), &(retvar))
# define _notify_dbus_message_iter_get_boolean(iter, retvar) \
dbus_message_iter_get_basic((iter), &(retvar))
# define _notify_dbus_message_iter_get_string(iter, retvar) \
dbus_message_iter_get_basic((iter), &(retvar))
# define _notify_dbus_message_iter_get_int32(iter, retvar) \
dbus_message_iter_get_basic((iter), &(retvar))
# define _notify_dbus_message_iter_get_uint32(iter, retvar) \
dbus_message_iter_get_basic((iter), &(retvar))
# define _notify_dbus_message_iter_get_double(iter, retvar) \
dbus_message_iter_get_basic((iter), &(retvar))
# define _notify_dbus_message_iter_get_byte_array \
dbus_message_iter_get_fixed_array
# define _notify_dbus_message_iter_get_boolean_array \
dbus_message_iter_get_fixed_array
# define _notify_dbus_message_iter_get_int32_array \
dbus_message_iter_get_fixed_array
# define _notify_dbus_message_iter_get_uint32_array \
dbus_message_iter_get_fixed_array
# define _notify_dbus_message_iter_get_string_array(iter, array, num_items) \
dbus_message_iter_get_fixed_array((iter), (array), (num_items))
#else /* D-BUS < 0.30 */
# define DBUS_INTERFACE_DBUS DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS
# define DBUS_SERVICE_DBUS DBUS_SERVICE_ORG_FREEDESKTOP_DBUS
# define DBUS_PATH_DBUS DBUS_PATH_ORG_FREEDESKTOP_DBUS
# define DBUS_ERROR_SERVICE_UNKNOWN DBUS_ERROR_SERVICE_DOES_NOT_EXIST
# define dbus_bus_start_service_by_name dbus_bus_activate_service
# define dbus_message_iter_close_container(iter, container_iter)
# define dbus_message_iter_init_append(msg, iter) \
dbus_message_iter_init(msg, iter)
# define _notify_dbus_message_iter_append_byte(iter, val) \
dbus_message_iter_append_byte((iter), (val))
# define _notify_dbus_message_iter_append_boolean(iter, val) \
dbus_message_iter_append_boolean((iter), (val))
# define _notify_dbus_message_iter_append_string(iter, val) \
dbus_message_iter_append_string((iter), (val))
# define _notify_dbus_message_iter_append_int32(iter, val) \
dbus_message_iter_append_int32((iter), (val))
# define _notify_dbus_message_iter_append_uint32(iter, val) \
dbus_message_iter_append_uint32((iter), (val))
# define _notify_dbus_message_iter_append_double(iter, val) \
dbus_message_iter_append_double((iter), (val))
# define _notify_dbus_message_iter_append_byte_array(iter, data, len) \
dbus_message_iter_append_byte_array((iter), (data), (len))
# define _notify_dbus_message_iter_append_boolean_array(iter, data, len) \
dbus_message_iter_append_boolean_array((iter), (data), (len))
# define _notify_dbus_message_iter_append_int32_array(iter, data, len) \
dbus_message_iter_append_int32_array((iter), (data), (len))
# define _notify_dbus_message_iter_append_uint32_array(iter, data, len) \
dbus_message_iter_append_uint32_array((iter), (data), (len))
# define _notify_dbus_message_iter_append_string_array(iter, data, len) \
dbus_message_iter_append_string_array((iter), (const char **)(data), (len))
# define _notify_dbus_message_iter_get_byte(iter, retvar) \
retvar = dbus_message_iter_get_byte((iter))
# define _notify_dbus_message_iter_get_boolean(iter, retvar) \
retvar = dbus_message_iter_get_boolean((iter))
# define _notify_dbus_message_iter_get_string(iter, retvar) \
retvar = dbus_message_iter_get_string((iter))
# define _notify_dbus_message_iter_get_int32(iter, retvar) \
retvar = dbus_message_iter_get_int32((iter))
# define _notify_dbus_message_iter_get_uint32(iter, retvar) \
retvar = dbus_message_iter_get_uint32((iter))
# define _notify_dbus_message_iter_get_double(iter, retvar) \
retvar = dbus_message_iter_get_double((iter))
# define _notify_dbus_message_iter_get_byte_array(iter, data, len) \
dbus_message_iter_get_byte_array((iter), (data), (len))
# define _notify_dbus_message_iter_get_boolean_array(iter, data, len) \
dbus_message_iter_get_boolean_array((iter), (data), (len))
# define _notify_dbus_message_iter_get_int32_array(iter, data, len) \
dbus_message_iter_get_int32_array((iter), (data), (len))
# define _notify_dbus_message_iter_get_uint32_array(iter, data, len) \
dbus_message_iter_get_uint32_array((iter), (data), (len))
# define _notify_dbus_message_iter_get_string_array(iter, data, len) \
dbus_message_iter_get_string_array((iter), (data), (len))
#endif
#endif /* NOTIFY_DBUS_COMPAT_H_ */

53
libnotify/internal.h Normal file
View File

@ -0,0 +1,53 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file libnotify/internal.h Internal definitions
*
* @Copyright (C) 2006 Christian Hammond
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _LIBNOTIFY_INTERNAL_H_
#define _LIBNOTIFY_INTERNAL_H_
#define NOTIFY_DBUS_NAME "org.freedesktop.Notifications"
#define NOTIFY_DBUS_CORE_INTERFACE "org.freedesktop.Notifications"
#define NOTIFY_DBUS_CORE_OBJECT "/org/freedesktop/Notifications"
#define NOTIFY_PORTAL_DBUS_NAME "org.freedesktop.portal.Desktop"
#define NOTIFY_PORTAL_DBUS_CORE_INTERFACE "org.freedesktop.portal.Notification"
#define NOTIFY_PORTAL_DBUS_CORE_OBJECT "/org/freedesktop/portal/desktop"
G_BEGIN_DECLS
GDBusProxy * _notify_get_proxy (GError **error);
void _notify_cache_add_notification (NotifyNotification *n);
void _notify_cache_remove_notification (NotifyNotification *n);
gint _notify_notification_get_timeout (const NotifyNotification *n);
gboolean _notify_notification_has_nondefault_actions (const NotifyNotification *n);
gboolean _notify_check_spec_version (int major, int minor);
const char * _notify_get_snap_name (void);
const char * _notify_get_snap_path (void);
const char * _notify_get_snap_app (void);
const char * _notify_get_flatpak_app (void);
gboolean _notify_uses_portal_notifications (void);
G_END_DECLS
#endif /* _LIBNOTIFY_INTERNAL_H_ */

6
libnotify/libnotify.map Normal file
View File

@ -0,0 +1,6 @@
{
global:
notify_*;
local:
*;
};

86
libnotify/meson.build Normal file
View File

@ -0,0 +1,86 @@
libnotify_includesubdir = meson.project_name()
libnotify_includedir = join_paths(includedir, libnotify_includesubdir)
headers = [
'notify.h',
'notification.h',
]
sources = [
'notify.c',
'notification.c',
]
features_data = configuration_data()
features_data.set('LIBNOTIFY_MAJOR_VERSION', VERSION_ARRAY[0])
features_data.set('LIBNOTIFY_MINOR_VERSION', VERSION_ARRAY[1])
features_data.set('LIBNOTIFY_MICRO_VERSION', VERSION_ARRAY[2])
headers += configure_file(
input: 'notify-features.h.in',
output: 'notify-features.h',
configuration: features_data)
enum_types = gnome.mkenums_simple('@0@-enum-types'.format(LIBNAME),
sources : headers,
install_header: true,
install_dir: libnotify_includedir
)
marshal = gnome.genmarshal('@0@-marshal'.format(LIBNAME),
prefix: '@0@_marshal'.format(LIBNAME),
sources: '@0@-marshal.list'.format(LIBNAME),
)
libnotify_cflags = [
'-DG_LOG_DOMAIN="libnotify"',
]
mapfile = meson.project_name() + '.map'
libnotify_ldflags = cc.get_supported_link_arguments([
'-Wl,--version-script,'+join_paths(meson.current_source_dir(), mapfile),
])
notify_dep = declare_dependency(
include_directories: default_includes,
dependencies: libnotify_deps,
compile_args: libnotify_cflags,
sources: headers + [enum_types[1]] + [marshal[1]],
link_args: libnotify_ldflags,
)
libnotify_lib = shared_library(LIBNAME,
dependencies: notify_dep,
sources: sources + enum_types + marshal,
version: '@0@.@1@.@2@'.format(LT_CURRENT, LT_REVISION, LT_AGE),
soversion: LT_CURRENT,
install: true,
)
libnotify_dep = declare_dependency(
dependencies: notify_dep,
link_with: libnotify_lib
)
pkgconfig.generate(libnotify_lib,
name: meson.project_name(),
libraries: libnotify_deps,
description: 'Notifications Library',
)
introspection = get_option('introspection')
g_ir_scanner = find_program('g-ir-scanner', required: introspection.enabled())
if g_ir_scanner.found() and not introspection.disabled()
gnome.generate_gir(libnotify_lib,
sources: headers + sources + enum_types,
namespace: 'Notify',
nsversion: MODULE_VERSION,
export_packages: meson.project_name(),
includes: ['GLib-2.0', 'GdkPixbuf-2.0'],
extra_args: '--c-include=@0@/@1@.h'.format(meson.project_name(), LIBNAME),
install: true
)
endif
install_headers(headers, subdir: libnotify_includesubdir)

1781
libnotify/notification.c Normal file

File diff suppressed because it is too large Load Diff

220
libnotify/notification.h Normal file
View File

@ -0,0 +1,220 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2006 Christian Hammond
* Copyright (C) 2006 John Palmieri
* Copyright (C) 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _NOTIFY_NOTIFICATION_H_
#define _NOTIFY_NOTIFICATION_H_
#include <glib.h>
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
/**
* NOTIFY_EXPIRES_DEFAULT:
*
* The default expiration time on a notification.
*/
#define NOTIFY_EXPIRES_DEFAULT -1
/**
* NOTIFY_EXPIRES_NEVER:
*
* The notification never expires. It stays open until closed by the calling API
* or the user.
*/
#define NOTIFY_EXPIRES_NEVER 0
#define NOTIFY_TYPE_NOTIFICATION (notify_notification_get_type ())
#define NOTIFY_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotification))
#define NOTIFY_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
#define NOTIFY_IS_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_IS_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_NOTIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
typedef struct _NotifyNotification NotifyNotification;
typedef struct _NotifyNotificationClass NotifyNotificationClass;
typedef struct _NotifyNotificationPrivate NotifyNotificationPrivate;
/**
* NotifyNotification:
*
* A passive pop-up notification.
*/
struct _NotifyNotification
{
/*< private >*/
GObject parent_object;
NotifyNotificationPrivate *priv;
};
struct _NotifyNotificationClass
{
GObjectClass parent_class;
/* Signals */
void (*closed) (NotifyNotification *notification);
};
/**
* NotifyUrgency:
* @NOTIFY_URGENCY_LOW: Low urgency. Used for unimportant notifications.
* @NOTIFY_URGENCY_NORMAL: Normal urgency. Used for most standard notifications.
* @NOTIFY_URGENCY_CRITICAL: Critical urgency. Used for very important notifications.
*
* The urgency level of the notification.
*/
typedef enum
{
NOTIFY_URGENCY_LOW,
NOTIFY_URGENCY_NORMAL,
NOTIFY_URGENCY_CRITICAL,
} NotifyUrgency;
/**
* NotifyClosedReason:
* @NOTIFY_CLOSED_REASON_UNSET: Notification not closed.
* @NOTIFY_CLOSED_REASON_EXPIRED: Timeout has expired.
* @NOTIFY_CLOSED_REASON_DISMISSED: It has been dismissed by the user.
* @NOTIFY_CLOSED_REASON_API_REQUEST: It has been closed by a call to
* notify_notification_close().
* @NOTIFY_CLOSED_REASON_UNDEFIEND: Closed by undefined/reserved reasons.
*
* The reason for which the notification has been closed.
*
* Since: 0.8.0
*/
typedef enum
{
NOTIFY_CLOSED_REASON_UNSET = -1,
NOTIFY_CLOSED_REASON_EXPIRED = 1,
NOTIFY_CLOSED_REASON_DISMISSED = 2,
NOTIFY_CLOSED_REASON_API_REQUEST = 3,
NOTIFY_CLOSED_REASON_UNDEFIEND = 4,
} NotifyClosedReason;
/**
* NotifyActionCallback:
* @notification: a #NotifyActionCallback notification
* @action: (transfer none): The activated action name
* @user_data: (nullable) (transfer none): User provided data
*
* An action callback function.
*/
typedef void (*NotifyActionCallback) (NotifyNotification *notification,
char *action,
gpointer user_data);
/**
* NOTIFY_ACTION_CALLBACK:
* @func: The function to cast.
*
* A convenience macro for casting a function to a #NotifyActionCallback. This
* is much like G_CALLBACK().
*/
#define NOTIFY_ACTION_CALLBACK(func) ((NotifyActionCallback)(func))
GType notify_notification_get_type (void);
NotifyNotification *notify_notification_new (const char *summary,
const char *body,
const char *icon);
gboolean notify_notification_update (NotifyNotification *notification,
const char *summary,
const char *body,
const char *icon);
gboolean notify_notification_show (NotifyNotification *notification,
GError **error);
void notify_notification_set_timeout (NotifyNotification *notification,
gint timeout);
void notify_notification_set_category (NotifyNotification *notification,
const char *category);
void notify_notification_set_urgency (NotifyNotification *notification,
NotifyUrgency urgency);
void notify_notification_set_image_from_pixbuf (NotifyNotification *notification,
GdkPixbuf *pixbuf);
#ifndef LIBNOTIFY_DISABLE_DEPRECATED
void notify_notification_set_icon_from_pixbuf (NotifyNotification *notification,
GdkPixbuf *icon);
void notify_notification_set_hint_int32 (NotifyNotification *notification,
const char *key,
gint value);
void notify_notification_set_hint_uint32 (NotifyNotification *notification,
const char *key,
guint value);
void notify_notification_set_hint_double (NotifyNotification *notification,
const char *key,
gdouble value);
void notify_notification_set_hint_string (NotifyNotification *notification,
const char *key,
const char *value);
void notify_notification_set_hint_byte (NotifyNotification *notification,
const char *key,
guchar value);
void notify_notification_set_hint_byte_array (NotifyNotification *notification,
const char *key,
const guchar *value,
gsize len);
#endif
void notify_notification_set_hint (NotifyNotification *notification,
const char *key,
GVariant *value);
void notify_notification_set_app_name (NotifyNotification *notification,
const char *app_name);
void notify_notification_clear_hints (NotifyNotification *notification);
void notify_notification_add_action (NotifyNotification *notification,
const char *action,
const char *label,
NotifyActionCallback callback,
gpointer user_data,
GFreeFunc free_func);
const char *notify_notification_get_activation_token (NotifyNotification *notification);
void notify_notification_clear_actions (NotifyNotification *notification);
gboolean notify_notification_close (NotifyNotification *notification,
GError **error);
gint notify_notification_get_closed_reason (const NotifyNotification *notification);
G_END_DECLS
#endif /* NOTIFY_NOTIFICATION_H */

View File

@ -0,0 +1,41 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
*
* Copyright (C) 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __NOTIFY_VERSION_H__
#define __NOTIFY_VERSION_H__
/* compile time version
*/
#define NOTIFY_VERSION_MAJOR (@LIBNOTIFY_MAJOR_VERSION@)
#define NOTIFY_VERSION_MINOR (@LIBNOTIFY_MINOR_VERSION@)
#define NOTIFY_VERSION_MICRO (@LIBNOTIFY_MICRO_VERSION@)
/* check whether a version equal to or greater than
* major.minor.micro is present.
*/
#define NOTIFY_CHECK_VERSION(major,minor,micro) \
(NOTIFY_VERSION_MAJOR > (major) || \
(NOTIFY_VERSION_MAJOR == (major) && NOTIFY_VERSION_MINOR > (minor)) || \
(NOTIFY_VERSION_MAJOR == (major) && NOTIFY_VERSION_MINOR == (minor) && \
NOTIFY_VERSION_MICRO >= (micro)))
#endif /* __NOTIFY_VERSION_H__ */

View File

@ -0,0 +1,2 @@
VOID:UINT,UINT
VOID:UINT,STRING

View File

@ -1,9 +1,9 @@
/* -*- mode: c-mode; tab-width: 4; indent-tabs-mode: t; -*- */ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
/**
* @file libnotify/notify.c Notifications library
* *
* @Copyright (C) 2004 Christian Hammond <chipx86@chipx86.com> * Copyright (C) 2004-2006 Christian Hammond <chipx86@chipx86.com>
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * Copyright (C) 2004-2006 Mike Hearn <mike@navi.cx>
* Copyright (C) 2010 Red Hat, Inc.
* Copyright © 2010 Christian Persch
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -21,88 +21,663 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #include "config.h"
# include "config.h"
#endif
#ifndef DBUS_API_SUBJECT_TO_CHANGE
# define DBUS_API_SUBJECT_TO_CHANGE 1
#endif
#include "notify.h"
#include "dbus-compat.h"
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h> #include <unistd.h>
static gboolean _initted = FALSE; #include <glib.h>
static gchar *_app_name = NULL; #include <gio/gio.h>
#ifdef __GNUC__
# define format_func __attribute__((format(printf, 1, 2)))
#else /* no format string checking with this compiler */
# define format_func
#endif
static void format_func #include "notify.h"
print_error (char *message, ...) #include "internal.h"
#include "notify-marshal.h"
/**
* SECTION:notify
* @Short_description: Notification API
* @Title: notify
*/
static gboolean _initted = FALSE;
static char *_app_name = NULL;
static char *_snap_name = NULL;
static char *_snap_app = NULL;
static char *_flatpak_app = NULL;
static GDBusProxy *_proxy = NULL;
static GList *_active_notifications = NULL;
static int _spec_version_major = 0;
static int _spec_version_minor = 0;
static int _portal_version = 0;
gboolean
_notify_check_spec_version (int major,
int minor)
{ {
char buf[1024]; if (_spec_version_major > major)
va_list args; return TRUE;
if (_spec_version_major < major)
va_start (args, message); return FALSE;
vsnprintf (buf, sizeof (buf), message, args); return _spec_version_minor >= minor;
va_end (args);
fprintf (stderr, "%s(%d): libnotify: %s",
(getenv ("_") ? getenv ("_") : ""), getpid (), buf);
} }
static gboolean
_notify_get_server_info (char **ret_name,
char **ret_vendor,
char **ret_version,
char **ret_spec_version,
GError **error)
{
GDBusProxy *proxy;
GVariant *result;
proxy = _notify_get_proxy (error);
if (proxy == NULL) {
return FALSE;
}
if (_notify_uses_portal_notifications ()) {
if (ret_name) {
*ret_name = g_strdup ("Portal Notification");
}
if (ret_vendor) {
*ret_vendor = g_strdup ("Freedesktop");
}
if (ret_version) {
*ret_version = g_strdup_printf ("%u", _portal_version);
}
if (ret_spec_version) {
*ret_spec_version = g_strdup ("1.2");
}
return TRUE;
}
result = g_dbus_proxy_call_sync (proxy,
"GetServerInformation",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1 /* FIXME shorter timeout? */,
NULL,
error);
if (result == NULL) {
return FALSE;
}
if (!g_variant_is_of_type (result, G_VARIANT_TYPE ("(ssss)"))) {
g_variant_unref (result);
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Unexpected reply type");
return FALSE;
}
g_variant_get (result, "(ssss)",
ret_name,
ret_vendor,
ret_version,
ret_spec_version);
g_variant_unref (result);
return TRUE;
}
static gboolean
_notify_update_spec_version (GError **error)
{
char *spec_version;
if (!_notify_get_server_info (NULL, NULL, NULL, &spec_version, error)) {
return FALSE;
}
sscanf (spec_version,
"%d.%d",
&_spec_version_major,
&_spec_version_minor);
g_free (spec_version);
return TRUE;
}
static gboolean
set_app_name (const char *app_name)
{
g_return_val_if_fail (app_name != NULL, FALSE);
g_return_val_if_fail (*app_name != '\0', FALSE);
g_free (_app_name);
_app_name = g_strdup (app_name);
return TRUE;
}
/**
* notify_set_app_name:
* @app_name: The name of the application
*
* Sets the application name.
*
*/
void
notify_set_app_name (const char *app_name)
{
set_app_name (app_name);
}
/**
* notify_init:
* @app_name: (nullable): The name of the application initializing libnotify.
*
* Initialized libnotify. This must be called before any other functions.
*
* Starting from 0.8, if the provided @app_name is %NULL, libnotify will
* try to figure it out from the running application.
* Before it was not allowed, and was causing libnotify not to be initialized.
*
* Returns: %TRUE if successful, or %FALSE on error.
*/
gboolean gboolean
notify_init (const char *app_name) notify_init (const char *app_name)
{ {
g_return_val_if_fail (app_name != NULL, FALSE); if (_initted)
g_return_val_if_fail (*app_name != '\0', FALSE); return TRUE;
if (_initted) if (app_name == NULL) {
return TRUE; GApplication *application;
_app_name = g_strdup (app_name); app_name = _notify_get_snap_app ();
if (app_name == NULL) {
app_name = _notify_get_flatpak_app ();
}
g_type_init (); if (app_name == NULL &&
(application = g_application_get_default ())) {
app_name = g_application_get_application_id (application);
}
}
#ifdef HAVE_ATEXIT if (!set_app_name (app_name)) {
atexit (notify_uninit); return FALSE;
#endif /* HAVE_ATEXIT */ }
_initted = TRUE; _initted = TRUE;
return TRUE; return TRUE;
} }
const gchar * static void
_notify_get_app_name (void) _initialize_snap_names (void)
{ {
return _app_name; gchar *cgroup_contents = NULL;
gchar *found_snap_name = NULL;
gchar **lines;
gint i;
if (!g_file_get_contents ("/proc/self/cgroup", &cgroup_contents,
NULL, NULL)) {
g_free (cgroup_contents);
return;
}
lines = g_strsplit (cgroup_contents, "\n", -1);
g_free (cgroup_contents);
for (i = 0; lines[i]; ++i) {
gchar **parts = g_strsplit (lines[i], ":", 3);
gchar *basename;
gchar **ns;
guint ns_length;
if (g_strv_length (parts) != 3) {
g_strfreev (parts);
continue;
}
basename = g_path_get_basename (parts[2]);
g_strfreev (parts);
if (!basename) {
continue;
}
ns = g_strsplit (basename, ".", -1);
ns_length = g_strv_length (ns);
g_free (basename);
if (ns_length < 2 || !g_str_equal (ns[0], "snap")) {
g_strfreev (ns);
continue;
}
if (_snap_name == NULL) {
g_free (found_snap_name);
found_snap_name = g_strdup (ns[1]);
}
if (ns_length < 3) {
g_strfreev (ns);
continue;
}
if (_snap_name == NULL) {
_snap_name = found_snap_name;
found_snap_name = NULL;
g_debug ("SNAP name: %s", _snap_name);
}
if (g_str_equal (ns[1], _snap_name)) {
_snap_app = g_strdup (ns[2]);
g_strfreev (ns);
break;
}
g_strfreev (ns);
}
if (_snap_name == NULL && found_snap_name != NULL) {
_snap_name = found_snap_name;
found_snap_name = NULL;
g_debug ("SNAP name: %s", _snap_name);
}
if (_snap_app == NULL) {
_snap_app = g_strdup (_snap_name);
}
g_debug ("SNAP app: %s", _snap_app);
g_strfreev (lines);
g_free (found_snap_name);
} }
void const char *
notify_uninit (void) _notify_get_snap_path (void)
{ {
static const char *snap_path = NULL;
static gsize snap_path_set = FALSE;
if (_app_name != NULL) if (g_once_init_enter (&snap_path_set)) {
{ snap_path = g_getenv ("SNAP");
g_free (_app_name);
_app_name = NULL;
}
/* TODO: keep track of all notifications and destroy them here? */ if (!snap_path || *snap_path == '\0' ||
!strchr (snap_path, G_DIR_SEPARATOR)) {
snap_path = NULL;
} else {
g_debug ("SNAP path: %s", snap_path);
}
g_once_init_leave (&snap_path_set, TRUE);
}
return snap_path;
}
const char *
_notify_get_snap_name (void)
{
static gsize snap_name_set = FALSE;
if (g_once_init_enter (&snap_name_set)) {
if (!_snap_name) {
const char *snap_name_env = g_getenv ("SNAP_NAME");
if (!snap_name_env || *snap_name_env == '\0')
snap_name_env = NULL;
_snap_name = g_strdup (snap_name_env);
g_debug ("SNAP name: %s", _snap_name);
}
g_once_init_leave (&snap_name_set, TRUE);
}
return _snap_name;
}
const char *
_notify_get_snap_app (void)
{
static gsize snap_app_set = FALSE;
if (g_once_init_enter (&snap_app_set)) {
_initialize_snap_names ();
g_once_init_leave (&snap_app_set, TRUE);
}
return _snap_app;
}
const char *
_notify_get_flatpak_app (void)
{
static gsize flatpak_app_set = FALSE;
if (g_once_init_enter (&flatpak_app_set)) {
GKeyFile *info = g_key_file_new ();
if (g_key_file_load_from_file (info, "/.flatpak-info",
G_KEY_FILE_NONE, NULL)) {
const char *group = "Application";
if (g_key_file_has_group (info, "Runtime")) {
group = "Runtime";
}
_flatpak_app = g_key_file_get_string (info, group,
"name", NULL);
}
g_key_file_free (info);
g_once_init_leave (&flatpak_app_set, TRUE);
}
return _flatpak_app;
}
static gboolean
_notify_is_running_under_flatpak (void)
{
return !!_notify_get_flatpak_app ();
}
static gboolean
_notify_is_running_under_snap (void)
{
return !!_notify_get_snap_app ();
}
static gboolean
_notify_is_running_in_sandbox (void)
{
static gsize use_portal = 0;
enum {
IGNORE_PORTAL = 1,
TRY_USE_PORTAL = 2,
FORCE_PORTAL = 3
};
if (g_once_init_enter (&use_portal)) {
if (G_UNLIKELY (g_getenv ("NOTIFY_IGNORE_PORTAL"))) {
g_once_init_leave (&use_portal, IGNORE_PORTAL);
} else if (G_UNLIKELY (g_getenv ("NOTIFY_FORCE_PORTAL"))) {
g_once_init_leave (&use_portal, FORCE_PORTAL);
} else {
g_once_init_leave (&use_portal, TRY_USE_PORTAL);
}
}
if (use_portal == IGNORE_PORTAL) {
return FALSE;
}
return use_portal == FORCE_PORTAL ||
_notify_is_running_under_flatpak () ||
_notify_is_running_under_snap ();
} }
gboolean
_notify_uses_portal_notifications (void)
{
return _portal_version != 0;
}
/**
* notify_get_app_name:
*
* Gets the application name registered.
*
* Returns: The registered application name, passed to notify_init().
*/
const char *
notify_get_app_name (void)
{
return _app_name;
}
/**
* notify_uninit:
*
* Uninitialized libnotify.
*
* This should be called when the program no longer needs libnotify for
* the rest of its lifecycle, typically just before exitting.
*/
void
notify_uninit (void)
{
GList *l;
if (!_initted) {
return;
}
if (_app_name != NULL) {
g_free (_app_name);
_app_name = NULL;
}
for (l = _active_notifications; l != NULL; l = l->next) {
NotifyNotification *n = NOTIFY_NOTIFICATION (l->data);
if (_notify_notification_get_timeout (n) == 0 ||
_notify_notification_has_nondefault_actions (n)) {
notify_notification_close (n, NULL);
}
}
if (_proxy != NULL) {
g_object_unref (_proxy);
_proxy = NULL;
}
g_free (_snap_name);
_snap_name = NULL;
g_free (_snap_app);
_snap_app = NULL;
g_free (_flatpak_app);
_flatpak_app = NULL;
_initted = FALSE;
}
/**
* notify_is_initted:
*
* Gets whether or not libnotify is initialized.
*
* Returns: %TRUE if libnotify is initialized, or %FALSE otherwise.
*/
gboolean gboolean
notify_is_initted (void) notify_is_initted (void)
{ {
return _initted; return _initted;
}
GDBusProxy *
_get_portal_proxy (GError **error)
{
GError *local_error = NULL;
GDBusProxy *proxy;
GVariant *res;
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
NOTIFY_PORTAL_DBUS_NAME,
NOTIFY_PORTAL_DBUS_CORE_OBJECT,
NOTIFY_PORTAL_DBUS_CORE_INTERFACE,
NULL,
&local_error);
if (proxy == NULL) {
g_debug ("Failed to get portal proxy: %s", local_error->message);
g_clear_error (&local_error);
return NULL;
}
res = g_dbus_proxy_get_cached_property (proxy, "version");
if (!res) {
g_object_unref (proxy);
return NULL;
}
_portal_version = g_variant_get_uint32 (res);
g_assert (_portal_version > 0);
g_warning ("Running in confined mode, using Portal notifications. "
"Some features and hints won't be supported");
g_variant_unref (res);
return proxy;
}
/*
* _notify_get_proxy:
* @error: (allow-none): a location to store a #GError, or %NULL
*
* Synchronously creates the #GDBusProxy for the notification service,
* and caches the result.
*
* Returns: the #GDBusProxy for the notification service, or %NULL on error
*/
GDBusProxy *
_notify_get_proxy (GError **error)
{
if (_proxy != NULL)
return _proxy;
if (_notify_is_running_in_sandbox ()) {
_proxy = _get_portal_proxy (error);
if (_proxy != NULL) {
goto out;
}
}
_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
NULL,
NOTIFY_DBUS_NAME,
NOTIFY_DBUS_CORE_OBJECT,
NOTIFY_DBUS_CORE_INTERFACE,
NULL,
error);
out:
if (_proxy == NULL) {
return NULL;
}
if (!_notify_update_spec_version (error)) {
g_object_unref (_proxy);
_proxy = NULL;
return NULL;
}
g_object_add_weak_pointer (G_OBJECT (_proxy), (gpointer *) &_proxy);
return _proxy;
}
/**
* notify_get_server_caps:
*
* Synchronously queries the server for its capabilities and returns them in a #GList.
*
* Returns: (transfer full) (element-type utf8): a #GList of server capability strings. Free
* the list elements with g_free() and the list itself with g_list_free().
*/
GList *
notify_get_server_caps (void)
{
GDBusProxy *proxy;
GVariant *result;
char **cap, **caps;
GList *list = NULL;
proxy = _notify_get_proxy (NULL);
if (proxy == NULL) {
g_warning ("Failed to connect to proxy");
return NULL;
}
if (_notify_uses_portal_notifications ()) {
list = g_list_prepend (list, g_strdup ("actions"));
list = g_list_prepend (list, g_strdup ("body"));
list = g_list_prepend (list, g_strdup ("body-images"));
list = g_list_prepend (list, g_strdup ("icon-static"));
return list;
}
result = g_dbus_proxy_call_sync (proxy,
"GetCapabilities",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1 /* FIXME shorter timeout? */,
NULL,
NULL);
if (result == NULL) {
return NULL;
}
if (!g_variant_is_of_type (result, G_VARIANT_TYPE ("(as)"))) {
g_variant_unref (result);
return NULL;
}
g_variant_get (result, "(^as)", &caps);
for (cap = caps; *cap != NULL; cap++) {
list = g_list_prepend (list, *cap);
}
g_free (caps);
g_variant_unref (result);
return g_list_reverse (list);
}
/**
* notify_get_server_info:
* @ret_name: (out) (allow-none) (transfer full): a location to store the server name, or %NULL
* @ret_vendor: (out) (allow-none) (transfer full): a location to store the server vendor, or %NULL
* @ret_version: (out) (allow-none) (transfer full): a location to store the server version, or %NULL
* @ret_spec_version: (out) (allow-none) (transfer full): a location to store the version the service is compliant with, or %NULL
*
* Synchronously queries the server for its information, specifically, the name, vendor,
* server version, and the version of the notifications specification that it
* is compliant with.
*
* Returns: %TRUE if successful, and the variables passed will be set, %FALSE
* on error. The returned strings must be freed with g_free
*/
gboolean
notify_get_server_info (char **ret_name,
char **ret_vendor,
char **ret_version,
char **ret_spec_version)
{
return _notify_get_server_info (ret_name, ret_vendor, ret_version, ret_spec_version, NULL);
}
void
_notify_cache_add_notification (NotifyNotification *n)
{
_active_notifications = g_list_prepend (_active_notifications, n);
}
void
_notify_cache_remove_notification (NotifyNotification *n)
{
_active_notifications = g_list_remove (_active_notifications, n);
} }

View File

@ -1,8 +1,7 @@
/* -*- mode: c-mode; tab-width: 4; indent-tabs-mode: t; -*- */ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
/**
* @file libnotify/notify.h Notifications library
* *
* @Copyright (C) 2004 Christian Hammond * Copyright (C) 2004-2006 Christian Hammond
* Copyright (C) 2010 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,51 +17,33 @@
* License along with this library; if not, write to the * License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*
* @todo We talk about URIs, but they are actually file paths not URIs
* @todo Un-glibify?
*/ */
#ifndef _LIBNOTIFY_NOTIFY_H_ #ifndef _LIBNOTIFY_NOTIFY_H_
#define _LIBNOTIFY_NOTIFY_H_ #define _LIBNOTIFY_NOTIFY_H_
#include <glib.h> #include <glib.h>
#include <time.h>
#include "notifycommon.h" #include <libnotify/notification.h>
#include "notifynotification.h" #include <libnotify/notify-enum-types.h>
#include <libnotify/notify-features.h>
/**************************************************************************/ G_BEGIN_DECLS
/** @name libnotify Base API */
/**************************************************************************/
/*@{*/
/** gboolean notify_init (const char *app_name);
* Initializes the notifications library. void notify_uninit (void);
* gboolean notify_is_initted (void);
* @param app_name The application name.
*
* @return TRUE if the library initialized properly and a connection to a
* notification server was made.
*/
gboolean notify_init(const char *app_name);
/** const char *notify_get_app_name (void);
* Uninitializes the notifications library. void notify_set_app_name (const char *app_name);
*
* This will be automatically called on exit unless previously called.
*/
void notify_uninit(void);
/** GList *notify_get_server_caps (void);
* Returns whether or not the notification library is initialized.
*
* @return TRUE if the library is initialized, or FALSE.
*/
gboolean notify_is_initted(void);
const gchar *_notify_get_app_name(void); gboolean notify_get_server_info (char **ret_name,
/*@}*/ char **ret_vendor,
char **ret_version,
char **ret_spec_version);
G_END_DECLS
#endif /* _LIBNOTIFY_NOTIFY_H_ */ #endif /* _LIBNOTIFY_NOTIFY_H_ */

View File

@ -1,23 +0,0 @@
#ifndef _LIBNOTIFY_NOTIFY_COMMON_H_
#define _LIBNOTIFY_NOTIFY_COMMON_H_
#include <glib.h>
#define NOTIFY_TIMEOUT_DEFAULT -1
#define NOTIFY_TIMEOUT_NEVER 0
#define NOTIFY_DBUS_NAME "org.freedesktop.Notifications"
#define NOTIFY_DBUS_CORE_INTERFACE "org.freedesktop.Notifications"
#define NOTIFY_DBUS_CORE_OBJECT "/org/freedesktop/Notifications"
/**
* Notification urgency levels.
*/
typedef enum
{
NOTIFY_URGENCY_LOW, /**< Low urgency. */
NOTIFY_URGENCY_NORMAL, /**< Normal urgency. */
NOTIFY_URGENCY_CRITICAL, /**< Critical urgency. */
} NotifyUrgency;
#endif /* _LIBNOTIFY_NOTIFY_H_ */

View File

@ -1,56 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with main.c; if not, write to:
* The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "notifymarshal.h"
void
_notify_marshal_VOID__UINT_STRING (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__UINT_STRING) (gpointer data1,
gpointer arg_1,
gpointer arg_2,
gpointer data2);
register GMarshalFunc_VOID__UINT_STRING callback;
register GCClosure *cc = (GCClosure*) closure;
register gpointer data1, data2;
g_return_if_fail (n_param_values == 3);
if (G_CCLOSURE_SWAP_DATA (closure))
{
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
}
else
{
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback = (GMarshalFunc_VOID__UINT_STRING) (marshal_data ? marshal_data : cc->callback);
callback (data1,
g_value_get_uint (param_values + 1),
g_value_get_string (param_values + 2),
data2);
}

View File

@ -1,36 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with main.c; if not, write to:
* The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __notify_marshal_MARSHAL_H__
#define __notify_marshal_MARSHAL_H__
#include <glib-object.h>
G_BEGIN_DECLS
void
_notify_marshal_VOID__UINT_STRING (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
G_END_DECLS
#endif

View File

@ -1,936 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with main.c; if not, write to:
* The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include "notify.h"
#include "notifynotification.h"
#include "notifymarshal.h"
static void notify_notification_class_init (NotifyNotificationClass * klass);
static void notify_notification_init (NotifyNotification * sp);
static void notify_notification_finalize (GObject * object);
static void _close_signal_handler (DBusGProxy *proxy,
guint32 id,
NotifyNotification *notification);
static void _action_signal_handler (DBusGProxy *proxy,
guint32 id,
gchar *action,
NotifyNotification *notification);
struct NotifyNotificationPrivate
{
guint32 id;
gchar *summary;
gchar *message;
/*NULL to use icon data
anything else to have server lookup icon */
gchar *icon_name;
/*-1 = use server default
0 = never timeout
>0 = Number of milliseconds before we timeout
*/
gint timeout;
GSList *actions;
GHashTable *action_map;
GHashTable *hints;
GtkWidget *attached_widget;
gint widget_old_x;
gint widget_old_y;
gpointer user_data;
GDestroyNotify user_data_free_func;
gboolean updates_pending;
DBusGProxy *proxy;
};
typedef enum
{
SIGNAL_TYPE_CLOSED,
LAST_SIGNAL
} NotifyNotificationSignalType;
typedef struct
{
NotifyNotification *object;
} NotifyNotificationSignal;
static guint notify_notification_signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class = NULL;
GType
notify_notification_get_type ()
{
static GType type = 0;
if (type == 0)
{
static const GTypeInfo our_info = {
sizeof (NotifyNotificationClass),
NULL,
NULL,
(GClassInitFunc) notify_notification_class_init,
NULL,
NULL,
sizeof (NotifyNotification),
0,
(GInstanceInitFunc) notify_notification_init,
};
type = g_type_register_static (G_TYPE_OBJECT,
"NotifyNotification", &our_info, 0);
}
return type;
}
static void
notify_notification_class_init (NotifyNotificationClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = notify_notification_finalize;
/* Create signals here: */
notify_notification_signals[SIGNAL_TYPE_CLOSED] =
g_signal_new ("closed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NotifyNotificationClass, closed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
dbus_g_object_register_marshaller (_notify_marshal_VOID__UINT_STRING,
G_TYPE_NONE,
G_TYPE_UINT,
G_TYPE_STRING,
G_TYPE_INVALID);
}
static void
_g_value_free (GValue * value)
{
g_value_unset (value);
g_free (value);
}
static void
notify_notification_init (NotifyNotification * obj)
{
obj->priv = g_new0 (NotifyNotificationPrivate, 1);
obj->priv->id = 0;
obj->priv->summary = NULL;
obj->priv->message = NULL;
obj->priv->icon_name = NULL;
obj->priv->timeout = NOTIFY_TIMEOUT_DEFAULT;
obj->priv->actions = NULL;
obj->priv->hints = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
(GDestroyNotify) _g_value_free);
obj->priv->action_map = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
NULL);
obj->priv->attached_widget = NULL;
obj->priv->user_data = NULL;
obj->priv->user_data_free_func = NULL;
obj->priv->updates_pending = FALSE;
obj->priv->widget_old_x = 0;
obj->priv->widget_old_y = 0;
obj->priv->proxy = NULL;
}
static void
notify_notification_finalize (GObject * object)
{
NotifyNotification *obj;
NotifyNotificationPrivate *priv;
obj = NOTIFY_NOTIFICATION (object);
priv = obj->priv;
g_free (priv->summary);
g_free (priv->message);
g_free (priv->icon_name);
if (priv->actions != NULL)
{
g_slist_foreach (priv->actions, (GFunc) g_free, NULL);
g_slist_free (priv->actions);
}
if (priv->action_map != NULL)
g_hash_table_destroy (priv->action_map);
if (priv->hints != NULL)
g_hash_table_destroy (priv->hints);
if (priv->attached_widget != NULL)
gtk_widget_unref (priv->attached_widget);
if (priv->user_data_free_func != NULL)
priv->user_data_free_func (priv->user_data);
dbus_g_proxy_disconnect_signal (priv->proxy, "NotificationClosed",
(GCallback) _close_signal_handler,
object);
dbus_g_proxy_disconnect_signal (priv->proxy, "ActionInvoked",
(GCallback) _action_signal_handler,
object);
g_free (obj->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
_notify_notification_update_applet_hints (NotifyNotification * n)
{
NotifyNotificationPrivate *priv;
gboolean update_pending;
update_pending = FALSE;
priv = n->priv;
if (priv->attached_widget != NULL)
{
gint x, y, h, w;
GtkWidget *widget;
GtkRequisition requisition;
widget = priv->attached_widget;
gtk_widget_size_request (widget, &requisition);
w = requisition.width;
h = requisition.height;
gdk_window_get_origin (widget->window, &x, &y);
if (GTK_WIDGET_NO_WINDOW (widget))
{
x += widget->allocation.x;
y += widget->allocation.y;
}
x += widget->allocation.width / 2;
y += widget->allocation.height / 2;
if (x != priv->widget_old_x)
{
notify_notification_set_hint_int32 (n, "x", x);
priv->widget_old_x = x;
update_pending = TRUE;
}
if (y != priv->widget_old_y)
{
notify_notification_set_hint_int32 (n, "y", y);
priv->widget_old_y = y;
update_pending = TRUE;
}
}
return update_pending;
}
#if 0
/* This is left here just incase we revisit autoupdating
One thought would be to check for updates every time the icon
is redrawn but we still have to deal with the race conditions
that could occure between the server and the client so we will
leave this alone for now.
*/
static gboolean
_idle_check_updates (void *user_data)
{
NotifyNotification *n;
NotifyNotificationPrivate *priv;
n = NOTIFY_NOTIFICATION (user_data);
priv = n->priv;
if (priv->is_visible)
{
priv->updates_pending = _notify_notification_update_applet_hints (n);
if (priv->updates_pending)
{
/* Try again if we fail on next idle */
priv->updates_pending = !notify_notification_show (n, NULL);
}
}
else
{
priv->updates_pending = FALSE;
}
n = NOTIFY_NOTIFICATION (user_data);
priv = n->priv;
return TRUE;
}
#endif
GdkFilterReturn
_catch (GdkXEvent * xevent, GdkEvent * event, gpointer data)
{
static int i = 1;
printf ("here, %i\n", i);
i++;
return GDK_FILTER_CONTINUE;
}
NotifyNotification *
notify_notification_new (const gchar * summary,
const gchar * message,
const gchar * icon, GtkWidget * attach)
{
NotifyNotification *obj;
g_assert (summary != NULL);
g_assert (message != NULL);
obj = NOTIFY_NOTIFICATION (g_object_new (NOTIFY_TYPE_NOTIFICATION, NULL));
obj->priv->summary = g_strdup (summary);
obj->priv->message = g_strdup (message);
obj->priv->icon_name = g_strdup (icon);
if (attach != NULL)
{
gtk_widget_ref (attach);
obj->priv->attached_widget = attach;
}
return obj;
}
gboolean
notify_notification_update (NotifyNotification * notification,
const gchar * summary,
const gchar * message, const gchar * icon)
{
NotifyNotificationPrivate *priv;
priv = notification->priv;
g_free (priv->summary);
g_free (priv->message);
g_free (priv->icon_name);
priv->summary = g_strdup (summary);
priv->message = g_strdup (message);
priv->icon_name = g_strdup (icon);
priv->updates_pending = TRUE;
/*TODO: return false on OOM */
return TRUE;
}
void
notify_notification_attach_to_widget (NotifyNotification * notification,
GtkWidget * attach)
{
NotifyNotificationPrivate *priv;
priv = notification->priv;
if (priv->attached_widget != NULL)
gtk_widget_unref (priv->attached_widget);
if (attach != NULL)
priv->attached_widget = gtk_widget_ref (attach);
else
priv->attached_widget = NULL;
}
gboolean
notify_notification_set_user_data (NotifyNotification * notification,
void *user_data, GFreeFunc free_func)
{
NotifyNotificationPrivate *priv;
priv = notification->priv;
if (priv->user_data)
if (priv->user_data_free_func)
priv->user_data_free_func (priv->user_data);
priv->user_data = user_data;
priv->user_data_free_func = priv->user_data;
/* TODO: return FALSE on OOM */
return TRUE;
}
static void
_close_signal_handler (DBusGProxy *proxy,
guint32 id,
NotifyNotification *notification)
{
printf ("Got the NotificationClosed signal (id = %i, notification->id = %i)\n"
, id, notification->priv->id);
if (id == notification->priv->id)
g_signal_emit (notification,
notify_notification_signals[SIGNAL_TYPE_CLOSED],
0);
}
static void
_action_signal_handler (DBusGProxy *proxy,
guint32 id,
gchar *action,
NotifyNotification *notification)
{
g_assert (NOTIFY_IS_NOTIFICATION (notification));
if (id == notification->priv->id)
{
NotifyActionCallback callback;
callback = (NotifyActionCallback) g_hash_table_lookup (notification->priv->action_map,
action);
if (callback == NULL)
g_warning ("Recieved unknown action %s", action);
else
callback (notification, action);
}
}
static gchar **
_gslist_to_string_array (GSList *list)
{
GSList *element;
GArray *a;
gsize len;
gchar **result;
len = g_slist_length (list);
a = g_array_sized_new (TRUE, FALSE, sizeof (gchar *), len);
element = list;
while (element != NULL)
{
g_array_append_val (a, element->data);
element = g_slist_next (element);
}
result = (gchar **)g_array_free (a, FALSE);
return result;
}
static gboolean
_notify_notification_show_internal (NotifyNotification *notification,
GError **error,
gboolean ignore_reply)
{
NotifyNotificationPrivate *priv;
GError *tmp_error;
gchar **action_array;
int i;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = notification->priv;
tmp_error = NULL;
if (priv->proxy == NULL)
{
DBusGConnection *bus;
bus = dbus_g_bus_get (DBUS_BUS_SESSION, &tmp_error);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return FALSE;
}
priv->proxy = dbus_g_proxy_new_for_name (bus,
NOTIFY_DBUS_NAME,
NOTIFY_DBUS_CORE_OBJECT,
NOTIFY_DBUS_CORE_INTERFACE);
dbus_g_proxy_add_signal (priv->proxy, "NotificationClosed",
G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->proxy, "NotificationClosed",
(GCallback) _close_signal_handler,
notification, NULL);
dbus_g_proxy_add_signal (priv->proxy, "ActionInvoked",
G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->proxy, "ActionInvoked",
(GCallback) _action_signal_handler,
notification, NULL);
dbus_g_connection_unref (bus);
}
/*if attached to a widget modify x and y in hints */
_notify_notification_update_applet_hints (notification);
action_array = _gslist_to_string_array (priv->actions);
/*TODO: make this nonblocking */
if (!ignore_reply)
dbus_g_proxy_call (priv->proxy, "Notify", &tmp_error,
G_TYPE_STRING, _notify_get_app_name (),
G_TYPE_STRING,
(priv->icon_name != NULL) ? priv->icon_name : "",
G_TYPE_UINT, priv->id, G_TYPE_STRING, priv->summary,
G_TYPE_STRING, priv->message,
G_TYPE_STRV,
action_array, dbus_g_type_get_map ("GHashTable",
G_TYPE_STRING,
G_TYPE_VALUE),
priv->hints, G_TYPE_INT, priv->timeout, G_TYPE_INVALID,
G_TYPE_UINT, &priv->id, G_TYPE_INVALID);
else
dbus_g_proxy_call_no_reply (priv->proxy, "Notify",
G_TYPE_STRING, _notify_get_app_name (),
G_TYPE_STRING,
(priv->icon_name != NULL) ? priv->icon_name : "",
G_TYPE_UINT, priv->id, G_TYPE_STRING, priv->summary,
G_TYPE_STRING, priv->message,
G_TYPE_STRV,
action_array, dbus_g_type_get_map ("GHashTable",
G_TYPE_STRING,
G_TYPE_VALUE),
priv->hints, G_TYPE_INT, priv->timeout, G_TYPE_INVALID);
/*don't free the elements because they are owned by priv->actions */
g_free (action_array);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return FALSE;
}
return TRUE;
}
gboolean
notify_notification_show (NotifyNotification *notification, GError **error)
{
return _notify_notification_show_internal (notification, error, FALSE);
}
gboolean
notify_notification_show_and_forget (NotifyNotification *notification, GError **error)
{
gboolean result;
result = _notify_notification_show_internal (notification, error, TRUE);
g_object_unref (G_OBJECT (notification));
return result;
}
void
notify_notification_set_timeout (NotifyNotification * notification,
gint timeout)
{
notification->priv->timeout = timeout;
}
gboolean
notify_notification_set_category (NotifyNotification * notification,
const char *category)
{
return notify_notification_set_hint_string (notification,
"category", category);
}
gboolean
notify_notification_set_urgency (NotifyNotification * notification,
NotifyUrgency l)
{
return notify_notification_set_hint_byte (notification,
"urgency", (guchar) l);
}
static gboolean
_gvalue_array_append_int (GValueArray * array, gint i)
{
GValue *value;
value = g_new0 (GValue, 1);
if (!value)
return FALSE;
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, i);
g_value_array_append (array, value);
return TRUE;
}
static gboolean
_gvalue_array_append_bool (GValueArray * array, gboolean b)
{
GValue *value;
value = g_new0 (GValue, 1);
if (!value)
return FALSE;
g_value_init (value, G_TYPE_BOOLEAN);
g_value_set_boolean (value, b);
g_value_array_append (array, value);
return TRUE;
}
static gboolean
_gvalue_array_append_byte_array (GValueArray * array,
guchar * bytes, gsize len)
{
GArray *byte_array;
GValue *value;
byte_array = g_array_sized_new (FALSE, FALSE, sizeof (guchar), len);
if (!byte_array)
return FALSE;
byte_array = g_array_append_vals (byte_array, bytes, len);
value = g_new0 (GValue, 1);
if (!value)
{
g_array_free (byte_array, TRUE);
return FALSE;
}
g_value_init (value, dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR));
g_value_set_boxed_take_ownership (value, byte_array);
g_value_array_append (array, value);
return TRUE;
}
gboolean
notify_notification_set_icon_data_from_pixbuf (NotifyNotification *
notification, GdkPixbuf * icon)
{
gint width;
gint height;
gint rowstride;
gboolean alpha;
gint bits_per_sample;
gint n_channels;
guchar *image;
gsize image_len;
gchar *key_dup;
GValueArray *image_struct;
GValue *value;
NotifyNotificationPrivate *priv;
priv = notification->priv;
width = gdk_pixbuf_get_width (icon);
height = gdk_pixbuf_get_height (icon);
rowstride = gdk_pixbuf_get_rowstride (icon);
n_channels = gdk_pixbuf_get_n_channels (icon);
bits_per_sample = gdk_pixbuf_get_bits_per_sample (icon);
alpha = gdk_pixbuf_get_has_alpha (icon);
image_len =
(height - 1) * rowstride +
width * ((n_channels * bits_per_sample + 7) / 8);
image = gdk_pixbuf_get_pixels (icon);
image_struct = g_value_array_new (8);
if (!image_struct)
goto fail;
_gvalue_array_append_int (image_struct, width);
_gvalue_array_append_int (image_struct, height);
_gvalue_array_append_int (image_struct, rowstride);
_gvalue_array_append_bool (image_struct, alpha);
_gvalue_array_append_int (image_struct, bits_per_sample);
_gvalue_array_append_int (image_struct, n_channels);
_gvalue_array_append_byte_array (image_struct, image, image_len);
value = g_new0 (GValue, 1);
if (!value)
goto fail;
g_value_init (value, G_TYPE_VALUE_ARRAY);
g_value_set_boxed (value, image_struct);
key_dup = g_strdup ("icon_data");
if (!key_dup)
goto fail;
g_hash_table_insert (priv->hints, key_dup, value);
return TRUE;
fail:
if (image_struct != NULL)
g_value_array_free (image_struct);
return FALSE;
}
gboolean
notify_notification_set_hint_int32 (NotifyNotification * notification,
const gchar * key, gint value)
{
NotifyNotificationPrivate *priv;
GValue *hint_value;
gchar *key_dup;
priv = notification->priv;
hint_value = g_new0 (GValue, 1);
g_value_init (hint_value, G_TYPE_INT);
g_value_set_int (hint_value, value);
key_dup = g_strdup (key);
g_hash_table_insert (priv->hints, key_dup, hint_value);
/* TODO: return FALSE on OOM */
return TRUE;
}
gboolean
notify_notification_set_hint_double (NotifyNotification * notification,
const gchar * key, gdouble value)
{
NotifyNotificationPrivate *priv;
GValue *hint_value;
gchar *key_dup;
priv = notification->priv;
hint_value = g_new0 (GValue, 1);
g_value_init (hint_value, G_TYPE_FLOAT);
g_value_set_float (hint_value, value);
key_dup = g_strdup (key);
g_hash_table_insert (priv->hints, key_dup, hint_value);
/* TODO: return FALSE on OOM */
return TRUE;
}
gboolean
notify_notification_set_hint_byte (NotifyNotification * notification,
const gchar * key, guchar value)
{
NotifyNotificationPrivate *priv;
GValue *hint_value;
gchar *key_dup;
priv = notification->priv;
hint_value = g_new0 (GValue, 1);
g_value_init (hint_value, G_TYPE_UCHAR);
g_value_set_uchar (hint_value, value);
key_dup = g_strdup (key);
g_hash_table_insert (priv->hints, key_dup, hint_value);
/* TODO: return FALSE on OOM */
return TRUE;
}
gboolean
notify_notification_set_hint_byte_array (NotifyNotification * notification,
const gchar * key,
const guchar * value, gsize len)
{
NotifyNotificationPrivate *priv;
GValue *hint_value;
gchar *key_dup;
GArray *byte_array;
priv = notification->priv;
byte_array = g_array_sized_new (FALSE, FALSE, sizeof (guchar), len);
byte_array = g_array_append_vals (byte_array, value, len);
hint_value = g_new0 (GValue, 1);
g_value_init (hint_value,
dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR));
g_value_set_boxed_take_ownership (hint_value, byte_array);
key_dup = g_strdup (key);
g_hash_table_insert (priv->hints, key_dup, hint_value);
/* TODO: return FALSE on OOM */
return TRUE;
}
gboolean
notify_notification_set_hint_string (NotifyNotification * notification,
const gchar * key, const gchar * value)
{
NotifyNotificationPrivate *priv;
GValue *hint_value;
gchar *key_dup;
priv = notification->priv;
hint_value = g_new0 (GValue, 1);
g_value_init (hint_value, G_TYPE_STRING);
g_value_set_string (hint_value, value);
key_dup = g_strdup (key);
g_hash_table_insert (priv->hints, key_dup, hint_value);
/* TODO: return FALSE on OOM */
return TRUE;
}
static gboolean
_remove_all (void)
{
return TRUE;
}
void
notify_notification_clear_hints (NotifyNotification *notification)
{
g_hash_table_foreach_remove (notification->priv->hints,
(GHRFunc) _remove_all, NULL);
}
void
notify_notification_clear_actions (NotifyNotification *notification)
{
g_hash_table_foreach_remove (notification->priv->action_map, (GHRFunc) _remove_all, NULL);
if (notification->priv->actions != NULL)
{
g_slist_foreach (notification->priv->actions, (GFunc) g_free, NULL);
g_slist_free (notification->priv->actions);
}
notification->priv->actions = NULL;
}
gboolean
notify_notification_add_action (NotifyNotification *notification,
const char *action,
const char *label,
NotifyActionCallback callback)
{
NotifyNotificationPrivate *priv;
priv = notification->priv;
priv->actions = g_slist_append (priv->actions, g_strdup (action));
priv->actions = g_slist_append (priv->actions, g_strdup (label));
g_hash_table_insert (priv->action_map, g_strdup (action), callback);
return FALSE;
}
gboolean
notify_notification_close (NotifyNotification * notification, GError ** error)
{
NotifyNotificationPrivate *priv;
GError *tmp_error;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = notification->priv;
tmp_error = NULL;
if (priv->proxy == NULL)
{
DBusGConnection *bus;
bus = dbus_g_bus_get (DBUS_BUS_SESSION, &tmp_error);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return FALSE;
}
priv->proxy = dbus_g_proxy_new_for_name (bus,
NOTIFY_DBUS_NAME,
NOTIFY_DBUS_CORE_OBJECT,
NOTIFY_DBUS_CORE_INTERFACE);
dbus_g_connection_unref (bus);
}
dbus_g_proxy_call (priv->proxy, "CloseNotification", &tmp_error,
G_TYPE_UINT, priv->id, G_TYPE_INVALID, G_TYPE_INVALID);
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
return FALSE;
}
return TRUE;
}

View File

@ -1,125 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with main.c; if not, write to:
* The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef NOTIFY_NOTIFICATION_H
#define NOTIFY_NOTIFICATION_H
#include "config.h"
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "notifycommon.h"
G_BEGIN_DECLS
#define NOTIFY_TYPE_NOTIFICATION (notify_notification_get_type ())
#define NOTIFY_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotification))
#define NOTIFY_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
#define NOTIFY_IS_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_IS_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_NOTIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
typedef struct NotifyNotificationPrivate NotifyNotificationPrivate;
typedef struct {
GObject parent;
NotifyNotificationPrivate *priv;
} NotifyNotification;
typedef struct {
GObjectClass parent_class;
/* Add Signal Functions Here */
void (*closed) (void);
} NotifyNotificationClass;
typedef void (*NotifyActionCallback )(NotifyNotification *, gchar *);
GType notify_notification_get_type();
NotifyNotification *notify_notification_new (const gchar *summary,
const gchar *message,
const gchar *icon,
GtkWidget *attach);
gboolean notify_notification_update (NotifyNotification *notification,
const gchar *summary,
const gchar *message,
const gchar *icon);
void notify_notification_attach_to_widget (NotifyNotification *notification,
GtkWidget *attach);
gboolean notify_notification_set_user_data (NotifyNotification *notification,
void *user_data,
GFreeFunc free_func);
gboolean notify_notification_show (NotifyNotification *notification,
GError **error);
gboolean notify_notification_show_and_forget (NotifyNotification *notification,
GError **error);
void notify_notification_set_timeout (NotifyNotification *notification,
gint timeout);
gboolean notify_notification_set_category (NotifyNotification *notification,
const char *category);
gboolean notify_notification_set_urgency (NotifyNotification *notification,
NotifyUrgency l);
gboolean notify_notification_set_icon_data_from_pixbuf (NotifyNotification *notification,
GdkPixbuf *icon);
gboolean notify_notification_set_hint_int32 (NotifyNotification *notification,
const gchar *key,
gint value);
gboolean notify_notification_set_hint_double (NotifyNotification *notification,
const gchar *key,
gdouble value);
gboolean notify_notification_set_hint_string (NotifyNotification *notification,
const gchar *key,
const gchar *value);
gboolean notify_notification_set_hint_byte (NotifyNotification *notification,
const gchar *key,
guchar value);
gboolean notify_notification_set_hint_byte_array (
NotifyNotification *notification,
const gchar *key,
const guchar *value,
gsize len);
void notify_notification_clear_hints (NotifyNotification *notification);
gboolean notify_notification_add_action (NotifyNotification *notification,
const char *action,
const char *label,
NotifyActionCallback callback);
void notify_notification_clear_actions (NotifyNotification *notification);
gboolean notify_notification_close (NotifyNotification *notification,
GError **error);
NotifyNotification *notify_notification_ref (NotifyNotification *notification);
void notify_notification_unref (NotifyNotification *notification);
#endif /* NOTIFY_NOTIFICATION_H */

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/org/freedesktop/Notification">
<interface name="org.freedesktop.NotificationListener">
</interface>
</node>

85
meson.build Normal file
View File

@ -0,0 +1,85 @@
project('libnotify',
'c',
version: '0.8.1',
meson_version: '>= 0.47.0')
gnome = import('gnome')
pkgconfig = import('pkgconfig')
cc = meson.get_compiler('c')
################################################################
# libtool versioning
################################################################
#
# +1 : 0 : +1 == new interface that does not break old one.
# +1 : 0 : 0 == removed an interface. Breaks old apps.
# ? : +1 : ? == internal changes that doesn't break anything.
#
# CURRENT : REVISION : AGE
#
LT_CURRENT=4
LT_REVISION=0
LT_AGE=0
API_VERSION = 7
VERSION_ARRAY = meson.project_version().split('.')
# Minor version is hardcoded until we have a real API break
MODULE_VERSION = '@0@.@1@'.format(VERSION_ARRAY[0], API_VERSION)
LIBNAME = meson.project_name().split('lib')[1]
default_includes = include_directories('.')
prefix = get_option('prefix')
includedir = join_paths(prefix, get_option('includedir'))
docdir = join_paths(prefix, get_option('datadir'), 'doc', meson.project_name())
man1dir = join_paths(prefix, get_option('mandir'), 'man1')
libnotify_deps = []
extra_deps = []
glib_req_version = '>= 2.38.0'
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0')
glib_dep = dependency('glib-2.0', version: glib_req_version)
gio_dep = dependency('gio-2.0', version: glib_req_version)
gtk_dep = dependency('gtk+-3.0', version: '>= 2.90', required: get_option('tests'))
libnotify_deps = [gdk_pixbuf_dep, gio_dep, glib_dep]
tests_deps = [gtk_dep]
conf = configuration_data()
conf.set_quoted('VERSION', meson.project_version())
configure_file(input: 'config.h.meson',
output : 'config.h',
configuration : conf)
if get_option('man')
xsltproc = find_program('xsltproc', required: true)
stylesheet = 'http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl'
xsltproc_command = [
xsltproc,
'--nonet',
'--stringparam', 'man.output.quietly', '1',
'--stringparam', 'funcsynopsis.style', 'ansi',
'--stringparam', 'man.th.extra1.suppress', '1',
'-o', '@OUTPUT@',
stylesheet,
'@INPUT@',
]
testrun = run_command(xsltproc, '--nonet', stylesheet, check: false)
if testrun.returncode() != 0
error('DocBook stylesheet for generating man pages not found, you need to install docbook-xsl-ns or similar package.')
endif
endif
subdir('libnotify')
subdir('tools')
subdir('docs')
if get_option('tests')
subdir('tests')
endif

20
meson_options.txt Normal file
View File

@ -0,0 +1,20 @@
option('tests',
type: 'boolean',
value: true,
description: 'Build tests')
option('introspection',
type: 'feature',
value: 'enabled',
description: 'Enable GObject introspection')
option('man',
type: 'boolean',
value: true,
description: 'Enable generating the manual page (depends on xsltproc)')
option('gtk_doc',
type: 'boolean',
value: true,
description: 'Enable generating the API reference (depends on GTK-Doc)')
option('docbook_docs',
type: 'feature',
value: 'auto',
description: 'Build DocBook documentation (requires xmlto)')

View File

@ -1,50 +0,0 @@
if HAVE_GDK
gdk_tests = \
test-xy-stress
test_xy_stress_SOURCES = test-xy-stress.c
else
gdk_tests =
endif
noinst_PROGRAMS = \
test-replace \
test-replace-widget \
test-default-action \
test-multi-actions \
test-image \
test-basic \
test-error \
test-markup \
test-xy \
$(gdk_tests)
common_ldflags = \
$(top_builddir)/libnotify/libnotify.la \
$(PACKAGE_LIBS) \
$(GDK_LIBS)
test_replace_SOURCES = test-replace.c
test_replace_LDADD = $(common_ldflags)
test_replace_widget_SOURCES = test-replace-widget.c
test_replace_widget_LDADD = $(common_ldflags)
test_default_action_SOURCES = test-default-action.c
test_default_action_LDADD = $(common_ldflags)
test_multi_actions_SOURCES = test-multi-actions.c
test_multi_actions_LDADD = $(common_ldflags)
test_image_SOURCES = test-image.c
test_image_LDADD = $(common_ldflags)
test_basic_SOURCES = test-basic.c
test_basic_LDADD = $(common_ldflags)
test_error_SOURCES = test-error.c
test_error_LDADD = $(common_ldflags)
test_markup_SOURCES = test-markup.c
test_markup_LDADD = $(common_ldflags)
test_xy_SOURCES = test-xy.c
test_xy_LDADD = $(common_ldflags)
test_xy_stress_LDADD = $(common_ldflags)
INCLUDES = $(PACKAGE_CFLAGS) $(GDK_CFLAGS)

28
tests/meson.build Normal file
View File

@ -0,0 +1,28 @@
test_progs = [
'replace',
'replace-widget',
'server-info',
'default-action',
'multi-actions',
'action-icons',
'image',
'basic',
'error',
'markup',
'persistence',
'removal',
'resident',
'rtl',
'size-changes',
'transient',
'urgency',
'xy',
'xy-actions',
'xy-stress',
]
foreach tprog: test_progs
executable('test-' + tprog, ['test-' + tprog + '.c'],
dependencies: [libnotify_dep, tests_deps],
)
endforeach

133
tests/test-action-icons.c Normal file
View File

@ -0,0 +1,133 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
static GMainLoop *loop;
static void
previous_callback (NotifyNotification *n,
const char *action)
{
g_assert (action != NULL);
g_assert (strcmp (action, "media-skip-backward") == 0);
printf ("You clicked Previous\n");
notify_notification_close (n, NULL);
g_main_loop_quit (loop);
}
static void
pause_callback (NotifyNotification *n,
const char *action)
{
g_assert (action != NULL);
g_assert (strcmp (action, "media-playback-pause") == 0);
printf ("You clicked Pause\n");
notify_notification_close (n, NULL);
g_main_loop_quit (loop);
}
static void
next_callback (NotifyNotification *n,
const char *action)
{
g_assert (action != NULL);
g_assert (strcmp (action, "media-skip-forward") == 0);
printf ("You clicked Next\n");
notify_notification_close (n, NULL);
g_main_loop_quit (loop);
}
int
main (int argc, char **argv)
{
NotifyNotification *n;
if (!notify_init ("Action Icon Test"))
exit (1);
loop = g_main_loop_new (NULL, FALSE);
n = notify_notification_new ("Music Player",
"Some solid funk",
NULL);
notify_notification_set_hint (n, "action-icons", g_variant_new_boolean (TRUE));
notify_notification_add_action (n,
"media-skip-backward",
"Previous",
(NotifyActionCallback) previous_callback,
NULL,
NULL);
notify_notification_add_action (n,
"media-playback-pause",
"Pause",
(NotifyActionCallback) pause_callback,
NULL,
NULL);
notify_notification_add_action (n,
"media-skip-forward",
"Next",
(NotifyActionCallback) next_callback,
NULL,
NULL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
n = notify_notification_new ("Music Player",
"Shouldn't have icons",
NULL);
notify_notification_set_hint (n, "action-icons", g_variant_new_boolean (FALSE));
notify_notification_add_action (n,
"media-skip-backward",
"Previous",
(NotifyActionCallback) previous_callback,
NULL,
NULL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_main_loop_run (loop);
return 0;
}

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-basic.c Unit test: basics * @file tests/test-basic.c Unit test: basics
* *
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
@ -23,20 +24,51 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
int main() { int
NotifyNotification *n; main ()
{
NotifyNotification *n;
notify_init("Basics"); notify_init ("Basics");
n = notify_notification_new ("Summary", /* Long summary */
n = notify_notification_new ("Summary that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
"Content",
NULL);
notify_notification_set_timeout (n, 3000); //3 seconds
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_object_unref (G_OBJECT (n));
/* Long message */
n = notify_notification_new ("Summary",
"Content that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh", "Content that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
NULL, NULL); NULL);
notify_notification_set_timeout (n, 3000); //3 seconds notify_notification_set_timeout (n, 3000); //3 seconds
if (!notify_notification_show_and_forget (n, NULL)) { if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n"); fprintf (stderr, "failed to send notification\n");
return 1; return 1;
} }
return 0; g_object_unref (G_OBJECT (n));
/* Summary only */
n = notify_notification_new ("Summary only there is no message content",
NULL,
NULL);
notify_notification_set_timeout (n, NOTIFY_EXPIRES_NEVER);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_object_unref (G_OBJECT (n));
return 0;
} }

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-default-action.c Unit test: default action * @file tests/test-default-action.c Unit test: default action
* *
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
@ -26,48 +27,48 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#define DBUS_API_SUBJECT_TO_CHANGE 1
#include <glib.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
static GMainLoop *loop; static GMainLoop *loop;
static void callback(NotifyNotification *n, const char *action, void *user_data) static void
callback (NotifyNotification *n,
const char *action,
void *user_data)
{ {
assert (action != NULL); printf ("callback\n");
assert (action != NULL);
assert (strcmp ("default", action) == 0); assert (strcmp ("default", action) == 0);
notify_notification_close (n, NULL); notify_notification_close (n, NULL);
g_main_loop_quit(loop); g_main_loop_quit (loop);
} }
int int
main() main ()
{ {
NotifyNotification *n; NotifyNotification *n;
if (!notify_init("Default Action Test")) exit(1); if (!notify_init ("Default Action Test"))
exit (1);
DBusConnection *conn = dbus_bus_get(DBUS_BUS_SESSION, NULL); loop = g_main_loop_new (NULL, FALSE);
loop = g_main_loop_new(NULL, FALSE);
dbus_connection_setup_with_g_main(conn, NULL); n = notify_notification_new ("Matt is online", "", NULL);
notify_notification_set_timeout (n, NOTIFY_EXPIRES_DEFAULT);
notify_notification_add_action (n,
"default",
"Do Default Action",
(NotifyActionCallback) callback,
NULL,
NULL);
notify_notification_set_category (n, "presence.online");
n = notify_notification_new ("Matt is online", "", NULL, NULL); if (!notify_notification_show (n, NULL)) {
notify_notification_set_timeout (n, NOTIFY_TIMEOUT_NEVER); fprintf (stderr, "failed to send notification\n");
notify_notification_add_action (n, "default", "Do Default Action", callback); return 1;
notify_notification_set_category (n, "presence.online"); }
if (!notify_notification_show (n, NULL)) { g_main_loop_run (loop);
fprintf(stderr, "failed to send notification\n");
return 1;
}
g_main_loop_run(loop); return 0;
return 0;
} }

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-default-action.c Unit test: error handling * @file tests/test-default-action.c Unit test: error handling
* *
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
@ -23,26 +24,24 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
int main() { int
NotifyNotification *n; main ()
{
NotifyNotification *n;
g_type_init (); notify_init ("Error Handling");
notify_init("Error Handling"); n = notify_notification_new ("Summary", "Content", NULL);
notify_notification_set_timeout (n, 3000); //3 seconds
n = notify_notification_new ("Summary", /* TODO: Create an error condition */
"Content",
NULL, NULL);
notify_notification_set_timeout (n, 3000); //3 seconds
/* TODO: Create an error condition */
if (!notify_notification_show (n, NULL)) { if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n"); fprintf (stderr, "failed to send notification\n");
return 1; return 1;
} }
return 0; return 0;
} }

55
tests/test-gir.py Executable file
View File

@ -0,0 +1,55 @@
#!/usr/bin/python
# @file tests/test-gir.py Unit test: Test GI repository
#
# @Copyright (C) 2010 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@ubuntu.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
import os
# use our local typelib
os.environ['GI_TYPELIB_PATH'] = 'libnotify:' + os.environ.get('GI_TYPELIB_PATH', '')
from gi.repository import Notify
assert Notify.is_initted() == False
Notify.init('test')
assert Notify.is_initted() == True
print 'server info:', Notify.get_server_info()
print 'server capabilities:', Notify.get_server_caps()
n = Notify.Notification.new('title', None, None)
n.show()
n = Notify.Notification.new('title', 'text', None)
n.show()
n = Notify.Notification.new('title', 'text', 'gtk-ok')
n.show()
n.update('New Title', None, None)
n.show()
n.update('Newer Title', 'New Body', None)
n.show()
def callback():
print 'Do it! Callback'
n = Notify.Notification.new('Action', 'Here we go!', 'gtk-alert')
n.add_action('doit', 'Do it!', callback, None, None)
n.show()

View File

@ -1,12 +1,13 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-image.c Unit test: images * @file tests/test-image.c Unit test: images
* *
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * @Copyright(C) 2004 Mike Hearn <mike@navi.cx>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or(at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -30,84 +31,76 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#define DBUS_API_SUBJECT_TO_CHANGE 1
#include <glib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
GMainLoop *loop; GMainLoop *loop;
NotifyNotification *n; NotifyNotification *n;
int main(int argc, char *argv[]) { int
char file[PATH_MAX]; main (int argc, char *argv[])
int size; {
char *uri; char *file;
GdkPixbuf *icon; char *uri;
gchar *buf; GdkPixbuf *pixbuf;
gsize buf_size;
GtkWidget *helper;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
if (!notify_init("Images Test")) exit(1); if (!notify_init ("Images Test"))
exit (1);
n = notify_notification_new ("Icon Test", "Testing stock icon", "stock_help", NULL); /* Stock icon */
n = notify_notification_new ("Icon Test",
"Testing stock icon",
"appointment-new");
notify_notification_set_hint_int32 (n, "x", 300); if (!notify_notification_show (n, NULL)) {
notify_notification_set_hint_int32 (n, "y", 24); fprintf (stderr, "failed to send notification\n");
return 1;
}
notify_notification_set_timeout (n, NOTIFY_TIMEOUT_NEVER); g_object_unref (G_OBJECT (n));
if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n");
return 1;
}
g_usleep (5000000); //5 seconds file = g_get_current_dir ();
uri = g_strdup_printf ("file://%s/%s",
file,
"dewdop_leaf.jpg");
size = readlink("/proc/self/cwd", file, PATH_MAX - 1); g_free (file);
file[size] = '\0'; printf ("sending %s\n", uri);
uri = g_strdup_printf ("file://%s/%s", file, "applet-critical.png");
printf("sending %s\n", uri); /* URIs */
n = notify_notification_new ("Alert!",
"Testing URI icons",
uri);
notify_notification_update (n, "Alert!", "Testing URI icons", uri); if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
if (!notify_notification_show (n, NULL)) { g_object_unref (G_OBJECT (n));
fprintf(stderr, "failed to send notification\n");
return 1;
}
g_usleep (5000000); //5 seconds /* Raw image */
n = notify_notification_new ("Raw image test",
"Testing sending raw pixbufs",
NULL);
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_for_screen (gdk_screen_get_default ()),
"folder-open",
48,
GTK_ICON_LOOKUP_USE_BUILTIN,
NULL);
if (pixbuf == NULL) {
fprintf (stderr, "failed to render pixbuf\n");
return 1;
}
notify_notification_update (n, "Raw image test", "Testing sending raw pixbufs", NULL); notify_notification_set_image_from_pixbuf (n, pixbuf);
g_object_unref (pixbuf);
/* This is just a hack to get a stock icon's pixbuf if (!notify_notification_show (n, NULL)) {
in a realworld app if you were sending bitmapped data fprintf (stderr, "failed to send notification\n");
you would know the file location and open it up with return 1;
a method that could generate a bmp for you*/ }
helper = gtk_button_new();
icon = gtk_widget_render_icon (helper,
GTK_STOCK_DIALOG_QUESTION,
GTK_ICON_SIZE_DIALOG,
"");
return 0;
notify_notification_set_icon_data_from_pixbuf (n,
icon);
if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n");
return 1;
}
gtk_widget_destroy (helper);
g_object_unref ((GObject *)icon);
g_usleep (5000000); //5 seconds
return 0;
} }

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-markup.c Unit test: markup * @file tests/test-markup.c Unit test: markup
* *
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
@ -23,21 +24,23 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
int main() { int
NotifyNotification *n; main ()
{
NotifyNotification *n;
notify_init("Markup"); notify_init ("Markup");
n = notify_notification_new ("Summary", n = notify_notification_new ("Summary",
"Some <b>bold</b>, <u>underlined</u>, <i>italic</i>, " "Some <b>bold</b>, <u>underlined</u>, <i>italic</i>, "
"<a href='http://www.google.com'>linked</a> text", "<a href='http://www.google.com'>linked</a> text",
NULL, NULL); NULL);
notify_notification_set_timeout (n, 3000); //3 seconds notify_notification_set_timeout (n, 3000); //3 seconds
if (!notify_notification_show (n, NULL)) { if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n"); fprintf (stderr, "failed to send notification\n");
return 1; return 1;
} }
return 0; return 0;
} }

View File

@ -1,12 +1,13 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-multi-actions.c Unit test: multiple actions * @file tests/test-multi-actions.c Unit test: multiple actions
* *
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx> * @Copyright(C) 2004 Mike Hearn <mike@navi.cx>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or(at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -23,82 +24,97 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include <string.h> #include <string.h>
#define DBUS_API_SUBJECT_TO_CHANGE 1 static GMainLoop *loop;
#include <glib.h> static void
#include <dbus/dbus.h> help_callback (NotifyNotification *n,
#include <dbus/dbus-glib.h> const char *action)
#include <dbus/dbus-glib-lowlevel.h>
GMainLoop *loop;
static void help_callback(NotifyNotification *n, const char *action)
{ {
assert( action != NULL ); g_assert (action != NULL);
assert( strcmp (action, "help") == 0 ); g_assert (strcmp (action, "help") == 0);
printf("You clicked Help\n"); printf ("You clicked Help\n");
notify_notification_close(n, NULL); notify_notification_close (n, NULL);
g_main_loop_quit(loop); g_main_loop_quit (loop);
} }
static void ignore_callback(NotifyNotification *n, const char *action) static void
ignore_callback (NotifyNotification *n,
const char *action)
{ {
assert( action != NULL ); g_assert (action != NULL);
assert( strcmp (action, "ignore") == 0 ); g_assert (strcmp (action, "ignore") == 0);
printf("You clicked Ignore\n"); printf ("You clicked Ignore\n");
notify_notification_close(n, NULL); notify_notification_close (n, NULL);
g_main_loop_quit(loop); g_main_loop_quit (loop);
}
static void
empty_callback (NotifyNotification *n,
const char *action)
{
g_assert (action != NULL);
g_assert (strcmp (action, "empty") == 0);
printf ("You clicked Empty Trash\n");
notify_notification_close (n, NULL);
g_main_loop_quit (loop);
} }
static void empty_callback(NotifyNotification *n, const char *action) int
main (int argc, char **argv)
{ {
assert( action != NULL );
assert( strcmp (action, "empty") == 0 );
printf("You clicked Empty Trash\n");
notify_notification_close(n, NULL);
g_main_loop_quit(loop);
}
int main() {
NotifyNotification *n; NotifyNotification *n;
if (!notify_init("Multi Action Test")) exit(1); if (!notify_init ("Multi Action Test"))
exit (1);
DBusConnection *conn = dbus_bus_get(DBUS_BUS_SESSION, NULL); loop = g_main_loop_new (NULL, FALSE);
loop = g_main_loop_new(NULL, FALSE);
dbus_connection_setup_with_g_main(conn, NULL); n = notify_notification_new ("Low disk space",
n = notify_notification_new ("Low disk space",
"You can free up some disk space by " "You can free up some disk space by "
"emptying the trash can.", "emptying the trash can.",
NULL, NULL); "drive-harddisk-symbolic");
notify_notification_set_timeout (n, NOTIFY_TIMEOUT_NEVER); notify_notification_set_hint (n, "transient", g_variant_new_boolean (TRUE));
notify_notification_add_action (n, "help", "Help", help_callback); notify_notification_set_urgency (n, NOTIFY_URGENCY_CRITICAL);
notify_notification_add_action (n, "ignore", "Ignore", ignore_callback); notify_notification_set_timeout (n, NOTIFY_EXPIRES_DEFAULT);
notify_notification_add_action (n, "empty", "Empty Trash", empty_callback); notify_notification_add_action (n,
notify_notification_set_category (n, "device"); "help",
"Help",
(NotifyActionCallback) help_callback,
NULL,
NULL);
notify_notification_add_action (n,
"ignore",
"Ignore",
(NotifyActionCallback)
ignore_callback,
NULL,
NULL);
notify_notification_add_action (n,
"empty",
"Empty Trash",
(NotifyActionCallback) empty_callback,
NULL,
NULL);
notify_notification_set_category (n, "device");
if (!notify_notification_show (n, NULL)) { if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n"); fprintf (stderr, "failed to send notification\n");
return 1; return 1;
} }
g_main_loop_run(loop); g_main_loop_run (loop);
return 0; return 0;
} }

94
tests/test-persistence.c Normal file
View File

@ -0,0 +1,94 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
static gboolean
server_has_persistence (void)
{
gboolean has;
GList *caps;
GList *l;
caps = notify_get_server_caps ();
if (caps == NULL) {
fprintf (stderr, "Failed to receive server caps.\n");
return FALSE;
}
l = g_list_find_custom (caps, "persistence", (GCompareFunc)strcmp);
has = l != NULL;
g_list_foreach (caps, (GFunc) g_free, NULL);
g_list_free (caps);
return has;
}
static void
install_callback (NotifyNotification *n,
const char *action)
{
g_assert (action != NULL);
g_assert (strcmp (action, "install") == 0);
printf ("You clicked Install\n");
gtk_main_quit ();
}
int
main (int argc, char *argv[])
{
NotifyNotification *n;
gtk_init (&argc, &argv);
notify_init ("Persistence Test");
n = notify_notification_new ("Software Updates Available",
"Important updates for your apps are now available.",
"software-update-available-symbolic");
notify_notification_add_action (n,
"install",
"Install now",
(NotifyActionCallback) install_callback,
NULL,
NULL);
notify_notification_set_timeout (n, 0); //don't timeout
notify_notification_show (n, NULL);
if (!server_has_persistence ()) {
GtkStatusIcon *icon;
g_message ("Server does not support persistence; using a status icon");
icon = gtk_status_icon_new_from_icon_name ("software-update-available-symbolic");
gtk_status_icon_set_tooltip_markup (icon, "<b>Software Updates Available</b>\nImportant updates for your apps are now available.");
gtk_status_icon_set_visible (icon, TRUE);
} else {
g_message ("Server supports persistence; status icon not needed");
}
gtk_main ();
return 0;
}

112
tests/test-removal.c Normal file
View File

@ -0,0 +1,112 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <libnotify/notify.h>
#include <gtk/gtk.h>
static void
next_callback (NotifyNotification *n,
const char *action)
{
g_assert (action != NULL);
printf ("You clicked Next\n");
notify_notification_close (n, NULL);
gtk_main_quit ();
}
int
main (int argc, char *argv[])
{
NotifyNotification *n;
gtk_init (&argc, &argv);
notify_init ("Urgency");
n = notify_notification_new ("Low Urgency",
"Joe signed online.",
NULL);
notify_notification_set_urgency (n, NOTIFY_URGENCY_LOW);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
exit (1);
}
sleep (3);
if (!notify_notification_close (n, NULL)) {
fprintf (stderr, "failed to remove notification\n");
exit (1);
}
g_object_unref (G_OBJECT (n));
n = notify_notification_new ("Normal Urgency",
"You have a meeting in 10 minutes.",
NULL);
notify_notification_set_urgency (n, NOTIFY_URGENCY_NORMAL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
exit (1);
}
sleep (3);
if (!notify_notification_close (n, NULL)) {
fprintf (stderr, "failed to remove notification\n");
exit (1);
}
g_object_unref (G_OBJECT (n));
n = notify_notification_new ("Critical Urgency",
"This message will self-destruct in 10 seconds.",
NULL);
notify_notification_set_urgency (n, NOTIFY_URGENCY_CRITICAL);
notify_notification_set_timeout (n, NOTIFY_EXPIRES_NEVER);
notify_notification_add_action (n,
"media-skip-forward",
"Next",
(NotifyActionCallback) next_callback,
NULL,
NULL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
exit (1);
}
sleep (3);
if (!notify_notification_close (n, NULL)) {
fprintf (stderr, "failed to remove notification\n");
exit (1);
}
gtk_main ();
g_object_unref (G_OBJECT (n));
return 0;
}

View File

@ -1,62 +1,93 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h> #include <libnotify/notify.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <glib.h> #include <glib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
static int count = 0;
static int count = 0; static void
on_exposed (GtkWidget *widget,
GdkEventExpose *ev,
void *user_data)
{
NotifyNotification *n = NOTIFY_NOTIFICATION (user_data);
void on_exposed (GtkWidget *widget, GdkEventExpose *ev, void *user_data) { g_signal_handlers_disconnect_by_func (widget, on_exposed, user_data);
NotifyNotification *n = NOTIFY_NOTIFICATION (user_data);
g_signal_handlers_disconnect_by_func(widget, on_exposed, user_data); notify_notification_show (n, NULL);
notify_notification_show (n, NULL);
}
void on_clicked (GtkButton *button, void *user_data) {
GError *error;
gchar *buf;
NotifyNotification *n = NOTIFY_NOTIFICATION (user_data);
count++;
buf = g_strdup_printf ("You clicked the button %i times", count);
notify_notification_update (n, "Widget Attachment Test",
buf, NULL);
notify_notification_show (n, NULL);
g_free (buf);
} }
int main(int argc, char *argv[]) { static void
NotifyNotification *n; on_clicked (GtkButton *button,
GtkWidget *window; void *user_data)
GtkWidget *button; {
gchar *buf;
NotifyNotification *n = NOTIFY_NOTIFICATION (user_data);
GError *error; count++;
error = NULL; buf = g_strdup_printf ("You clicked the button %i times", count);
notify_notification_update (n, "Widget Attachment Test", buf, NULL);
g_free (buf);
gtk_init (&argc, &argv); notify_notification_show (n, NULL);
notify_init("Replace Test"); }
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); int
button = gtk_button_new_with_label ("click here to change notification"); main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER(window), button); {
NotifyNotification *n;
gtk_widget_show_all (window); GtkWidget *window;
GtkWidget *button;
n = notify_notification_new ("Widget Attachment Test", "Button has not been clicked yet", gtk_init (&argc, &argv);
NULL, //no icon notify_init ("Replace Test");
button); //attach to button
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window),
notify_notification_set_timeout (n, 0); //don't timeout "delete_event",
G_CALLBACK (gtk_main_quit),
g_signal_connect (button, "clicked", (GCallback *)on_clicked, n); NULL);
g_signal_connect_after (button, "expose-event", (GCallback *)on_exposed, n);
button = gtk_button_new_with_label ("click here to change notification");
gtk_main(); gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show_all (window);
n = notify_notification_new ("Widget Attachment Test",
"Button has not been clicked yet",
NULL); //no icon
notify_notification_set_timeout (n, 0); //don't timeout
g_signal_connect (G_OBJECT (button),
"clicked",
G_CALLBACK (on_clicked),
n);
g_signal_connect_after (G_OBJECT (button),
"expose-event",
G_CALLBACK (on_exposed),
n);
gtk_main ();
return 0;
} }

View File

@ -1,40 +1,63 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h> #include <libnotify/notify.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <glib.h> #include <glib.h>
int main() { int
NotifyNotification *n; main ()
GError *error; {
error = NULL; NotifyNotification *n;
GError *error;
error = NULL;
g_type_init (); notify_init ("Replace Test");
notify_init("Replace Test"); n = notify_notification_new ("Summary",
"First message",
n = notify_notification_new ("Summary", "First message", NULL); //no icon
NULL, //no icon
NULL); //don't attach to widget
notify_notification_set_timeout (n, 0); //don't timeout
notify_notification_set_timeout (n, 0); //don't timeout
if (!notify_notification_show (n, &error)) {
fprintf(stderr, "failed to send notification: %s\n", error->message);
g_error_free (error);
return 1;
}
sleep(3); if (!notify_notification_show (n, &error)) {
fprintf (stderr, "failed to send notification: %s\n",
error->message);
g_error_free (error);
return 1;
}
notify_notification_update (n, "Second Summary", sleep (3);
"First mesage was replaced", NULL);
if (!notify_notification_show (n, &error)) { notify_notification_update (n,
fprintf(stderr, "failed to send notification: %s\n", error->message); "Second Summary",
g_error_free (error); "First mesage was replaced",
return 1; NULL);
} notify_notification_set_timeout (n, NOTIFY_EXPIRES_DEFAULT);
return 0; if (!notify_notification_show (n, &error)) {
fprintf (stderr,
"failed to send notification: %s\n",
error->message);
g_error_free (error);
return 1;
}
return 0;
} }

149
tests/test-resident.c Normal file
View File

@ -0,0 +1,149 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
static GMainLoop *loop;
static int counter;
static gboolean is_playing;
static void
prev_callback (NotifyNotification *n,
const char *action)
{
char *body;
g_assert (action != NULL);
g_assert (strcmp (action, "previous") == 0);
printf ("You clicked Previous\n");
body = g_strdup_printf ("Playing some fine song %d", --counter);
notify_notification_update (n,
"Music Player",
body,
"audio-x-generic");
g_free (body);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send update\n");
}
}
static void
pause_callback (NotifyNotification *n,
const char *action)
{
char *body;
g_assert (action != NULL);
g_assert (strcmp (action, "pause") == 0);
printf ("You clicked Play/Pause\n");
is_playing = !is_playing;
if (is_playing) {
body = g_strdup_printf ("Playing some fine song %d", counter);
} else {
body = g_strdup_printf ("Not playing some fine song %d", counter);
}
notify_notification_update (n,
"Music Player",
body,
"audio-x-generic");
g_free (body);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send update\n");
}
}
static void
next_callback (NotifyNotification *n,
const char *action)
{
char *body;
g_assert (action != NULL);
g_assert (strcmp (action, "next") == 0);
printf ("You clicked Next\n");
body = g_strdup_printf ("Playing some fine song %d", ++counter);
notify_notification_update (n,
"Music Player",
body,
"audio-x-generic");
g_free (body);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send update\n");
}
}
int
main (int argc, char **argv)
{
NotifyNotification *n;
GVariant *hint;
if (!notify_init ("Resident Test"))
exit (1);
loop = g_main_loop_new (NULL, FALSE);
counter = 0;
is_playing = TRUE;
n = notify_notification_new ("Music Player",
"Playing some fine song",
"audio-x-generic");
hint = g_variant_new_boolean (TRUE);
notify_notification_set_hint (n, "resident", hint);
notify_notification_add_action (n,
"previous",
"Previous",
(NotifyActionCallback) prev_callback,
NULL,
NULL);
notify_notification_add_action (n,
"pause",
"Pause",
(NotifyActionCallback)
pause_callback,
NULL,
NULL);
notify_notification_add_action (n,
"next",
"Next",
(NotifyActionCallback) next_callback,
NULL,
NULL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_main_loop_run (loop);
return 0;
}

48
tests/test-rtl.c Normal file
View File

@ -0,0 +1,48 @@
/*
* @file tests/test-basic.c Unit test: basics
*
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
*
* Test Case by Djihed Afifi <djihed@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
int
main ()
{
NotifyNotification *n;
notify_init("Basics");
n = notify_notification_new ("اختبار",
"يوفر ويكي عربآيز مناخا للنقاش وتبادل الخبرات والمعرفة حول اللغة العربية ولسانياتها ومايتعلّق بدعمها والإرتقاء بها في الحوسبة عموماً والبرمجيات الحرة على وجه الخصوص. هذا الويكي عبارة عن بيئة تعاونية تشاركية مفتوحة للجميع بدون قيود، لغتنا الجميلة بانتظار مساهمتك فلا تبخل عليها ",
NULL);
notify_notification_set_timeout (n, 3000);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_object_unref (G_OBJECT (n));
return 0;
}

60
tests/test-server-info.c Normal file
View File

@ -0,0 +1,60 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-server-info.c Retrieves the server info and caps
*
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char **argv)
{
GList *l, *caps;
char *name, *vendor, *version, *spec_version;
notify_init ("TestCaps");
if (!notify_get_server_info (&name, &vendor, &version, &spec_version)) {
fprintf (stderr, "Failed to receive server info.\n");
exit (1);
}
printf ("Name: %s\n", name);
printf ("Vendor: %s\n", vendor);
printf ("Version: %s\n", version);
printf ("Spec Version: %s\n", spec_version);
printf ("Capabilities:\n");
caps = notify_get_server_caps ();
if (caps == NULL) {
fprintf (stderr, "Failed to receive server caps.\n");
exit (1);
}
for (l = caps; l != NULL; l = l->next)
printf ("\t%s\n", (char *) l->data);
g_list_foreach (caps, (GFunc) g_free, NULL);
g_list_free (caps);
return 0;
}

84
tests/test-size-changes.c Normal file
View File

@ -0,0 +1,84 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-size-changes.c Unit test: Notification size changes
*
* @Copyright (C) 2006 Christian Hammond <chipx86@chipx86.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
int
main ()
{
NotifyNotification *n1, *n2, *n3;
notify_init ("Size Changes");
n1 = notify_notification_new ("Notification 1",
"Notification number 1!",
NULL);
notify_notification_set_timeout (n1, 7000);
if (!notify_notification_show (n1, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_object_unref (G_OBJECT (n1));
n2 = notify_notification_new ("Notification 2",
"Notification number 2!",
NULL);
notify_notification_set_timeout (n2, 7000);
if (!notify_notification_show (n2, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
n3 = notify_notification_new ("Notification 3",
"Notification number 3!",
NULL);
notify_notification_set_timeout (n3, 7000);
if (!notify_notification_show (n3, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_object_unref (G_OBJECT (n3));
sleep (2);
notify_notification_update (n2,
"Longer Notification 2",
"This is a much longer notification.\n"
"Two lines.\n"
"Well, okay, three.\n" "Last one.",
NULL);
if (!notify_notification_show (n2, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
return 0;
}

52
tests/test-transient.c Normal file
View File

@ -0,0 +1,52 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
static GMainLoop *loop;
int
main (int argc, char **argv)
{
NotifyNotification *n;
GVariant *hint;
if (!notify_init ("Transient Test"))
exit (1);
loop = g_main_loop_new (NULL, FALSE);
n = notify_notification_new ("Some transient change",
"Something happened",
"audio-volume-medium");
hint = g_variant_new_boolean (TRUE);
notify_notification_set_hint (n, "transient", hint);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_main_loop_run (loop);
return 0;
}

71
tests/test-urgency.c Normal file
View File

@ -0,0 +1,71 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-urgency.c Unit test: urgency levels
*
* @Copyright(C) 2006 Christian Hammond <chipx8@chipx86.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
NotifyNotification *n;
notify_init ("Urgency");
n = notify_notification_new ("Low Urgency",
"Joe signed online.",
NULL);
notify_notification_set_urgency (n, NOTIFY_URGENCY_LOW);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
exit (1);
}
g_object_unref (G_OBJECT (n));
n = notify_notification_new ("Normal Urgency",
"You have a meeting in 10 minutes.",
NULL);
notify_notification_set_urgency (n, NOTIFY_URGENCY_NORMAL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
exit (1);
}
g_object_unref (G_OBJECT (n));
n = notify_notification_new ("Critical Urgency",
"This message will self-destruct in 10 seconds.",
NULL);
notify_notification_set_urgency (n, NOTIFY_URGENCY_CRITICAL);
notify_notification_set_timeout (n, 10000); // 10 seconds
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
exit (1);
}
g_object_unref (G_OBJECT (n));
return 0;
}

75
tests/test-xy-actions.c Normal file
View File

@ -0,0 +1,75 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-xy-actions.c Unit test: X, Y hints and actions
*
* @Copyright (C) 2006 Christian Hammond <chipx86@chipx86.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
static GMainLoop *loop;
static void
action_cb (NotifyNotification *n,
const char *action)
{
printf ("You clicked '%s'\n", action);
g_main_loop_quit (loop);
}
int
main (int argc, char **argv)
{
NotifyNotification *n;
notify_init ("XY");
loop = g_main_loop_new (NULL, FALSE);
n = notify_notification_new ("System update available",
"New system updates are available. It is "
"recommended that you install the updates.",
NULL);
notify_notification_set_hint_int32 (n, "x", 600);
notify_notification_set_hint_int32 (n, "y", 10);
notify_notification_add_action (n,
"help",
"Help",
(NotifyActionCallback) action_cb,
NULL,
NULL);
notify_notification_add_action (n,
"update",
"Update",
(NotifyActionCallback) action_cb,
NULL,
NULL);
if (!notify_notification_show (n, NULL)) {
fprintf (stderr, "failed to send notification\n");
return 1;
}
g_main_loop_run (loop);
return 0;
}

View File

@ -1,16 +1,17 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-xy.c Unit test: X, Y hints * @file tests/test-xy.c Unit test: X, Y hints
* *
* @Copyright (C) 2005 Christian Hammond <chipx86@chipx86.com> * @Copyright(C) 2005 Christian Hammond <chipx86@chipx86.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or(at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
@ -24,77 +25,72 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
static void static void
_handle_closed (GObject *o) _handle_closed (GObject * obj)
{ {
g_message ("closing"); g_message ("closing");
g_object_unref (o); g_object_unref (obj);
} }
static void static void
emit_notification(int x, int y) emit_notification (int x, int y)
{ {
static char buffer[BUFSIZ]; char *buffer;
NotifyNotification *n; NotifyNotification *n;
g_snprintf(buffer, sizeof(buffer), buffer = g_strdup_printf ("This notification should point to %d, %d.",
"This notification should point to %d, %d.", x, y); x,
y);
n = notify_notification_new ("X, Y Test", n = notify_notification_new ("X, Y Test", buffer, NULL);
buffer, g_free (buffer);
NULL, NULL);
notify_notification_set_hint_int32 (n, "x", x); notify_notification_set_hint_int32 (n, "x", x);
notify_notification_set_hint_int32 (n, "y", y); notify_notification_set_hint_int32 (n, "y", y);
g_signal_connect (n, "closed", _handle_closed, NULL); g_signal_connect (G_OBJECT (n),
"closed",
G_CALLBACK (_handle_closed),
NULL);
if (!notify_notification_show (n, NULL)) { if (!notify_notification_show (n, NULL))
fprintf(stderr, "failed to send notification\n"); fprintf (stderr, "failed to send notification\n");
return 1;
}
} }
static gboolean static gboolean
_popup_random_bubble (void) _popup_random_bubble (gpointer unused)
{ {
GdkDisplay *display; GdkDisplay *display;
GdkScreen *screen; GdkScreen *screen;
int screen_x2, screen_y2; int screen_x2, screen_y2;
int x, y; int x, y;
display = gdk_display_get_default(); display = gdk_display_get_default ();
screen = gdk_display_get_default_screen(display); screen = gdk_display_get_default_screen (display);
screen_x2 = gdk_screen_get_width(screen) - 1; screen_x2 = gdk_screen_get_width (screen) - 1;
screen_y2 = gdk_screen_get_height(screen) - 1; screen_y2 = gdk_screen_get_height (screen) - 1;
x = g_random_int_range (0, screen_x2); x = g_random_int_range (0, screen_x2);
y = g_random_int_range (0, screen_y2); y = g_random_int_range (0, screen_y2);
emit_notification(x, y); emit_notification (x, y);
return TRUE; return TRUE;
} }
int int
main(int argc, char **argv) main (int argc, char **argv)
{ {
GMainLoop *loop; GMainLoop *loop;
DBusConnection *conn;
gdk_init(&argc, &argv);
notify_init("XY"); gdk_init (&argc, &argv);
conn = dbus_bus_get (DBUS_BUS_SESSION, NULL); notify_init ("XY");
dbus_connection_setup_with_g_main (conn, NULL);
g_timeout_add (1000, _popup_random_bubble, NULL); g_timeout_add (1000, _popup_random_bubble, NULL);
loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop); g_main_loop_run (loop);
return 0;
} }

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* @file tests/test-xy.c Unit test: X, Y hints * @file tests/test-xy.c Unit test: X, Y hints
* *
* @Copyright (C) 2005 Christian Hammond <chipx86@chipx86.com> * @Copyright (C) 2005 Christian Hammond <chipx86@chipx86.com>
@ -23,22 +24,24 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
int main() { int
NotifyNotification *n; main ()
{
NotifyNotification *n;
notify_init("XY"); notify_init ("XY");
n = notify_notification_new ("X, Y Test", n = notify_notification_new ("X, Y Test",
"This notification should point to 150, 10", "This notification should point to 150, 10",
NULL, NULL); NULL);
notify_notification_set_hint_int32 (n, "x", 30); notify_notification_set_hint_int32 (n, "x", 150);
notify_notification_set_hint_int32 (n, "y", 10); notify_notification_set_hint_int32 (n, "y", 10);
if (!notify_notification_show (n, NULL)) { if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n"); fprintf (stderr, "failed to send notification\n");
return 1; return 1;
} }
return 0; return 0;
} }

View File

@ -1,11 +0,0 @@
bin_PROGRAMS = notify-send
common_ldflags = \
$(top_builddir)/libnotify/libnotify.la \
$(PACKAGE_LIBS) \
-lpopt
notify_send_SOURCES = notify-send.c
notify_send_LDADD = $(common_ldflags)
INCLUDES = $(PACKAGE_CFLAGS)

7
tools/meson.build Normal file
View File

@ -0,0 +1,7 @@
progs = ['notify-send']
foreach prog: progs
executable(prog, [prog + '.c'],
dependencies: libnotify_dep,
install: true)
endforeach

View File

@ -1,144 +1,486 @@
/** /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* @file notify-send.c A tool for sending notifications.
* *
* Copyright (C) 2004 Christian Hammond. * Copyright (C) 2004 Christian Hammond.
* *
* This program is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU Lesser General Public
* published by the Free Software Foundation; either version 2 of * License as published by the Free Software Foundation; either
* the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free * License along with this library; if not, write to the
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* MA 02111-1307 USA * Boston, MA 02111-1307, USA.
*/ */
#include "config.h"
#include <libnotify/notify.h> #include <libnotify/notify.h>
#include <locale.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h>
#include <popt.h>
#include <glib.h> #include <glib.h>
#include <glib-unix.h>
#include <glib/gprintf.h>
#define N_(x) (x) #define N_(x) (x)
#define GETTEXT_PACKAGE NULL
static NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL;
static GMainLoop *loop = NULL;
static gboolean
g_option_arg_urgency_cb (const char *option_name,
const char *value,
gpointer data,
GError **error)
{
if (value != NULL) {
if (!strcasecmp (value, "low"))
urgency = NOTIFY_URGENCY_LOW;
else if (!strcasecmp (value, "normal"))
urgency = NOTIFY_URGENCY_NORMAL;
else if (!strcasecmp (value, "critical"))
urgency = NOTIFY_URGENCY_CRITICAL;
else {
*error = g_error_new (G_OPTION_ERROR,
G_OPTION_ERROR_BAD_VALUE,
N_("Unknown urgency %s specified. "
"Known urgency levels: low, "
"normal, critical."), value);
return FALSE;
}
}
return TRUE;
}
static gboolean
notify_notification_set_hint_variant (NotifyNotification *notification,
const char *type,
const char *key,
const char *value,
GError **error)
{
static gboolean conv_error = FALSE;
if (!strcasecmp (type, "string")) {
notify_notification_set_hint_string (notification,
key,
value);
} else if (!strcasecmp (type, "int")) {
if (!g_ascii_isdigit (*value))
conv_error = TRUE;
else {
gint h_int = (gint) g_ascii_strtoull (value, NULL, 10);
notify_notification_set_hint_int32 (notification,
key,
h_int);
}
} else if (!strcasecmp (type, "double")) {
if (!g_ascii_isdigit (*value))
conv_error = TRUE;
else {
gdouble h_double = g_strtod (value, NULL);
notify_notification_set_hint_double (notification,
key, h_double);
}
} else if (!strcasecmp (type, "byte")) {
gint h_byte = (gint) g_ascii_strtoull (value, NULL, 10);
if (h_byte < 0 || h_byte > 0xFF)
conv_error = TRUE;
else {
notify_notification_set_hint_byte (notification,
key,
(guchar) h_byte);
}
} else if (g_ascii_strcasecmp (type, "boolean") == 0) {
gboolean h_boolean = FALSE;
if (g_ascii_strcasecmp (value, "true") == 0) {
h_boolean = TRUE;
} else if (g_ascii_isdigit (*value)) {
h_boolean = !!g_ascii_strtoull (value, NULL, 10);
}
notify_notification_set_hint (notification, key,
g_variant_new_boolean (h_boolean));
} else if (g_ascii_strcasecmp (type, "variant") == 0) {
GVariant *variant = g_variant_parse (NULL, value, NULL, NULL, NULL);
if (variant != NULL) {
notify_notification_set_hint (notification, key, variant);
} else {
conv_error = TRUE;
}
} else {
*error = g_error_new (G_OPTION_ERROR,
G_OPTION_ERROR_BAD_VALUE,
N_("Invalid hint type \"%s\". Valid types "
"are int, double, string and byte."),
type);
return FALSE;
}
if (conv_error) {
*error = g_error_new (G_OPTION_ERROR,
G_OPTION_ERROR_BAD_VALUE,
N_("Value \"%s\" of hint \"%s\" could not be "
"parsed as type \"%s\"."), value, key,
type);
return FALSE;
}
return TRUE;
}
static void
handle_closed (NotifyNotification *notify,
gpointer user_data)
{
g_main_loop_quit (loop);
}
static gboolean
on_sigint (gpointer data)
{
NotifyNotification *notification = data;
g_printerr ("Wait cancelled, closing notification\n");
notify_notification_close (notification, NULL);
g_main_loop_quit (loop);
return FALSE;
}
static void
handle_action (NotifyNotification *notify,
char *action,
gpointer user_data)
{
const char *action_name = user_data;
const char *activation_token;
activation_token = notify_notification_get_activation_token (notify);
g_printf ("%s\n", action_name);
if (activation_token) {
g_debug ("Activation Token: %s", activation_token);
}
notify_notification_close (notify, NULL);
}
static gboolean
on_wait_timeout (gpointer data)
{
fprintf (stderr, "Wait timeout expired\n");
g_main_loop_quit (loop);
return FALSE;
}
static gboolean
server_has_capability (const gchar *capability)
{
GList *server_caps = notify_get_server_caps ();
gboolean supported;
supported = !!g_list_find_custom (server_caps,
capability,
(GCompareFunc) g_ascii_strcasecmp);
g_list_foreach (server_caps, (GFunc) g_free, NULL);
g_list_free (server_caps);
return supported;
}
int int
main(int argc, const char **argv) main (int argc, char *argv[])
{ {
const gchar *summary = NULL; static const char *summary = NULL;
const gchar *body = NULL; char *body;
const gchar *type = NULL; static const char *type = NULL;
char *urgency_str = NULL; static char *app_name = NULL;
gchar *icon_str = NULL; static char *icon_str = NULL;
gchar *icons = NULL; static char **n_text = NULL;
NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL; static char **hints = NULL;
long expire_timeout = NOTIFY_TIMEOUT_DEFAULT; static char **actions = NULL;
char ch; static char *server_name = NULL;
poptContext opt_ctx; static char *server_vendor = NULL;
const char **args; static char *server_version = NULL;
static char *server_spec_version = NULL;
static gboolean print_id = FALSE;
static gint notification_id = 0;
static gboolean do_version = FALSE;
static gboolean hint_error = FALSE, show_error = FALSE;
static gboolean transient = FALSE;
static gboolean wait = FALSE;
static glong expire_timeout = NOTIFY_EXPIRES_DEFAULT;
GOptionContext *opt_ctx;
NotifyNotification *notify; NotifyNotification *notify;
GError *error = NULL; GError *error = NULL;
gboolean retval;
g_type_init (); static const GOptionEntry entries[] = {
{"urgency", 'u', 0, G_OPTION_ARG_CALLBACK,
g_option_arg_urgency_cb,
N_("Specifies the urgency level (low, normal, critical)."),
N_("LEVEL")},
{"expire-time", 't', 0, G_OPTION_ARG_INT, &expire_timeout,
N_
("Specifies the timeout in milliseconds at which to expire the "
"notification."), N_("TIME")},
{"app-name", 'a', 0, G_OPTION_ARG_STRING, &app_name,
N_("Specifies the app name for the icon"), N_("APP_NAME")},
{"icon", 'i', 0, G_OPTION_ARG_FILENAME, &icon_str,
N_("Specifies an icon filename or stock icon to display."),
N_("ICON")},
{"category", 'c', 0, G_OPTION_ARG_FILENAME, &type,
N_("Specifies the notification category."),
N_("TYPE[,TYPE...]")},
{"transient", 'e', 0, G_OPTION_ARG_NONE, &transient,
N_("Create a transient notification"),
NULL},
{"hint", 'h', 0, G_OPTION_ARG_FILENAME_ARRAY, &hints,
N_
("Specifies basic extra data to pass. Valid types are boolean, int, double, string, byte and variant."),
N_("TYPE:NAME:VALUE")},
{"print-id", 'p', 0, G_OPTION_ARG_NONE, &print_id,
N_ ("Print the notification ID."), NULL},
{"replace-id", 'r', 0, G_OPTION_ARG_INT, &notification_id,
N_ ("The ID of the notification to replace."), N_("REPLACE_ID")},
{"wait", 'w', 0, G_OPTION_ARG_NONE, &wait,
N_("Wait for the notification to be closed before exiting."),
NULL},
{"action", 'A', 0, G_OPTION_ARG_FILENAME_ARRAY, &actions,
N_
("Specifies the actions to display to the user. Implies --wait to wait for user input."
" May be set multiple times. The name of the action is output to stdout. If NAME is "
"not specified, the numerical index of the option is used (starting with 0)."),
N_("[NAME=]Text...")},
{"version", 'v', 0, G_OPTION_ARG_NONE, &do_version,
N_("Version of the package."),
NULL},
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY,
&n_text, NULL,
NULL},
{NULL}
};
struct poptOption options[] = body = NULL;
{
{ "urgency", 'u', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &urgency_str,
0, N_("Specifies the urgency level (low, normal, critical)."),
NULL },
{ "expire-time", 't', POPT_ARG_INT | POPT_ARGFLAG_STRIP,
&expire_timeout, 0,
N_("Specifies the timeout in seconds at which to expire the "
"notification."),
NULL },
{ "icon", 'i', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &icons, 0,
N_("Specifies an icon filename or stock icon to display."),
N_("ICON1,ICON2,...") },
{ "type", 't', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &type, 0,
N_("Specifies the notification type."),
N_("ICON1,ICON2,...") },
POPT_AUTOHELP
POPT_TABLEEND
};
opt_ctx = poptGetContext("notify-send", argc, argv, options, 0); setlocale (LC_ALL, "");
poptSetOtherOptionHelp(opt_ctx, "[OPTIONS]* <summary> [body]");
while ((ch = poptGetNextOpt(opt_ctx)) >= 0) g_set_prgname (argv[0]);
; g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
if (ch < -1 || (args = poptGetArgs(opt_ctx)) == NULL) opt_ctx = g_option_context_new (N_("<SUMMARY> [BODY] - "
{ "create a notification"));
poptPrintUsage(opt_ctx, stderr, 0); g_option_context_add_main_entries (opt_ctx, entries, GETTEXT_PACKAGE);
exit(1); retval = g_option_context_parse (opt_ctx, &argc, &argv, &error);
} g_option_context_free (opt_ctx);
if (args[0] != NULL) if (!retval) {
summary = args[0]; fprintf (stderr, "%s\n", error->message);
g_error_free (error);
exit (1);
}
if (summary == NULL) if (do_version) {
{ g_printf ("%s %s\n", g_get_prgname (), VERSION);
poptPrintUsage(opt_ctx, stderr, 0); exit (0);
exit(1); }
}
if (args[1] != NULL) if (n_text != NULL && n_text[0] != NULL && *n_text[0] != '\0')
{ summary = n_text[0];
body = args[1];
if (args[2] != NULL) if (summary == NULL) {
{ fprintf (stderr, "%s\n", N_("No summary specified."));
poptPrintUsage(opt_ctx, stderr, 0); exit (1);
exit(1); }
}
}
if (icons != NULL) if (n_text[1] != NULL) {
{ body = g_strcompress (n_text[1]);
char *c;
/* XXX */ if (n_text[2] != NULL) {
if ((c = strchr(icons, ',')) != NULL) fprintf (stderr, "%s\n",
*c = '\0'; N_("Invalid number of options."));
exit (1);
}
}
icon_str = icons; if (!notify_init ("notify-send"))
exit (1);
} notify_get_server_info (&server_name,
&server_vendor,
&server_version,
&server_spec_version);
if (urgency_str != NULL) g_debug ("Using sever %s %s, v%s - Supporting Notification Spec %s",
{ server_name, server_vendor, server_version, server_spec_version);
if (!strcasecmp(urgency_str, "low")) g_free (server_name);
urgency = NOTIFY_URGENCY_LOW; g_free (server_vendor);
else if (!strcasecmp(urgency_str, "normal")) g_free (server_version);
urgency = NOTIFY_URGENCY_NORMAL; g_free (server_spec_version);
else if (!strcasecmp(urgency_str, "critical"))
urgency = NOTIFY_URGENCY_CRITICAL;
else
{
poptPrintHelp(opt_ctx, stderr, 0);
exit(1);
}
}
if (!notify_init("notify-send")) notify = g_object_new (NOTIFY_TYPE_NOTIFICATION,
exit(1); "summary", summary,
"body", body,
"icon-name", icon_str,
"id", notification_id,
NULL);
notify_notification_set_category (notify, type);
notify_notification_set_urgency (notify, urgency);
notify_notification_set_timeout (notify, expire_timeout);
notify_notification_set_app_name (notify, app_name);
notify = notify_notification_new (summary, body, icon_str, NULL); if (transient) {
notify_notification_set_category (notify, type); notify_notification_set_hint (notify, "transient",
notify_notification_set_urgency (notify, urgency); g_variant_new_boolean (TRUE));
notify_notification_set_timeout (notify, expire_timeout);
notify_notification_show (notify, error); if (!server_has_capability ("persistence")) {
g_debug ("Persistence is not supported by the "
"notifications server. "
"All notifications are transient.");
}
}
poptFreeContext(opt_ctx); g_free (body);
notify_uninit();
return 0; /* Set hints */
if (hints != NULL) {
gint i = 0;
gint l;
char *hint = NULL;
char **tokens = NULL;
while ((hint = hints[i++])) {
tokens = g_strsplit (hint, ":", 3);
l = g_strv_length (tokens);
if (l != 3) {
fprintf (stderr, "%s\n",
N_("Invalid hint syntax specified. "
"Use TYPE:NAME:VALUE."));
hint_error = TRUE;
} else {
retval = notify_notification_set_hint_variant (notify,
tokens[0],
tokens[1],
tokens[2],
&error);
if (!retval) {
fprintf (stderr, "%s\n", error->message);
g_clear_error (&error);
hint_error = TRUE;
}
}
g_strfreev (tokens);
if (hint_error)
break;
}
}
if (actions != NULL) {
gint i = 0;
char *action = NULL;
gchar **spl = NULL;
gboolean have_actions;
have_actions = server_has_capability ("actions");
if (!have_actions) {
g_printerr (N_("Actions are not supported by this "
"notifications server. "
"Displaying non-interactively.\n"));
show_error = TRUE;
}
while (have_actions && (action = actions[i++])) {
gchar *name;
const gchar *label;
spl = g_strsplit (action, "=", 2);
if (g_strv_length (spl) == 1) {
name = g_strdup_printf ("%d", i - 1);
label = g_strstrip (spl[0]);
} else {
name = g_strdup (g_strstrip (spl[0]));
label = g_strstrip (spl[1]);
}
if (*label != '\0' && *name != '\0') {
notify_notification_add_action (notify,
name,
label,
handle_action,
name,
g_free);
wait = TRUE;
}
g_strfreev (spl);
}
g_strfreev (actions);
}
if (wait) {
g_signal_connect (G_OBJECT (notify),
"closed",
G_CALLBACK (handle_closed),
NULL);
if (expire_timeout > 0) {
g_timeout_add (expire_timeout, on_wait_timeout, NULL);
}
}
if (!hint_error) {
retval = notify_notification_show (notify, &error);
if (!retval) {
fprintf (stderr, "%s\n", error->message);
g_clear_error (&error);
show_error = TRUE;
}
}
if (print_id) {
g_object_get (notify, "id", &notification_id, NULL);
g_printf ("%d\n", notification_id);
}
if (wait) {
g_unix_signal_add (SIGINT, on_sigint, notify);
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
g_main_loop_unref (loop);
loop = NULL;
}
g_object_unref (G_OBJECT (notify));
notify_uninit ();
if (hint_error || show_error)
exit (1);
return 0;
} }