summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/menu.c4
-rw-r--r--src/prefs.c23
-rw-r--r--src/screen.c10
3 files changed, 29 insertions, 8 deletions
diff --git a/src/menu.c b/src/menu.c
index 9cec2f5f..ea340b9e 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -141,6 +141,8 @@ get_workspace_name_with_accel (Display *display,
name = meta_core_get_workspace_name_with_index (display, xroot, index);
+ g_assert (name != NULL);
+
/*
* If the name is of the form "Workspace x" where x is an unsigned
* integer, insert a '_' before the number if it is less than 10 and
@@ -188,7 +190,7 @@ get_workspace_name_with_accel (Display *display,
* *new_name to the calling code.
*/
return new_name;
- }
+ }
}
static GtkWidget*
diff --git a/src/prefs.c b/src/prefs.c
index e607d25c..3b55ca3a 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -1137,6 +1137,10 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_BUTTON_LAYOUT:
return "BUTTON_LAYOUT";
break;
+
+ case META_PREF_WORKSPACE_NAMES:
+ return "WORKSPACE_NAMES";
+ break;
}
return "(unknown)";
@@ -1342,6 +1346,8 @@ init_workspace_names (void)
update_workspace_name (key, str_val);
+ g_assert (workspace_names[i] != NULL);
+
g_free (str_val);
g_free (key);
@@ -1553,21 +1559,23 @@ update_workspace_name (const char *name,
return FALSE;
}
- if ((workspace_names[i] == NULL && value == NULL) ||
- (workspace_names[i] && value && strcmp (workspace_names[i], value) == 0))
+ if (workspace_names[i] && value && strcmp (workspace_names[i], value) == 0)
{
meta_topic (META_DEBUG_PREFS,
"Workspace name %d is unchanged\n", i);
return FALSE;
- }
-
- g_free (workspace_names[i]);
+ }
+
if (value != NULL)
- workspace_names[i] = g_strdup (value);
+ {
+ g_free (workspace_names[i]);
+ workspace_names[i] = g_strdup (value);
+ }
else
{
/* use a default name */
char *d;
+
d = g_strdup_printf (_("Workspace %d"), i + 1);
if (workspace_names[i] && strcmp (workspace_names[i], d) == 0)
{
@@ -1576,6 +1584,7 @@ update_workspace_name (const char *name,
}
else
{
+ g_free (workspace_names[i]);
workspace_names[i] = d;
}
}
@@ -1591,6 +1600,8 @@ const char*
meta_prefs_get_workspace_name (int i)
{
g_return_val_if_fail (i >= 0 && i < MAX_REASONABLE_WORKSPACES, NULL);
+
+ g_assert (workspace_names[i] != NULL);
return workspace_names[i];
}
diff --git a/src/screen.c b/src/screen.c
index ca24ef7d..8be27c35 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1137,6 +1137,9 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
entries[iter].key = (MetaTabEntryKey) workspace;
entries[iter].title = meta_workspace_get_name (workspace);
entries[iter].icon = NULL;
+
+ g_assert (entries[iter].title != NULL);
+
iter++;
}
}
@@ -1156,6 +1159,8 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
entries[i].key = (MetaTabEntryKey) workspace;
entries[i].title = meta_workspace_get_name (workspace);
entries[i].icon = NULL;
+
+ g_assert (entries[i].title != NULL);
}
}
@@ -1416,7 +1421,7 @@ update_workspace_names (MetaScreen *screen)
name = meta_prefs_get_workspace_name (i);
if (name)
- g_string_append_len (flattened, name,
+ g_string_append_len (flattened, name,
strlen (name) + 1);
else
g_string_append_len (flattened, "", 1);
@@ -1462,6 +1467,9 @@ meta_screen_update_workspace_names (MetaScreen *screen)
i = 0;
while (i < n_names)
{
+ meta_topic (META_DEBUG_PREFS,
+ "Setting workspace %d name to \"%s\" due to _NET_DESKTOP_NAMES change\n",
+ i, names[i] ? names[i] : "null");
meta_prefs_change_workspace_name (i, names[i]);
++i;