[Glade-devel] [glade-3] Problem with undo/redo menu getting too long



--=-2CLnYLjMLYDivhyiuInj
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2004-04-23 at 16:44, Joaquin Cuenca Abela wrote:

It seems more sensible to me to chop the string
representation of the property in
glade_command_set_{property,name} if it's too long,
and in this case just display the begin ... end of the
property.

Yes, that would be possible. Though handling Unicode strings nicely may
be slightly awkward.

There is also a problem with '_' characters, which get converted into
underlined accelerator keys in the menu item.

I've attached a patch that only uses the value string if it is non-NULL,
less than 10 bytes long and doesn't contain any '_' characters.

I think that is good enough for now. If someone wants to do a better fix
later they can.

Damon


--=-2CLnYLjMLYDivhyiuInj
Content-Disposition: attachment; filename=glade3.patch
Content-Type: text/x-patch; name=glade3.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Index: glade-command.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-command.c,v
retrieving revision 1.30
diff -u -r1.30 glade-command.c
--- glade-command.c     21 Apr 2004 21:03:40 -0000      1.30
+++ glade-command.c     25 Apr 2004 14:41:56 -0000
@@ -355,6 +355,9 @@
        glade_project_window_refresh_undo_redo ();
 }
 
+
+#define MAX_UNDO_MENU_ITEM_VALUE_LEN   10
+
 void
 glade_command_set_property (GladeProperty *property, const GValue* pvalue)
 {
@@ -378,8 +381,18 @@
        g_value_copy (pvalue, me->arg_value);
 
        value_name = glade_property_class_make_string_from_gvalue (property->class, pvalue);
-       cmd->description = g_strdup_printf (_("Setting %s of %s to %s"),
-                                           property->class->name, gwidget->name, value_name);
+       if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
+           || strchr (value_name, '_')) {
+               cmd->description = g_strdup_printf (_("Setting %s of %s"),
+                                                   property->class->name,
+                                                   gwidget->name);
+
+       } else {
+               cmd->description = g_strdup_printf (_("Setting %s of %s to %s"),
+                                                   property->class->name,
+                                                   gwidget->name, value_name);
+       }
+
        g_assert (cmd->description);
        g_free (value_name);
 

--=-2CLnYLjMLYDivhyiuInj--





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]