From 26bd02d45730ccfa99bccb786a9a07e0aa32fd04 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 24 Sep 2025 20:25:27 +0100 Subject: [PATCH] Add translate.h for HAVE_NLS includes/defines ...to shrink labwc.h footprint --- include/labwc.h | 7 ------- include/translate.h | 14 ++++++++++++++ src/action-prompt-command.c | 2 +- src/config/rcxml.c | 1 + src/desktop-entry.c | 1 + src/main.c | 1 + src/menu/menu.c | 1 + 7 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 include/translate.h diff --git a/include/labwc.h b/include/labwc.h index 72dbe687..c75b1e39 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -7,13 +7,6 @@ #include "common/set.h" #include "input/cursor.h" #include "overlay.h" -#if HAVE_NLS -#include -#include -#define _ gettext -#else -#define _(s) (s) -#endif #define XCURSOR_DEFAULT "left_ptr" #define XCURSOR_SIZE 24 diff --git a/include/translate.h b/include/translate.h new file mode 100644 index 00000000..f7fc51e2 --- /dev/null +++ b/include/translate.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef LABWC_TRANSLATE_H +#define LABWC_TRANSLATE_H +#include "config.h" + +#if HAVE_NLS +#include +#include +#define _ gettext +#else +#define _(s) (s) +#endif + +#endif /* LABWC_TRANSLATE_H */ diff --git a/src/action-prompt-command.c b/src/action-prompt-command.c index 65bd0b49..faad41c9 100644 --- a/src/action-prompt-command.c +++ b/src/action-prompt-command.c @@ -5,8 +5,8 @@ #include #include "action.h" #include "common/buf.h" -#include "labwc.h" /* for gettext */ #include "theme.h" +#include "translate.h" enum { LAB_PROMPT_NONE = 0, diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 162f3f1d..89293c43 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -33,6 +33,7 @@ #include "osd.h" #include "regions.h" #include "ssd.h" +#include "translate.h" #include "view.h" #include "window-rules.h" #include "workspaces.h" diff --git a/src/desktop-entry.c b/src/desktop-entry.c index 60cff28e..7aefa77e 100644 --- a/src/desktop-entry.c +++ b/src/desktop-entry.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only #include "desktop-entry.h" +#include #include #include #include diff --git a/src/main.c b/src/main.c index 068829dc..755a0a0c 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,7 @@ #include "config/session.h" #include "labwc.h" #include "theme.h" +#include "translate.h" #include "menu/menu.h" struct rcxml rc = { 0 }; diff --git a/src/menu/menu.c b/src/menu/menu.c index fca755b2..0e23e850 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -29,6 +29,7 @@ #include "scaled-buffer/scaled-font-buffer.h" #include "scaled-buffer/scaled-icon-buffer.h" #include "theme.h" +#include "translate.h" #include "view.h" #include "workspaces.h"