GtkActionHelper: two small fixups in _set_target_value()

First, ensure we always consume floating values, as documented.

Second (and more serious), don't try to query the action if the
action name is not set yet.  This will cause crashes...
This commit is contained in:
Ryan Lortie 2012-08-22 00:54:57 -04:00
parent c5f1dede79
commit 81e76746ff

View File

@ -523,7 +523,10 @@ gtk_action_helper_set_action_target_value (GtkActionHelper *helper,
return; return;
if (target_value && helper->target && g_variant_equal (target_value, helper->target)) if (target_value && helper->target && g_variant_equal (target_value, helper->target))
{
g_variant_unref (g_variant_ref_sink (target_value));
return; return;
}
if (helper->target) if (helper->target)
{ {
@ -534,6 +537,10 @@ gtk_action_helper_set_action_target_value (GtkActionHelper *helper,
if (target_value) if (target_value)
helper->target = g_variant_ref_sink (target_value); helper->target = g_variant_ref_sink (target_value);
/* The action_name has not yet been set. Don't do anything yet. */
if (helper->action_name == NULL)
return;
was_enabled = helper->enabled; was_enabled = helper->enabled;
was_active = helper->active; was_active = helper->active;