After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 78903 - Does not escape underscores in profile names used for menu items
Does not escape underscores in profile names used for menu items
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
2.2.x
Other other
: High normal
: 2.2
Assigned To: Jeffrey Stedfast
Havoc Pennington
Depends on:
Blocks:
 
 
Reported: 2002-04-17 04:03 UTC by Havoc Pennington
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Here's a straight-forward fix (written and tested May 11 2002) (2.36 KB, patch)
2002-05-12 04:56 UTC, Nate Case
none Details | Review
78903.patch (3.38 KB, patch)
2002-10-25 23:54 UTC, Jeffrey Stedfast
none Details | Review
fix the bug, using GStrings (2.28 KB, patch)
2003-06-29 02:55 UTC, Mariano Suárez-Alvarez
none Details | Review

Description Havoc Pennington 2002-04-17 04:03:00 UTC
So we end up with funky mnemonics.
Comment 1 Nate Case 2002-05-12 04:56:36 UTC
Created attachment 8393 [details] [review]
Here's a straight-forward fix (written and tested May 11 2002)
Comment 2 Kjartan Maraas 2002-09-19 19:25:06 UTC
Is there an easier way to do this using some glib utility function or
something?
Comment 3 Nate Case 2002-09-19 19:39:06 UTC
To my knowledge there isn't any substantially "easier" way using glib.
 I remember checking for just that when doing it.  But then again, I
didn't think the 20-line or so function the patch uses to do it now is
all that "hard" anyway.  If you find a more elegant way, then by all
means attach it.
Comment 4 Jeffrey Stedfast 2002-10-25 23:48:17 UTC
I'm going to guess that the "proper" way to do this would probably be
to use pango markup or something.
Comment 5 Jeffrey Stedfast 2002-10-25 23:54:01 UTC
Created attachment 11839 [details] [review]
78903.patch
Comment 6 Jeffrey Stedfast 2002-10-25 23:57:41 UTC
this patch fixes it properly.

a few comments: 

- I'm not 100% sure how gtk_label_set_pattern() works, so it might be
possible to cheat by just using "_" instead of creating a pattern
buffer and filling it with spaces and such.

- I suppose, even though we will only ever g_alloca() up to a max of
36 pattern buffers, we might have problems with not having enough
space on the stack? possibly should change the patch to use g_malloc()
and g_free (pattern) when we g_free (str)

the patch is against gnome-2-0 branch, but I realise this patch will
also have to go into HEAD so I can do that too.
Comment 7 Havoc Pennington 2002-10-26 05:07:27 UTC
set_pattern() is visual-only, it doesn't actually set up a mnemonic,
would just make it look like there was one.

I think the first fix is more how I would go about it (and yes I'm a
loser for not processing this bug earlier). The main things I'd change 
in the first patch are just stylistic:

 - while loop not for
 - braces on their own line
 - name the function escape_underscores() not get_name_formatted_...
 - spaces before parentheses

But basically an escape_underscores() function is how I'd go about this.

Thanks to everybody for their help.
Comment 8 Kjartan Maraas 2003-04-22 14:50:46 UTC
A couple of things. I looked at updating the patch to meet your
wishes, but I need to know:

- which for loop should be a while loop? Both?
- there are already spaces before parentheses and the braces are on
their own lines, wassup? :)
Comment 9 Havoc Pennington 2003-04-22 18:19:49 UTC
yeah both for loops should be while

also, s/gchar/char/ and in "char * foo" should be "char *foo"

Comment 10 Abigail Brady 2003-06-27 13:56:36 UTC
The original patch also allocated not enough memory - didn't take into
account the terminating \0.
Comment 11 Mariano Suárez-Alvarez 2003-06-29 02:52:24 UTC
The following patch does the same thing, using GLib's GString.
Comment 12 Mariano Suárez-Alvarez 2003-06-29 02:55:02 UTC
Created attachment 17885 [details] [review]
fix the bug, using GStrings
Comment 13 Havoc Pennington 2003-06-29 03:25:32 UTC
Patch looks good to commit to me.
Comment 14 Mariano Suárez-Alvarez 2003-06-29 04:31:23 UTC
Commited