mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
control/dbus: dbus_root: simplify PropertiesChangedSignal
There is no need to query all keys when we are only interested in the presence of a single one; these changes simplify the implementation to properly reflect the intent. Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
This commit is contained in:
parent
a8a4b7fb0f
commit
adc31fd144
@ -453,8 +453,6 @@ PropertiesChangedSignal( intf_thread_t *p_intf,
|
||||
DBusConnection *p_conn = p_intf->p_sys->p_conn;
|
||||
DBusMessageIter changed_properties, invalidated_properties;
|
||||
const char *psz_interface_name = DBUS_MPRIS_ROOT_INTERFACE;
|
||||
char **ppsz_properties = NULL;
|
||||
int i_properties = 0;
|
||||
|
||||
SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
|
||||
DBUS_MPRIS_OBJECT_PATH,
|
||||
@ -467,23 +465,9 @@ PropertiesChangedSignal( intf_thread_t *p_intf,
|
||||
&changed_properties ) )
|
||||
return DBUS_HANDLER_RESULT_NEED_MEMORY;
|
||||
|
||||
i_properties = vlc_dictionary_keys_count( p_changed_properties );
|
||||
ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );
|
||||
|
||||
if( unlikely(!ppsz_properties) )
|
||||
{
|
||||
dbus_message_iter_abandon_container( &args, &changed_properties );
|
||||
return DBUS_HANDLER_RESULT_NEED_MEMORY;
|
||||
}
|
||||
|
||||
for( int i = 0; i < i_properties; i++ )
|
||||
{
|
||||
if( !strcmp( ppsz_properties[i], "Fullscreen" ) )
|
||||
if( vlc_dictionary_has_key( p_changed_properties, "Fullscreen" ) )
|
||||
AddProperty( p_intf, &changed_properties, "Fullscreen", "b",
|
||||
MarshalFullscreen );
|
||||
free( ppsz_properties[i] );
|
||||
}
|
||||
free( ppsz_properties );
|
||||
|
||||
if( !dbus_message_iter_close_container( &args, &changed_properties ) )
|
||||
return DBUS_HANDLER_RESULT_NEED_MEMORY;
|
||||
|
Loading…
Reference in New Issue
Block a user