summaryrefslogtreecommitdiffstats
path: root/src/helper/action.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2013-12-20 14:22:30 +0000
committerKris <Kris.De.Gussem@hotmail.com>2013-12-20 14:22:30 +0000
commit968ce4cd75e9309b8fb78f5b21f96d53e0d0c6e6 (patch)
treebb94ef7267b84e6e4dd562ac17eb8c0a5d75d5db /src/helper/action.cpp
parentmodify transform behaviour for scaled stroke width, Preserved Transforms (diff)
downloadinkscape-968ce4cd75e9309b8fb78f5b21f96d53e0d0c6e6.tar.gz
inkscape-968ce4cd75e9309b8fb78f5b21f96d53e0d0c6e6.zip
Null check added. (should fix bug 1172484)
(bzr r12853)
Diffstat (limited to 'src/helper/action.cpp')
-rw-r--r--src/helper/action.cpp71
1 files changed, 37 insertions, 34 deletions
diff --git a/src/helper/action.cpp b/src/helper/action.cpp
index 28cb40334..060bf317c 100644
--- a/src/helper/action.cpp
+++ b/src/helper/action.cpp
@@ -40,16 +40,16 @@ sp_action_class_init (SPActionClass *klass)
static void
sp_action_init (SPAction *action)
{
- action->sensitive = 0;
- action->active = 0;
- action->context = Inkscape::ActionContext();
- action->id = action->name = action->tip = NULL;
- action->image = NULL;
-
- new (&action->signal_perform) sigc::signal<void>();
- new (&action->signal_set_sensitive) sigc::signal<void, bool>();
- new (&action->signal_set_active) sigc::signal<void, bool>();
- new (&action->signal_set_name) sigc::signal<void, Glib::ustring const &>();
+ action->sensitive = 0;
+ action->active = 0;
+ action->context = Inkscape::ActionContext();
+ action->id = action->name = action->tip = NULL;
+ action->image = NULL;
+
+ new (&action->signal_perform) sigc::signal<void>();
+ new (&action->signal_set_sensitive) sigc::signal<void, bool>();
+ new (&action->signal_set_active) sigc::signal<void, bool>();
+ new (&action->signal_set_name) sigc::signal<void, Glib::ustring const &>();
}
/**
@@ -84,17 +84,17 @@ sp_action_new(Inkscape::ActionContext const &context,
const gchar *image,
Inkscape::Verb * verb)
{
- SPAction *action = (SPAction *)g_object_new(SP_TYPE_ACTION, NULL);
+ SPAction *action = (SPAction *)g_object_new(SP_TYPE_ACTION, NULL);
- action->context = context;
- action->sensitive = TRUE;
- action->id = g_strdup (id);
- action->name = g_strdup (name);
- action->tip = g_strdup (tip);
- action->image = g_strdup (image);
- action->verb = verb;
+ action->context = context;
+ action->sensitive = TRUE;
+ action->id = g_strdup (id);
+ action->name = g_strdup (name);
+ action->tip = g_strdup (tip);
+ action->image = g_strdup (image);
+ action->verb = verb;
- return action;
+ return action;
}
namespace {
@@ -129,11 +129,11 @@ public:
*/
void sp_action_perform(SPAction *action, void * /*data*/)
{
- g_return_if_fail (action != NULL);
- g_return_if_fail (SP_IS_ACTION (action));
+ g_return_if_fail (action != NULL);
+ g_return_if_fail (SP_IS_ACTION (action));
- Inkscape::Debug::EventTracker<ActionEvent> tracker(action);
- action->signal_perform.emit();
+ Inkscape::Debug::EventTracker<ActionEvent> tracker(action);
+ action->signal_perform.emit();
}
/**
@@ -142,10 +142,10 @@ void sp_action_perform(SPAction *action, void * /*data*/)
void
sp_action_set_active (SPAction *action, unsigned int active)
{
- g_return_if_fail (action != NULL);
- g_return_if_fail (SP_IS_ACTION (action));
+ g_return_if_fail (action != NULL);
+ g_return_if_fail (SP_IS_ACTION (action));
- action->signal_set_active.emit(active);
+ action->signal_set_active.emit(active);
}
/**
@@ -154,15 +154,18 @@ sp_action_set_active (SPAction *action, unsigned int active)
void
sp_action_set_sensitive (SPAction *action, unsigned int sensitive)
{
- g_return_if_fail (action != NULL);
- g_return_if_fail (SP_IS_ACTION (action));
+ g_return_if_fail (action != NULL);
+ g_return_if_fail (SP_IS_ACTION (action));
- action->signal_set_sensitive.emit(sensitive);
+ action->signal_set_sensitive.emit(sensitive);
}
void
sp_action_set_name (SPAction *action, Glib::ustring const &name)
{
+ g_return_if_fail (action != NULL);
+ g_return_if_fail (SP_IS_ACTION (action));
+
g_free(action->name);
action->name = g_strdup(name.data());
action->signal_set_name.emit(name);
@@ -174,8 +177,8 @@ sp_action_set_name (SPAction *action, Glib::ustring const &name)
SPDocument *
sp_action_get_document (SPAction *action)
{
- g_return_val_if_fail (SP_IS_ACTION (action), NULL);
- return action->context.getDocument();
+ g_return_val_if_fail (SP_IS_ACTION (action), NULL);
+ return action->context.getDocument();
}
/**
@@ -194,8 +197,8 @@ sp_action_get_selection (SPAction *action)
Inkscape::UI::View::View *
sp_action_get_view (SPAction *action)
{
- g_return_val_if_fail (SP_IS_ACTION (action), NULL);
- return action->context.getView();
+ g_return_val_if_fail (SP_IS_ACTION (action), NULL);
+ return action->context.getView();
}
/**
@@ -209,7 +212,7 @@ sp_action_get_desktop (SPAction *action)
// already the norm in the Inkscape codebase. This seems wrong. Surely
// we should store an SPDesktop* in the first place? Is there a case
// of actions being carried out on a View that is not an SPDesktop?
- return static_cast<SPDesktop *>(sp_action_get_view(action));
+ return static_cast<SPDesktop *>(sp_action_get_view(action));
}
/*