Change notification



I noticed that the behaviour of setters wrt to change notification is not
consistent.
Some, e.g gtk_entry_set_visibility(), always notify:

void
gtk_entry_set_visibility (GtkEntry *entry,
     gboolean visible)
{
  g_return_if_fail (GTK_IS_ENTRY (entry));

  entry->visible = visible ? TRUE : FALSE;
  g_object_notify (G_OBJECT (entry), "visibility");
  gtk_entry_recompute (entry);
}

Others, e.g. gtk_entry_set_activates_default(), notify only if the property
actually changed:

void
gtk_entry_set_activates_default (GtkEntry *entry,
                                 gboolean  setting)
{
  g_return_if_fail (GTK_IS_ENTRY (entry));
  setting = setting != FALSE;

  if (setting != entry->activates_default)
    {
      entry->activates_default = setting;
      g_object_notify (G_OBJECT (entry), "activates_default");
    }
}


What is the policy here ? IMO, the second is more correct.
Would a patch to change setters in this direction be accepted ?

Matthias




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]