summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/xfdesktop-common.c26
-rw-r--r--common/xfdesktop-common.h1
-rw-r--r--settings/main.c4
-rw-r--r--src/xfce-workspace.c11
4 files changed, 34 insertions, 8 deletions
diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index 5d2c2551..1f180dff 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -194,6 +194,32 @@ xfdesktop_popup_keyboard_grab_available(GdkWindow *win)
}
+/*
+ * xfdesktop_remove_whitspaces:
+ * remove all whitespaces from string (not only trailing or leading)
+ */
+gchar*
+xfdesktop_remove_whitspaces(gchar* str)
+{
+ gchar* dest;
+ gint offs, curr;
+
+ g_return_val_if_fail(str, NULL);
+
+ offs = 0;
+ dest = str;
+ for(curr=0; curr<=strlen(str); curr++) {
+ if(*dest == ' ' || *dest == '\t')
+ offs++;
+ else if(0 != offs)
+ *(dest-offs) = *dest;
+ dest++;
+ }
+
+ return str;
+}
+
+
#ifdef G_ENABLE_DEBUG
/* With --enable-debug=full turn on debugging messages from the start */
static gboolean enable_debug = TRUE;
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index d1a27456..9e76e788 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -100,6 +100,7 @@ gint xfce_translate_image_styles(gint input);
guint32 xfdesktop_popup_keyboard_grab_available(GdkWindow *win);
+gchar* xfdesktop_remove_whitspaces(gchar* str);
#if defined(G_HAVE_ISO_VARARGS)
diff --git a/settings/main.c b/settings/main.c
index bc68099d..b37abad9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -795,9 +795,9 @@ xfdesktop_settings_generate_per_workspace_binding_string(AppearancePanel *panel,
panel->screen, panel->monitor, panel->workspace,
property);
} else {
- buf = g_strdup_printf("/backdrop/screen%d/monitor%s/workspace%d/%s",
+ buf = xfdesktop_remove_whitspaces(g_strdup_printf("/backdrop/screen%d/monitor%s/workspace%d/%s",
panel->screen, panel->monitor_name, panel->workspace,
- property);
+ property));
}
XF_DEBUG("name %s", buf);
diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c
index 6d3b3e66..13e1187e 100644
--- a/src/xfce-workspace.c
+++ b/src/xfce-workspace.c
@@ -157,7 +157,7 @@ xfce_workspace_set_xfconf_property_string(XfceWorkspace *workspace,
workspace->priv->property_prefix, monitor_num, workspace->priv->workspace_num, property);
} else {
g_snprintf(buf, sizeof(buf), "%smonitor%s/workspace%d/%s",
- workspace->priv->property_prefix, monitor_name, workspace->priv->workspace_num, property);
+ workspace->priv->property_prefix, xfdesktop_remove_whitspaces(monitor_name), workspace->priv->workspace_num, property);
g_free(monitor_name);
}
@@ -191,7 +191,7 @@ xfce_workspace_set_xfconf_property_value(XfceWorkspace *workspace,
workspace->priv->property_prefix, monitor_num, workspace->priv->workspace_num, property);
} else {
g_snprintf(buf, sizeof(buf), "%smonitor%s/workspace%d/%s",
- workspace->priv->property_prefix, monitor_name, workspace->priv->workspace_num, property);
+ workspace->priv->property_prefix, xfdesktop_remove_whitspaces(monitor_name), workspace->priv->workspace_num, property);
g_free(monitor_name);
}
@@ -609,8 +609,9 @@ xfce_workspace_connect_backdrop_settings(XfceWorkspace *workspace,
workspace->priv->property_prefix, monitor, workspace->priv->workspace_num);
} else {
g_snprintf(buf, sizeof(buf), "%smonitor%s/workspace%d/",
- workspace->priv->property_prefix, monitor_name, workspace->priv->workspace_num);
- }
+ workspace->priv->property_prefix, xfdesktop_remove_whitspaces(monitor_name), workspace->priv->workspace_num);
+ g_free(monitor_name);
+ }
pp_len = strlen(buf);
XF_DEBUG("prefix string: %s", buf);
@@ -674,8 +675,6 @@ xfce_workspace_connect_backdrop_settings(XfceWorkspace *workspace,
xfconf_g_property_bind(channel, buf, G_TYPE_STRING,
G_OBJECT(backdrop), "image-filename");
-
- g_free(monitor_name);
}
static void