Index: gtk/gtkaction.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkaction.c,v
retrieving revision 1.44
diff -u -p -r1.44 gtkaction.c
--- gtk/gtkaction.c	26 Mar 2005 05:49:14 -0000	1.44
+++ gtk/gtkaction.c	10 Apr 2005 06:00:59 -0000
@@ -33,6 +33,7 @@
 #include "gtkaction.h"
 #include "gtkactiongroup.h"
 #include "gtkaccellabel.h"
+#include "gtkaccelmap.h"
 #include "gtkbutton.h"
 #include "gtkimage.h"
 #include "gtkimagemenuitem.h"
@@ -57,6 +58,7 @@ struct _GtkActionPrivate 
   gchar *short_label;
   gchar *tooltip;
   gchar *stock_id; /* icon */
+  gchar *accelerator;
 
   guint sensitive          : 1;
   guint visible            : 1;
@@ -101,7 +103,8 @@ enum 
   PROP_HIDE_IF_EMPTY,
   PROP_SENSITIVE,
   PROP_VISIBLE,
-  PROP_ACTION_GROUP
+  PROP_ACTION_GROUP,
+  PROP_ACCELERATOR
 };
 
 static void gtk_action_init       (GtkAction *action);
@@ -149,6 +152,8 @@ static void gtk_action_get_property (GOb
 				     GParamSpec      *pspec);
 static void gtk_action_set_action_group (GtkAction	    *action,
 					 GtkActionGroup *action_group);
+static void gtk_action_set_accelerator (GtkAction    *action,
+					const gchar  *accelerator);
 
 static GtkWidget *create_menu_item    (GtkAction *action);
 static GtkWidget *create_tool_item    (GtkAction *action);
@@ -162,6 +167,7 @@ static void       closure_accel_activate
 					  const GValue *param_values,
 					  gpointer      invocation_hint,
 					  gpointer      marshal_data);
+static void       update_accel_map    (GtkAction *action);
 
 static GObjectClass *parent_class = NULL;
 static guint         action_signals[LAST_SIGNAL] = { 0 };
@@ -300,6 +306,24 @@ gtk_action_class_init (GtkActionClass *k
 							 GTK_PARAM_READWRITE));
 
   /**
+   * GtkAction:accelerator:
+   *
+   * The accelerator to use for this action in the format understood by gtk_accelerator_parse(), 
+   * or "" for no accelerator, or %NULL to use the stock accelerator.
+   *
+   * Since: 2.8
+   */
+  g_object_class_install_property (gobject_class,
+				   PROP_ACCELERATOR,
+				   g_param_spec_string ("accelerator",
+							P_("Accelerator"),
+							P_("The accelerator to use for this action, "
+							   "or \"\" for no accelerator, "
+							   "or NULL to use the stock accelerator."),
+							NULL,
+							GTK_PARAM_READWRITE));
+
+  /**
    * GtkAction::activate:
    * @action: the #GtkAction
    *
@@ -514,6 +538,9 @@ gtk_action_set_property (GObject        
     case PROP_ACTION_GROUP:
       gtk_action_set_action_group (action, g_value_get_object (value));
       break;
+    case PROP_ACCELERATOR:
+      gtk_action_set_accelerator (action, g_value_get_string (value));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -571,6 +598,9 @@ gtk_action_get_property (GObject    *obj
     case PROP_ACTION_GROUP:
       g_value_set_object (value, action->private_data->action_group);
       break;
+    case PROP_ACCELERATOR:
+      g_value_set_string (value, action->private_data->accelerator);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1464,6 +1494,8 @@ gtk_action_set_accel_path (GtkAction   *
   g_return_if_fail (GTK_IS_ACTION (action));
 
   action->private_data->accel_quark = g_quark_from_string (accel_path);
+
+  update_accel_map (action);
 }
 
 /**
@@ -1514,6 +1546,60 @@ gtk_action_set_accel_group (GtkAction   
 
   action->private_data->accel_group = accel_group;
 }
+
+static void 
+update_accel_map (GtkAction *action)
+{
+  guint  accel_key = 0;
+  GdkModifierType accel_mods;
+  GtkStockItem stock_item;
+  const gchar *accel_path;
+  
+  if (!action->private_data->accel_quark)
+    return;
+
+  accel_path = g_quark_to_string (action->private_data->accel_quark);
+  
+  if (action->private_data->accelerator)
+    {
+      if (action->private_data->accelerator[0] == 0) 
+	accel_key = 0;
+      else
+	{
+	  gtk_accelerator_parse (action->private_data->accelerator, 
+				 &accel_key, &accel_mods);
+	  if (accel_key == 0)
+	    g_warning ("Unable to parse accelerator '%s' for action '%s'",
+		       action->private_data->accelerator, 
+		       action->private_data->name);
+	}
+    }
+  else if (action->private_data->stock_id && 
+	   gtk_stock_lookup (action->private_data->stock_id, &stock_item))
+    {
+      accel_key = stock_item.keyval;
+      accel_mods = stock_item.modifier;
+    }
+
+  if (!accel_key)
+    return;
+
+  gtk_accel_map_change_entry (accel_path, accel_key, accel_mods, TRUE);
+}
+
+static void 
+gtk_action_set_accelerator (GtkAction    *action,
+			    const gchar  *accelerator)
+{
+  g_free (action->private_data->accelerator);
+
+  action->private_data->accelerator = g_strdup (accelerator);
+  
+  update_accel_map (action);
+
+  g_object_notify (G_OBJECT (action), "accelerator"); 
+}
+
 
 /**
  * gtk_action_connect_accelerator:
Index: gtk/gtkactiongroup.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkactiongroup.c,v
retrieving revision 1.47
diff -u -p -r1.47 gtkactiongroup.c
--- gtk/gtkactiongroup.c	4 Apr 2005 04:36:04 -0000	1.47
+++ gtk/gtkactiongroup.c	10 Apr 2005 06:00:59 -0000
@@ -34,7 +34,6 @@
 #include "gtkstock.h"
 #include "gtktoggleaction.h"
 #include "gtkradioaction.h"
-#include "gtkaccelmap.h"
 #include "gtkmarshalers.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
@@ -572,40 +571,19 @@ gtk_action_group_add_action_with_accel (
 					GtkAction *action,
 					const gchar *accelerator)
 {
-  gchar *accel_path;
-  guint  accel_key = 0;
-  GdkModifierType accel_mods;
-  GtkStockItem stock_item;
   gchar *name;
   gchar *stock_id;
+  gchar *accel_path;
   
-  g_object_get (action, "name", &name, "stock-id", &stock_id, NULL);
-
-  accel_path = g_strconcat ("<Actions>/",
-			    action_group->private_data->name, "/", name, NULL);
-
-  if (accelerator)
-    {
-      if (accelerator[0] == 0) 
-	accel_key = 0;
-      else
-	{
-	  gtk_accelerator_parse (accelerator, &accel_key, &accel_mods);
-	  if (accel_key == 0)
-	    g_warning ("Unable to parse accelerator '%s' for action '%s'",
-		       accelerator, name);
-	}
-    }
-  else if (stock_id && gtk_stock_lookup (stock_id, &stock_item))
-    {
-      accel_key = stock_item.keyval;
-      accel_mods = stock_item.modifier;
-    }
+  g_object_get (action, 
+		"name", &name, 
+		"stock-id", &stock_id, 
+		NULL);
 
-  if (accel_key)
-    gtk_accel_map_change_entry (accel_path, accel_key, accel_mods, TRUE);
+  accel_path = g_strconcat ("<Actions>/", action_group->private_data->name, "/", name, NULL);
 
   gtk_action_set_accel_path (action, accel_path);
+  g_object_set (action, "accelerator", accelerator, NULL);
   gtk_action_group_add_action (action_group, action);
 
   g_free (accel_path);
