Workspaces whose name is the standard name plus a non-empty string are

2008-03-21  Thomas Thurman  <tthurman@gnome.org>

        * src/ui/menu.c (activate_cb, get_workspace_name_with_accel): Workspaces
	whose name is the standard name plus a non-empty string are handled
	correctly in menus.  Closes #453678.


svn path=/trunk/; revision=3657
This commit is contained in:
Thomas Thurman 2008-03-21 02:56:52 +00:00 committed by Thomas James Alexander Thurman
parent 18dfce2873
commit 932fb56ea9
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2008-03-21 Thomas Thurman <tthurman@gnome.org>
* src/ui/menu.c (activate_cb, get_workspace_name_with_accel): Workspaces
whose name is the standard name plus a non-empty string are handled
correctly in menus. Closes #453678.
2008-03-19 Iain Holmes <iain@gnome.org> 2008-03-19 Iain Holmes <iain@gnome.org>
* src/core/compositor.c (meta_compositor_set_active_window): Handle * src/core/compositor.c (meta_compositor_set_active_window): Handle

View File

@ -177,6 +177,9 @@ activate_cb (GtkWidget *menuitem, gpointer data)
* *
* The calling code owns the string, and is reponsible to free the * The calling code owns the string, and is reponsible to free the
* memory after use. * memory after use.
*
* See also http://mail.gnome.org/archives/gnome-i18n/2008-March/msg00380.html
* which discusses possible i18n concerns.
*/ */
static char* static char*
get_workspace_name_with_accel (Display *display, get_workspace_name_with_accel (Display *display,
@ -185,6 +188,7 @@ get_workspace_name_with_accel (Display *display,
{ {
const char *name; const char *name;
int number; int number;
int charcount=0;
name = meta_core_get_workspace_name_with_index (display, xroot, index); name = meta_core_get_workspace_name_with_index (display, xroot, index);
@ -196,7 +200,8 @@ get_workspace_name_with_accel (Display *display,
* return it * return it
*/ */
number = 0; number = 0;
if (sscanf (name, _("Workspace %d"), &number) == 1) if (sscanf (name, _("Workspace %d%n"), &number, &charcount) != 0 &&
*(name + charcount)=='\0')
{ {
char *new_name; char *new_name;
@ -241,7 +246,7 @@ get_workspace_name_with_accel (Display *display,
*dest++ = *source++; *dest++ = *source++;
} }
/* People don't start at workstation 0, but workstation 1 */ /* People don't start at workspace 0, but workspace 1 */
if (index < 9) if (index < 9)
{ {
g_snprintf (dest, 6, " (_%d)", index + 1); g_snprintf (dest, 6, " (_%d)", index + 1);