mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
Fix #98303 and assorted cleanup
2002-11-19 Havoc Pennington <hp@pobox.com> Fix #98303 and assorted cleanup * src/prefs.c (meta_preference_to_string): handle META_PREF_WORKSPACE_NAMES * src/menu.c (get_workspace_name_with_accel): assert that the workspace has a name * src/screen.c (meta_screen_ensure_workspace_popup): assert that we got a workspace name (meta_screen_ensure_workspace_popup): assert that we got a workspace name * src/prefs.c (update_workspace_name): fix screwiness (strcmp with a freed string, assorted bad logic) (init_workspace_names): assert that we filled in a default workspace name (meta_prefs_get_workspace_name): assert non-NULL workspace name
This commit is contained in:
parent
bd537dcfc6
commit
2541da1d83
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
2002-11-19 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
Fix #98303 and assorted cleanup
|
||||
|
||||
* src/prefs.c (meta_preference_to_string): handle
|
||||
META_PREF_WORKSPACE_NAMES
|
||||
|
||||
* src/menu.c (get_workspace_name_with_accel): assert that the
|
||||
workspace has a name
|
||||
|
||||
* src/screen.c (meta_screen_ensure_workspace_popup): assert that
|
||||
we got a workspace name
|
||||
(meta_screen_ensure_workspace_popup): assert that we got a
|
||||
workspace name
|
||||
|
||||
* src/prefs.c (update_workspace_name): fix screwiness (strcmp with
|
||||
a freed string, assorted bad logic)
|
||||
(init_workspace_names): assert that we filled in a default
|
||||
workspace name
|
||||
(meta_prefs_get_workspace_name): assert non-NULL workspace name
|
||||
|
||||
2002-11-16 Bill Haneman <bill.haneman@sun.com>
|
||||
|
||||
* src/themes/Atlanta/metacity-theme-1.xml:
|
||||
|
@ -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*
|
||||
|
23
src/prefs.c
23
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];
|
||||
}
|
||||
|
10
src/screen.c
10
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;
|
||||
|
Loading…
Reference in New Issue
Block a user