diff --git a/src/xml.c b/src/xml.c
index 861b919..640c47d 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -19,8 +19,8 @@ static struct ctx {
char *filename;
xmlDoc *doc;
xmlXPathContextPtr xpath_ctx_ptr;
- char *nodename;
- char *value;
+ const char *nodename;
+ const char *value;
xmlNode *node;
enum {
XML_MODE_SETTING = 0,
@@ -196,7 +196,7 @@ xml_finish(void)
}
void
-xml_set(char *nodename, char *value)
+xml_set(const char *nodename, const char *value)
{
ctx.nodename = nodename;
ctx.value = value;
@@ -205,7 +205,7 @@ xml_set(char *nodename, char *value)
}
void
-xml_set_num(char *nodename, double value)
+xml_set_num(const char *nodename, double value)
{
char buf[64];
snprintf(buf, sizeof(buf), "%.0f", value);
@@ -215,8 +215,8 @@ xml_set_num(char *nodename, double value)
xml_tree_walk(xmlDocGetRootElement(ctx.doc));
}
-char *
-xml_get(char *nodename)
+const char *
+xml_get(const char *nodename)
{
ctx.nodename = nodename;
ctx.mode = XML_MODE_GETTING;
@@ -225,7 +225,7 @@ xml_get(char *nodename)
}
int
-xml_get_int(char *nodename)
+xml_get_int(const char *nodename)
{
ctx.nodename = nodename;
ctx.mode = XML_MODE_GETTING;
@@ -234,9 +234,9 @@ xml_get_int(char *nodename)
}
int
-xml_get_bool_text(char *nodename)
+xml_get_bool_text(const char *nodename)
{
- char *value = xml_get(nodename);
+ const char *value = xml_get(nodename);
/* handle and where no value has been specified */
if (!value || !*value) {
@@ -263,7 +263,7 @@ xml_get_node(char *nodename)
}
char *
-xpath_get_content(char *xpath_expr)
+xpath_get_content(const char *xpath_expr)
{
xmlChar *ret = NULL;
xmlXPathObjectPtr object = xmlXPathEvalExpression((xmlChar *)xpath_expr, ctx.xpath_ctx_ptr);
diff --git a/src/xml.h b/src/xml.h
index 851e24b..ff40501 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -7,17 +7,17 @@ void xml_init(const char *filename);
void xml_save(void);
void xml_save_as(const char *filename);
void xml_finish(void);
-void xml_set(char *nodename, char *value);
-void xml_set_num(char *nodename, double value);
-char *xml_get(char *nodename);
-int xml_get_int(char *nodename);
-int xml_get_bool_text(char *nodename);
+void xml_set(const char *nodename, const char *value);
+void xml_set_num(const char *nodename, double value);
+const char *xml_get(const char *nodename);
+int xml_get_int(const char *nodename);
+int xml_get_bool_text(const char *nodename);
/**
* xpath_get_content() - Get content of node specified by xpath
* @xpath_expr: xpath expression for node
*/
-char *xpath_get_content(char *xpath_expr);
+char *xpath_get_content(const char *xpath_expr);
/**
* xpath_add_node - add xml nodes from xpath
diff --git a/tweaks-qt/maindialog.cpp b/tweaks-qt/maindialog.cpp
index b9e7690..af0d090 100644
--- a/tweaks-qt/maindialog.cpp
+++ b/tweaks-qt/maindialog.cpp
@@ -53,7 +53,7 @@ void MainDialog::activate()
struct themes openbox_themes = { 0 };
theme_find(&openbox_themes, "themes", "openbox-3/themerc");
int active = -1;
- char *active_id = xml_get((char *)"/labwc_config/theme/name");
+ char *active_id = xml_get("/labwc_config/theme/name");
for (int i = 0; i < openbox_themes.nr; ++i) {
struct theme *theme = openbox_themes.data + i;
if (active_id && !strcmp(theme->name, active_id)) {
@@ -67,7 +67,7 @@ void MainDialog::activate()
theme_free_vector(&openbox_themes);
/* Corner Radius */
- ui->cornerRadius->setValue(xml_get_int((char *)"/labwc_config/theme/cornerradius"));
+ ui->cornerRadius->setValue(xml_get_int("/labwc_config/theme/cornerradius"));
/* # MOUSE & TOUCHPAD */
@@ -96,13 +96,13 @@ void MainDialog::activate()
ui->naturalScroll->addItem("no");
ui->naturalScroll->addItem("yes");
ui->naturalScroll->setCurrentIndex(
- xml_get_bool_text((char *)"/labwc_config/libinput/device/naturalscroll"));
+ xml_get_bool_text("/labwc_config/libinput/device/naturalscroll"));
/* # LANGUAGE */
/* Keyboard Layout */
GList *keyboard_layouts = NULL;
- keyboard_layouts_init(&keyboard_layouts, (char *)"/usr/share/X11/xkb/rules/evdev.lst");
+ keyboard_layouts_init(&keyboard_layouts, "/usr/share/X11/xkb/rules/evdev.lst");
char xkb_default_layout[1024];
environment_get(xkb_default_layout, sizeof(xkb_default_layout), "XKB_DEFAULT_LAYOUT");
active = -1;
@@ -128,9 +128,9 @@ void MainDialog::activate()
void MainDialog::onApply()
{
/* ~/.config/labwc/rc.xml */
- xml_set_num((char *)"/labwc_config/theme/cornerradius", ui->cornerRadius->value());
- xml_set((char *)"/labwc_config/theme/name", ui->openboxTheme->currentText().toLatin1().data());
- xml_set((char *)"/labwc_config/libinput/device/naturalscroll",
+ xml_set_num("/labwc_config/theme/cornerradius", ui->cornerRadius->value());
+ xml_set("/labwc_config/theme/name", ui->openboxTheme->currentText().toLatin1().data());
+ xml_set("/labwc_config/libinput/device/naturalscroll",
ui->naturalScroll->currentText().toLatin1().data());
xml_save();