Remove libxdg-basedir dependency
GLib's g_get_user_config_dir function does exactly the same thing and we don't need libxdg-basedir for something else.
This commit is contained in:
parent
0306446efb
commit
403e4cc176
@ -8,7 +8,6 @@ addons:
|
|||||||
- libxrandr-dev
|
- libxrandr-dev
|
||||||
- libxinerama-dev
|
- libxinerama-dev
|
||||||
- libxss-dev
|
- libxss-dev
|
||||||
- libxdg-basedir-dev
|
|
||||||
- libglib2.0-dev
|
- libglib2.0-dev
|
||||||
- libpango1.0-dev
|
- libpango1.0-dev
|
||||||
- libcairo2-dev
|
- libcairo2-dev
|
||||||
|
@ -1,14 +1,3 @@
|
|||||||
{
|
|
||||||
xdgBaseDir_leak
|
|
||||||
# see https://github.com/devnev/libxdg-basedir/pull/6
|
|
||||||
Memcheck:Leak
|
|
||||||
fun:malloc
|
|
||||||
...
|
|
||||||
fun:xdgInitHandle
|
|
||||||
...
|
|
||||||
fun:main
|
|
||||||
}
|
|
||||||
|
|
||||||
# librsvg leaks some memory, when an invalid svg file is read
|
# librsvg leaks some memory, when an invalid svg file is read
|
||||||
# TODO: find the memory leak and fix it upstream
|
# TODO: find the memory leak and fix it upstream
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Remove libxdg-basedir dependency (GLib's function is used instead)
|
||||||
- `fullscreen` rule to hide notifications when a fullscreen window is active
|
- `fullscreen` rule to hide notifications when a fullscreen window is active
|
||||||
- When new notifications arrive, but display is full, important notifications don't
|
- When new notifications arrive, but display is full, important notifications don't
|
||||||
have to wait for a timeout in a displayed notification (#541)
|
have to wait for a timeout in a displayed notification (#541)
|
||||||
|
@ -22,7 +22,6 @@ Dunst has a number of build dependencies that must be present before attempting
|
|||||||
- libxinerama
|
- libxinerama
|
||||||
- libxrandr
|
- libxrandr
|
||||||
- libxss
|
- libxss
|
||||||
- libxdg-basedir
|
|
||||||
- glib
|
- glib
|
||||||
- pango/cairo
|
- pango/cairo
|
||||||
- libgtk-3-dev
|
- libgtk-3-dev
|
||||||
|
@ -32,10 +32,7 @@ pkg_config_packs := dbus-1 \
|
|||||||
"xrandr >= 1.5" \
|
"xrandr >= 1.5" \
|
||||||
xscrnsaver
|
xscrnsaver
|
||||||
|
|
||||||
# check if we need libxdg-basedir
|
ifneq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
||||||
ifeq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
|
||||||
pkg_config_packs += libxdg-basedir
|
|
||||||
else
|
|
||||||
$(warning STATIC_CONFIG is deprecated behavior. It will get removed in future releases)
|
$(warning STATIC_CONFIG is deprecated behavior. It will get removed in future releases)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef STATIC_CONFIG
|
|
||||||
#include <basedir.h>
|
|
||||||
#include <basedir_fs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "rules.h" // put before config.h to fix missing include
|
#include "rules.h" // put before config.h to fix missing include
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -88,15 +84,35 @@ static enum urgency ini_get_urgency(const char *section, const char *key, const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FILE *xdg_config(const char *filename)
|
||||||
|
{
|
||||||
|
const gchar * const * systemdirs = g_get_system_config_dirs();
|
||||||
|
const gchar * userdir = g_get_user_config_dir();
|
||||||
|
|
||||||
|
FILE *f;
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
path = g_strconcat(userdir, filename, NULL);
|
||||||
|
f = fopen(path, "r");
|
||||||
|
g_free(path);
|
||||||
|
|
||||||
|
for (const gchar * const *d = systemdirs;
|
||||||
|
!f && *d;
|
||||||
|
d++) {
|
||||||
|
path = g_strconcat(*d, filename, NULL);
|
||||||
|
f = fopen(path, "r");
|
||||||
|
g_free(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
void load_settings(char *cmdline_config_path)
|
void load_settings(char *cmdline_config_path)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef STATIC_CONFIG
|
#ifndef STATIC_CONFIG
|
||||||
xdgHandle xdg;
|
|
||||||
FILE *config_file = NULL;
|
FILE *config_file = NULL;
|
||||||
|
|
||||||
xdgInitHandle(&xdg);
|
|
||||||
|
|
||||||
if (cmdline_config_path) {
|
if (cmdline_config_path) {
|
||||||
if (0 == strcmp(cmdline_config_path, "-")) {
|
if (0 == strcmp(cmdline_config_path, "-")) {
|
||||||
config_file = stdin;
|
config_file = stdin;
|
||||||
@ -104,21 +120,23 @@ void load_settings(char *cmdline_config_path)
|
|||||||
config_file = fopen(cmdline_config_path, "r");
|
config_file = fopen(cmdline_config_path, "r");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!config_file) {
|
if (!config_file) {
|
||||||
DIE("Cannot find config file: '%s'", cmdline_config_path);
|
DIE("Cannot find config file: '%s'", cmdline_config_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config_file) {
|
if (!config_file) {
|
||||||
config_file = xdgConfigOpen("dunst/dunstrc", "r", &xdg);
|
config_file = xdg_config("/dunst/dunstrc");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config_file) {
|
if (!config_file) {
|
||||||
/* Fall back to just "dunstrc", which was used before 2013-06-23
|
/* Fall back to just "dunstrc", which was used before 2013-06-23
|
||||||
* (before v0.2). */
|
* (before v0.2). */
|
||||||
config_file = xdgConfigOpen("dunstrc", "r", &xdg);
|
config_file = xdg_config("/dunstrc");
|
||||||
if (!config_file) {
|
}
|
||||||
LOG_W("No dunstrc found.");
|
|
||||||
xdgWipeHandle(&xdg);
|
if (!config_file) {
|
||||||
}
|
LOG_W("No dunstrc found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
load_ini_file(config_file);
|
load_ini_file(config_file);
|
||||||
@ -788,7 +806,6 @@ void load_settings(char *cmdline_config_path)
|
|||||||
if (config_file) {
|
if (config_file) {
|
||||||
fclose(config_file);
|
fclose(config_file);
|
||||||
free_ini();
|
free_ini();
|
||||||
xdgWipeHandle(&xdg);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user