m-standard-event-source: remove the devices object manager
That makes no sense to have. The only script that uses this can easily be rewriten so that it uses object-added/removed instead.
This commit is contained in:

committed by
Julian Bouzas

parent
7be388c881
commit
c0322cb34f
@@ -17,7 +17,6 @@ struct _WpStandardEventSource
|
|||||||
{
|
{
|
||||||
WpPlugin parent;
|
WpPlugin parent;
|
||||||
WpObjectManager *om;
|
WpObjectManager *om;
|
||||||
WpObjectManager *devices_om;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (WpStandardEventSource, wp_standard_event_source,
|
G_DECLARE_FINAL_TYPE (WpStandardEventSource, wp_standard_event_source,
|
||||||
@@ -159,29 +158,6 @@ on_node_state_changed (WpNode *obj, WpNodeState old_state,
|
|||||||
G_OBJECT (self->om), G_OBJECT (obj)));
|
G_OBJECT (self->om), G_OBJECT (obj)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
on_objects_changed (WpObjectManager *om, WpStandardEventSource *self)
|
|
||||||
{
|
|
||||||
g_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (self));
|
|
||||||
g_return_if_fail (core);
|
|
||||||
g_autoptr (WpEventDispatcher) dispatcher =
|
|
||||||
wp_event_dispatcher_get_instance (core);
|
|
||||||
WpObject *obj = wp_object_manager_lookup (om, G_TYPE_OBJECT, NULL);
|
|
||||||
const gchar *type = NULL;
|
|
||||||
gint priority = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!get_object_type_and_priority (obj, &type, &priority))) {
|
|
||||||
wp_critical_object (self, "unknown object type: " WP_OBJECT_FORMAT,
|
|
||||||
WP_OBJECT_ARGS (obj));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wp_event_dispatcher_push_event (dispatcher, wp_event_new (
|
|
||||||
"objects-changed", priority,
|
|
||||||
wp_properties_new ("event.subject.type", type, NULL),
|
|
||||||
G_OBJECT (om), G_OBJECT (om)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_object_added (WpObjectManager *om, WpObject *obj, WpStandardEventSource *self)
|
on_object_added (WpObjectManager *om, WpObject *obj, WpStandardEventSource *self)
|
||||||
{
|
{
|
||||||
@@ -265,17 +241,6 @@ wp_standard_event_source_enable (WpPlugin * plugin, WpTransition * transition)
|
|||||||
g_signal_connect_object (self->om, "installed",
|
g_signal_connect_object (self->om, "installed",
|
||||||
G_CALLBACK (on_om_installed), self, 0);
|
G_CALLBACK (on_om_installed), self, 0);
|
||||||
wp_core_install_object_manager (core, self->om);
|
wp_core_install_object_manager (core, self->om);
|
||||||
|
|
||||||
self->devices_om = wp_object_manager_new ();
|
|
||||||
wp_object_manager_add_interest (self->devices_om, WP_TYPE_DEVICE, NULL);
|
|
||||||
wp_object_manager_request_object_features (self->devices_om,
|
|
||||||
WP_TYPE_GLOBAL_PROXY, WP_OBJECT_FEATURES_ALL);
|
|
||||||
g_signal_connect_object (self->devices_om, "objects-changed",
|
|
||||||
G_CALLBACK (on_objects_changed), self, 0);
|
|
||||||
g_signal_connect_object (self->devices_om, "installed",
|
|
||||||
G_CALLBACK (on_om_installed), self, 0);
|
|
||||||
wp_core_install_object_manager (core, self->devices_om);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user