summaryrefslogtreecommitdiffstats
path: root/src/helper
diff options
context:
space:
mode:
authorgustav_b <gustav_b@users.sourceforge.net>2006-07-09 11:32:23 +0000
committergustav_b <gustav_b@users.sourceforge.net>2006-07-09 11:32:23 +0000
commitc631dfb4add034db59cb477843ca95bcc2986758 (patch)
treec616db1f1e294f6630734af1e237322259c09366 /src/helper
parent* packaging/osx-app.sh: Set the svn:executable property. (diff)
downloadinkscape-c631dfb4add034db59cb477843ca95bcc2986758.tar.gz
inkscape-c631dfb4add034db59cb477843ca95bcc2986758.zip
Added descriptions to Undo/Redo commands in the menus
(bzr r1379)
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/action.cpp32
-rw-r--r--src/helper/action.h3
2 files changed, 34 insertions, 1 deletions
diff --git a/src/helper/action.cpp b/src/helper/action.cpp
index 9584c5dae..1c8c7ec15 100644
--- a/src/helper/action.cpp
+++ b/src/helper/action.cpp
@@ -13,7 +13,6 @@
#include <string.h>
-
#include "helper/action.h"
static void sp_action_class_init (SPActionClass *klass);
@@ -206,6 +205,37 @@ sp_action_set_sensitive (SPAction *action, unsigned int sensitive)
}
}
+
+/**
+ * Change name for all actions that can be taken with the action.
+ */
+void
+sp_action_set_name (SPAction *action, Glib::ustring name)
+{
+ nr_return_if_fail (action != NULL);
+ nr_return_if_fail (SP_IS_ACTION (action));
+
+ NRActiveObject *aobject;
+ g_free(action->name);
+ action->name = g_strdup(name.c_str());
+ aobject = (NRActiveObject *) action;
+ if (aobject->callbacks) {
+ unsigned int i;
+ for (i = 0; i < aobject->callbacks->length; i++) {
+ NRObjectListener *listener;
+ SPActionEventVector *avector;
+ listener = aobject->callbacks->listeners + i;
+ avector = (SPActionEventVector *) listener->vector;
+ if ((listener->size >= sizeof (SPActionEventVector)) && avector->set_name) {
+ avector->set_name (action, name, listener->data);
+ }
+ }
+ }
+}
+
+
+
+
/**
* Return View associated with the action.
*/
diff --git a/src/helper/action.h b/src/helper/action.h
index 1e3646439..4c99e31d8 100644
--- a/src/helper/action.h
+++ b/src/helper/action.h
@@ -25,6 +25,7 @@
#include "libnr/nr-object.h"
#include "forward.h"
+#include <glibmm/ustring.h>
//class Inkscape::UI::View::View;
namespace Inkscape {
@@ -41,6 +42,7 @@ struct SPActionEventVector {
void (* set_active)(SPAction *action, unsigned active, void *data); /**< Callback for activation change */
void (* set_sensitive)(SPAction *action, unsigned sensitive, void *data); /**< Callback for a change in sensitivity */
void (* set_shortcut)(SPAction *action, unsigned shortcut, void *data); /**< Callback for setting the shortcut for this function */
+ void (* set_name)(SPAction *action, Glib::ustring, void *data); /**< Callback for setting the name for this function */
};
/** All the data that is required to be an action. This
@@ -74,6 +76,7 @@ SPAction *sp_action_new(Inkscape::UI::View::View *view,
void sp_action_perform(SPAction *action, void *data);
void sp_action_set_active(SPAction *action, unsigned active);
void sp_action_set_sensitive(SPAction *action, unsigned sensitive);
+void sp_action_set_name (SPAction *action, Glib::ustring);
Inkscape::UI::View::View *sp_action_get_view(SPAction *action);
#endif