]> Pileus Git - ~andy/gtk/commitdiff
Display invalid accelerators as "Invalid" in GTK mode.
authorChristian Persch <chpe@gnome.org>
Wed, 8 Apr 2009 17:18:44 +0000 (19:18 +0200)
committerChristian Persch <chpe@gnome.org>
Mon, 20 Apr 2009 12:54:59 +0000 (14:54 +0200)
When in GTK_CELL_RENDERER_ACCEL_MODE_GTK, display accelerator key
combinations that don't pass gtk_accelerator_valid() as "Invalid".
Bug #572799.

gtk/gtkcellrendereraccel.c

index 306bc5e247bfa952f326eb7745b1906c4307b986..f3e229688b187e9badc056ecc8a4152583364fc2 100644 (file)
@@ -244,7 +244,16 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel,
   else 
     {
       if (accel->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
-       return gtk_accelerator_get_label (keysym, mask);
+        {
+          if (!gtk_accelerator_valid (keysym, mask))
+            /* This label is displayed in a treeview cell displaying
+             * an accelerator key combination that is not valid according
+             * to gtk_accelerator_valid().
+             */
+            return g_strdup (C_("Accelerator", "Invalid"));
+
+          return gtk_accelerator_get_label (keysym, mask);
+        }
       else 
        {
          gchar *name;