Skip to content
  • David Zeuthen's avatar
    gdbus-codegen: Don't send out PropertiesChanged if value ends up not changing · 6bccc46d
    David Zeuthen authored
    
    
    A fairly typical pattern is to have code that does
    
     foo_set_bar (object, "");
     if (some_condition)
       {
         foo_set_bar (object, "yes");
       }
    
    where some_condition is often true every time @object is updated.
    
    With this code, bar is essentially always "yes" but because of how
    gdbus-codegen works, useless PropertiesChanged events got scheduled
    and sent out. With this patch, we avoid that by always keeping the
    original value around and comparing it only when we deem it's time to
    send out the ::PropertiesChanged signal (typically in an idle but can
    be forced by the user via flush()).
    
    Also add a test case for this.
    
    Signed-off-by: default avatarDavid Zeuthen <davidz@redhat.com>
    6bccc46d