437 Commits

Author SHA1 Message Date
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
Nikos Tsipinakis
4aa4e93123 Format the settings file better 2017-02-04 22:10:51 +02:00
Edward Betts
d73526975e fix spelling mistakes 2017-02-01 10:02:01 +00:00
Nikos Tsipinakis
a788770a0f Add the ability to call load_settings more than once
free_ini() didn't properly reset `section_count` and `sections` which
caused a segfault if load_ini_file was called multiple times in the same
run.
2017-01-29 15:32:36 +02:00
Nikos Tsipinakis
63bb4ad857 Move setting enums to settings.h
Not sure why these were in dunst.h in the first place since they are
mostly used by the settings struct.
2017-01-29 15:32:36 +02:00
Nikos Tsipinakis
964688699e Use include guards consistently
* Don't mix pragma guards and include guards, prefer classic include
  guards since apparently pragma guards are not a standard yet.
* Use the DUNST_FILE_H naming convention for all include guards.
2017-01-29 15:32:36 +02:00
Nikos Tsipinakis
a3cce0ec2f Add raw_icon and timeout to notification printout 2017-01-28 12:16:20 +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
4afe2b6924 Vertically align icons 2017-01-21 09:37:02 +02:00
Nikos Tsipinakis
f51f9a19b7 Add missing semicolon 2017-01-21 09:19:02 +02:00
Nikos Tsipinakis
bba3cfe700 Fix segfault when checking for duplicate notifications with raw icons
If a notification has a raw icon, icon is set to NULL which was passed
without checking to strcmp. We don't (yet) support comparing raw icons so
if a raw icon is set, we can safely assume the notification is not a
duplicate.
2017-01-21 09:13:03 +02:00
John Chen
1e477395d9 Fix #281 bad free. Also fix a memory leak. (#282)
* Fix #281 bad free. Also fix a memory leak.

With `n->icon = r->new_icon` and later `free(n->icon)`
`r->new_icon` is wrongly freed. Fix that with strdup.
Also fix an obvious memory leak by the way.
2017-01-21 08:38:36 +02:00
Eizen
ec7905f50f Check file existence instead of null string 2017-01-18 16:58:48 -03:00
Eizen
ce37a46b0f Fix svg icons and free call
Now looks properly in folder for svg icons. Also g_free should be used for maybe_icon_path.
2017-01-18 01:06:27 -03:00
Nikos Tsipinakis
c4a002bc79 Initialise default icon before checking for duplicates
Since we are also comparing the icons, the icon path should be set
before the duplicate check is done
2017-01-16 17:46:06 +02:00
Nikos Tsipinakis
655abd7cc8 Remove unnecessary notification field initializations
Since notification_create was implemented memory is zeroed when a
notification is allocated, as such we don't need to manually set things
to null.
2017-01-01 20:06:01 +02:00
Nikos Tsipinakis
9ec8dbe5db Initialize null fields with sane defaults in notification_init 2017-01-01 20:04:59 +02:00
Nikos Tsipinakis
c6d783f5e2 Replace null checks with assert calls
In my opinion, it's better to crash early when something is wrong than
to pretend it never happened. This change will allow us to catch more
in the long run.
2017-01-01 17:15:29 +02: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
6c9de72c7d Don't consider notifications duplicate if icon or urgency differ
Expand the duplication checking functionality to also check for urgency
and icons. If icons are turned off in the settings the icon check is
skipped.

Icons matching is done based on the given path, if the path differs or
an icon name is used for one notification but an absolute path for
another, the icons are considered different even if they refer to the
same file.
2016-12-22 19:45:38 +02:00
Luke Shumaker
2c93c7a277 Use the appropriate string search functions instead of strstr everywhere.
This mostly means using strchr, but I also found:
  option_parser.c:load_ini_file:
    - replace multiple calls to strstr with strpbrk
  notification.c:notification_init:
    - replace string_replace in a while loop with a single call to
      string_replace_char

redo string replace all
2016-12-17 17:00:43 -03:00
Nikos Tsipinakis
187d3f9ab9 Invalid boolean values should fall back to the default
Previously, an invalid value was always false
2016-12-15 19:13:08 +02:00
Nikos Tsipinakis
a2e0a6efe7 Remove whitespace from empty line 2016-12-15 18:38:34 +02:00
Eizen
bfd24224aa Merge pull request #270 2016-12-13 20:36:55 -03:00
Nikos Tsipinakis
ad6557239a Fix incorrect indentation 2016-12-11 13:41:43 +02:00
Eizen
7f8648742f Fix memory leak
Incorrect call to disposal function, cairo_destroy should be used per cairo documentation.
2016-12-03 17:42:17 -03:00
Nikos Tsipinakis
bae745b1fd Don't use ini_get_int to get doubles
option_get_double used ini_get_int to retrieve values from the config
file, changed it to use ini_get_double so that decimal accuracy isn't
lost.
2016-12-03 19:16:32 +02:00
Eizen
7f12704b07 Merge branch 'master' of tsipinakis/dunst 2016-11-22 15:35:27 -03:00
Eizen
2d562968c0 Fix raw data when icon position is off and uninitialized pointer 2016-11-22 15:22:28 -03:00
Nikos Tsipinakis
756dee58c7 Remove unused function 2016-11-22 17:55:28 +02:00
Eizen
2784950f45 Fix uninitialized value warning and code indentation 2016-11-22 01:47:42 -03:00
Eizen
d605c91790 Fix merge commit 2016-11-20 00:03:25 -03:00
Eizen
b6dafbd444 Merge pull request #174 2016-11-19 23:58:17 -03:00
Nikos Tsipinakis
e0a8b233c2 Move the main function to main.c
Move the main function to main.c in the git root to allow for
alternative main functions to be linked in its place. Specifically this
will be used to link the test runner main to run tests.
2016-11-19 12:15:39 +02:00
Nikos Tsipinakis
2df2e7d06c Move dunst source files to src/ 2016-11-19 11:54:03 +02:00