From 2f130ce836c85f40df95a35174fff0cbd0242834 Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Sat, 17 Feb 2007 17:39:00 +0000
Subject: update workspace names on reconfig, and don't truncate list of names
 when writing rc

---
 ChangeLog      | 3 +++
 src/Screen.cc  | 3 +++
 src/fluxbox.cc | 8 +++-----
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 786178f..1f43df7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
  (Format: Year/Month/Day)
 Changes for 1.0rc3:
 *07/02/17:
+   * Update workspace names on reconfigure, and don't overwrite workspace names
+     not being used (Mark)
+     fluxbox.cc Screen.cc
    * Fixed some issues with transients of inactive tabs (Mark)
      Window.cc
 *07/02/10:
diff --git a/src/Screen.cc b/src/Screen.cc
index 4097dd7..2a4ea9b 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1503,6 +1503,9 @@ void BScreen::updateAvailableWorkspaceArea() {
 
 void BScreen::addWorkspaceName(const char *name) {
     m_workspace_names.push_back(FbTk::FbStringUtil::LocaleStrToFb(name));
+    Workspace *wkspc = getWorkspace(m_workspace_names.size()-1);
+    if (wkspc)
+        wkspc->setName(m_workspace_names.back());
 }
 
 
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 7958a27..42ff47d 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1506,11 +1506,9 @@ void Fluxbox::save_rc() {
         sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number);
         string workspaces_string(rc_string);
 
-        for (unsigned int workspace=0; workspace < screen->numberOfWorkspaces(); workspace++) {
-            if (screen->getWorkspace(workspace)->name().size()!=0)
-                workspaces_string.append(FbTk::FbStringUtil::FbStrToLocale(screen->getWorkspace(workspace)->name()));
-            else
-                workspaces_string.append("Null");
+        const vector<string> names = screen->getWorkspaceNames();
+        for (size_t i=0; i < names.size(); i++) {
+            workspaces_string.append(FbTk::FbStringUtil::FbStrToLocale(names[i]));
             workspaces_string.append(",");
         }
 
-- 
cgit v0.11.2