Translate fprintf statements into log messages
This commit is contained in:
parent
b5516be360
commit
19b364d67c
40
src/dbus.c
40
src/dbus.c
@ -7,6 +7,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "dunst.h"
|
#include "dunst.h"
|
||||||
|
#include "log.h"
|
||||||
#include "notification.h"
|
#include "notification.h"
|
||||||
#include "queues.h"
|
#include "queues.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -100,8 +101,9 @@ void handle_method_call(GDBusConnection *connection,
|
|||||||
} else if (g_strcmp0(method_name, "GetServerInformation") == 0) {
|
} else if (g_strcmp0(method_name, "GetServerInformation") == 0) {
|
||||||
on_get_server_information(connection, sender, parameters, invocation);
|
on_get_server_information(connection, sender, parameters, invocation);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "WARNING: sender: %s; unknown method_name: %s\n", sender,
|
LOG_M("Unknown method name: '%s' (sender: '%s').",
|
||||||
method_name);
|
method_name,
|
||||||
|
sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,14 +344,13 @@ static void on_get_server_information(GDBusConnection *connection,
|
|||||||
void signal_notification_closed(notification *n, enum reason reason)
|
void signal_notification_closed(notification *n, enum reason reason)
|
||||||
{
|
{
|
||||||
if (reason < REASON_MIN || REASON_MAX < reason) {
|
if (reason < REASON_MIN || REASON_MAX < reason) {
|
||||||
fprintf(stderr, "ERROR: Closing notification with reason '%d' not supported. "
|
LOG_W("Closing notification with reason '%d' not supported. "
|
||||||
"Closing it with reason '%d'.\n", reason, REASON_UNDEF);
|
"Closing it with reason '%d'.", reason, REASON_UNDEF);
|
||||||
reason = REASON_UNDEF;
|
reason = REASON_UNDEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_conn) {
|
if (!dbus_conn) {
|
||||||
fprintf(stderr, "ERROR: Tried to close notification but dbus connection not set!\n");
|
LOG_E("Unable to close notification: No DBus connection.");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GVariant *body = g_variant_new("(uu)", n->id, reason);
|
GVariant *body = g_variant_new("(uu)", n->id, reason);
|
||||||
@ -364,7 +365,7 @@ void signal_notification_closed(notification *n, enum reason reason)
|
|||||||
&err);
|
&err);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
fprintf(stderr, "Unable to close notification: %s\n", err->message);
|
LOG_W("Unable to close notification: %s", err->message);
|
||||||
g_error_free(err);
|
g_error_free(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +385,7 @@ void signal_action_invoked(notification *n, const char *identifier)
|
|||||||
&err);
|
&err);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
fprintf(stderr, "Unable to invoke action: %s\n", err->message);
|
LOG_W("Unable to invoke action: %s", err->message);
|
||||||
g_error_free(err);
|
g_error_free(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,8 +411,7 @@ static void on_bus_acquired(GDBusConnection *connection,
|
|||||||
&err);
|
&err);
|
||||||
|
|
||||||
if (registration_id == 0) {
|
if (registration_id == 0) {
|
||||||
fprintf(stderr, "Unable to register dbus connection: %s\n", err->message);
|
DIE("Unable to register dbus connection: %s", err->message);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,14 +536,14 @@ static void on_name_lost(GDBusConnection *connection,
|
|||||||
if (connection) {
|
if (connection) {
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
int pid = dbus_get_fdn_daemon_info(connection, &name, NULL);
|
int pid = dbus_get_fdn_daemon_info(connection, &name, NULL);
|
||||||
if (pid > 0)
|
if (pid > 0) {
|
||||||
fprintf(stderr, "Cannot acquire '"FDN_NAME"': "
|
DIE("Cannot acquire '"FDN_NAME"': "
|
||||||
"Name is acquired by '%s' with PID '%d'.\n", name, pid);
|
"Name is acquired by '%s' with PID '%d'.", name, pid);
|
||||||
else
|
|
||||||
fprintf(stderr, "Cannot acquire '"FDN_NAME"'.\n");
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Cannot connect to DBus.\n");
|
DIE("Cannot acquire '"FDN_NAME"'.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DIE("Cannot connect to DBus.");
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -568,10 +568,10 @@ static RawImage *get_raw_image_from_data_hint(GVariant *icon_data)
|
|||||||
* ((image->n_channels * image->bits_per_sample + 7) / 8);
|
* ((image->n_channels * image->bits_per_sample + 7) / 8);
|
||||||
|
|
||||||
if (expected_len != g_variant_get_size (data_variant)) {
|
if (expected_len != g_variant_get_size (data_variant)) {
|
||||||
fprintf(stderr, "Expected image data to be of length %" G_GSIZE_FORMAT
|
LOG_W("Expected image data to be of length %" G_GSIZE_FORMAT
|
||||||
" but got a " "length of %" G_GSIZE_FORMAT,
|
" but got a length of %" G_GSIZE_FORMAT,
|
||||||
expected_len,
|
expected_len,
|
||||||
g_variant_get_size (data_variant));
|
g_variant_get_size(data_variant));
|
||||||
g_free(image);
|
g_free(image);
|
||||||
g_variant_unref(data_variant);
|
g_variant_unref(data_variant);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
12
src/markup.c
12
src/markup.c
@ -7,6 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
@ -68,16 +69,14 @@ void markup_strip_a(char **str, char **urls)
|
|||||||
|
|
||||||
// the tag is broken, ignore it
|
// the tag is broken, ignore it
|
||||||
if (!tag1_end) {
|
if (!tag1_end) {
|
||||||
fprintf(stderr,
|
LOG_W("Given link is broken: '%s'",
|
||||||
"WARNING: Given link is broken: '%s'\n",
|
|
||||||
tag1);
|
tag1);
|
||||||
string_replace_at(*str, tag1-*str, strlen(tag1), "");
|
string_replace_at(*str, tag1-*str, strlen(tag1), "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tag2 && tag2 < tag1_end) {
|
if (tag2 && tag2 < tag1_end) {
|
||||||
int repl_len = (tag2 - tag1) + strlen("</a>");
|
int repl_len = (tag2 - tag1) + strlen("</a>");
|
||||||
fprintf(stderr,
|
LOG_W("Given link is broken: '%.*s.'",
|
||||||
"WARNING: Given link is broken: '%.*s.'\n",
|
|
||||||
repl_len, tag1);
|
repl_len, tag1);
|
||||||
string_replace_at(*str, tag1-*str, repl_len, "");
|
string_replace_at(*str, tag1-*str, repl_len, "");
|
||||||
break;
|
break;
|
||||||
@ -147,7 +146,7 @@ void markup_strip_img(char **str, char **urls)
|
|||||||
|
|
||||||
// the tag is broken, ignore it
|
// the tag is broken, ignore it
|
||||||
if (!end) {
|
if (!end) {
|
||||||
fprintf(stderr, "WARNING: Given image is broken: '%s'\n", start);
|
LOG_W("Given image is broken: '%s'", start);
|
||||||
string_replace_at(*str, start-*str, strlen(start), "");
|
string_replace_at(*str, start-*str, strlen(start), "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -188,8 +187,7 @@ void markup_strip_img(char **str, char **urls)
|
|||||||
text_src = g_strndup(src_s, src_e-src_s);
|
text_src = g_strndup(src_s, src_e-src_s);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,
|
LOG_W("Given image argument is broken: '%.*s'",
|
||||||
"WARNING: Given image argument is broken: '%.*s'\n",
|
|
||||||
(int)(end-start), start);
|
(int)(end-start), start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
#include "dunst.h"
|
#include "dunst.h"
|
||||||
|
#include "log.h"
|
||||||
#include "notification.h"
|
#include "notification.h"
|
||||||
#include "queues.h"
|
#include "queues.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -134,7 +135,7 @@ void invoke_action(const char *action)
|
|||||||
|
|
||||||
char *appname_begin = strchr(action, '[');
|
char *appname_begin = strchr(action, '[');
|
||||||
if (!appname_begin) {
|
if (!appname_begin) {
|
||||||
printf("invalid action: %s\n", action);
|
LOG_W("Invalid action: '%s'", action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appname_begin++;
|
appname_begin++;
|
||||||
@ -188,7 +189,7 @@ void dispatch_menu_result(const char *input)
|
|||||||
void context_menu(void)
|
void context_menu(void)
|
||||||
{
|
{
|
||||||
if (settings.dmenu_cmd == NULL) {
|
if (settings.dmenu_cmd == NULL) {
|
||||||
fprintf(stderr, "dmenu command not set properly. Cowardly refusing to open the context menu.\n");
|
LOG_C("Unable to open dmenu: No dmenu command set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char *dmenu_input = NULL;
|
char *dmenu_input = NULL;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
#include "dunst.h"
|
#include "dunst.h"
|
||||||
|
#include "log.h"
|
||||||
#include "markup.h"
|
#include "markup.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "queues.h"
|
#include "queues.h"
|
||||||
@ -33,6 +34,7 @@ static void notification_dmenu_string(notification *n);
|
|||||||
*/
|
*/
|
||||||
void notification_print(notification *n)
|
void notification_print(notification *n)
|
||||||
{
|
{
|
||||||
|
//TODO: use logging info for this
|
||||||
printf("{\n");
|
printf("{\n");
|
||||||
printf("\tappname: '%s'\n", n->appname);
|
printf("\tappname: '%s'\n", n->appname);
|
||||||
printf("\tsummary: '%s'\n", n->summary);
|
printf("\tsummary: '%s'\n", n->summary);
|
||||||
@ -416,12 +418,11 @@ static void notification_format_message(notification *n)
|
|||||||
MARKUP_NO);
|
MARKUP_NO);
|
||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
fprintf(stderr, "WARNING: format_string has trailing %% character."
|
LOG_W("format_string has trailing %% character. "
|
||||||
"To escape it use %%%%.");
|
"To escape it use %%%%.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "WARNING: format_string %%%c"
|
LOG_W("format_string %%%c is unknown.", substr[1]);
|
||||||
" is unknown\n", substr[1]);
|
|
||||||
// shift substr pointer forward,
|
// shift substr pointer forward,
|
||||||
// as we can't interpret the format string
|
// as we can't interpret the format string
|
||||||
substr++;
|
substr++;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "dunst.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
@ -239,10 +240,7 @@ int load_ini_file(FILE *fp)
|
|||||||
if (*start == '[') {
|
if (*start == '[') {
|
||||||
char *end = strchr(start + 1, ']');
|
char *end = strchr(start + 1, ']');
|
||||||
if (!end) {
|
if (!end) {
|
||||||
fprintf(stderr,
|
LOG_W("Invalid config file at line %d: Missing ']'.", line_num);
|
||||||
"Warning: invalid config file at line %d\n",
|
|
||||||
line_num);
|
|
||||||
fprintf(stderr, "Missing ']'\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,10 +254,7 @@ int load_ini_file(FILE *fp)
|
|||||||
|
|
||||||
char *equal = strchr(start + 1, '=');
|
char *equal = strchr(start + 1, '=');
|
||||||
if (!equal) {
|
if (!equal) {
|
||||||
fprintf(stderr,
|
LOG_W("Invalid config file at line %d: Missing '='.", line_num);
|
||||||
"Warning: invalid config file at line %d\n",
|
|
||||||
line_num);
|
|
||||||
fprintf(stderr, "Missing '='\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,10 +266,7 @@ int load_ini_file(FILE *fp)
|
|||||||
if (quote) {
|
if (quote) {
|
||||||
char *closing_quote = strchr(quote + 1, '"');
|
char *closing_quote = strchr(quote + 1, '"');
|
||||||
if (!closing_quote) {
|
if (!closing_quote) {
|
||||||
fprintf(stderr,
|
LOG_W("Invalid config file at line %d: Missing '\"'.", line_num);
|
||||||
"Warning: invalid config file at line %d\n",
|
|
||||||
line_num);
|
|
||||||
fprintf(stderr, "Missing '\"'\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -285,10 +277,7 @@ int load_ini_file(FILE *fp)
|
|||||||
value = g_strstrip(value);
|
value = g_strstrip(value);
|
||||||
|
|
||||||
if (!current_section) {
|
if (!current_section) {
|
||||||
fprintf(stderr,
|
LOG_W("Invalid config file at line %d: Key value pair without a section.", line_num);
|
||||||
"Warning: invalid config file at line %d\n",
|
|
||||||
line_num);
|
|
||||||
fprintf(stderr, "Key value pair without a section\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,8 +338,7 @@ static const char *cmdline_get_value(const char *key)
|
|||||||
|
|
||||||
if (idx + 1 >= cmdline_argc) {
|
if (idx + 1 >= cmdline_argc) {
|
||||||
/* the argument is missing */
|
/* the argument is missing */
|
||||||
fprintf(stderr, "Warning: %s, missing argument. Ignoring\n",
|
LOG_W("%s: Missing argument. Ignoring.", key);
|
||||||
key);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return cmdline_argv[idx + 1];
|
return cmdline_argv[idx + 1];
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "notification.h"
|
#include "notification.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ int queues_notification_insert(notification *n)
|
|||||||
if (settings.always_run_script) {
|
if (settings.always_run_script) {
|
||||||
notification_run_script(n);
|
notification_run_script(n);
|
||||||
}
|
}
|
||||||
printf("skipping notification: %s %s\n", n->body, n->summary);
|
LOG_M("Skipping notification: '%s' '%s'", n->body, n->summary);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Do not insert the message if it's a command */
|
/* Do not insert the message if it's a command */
|
||||||
|
@ -29,7 +29,7 @@ static void parse_follow_mode(const char *mode)
|
|||||||
else if (strcmp(mode, "none") == 0)
|
else if (strcmp(mode, "none") == 0)
|
||||||
settings.f_mode = FOLLOW_NONE;
|
settings.f_mode = FOLLOW_NONE;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Warning: unknown follow mode: \"%s\"\n", mode);
|
LOG_W("Unknown follow mode: '%s'", mode);
|
||||||
settings.f_mode = FOLLOW_NONE;
|
settings.f_mode = FOLLOW_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ static enum markup_mode parse_markup_mode(const char *mode)
|
|||||||
} else if (strcmp(mode, "full") == 0 || strcmp(mode, "yes") == 0) {
|
} else if (strcmp(mode, "full") == 0 || strcmp(mode, "yes") == 0) {
|
||||||
return MARKUP_FULL;
|
return MARKUP_FULL;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Warning: unknown markup mode: \"%s\"\n", mode);
|
LOG_W("Unknown markup mode: '%s'", mode);
|
||||||
return MARKUP_NO;
|
return MARKUP_NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,9 +61,7 @@ static enum urgency ini_get_urgency(const char *section, const char *key, const
|
|||||||
else if (strcmp(urg, "critical") == 0)
|
else if (strcmp(urg, "critical") == 0)
|
||||||
ret = URG_CRIT;
|
ret = URG_CRIT;
|
||||||
else
|
else
|
||||||
fprintf(stderr,
|
LOG_W("Unknown urgency: '%s'", urg);
|
||||||
"unknown urgency: %s, ignoring\n",
|
|
||||||
urg);
|
|
||||||
}
|
}
|
||||||
g_free(urg);
|
g_free(urg);
|
||||||
return ret;
|
return ret;
|
||||||
@ -97,15 +95,15 @@ void load_settings(char *cmdline_config_path)
|
|||||||
* (before v0.2). */
|
* (before v0.2). */
|
||||||
config_file = xdgConfigOpen("dunstrc", "r", &xdg);
|
config_file = xdgConfigOpen("dunstrc", "r", &xdg);
|
||||||
if (config_file == NULL) {
|
if (config_file == NULL) {
|
||||||
puts("no dunstrc found -> skipping\n");
|
LOG_W("No dunstrc found.");
|
||||||
xdgWipeHandle(&xdg);
|
xdgWipeHandle(&xdg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
load_ini_file(config_file);
|
load_ini_file(config_file);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Warning: dunstrc parsing disabled. "
|
LOG_M("dunstrc parsing disabled. "
|
||||||
"Using STATIC_CONFIG is deprecated behavior.\n");
|
"Using STATIC_CONFIG is deprecated behavior.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
settings.per_monitor_dpi = option_get_bool(
|
settings.per_monitor_dpi = option_get_bool(
|
||||||
@ -136,7 +134,8 @@ void load_settings(char *cmdline_config_path)
|
|||||||
);
|
);
|
||||||
|
|
||||||
settings.markup = (allow_markup ? MARKUP_FULL : MARKUP_STRIP);
|
settings.markup = (allow_markup ? MARKUP_FULL : MARKUP_STRIP);
|
||||||
fprintf(stderr, "Warning: 'allow_markup' is deprecated, please use 'markup' instead.\n");
|
LOG_M("'allow_markup' is deprecated, please "
|
||||||
|
"use 'markup' instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *c = option_get_string(
|
char *c = option_get_string(
|
||||||
@ -196,7 +195,7 @@ void load_settings(char *cmdline_config_path)
|
|||||||
} else if (strcmp(c, "end") == 0) {
|
} else if (strcmp(c, "end") == 0) {
|
||||||
settings.ellipsize = end;
|
settings.ellipsize = end;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Warning: unknown ellipsize value: \"%s\"\n", c);
|
LOG_W("Unknown ellipsize value: '%s'", c);
|
||||||
settings.ellipsize = defaults.ellipsize;
|
settings.ellipsize = defaults.ellipsize;
|
||||||
}
|
}
|
||||||
g_free(c);
|
g_free(c);
|
||||||
@ -284,8 +283,7 @@ void load_settings(char *cmdline_config_path)
|
|||||||
else if (strcmp(c, "right") == 0)
|
else if (strcmp(c, "right") == 0)
|
||||||
settings.align = right;
|
settings.align = right;
|
||||||
else
|
else
|
||||||
fprintf(stderr,
|
LOG_W("Unknown alignment value: '%s'", c);
|
||||||
"Warning: unknown alignment\n");
|
|
||||||
g_free(c);
|
g_free(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,8 +385,8 @@ void load_settings(char *cmdline_config_path)
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
if (!g_shell_parse_argv(settings.dmenu, NULL, &settings.dmenu_cmd, &error)) {
|
if (!g_shell_parse_argv(settings.dmenu, NULL, &settings.dmenu_cmd, &error)) {
|
||||||
fprintf(stderr, "Unable to parse dmenu command: %s\n", error->message);
|
LOG_W("Unable to parse dmenu command: '%s'."
|
||||||
fprintf(stderr, "dmenu functionality will be disabled.\n");
|
"dmenu functionality will be disabled.", error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
settings.dmenu_cmd = NULL;
|
settings.dmenu_cmd = NULL;
|
||||||
}
|
}
|
||||||
@ -416,8 +414,7 @@ void load_settings(char *cmdline_config_path)
|
|||||||
else if (strcmp(c, "off") == 0)
|
else if (strcmp(c, "off") == 0)
|
||||||
settings.icon_position = icons_off;
|
settings.icon_position = icons_off;
|
||||||
else
|
else
|
||||||
fprintf(stderr,
|
LOG_W("Unknown icon position: '%s'", c);
|
||||||
"Warning: unknown icon position: %s\n", c);
|
|
||||||
g_free(c);
|
g_free(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,7 +433,7 @@ void load_settings(char *cmdline_config_path)
|
|||||||
"icon_folders", "-icon_folders", defaults.icon_path,
|
"icon_folders", "-icon_folders", defaults.icon_path,
|
||||||
"folders to default icons (deprecated, please use 'icon_path' instead)"
|
"folders to default icons (deprecated, please use 'icon_path' instead)"
|
||||||
);
|
);
|
||||||
fprintf(stderr, "Warning: 'icon_folders' is deprecated, please use 'icon_path' instead.\n");
|
LOG_M("The option 'icon_folders' is deprecated, please use 'icon_path' instead.");
|
||||||
}
|
}
|
||||||
// Read value and generate usage string for icon_path.
|
// Read value and generate usage string for icon_path.
|
||||||
// If icon_path is set, override icon_folder.
|
// If icon_path is set, override icon_folder.
|
||||||
@ -456,7 +453,9 @@ void load_settings(char *cmdline_config_path)
|
|||||||
"width", NULL, defaults.frame_width,
|
"width", NULL, defaults.frame_width,
|
||||||
"Width of frame around the window"
|
"Width of frame around the window"
|
||||||
);
|
);
|
||||||
fprintf(stderr, "Warning: The frame section is deprecated, width has been renamed to frame_width and moved to the global section.\n");
|
LOG_M("The frame section is deprecated, width has "
|
||||||
|
"been renamed to frame_width and moved to "
|
||||||
|
"the global section.");
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.frame_width = option_get_int(
|
settings.frame_width = option_get_int(
|
||||||
@ -472,7 +471,9 @@ void load_settings(char *cmdline_config_path)
|
|||||||
"color", NULL, defaults.frame_color,
|
"color", NULL, defaults.frame_color,
|
||||||
"Color of the frame around the window"
|
"Color of the frame around the window"
|
||||||
);
|
);
|
||||||
fprintf(stderr, "Warning: The frame section is deprecated, color has been renamed to frame_color and moved to the global section.\n");
|
LOG_M("The frame section is deprecated, color "
|
||||||
|
"has been renamed to frame_color and moved "
|
||||||
|
"to the global section.");
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.frame_color = option_get_string(
|
settings.frame_color = option_get_string(
|
||||||
|
@ -136,13 +136,13 @@ gint64 string_to_time(const char *string)
|
|||||||
gint64 val = strtoll(string, &endptr, 10);
|
gint64 val = strtoll(string, &endptr, 10);
|
||||||
|
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
fprintf(stderr, "ERROR: Time: '%s': %s.\n", string, strerror(errno));
|
LOG_W("Time: '%s': %s.", string, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
} else if (string == endptr) {
|
} else if (string == endptr) {
|
||||||
fprintf(stderr, "ERROR: Time: No digits found.\n");
|
LOG_W("Time: '%s': No digits found.", string);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (errno != 0 && val == 0) {
|
} else if (errno != 0 && val == 0) {
|
||||||
fprintf(stderr, "ERROR: Time: '%s' unknown error.\n", string);
|
LOG_W("Time: '%s': Unknown error.", string);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (errno == 0 && !*endptr) {
|
} else if (errno == 0 && !*endptr) {
|
||||||
return val * G_USEC_PER_SEC;
|
return val * G_USEC_PER_SEC;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "src/log.h"
|
||||||
#include "src/settings.h"
|
#include "src/settings.h"
|
||||||
#include "x.h"
|
#include "x.h"
|
||||||
|
|
||||||
@ -90,7 +91,8 @@ void randr_init()
|
|||||||
{
|
{
|
||||||
int randr_error_base = 0;
|
int randr_error_base = 0;
|
||||||
if (!XRRQueryExtension(xctx.dpy, &randr_event_base, &randr_error_base)) {
|
if (!XRRQueryExtension(xctx.dpy, &randr_event_base, &randr_error_base)) {
|
||||||
fprintf(stderr, "Could not initialize the RandR extension, falling back to single monitor mode.\n");
|
LOG_W("Could not initialize the RandR extension. "
|
||||||
|
"Falling back to single monitor mode.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XRRQueryVersion(xctx.dpy, &randr_major_version, &randr_minor_version);
|
XRRQueryVersion(xctx.dpy, &randr_major_version, &randr_minor_version);
|
||||||
@ -101,7 +103,8 @@ void randr_update()
|
|||||||
{
|
{
|
||||||
if (randr_major_version < 1
|
if (randr_major_version < 1
|
||||||
|| (randr_major_version == 1 && randr_minor_version < 5)) {
|
|| (randr_major_version == 1 && randr_minor_version < 5)) {
|
||||||
fprintf(stderr, "Server RandR version too low (%i.%i). Falling back to single monitor mode\n",
|
LOG_W("Server RandR version too low (%i.%i). "
|
||||||
|
"Falling back to single monitor mode.",
|
||||||
randr_major_version,
|
randr_major_version,
|
||||||
randr_minor_version);
|
randr_minor_version);
|
||||||
screen_update_fallback();
|
screen_update_fallback();
|
||||||
@ -112,7 +115,8 @@ void randr_update()
|
|||||||
XRRMonitorInfo *m = XRRGetMonitors(xctx.dpy, RootWindow(xctx.dpy, DefaultScreen(xctx.dpy)), true, &n);
|
XRRMonitorInfo *m = XRRGetMonitors(xctx.dpy, RootWindow(xctx.dpy, DefaultScreen(xctx.dpy)), true, &n);
|
||||||
|
|
||||||
if (n < 1) {
|
if (n < 1) {
|
||||||
fprintf(stderr, "Get monitors reported %i monitors, falling back to single monitor mode\n", n);
|
LOG_C("Get monitors reported %i monitors. "
|
||||||
|
"Falling back to single monitor mode.", n);
|
||||||
screen_update_fallback();
|
screen_update_fallback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -150,7 +154,8 @@ void xinerama_update()
|
|||||||
XineramaScreenInfo *info = XineramaQueryScreens(xctx.dpy, &n);
|
XineramaScreenInfo *info = XineramaQueryScreens(xctx.dpy, &n);
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
fprintf(stderr, "(Xinerama) Could not get screen info, falling back to single monitor mode\n");
|
LOG_W("Could not get xinerama screen info. "
|
||||||
|
"Falling back to single monitor mode.");
|
||||||
screen_update_fallback();
|
screen_update_fallback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
20
src/x11/x.c
20
src/x11/x.c
@ -84,7 +84,7 @@ static color_t x_string_to_color_t(const char *str)
|
|||||||
char *end;
|
char *end;
|
||||||
long int val = strtol(str+1, &end, 16);
|
long int val = strtol(str+1, &end, 16);
|
||||||
if (*end != '\0' && *(end+1) != '\0') {
|
if (*end != '\0' && *(end+1) != '\0') {
|
||||||
printf("WARNING: Invalid color string: \"%s\"\n", str);
|
LOG_W("Invalid color string: '%s'", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return x_color_hex_to_double(val);
|
return x_color_hex_to_double(val);
|
||||||
@ -133,9 +133,7 @@ static color_t x_get_separator_color(colored_layout *cl, colored_layout *cl_next
|
|||||||
case AUTO:
|
case AUTO:
|
||||||
return calculate_foreground_color(cl->bg);
|
return calculate_foreground_color(cl->bg);
|
||||||
default:
|
default:
|
||||||
printf("Unknown separator color type. Please file a Bugreport.\n");
|
LOG_E("Unknown separator color type.");
|
||||||
return cl->fg;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,8 +377,7 @@ static GdkPixbuf *get_pixbuf_from_path(char *icon_path)
|
|||||||
} while (*(end) != '\0');
|
} while (*(end) != '\0');
|
||||||
}
|
}
|
||||||
if (pixbuf == NULL) {
|
if (pixbuf == NULL) {
|
||||||
fprintf(stderr,
|
LOG_W("Could not load icon: '%s'", icon_path);
|
||||||
"Could not load icon: '%s'\n", icon_path);
|
|
||||||
}
|
}
|
||||||
if (uri_path != NULL) {
|
if (uri_path != NULL) {
|
||||||
g_free(uri_path);
|
g_free(uri_path);
|
||||||
@ -535,7 +532,7 @@ static colored_layout *r_create_layout_from_notification(cairo_t *c, notificatio
|
|||||||
cl->attr = NULL;
|
cl->attr = NULL;
|
||||||
pango_layout_set_text(cl->l, n->text_to_render, -1);
|
pango_layout_set_text(cl->l, n->text_to_render, -1);
|
||||||
if (n->first_render) {
|
if (n->first_render) {
|
||||||
printf("Error parsing markup: %s\n", err->message);
|
LOG_W("Unable to parse markup: %s", err->message);
|
||||||
}
|
}
|
||||||
g_error_free(err);
|
g_error_free(err);
|
||||||
}
|
}
|
||||||
@ -1194,7 +1191,7 @@ void x_win_show(void)
|
|||||||
None,
|
None,
|
||||||
None);
|
None);
|
||||||
if (x_shortcut_tear_down_error_handler()) {
|
if (x_shortcut_tear_down_error_handler()) {
|
||||||
fprintf(stderr, "Unable to grab mouse button(s)\n");
|
LOG_W("Unable to grab mouse button(s).");
|
||||||
}
|
}
|
||||||
|
|
||||||
XMapRaised(xctx.dpy, xctx.win);
|
XMapRaised(xctx.dpy, xctx.win);
|
||||||
@ -1234,7 +1231,7 @@ KeySym x_shortcut_string_to_mask(const char *str)
|
|||||||
} else if (!strcmp(str, "shift")) {
|
} else if (!strcmp(str, "shift")) {
|
||||||
return ShiftMask;
|
return ShiftMask;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Warning: Unknown Modifier: %s\n", str);
|
LOG_W("Unknown Modifier: '%s'", str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1309,7 +1306,7 @@ int x_shortcut_grab(keyboard_shortcut *ks)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (x_shortcut_tear_down_error_handler()) {
|
if (x_shortcut_tear_down_error_handler()) {
|
||||||
fprintf(stderr, "Unable to grab key \"%s\"\n", ks->str);
|
LOG_W("Unable to grab key '%s'.", ks->str);
|
||||||
ks->is_valid = false;
|
ks->is_valid = false;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1372,8 +1369,7 @@ void x_shortcut_init(keyboard_shortcut *ks)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ks->sym == NoSymbol || ks->code == NoSymbol) {
|
if (ks->sym == NoSymbol || ks->code == NoSymbol) {
|
||||||
fprintf(stderr, "Warning: Unknown keyboard shortcut: %s\n",
|
LOG_W("Unknown keyboard shortcut: '%s'", ks->str);
|
||||||
ks->str);
|
|
||||||
ks->is_valid = false;
|
ks->is_valid = false;
|
||||||
} else {
|
} else {
|
||||||
ks->is_valid = true;
|
ks->is_valid = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user