86 Commits

Author SHA1 Message Date
Benedikt Heine
714731e8fc
Merge pull request #447 from bebehei/image-path
Support image-path hint
2017-11-25 10:56:47 +01:00
Benedikt Heine
bd8fd8b1d2 Improve whitespace handling 2017-11-25 01:38:28 +01:00
Benedikt Heine
fc4f0a4238 Refactor arguments into one line
Parameters should not cover an area. All arguments should be on a single
line (either horizontally or vertically).
2017-11-25 01:32:06 +01:00
Benedikt Heine
34ee1744dd Support image-path hint
As GApplications expose their icon via image-path hint and not via the
actual app_icon field, GApplication icons haven't been displayed before.

According to the notification spec, image-path hint should also override
the app_icon as follows:

1. image-data hint
2. image-path hint
3. app_icon parameter
2017-11-25 00:23:19 +01:00
Benedikt Heine
20807a09b0 Validate closing reasons inside dbus method
Also fixes a nice off by one error. According to notification spec, the
reason 0 doesn't exist, while the undefined reason wouldn't have been
sent.
2017-11-21 16:17:47 +01:00
Benedikt Heine
744712ad77 Use enum for close reason 2017-11-16 18:05:46 +01:00
Nikos Tsipinakis
76857b6e7c
Merge pull request #423 from bebehei/optimize_icons
Optimize icons
2017-11-02 07:54:41 +02:00
Benedikt Heine
11af7402fa Use '-1' for undefined progress 2017-10-31 15:58:41 +01:00
Benedikt Heine
b571698f52 Free Actions in separate method
Also free the memory of the actual Action.
2017-10-31 12:49:19 +01:00
Nikos Tsipinakis
e111f5393e
Merge pull request #411 from bebehei/refactor-queues
Refactor queues
2017-10-31 07:56:38 +02:00
Benedikt Heine
b57483416e Remove command handling from notification_init 2017-10-29 20:38:40 +01:00
Benedikt Heine
38e4bbb7bb Refactor notification_* functions to match queues namespace 2017-10-29 20:38:40 +01:00
Benedikt Heine
f869175d0d Move id assignment to separate function in queues.c
Move all id-changing functions out of notification_init and handle this
in queues.c

Also use stack_duplicates in combination with replacement of
notifications correctly. Fixes #404 (issue not found)
2017-10-29 20:38:40 +01:00
Benedikt Heine
7f335b79d2 Uncouple dunst.h from queues.c again 2017-10-29 20:38:40 +01:00
Benedikt Heine
a7003e3616 Refactor: Move queue specific methods to queues.c 2017-10-29 20:38:40 +01:00
Benedikt Heine
df56528bdc Unref GVariants after use again 2017-10-27 20:15:31 +02:00
Benedikt Heine
e3528ef3ec Indent functions to standard 2017-10-22 10:40:39 +02:00
Benedikt Heine
956b5c6401 Use gint64 as microseconds for internal timeunit
time(NULL) is vulnerable against timeshifts by NTP, timezones,...

g_get_monotonic_time() is not, but counts its in microseconds with the
gint64 datatype. To prevent any conversion bugs, all internal
timeformats are now using a gint64 and only get converted during import
or export (DBus notification arrives, configuration reading, age
threshold display).
2017-10-07 17:46:21 +02:00
Nikos Tsipinakis
16bbde5bf3 Merge pull request #343 from bebehei/transient-notifications
add support for transient hints
2017-09-07 14:01:19 +03:00
Benedikt Heine
759aa518d5 Refactor star scheme of pointers
To achieve a consistent scheme, all stars of the
pointers should be on the side of the variable and
not on the side of the type.

wrong: char* a
wrong: char * a
good:  char *a

This commit is generated by the following sed command
with manual fixes of all false positives.

find src \( -name '*.c' -or -name '*.h' \) -print0
| xargs -0 -n1 sed -i
's/\([a-zA-Z]\+[-_a-zA-Z0-9]*\)\s*\*\s\+
\([a-zA-Z]\+[-_a-zA-Z0-9]*\)/\1 *\2/g'
2017-09-06 23:14:25 +02:00
Benedikt Heine
02ba060490 Refactor if chain to avoid nested statements 2017-08-19 12:46:00 +02:00
Benedikt Heine
585f0f85e0 Add support for transistent hints 2017-08-19 12:46:00 +02:00
Steven Schäfer
d61a6183a5 parse raw icons from the (deprecated) image_data attribute 2017-08-06 22:11:10 +02:00
Benedikt Heine
c9980347cf improve readability in dbus.c 2017-07-23 02:12:10 +02:00
tadly
2587173048 added body-hyperlinks to capabilities as it is supported 2017-04-05 16:44:04 +02:00
Nikos Tsipinakis
f624c42432 Improve dbus error handling
* Improve error reporting to also include the glib error messages
* Call g_error_free after an error to avoid leaking memory.
2017-02-20 18:04:24 +02:00
Nikos Tsipinakis
37628f3dc4 Print errors to stderr
A lot of error reporting used a simple `printf` call which by default
prints to stdout. This was changed so that all error reporting is done
by an `fprintf(stderr, ...)` call.
2017-02-20 17:48:11 +02:00
John Chen
8ba62dc78a Use g_malloc0 where appropriate; remove unneeded null check 2017-02-14 00:45:02 +08:00
John Chen
17e2929ee7 Change malloc and related functions to glib ones.
* malloc  -> g_malloc
* realloc -> g_realloc
* free    -> g_free
* strdup  -> g_strdup
* strndup -> g_strndup
2017-02-14 00:44:53 +08:00
John Chen
7037afb2bc Fix include. Add empty lines between include layers. 2017-02-14 00:39:04 +08:00
Nikos Tsipinakis
4e1b97f3cc Merge allow_markup and plain_text into markup
Merge the allow_markup and plain_text settings into a single setting.

These 2 settings had a similar function, allow_markup controlled whether
markup was parsed or stripped and plain_text whether the notification
was escaped and displayed as is.

To cover all the possible combinations of the settings mentioned above
`markup` can take the following values:

full:  The equivalent of allow_markup yes, plain_text no.
       Passes the text straight to pango with minimal parsing. All valid
       pango tags will be parsed.

strip: The equivalent of allow_markup no, plain_text no.
       Strips the markup using string_strip_delimited. The parsing is
       simplistic and if there are any unescaped '<' and/or '>'
       characters it might get tripped and strip out actual text.

       According to the GNOME notification specification, if a server
       doesn't support markup(and we don't advertise that we do if it is
       turned off) it should be stripped clientside, so this setting
       should rarely be used. It is mainly left in for compatibility
       with broken clients that don't follow the specification.

no:   The equivalent of allow_markup [yes/no](any value), plain_text
      yes.
      Makes the notification content be rendered as plain text
      regardless if it contains markup. Any Markup will be shown as
      regular text.

Markup inside 'format' will still be parsed regardless of what markup is
set to.

Closes #279
2017-02-04 22:10:51 +02:00
Steven Allen
2b2992de38 Fix a double free in on_get_capabilities.
`value` was already being freed by `g_dbus_method_invocation_return_value`.

Fixes #215
2017-01-26 16:38:38 -08:00
Nikos Tsipinakis
0cb1524cc6 Don't check return status of notification_create
notification_create is guaranteed to return a pointer to a notification,
if the memory allocation fails it throws an error and exits the program.
2017-01-01 17:05:25 +02:00
Nikos Tsipinakis
0a0c02021d Update functions in dbus.c to use camel_case for consistency 2016-12-22 20:00:45 +02:00
Nikos Tsipinakis
de9c52f98f Implement notification_create function
notification_create currently simply allocates memory and zeroes it to
properly initialise a notification. Since we currently have at least 2
places in the code that create notifications(startup notification in
dunst.c and notifications from dbus in dbus.c) the creation should be
handled from a central location in case we ever need to change the
creation procedure later on.
2016-12-22 19:49:29 +02:00
Nikos Tsipinakis
2df2e7d06c Move dunst source files to src/ 2016-11-19 11:54:03 +02:00