events: rename find-target-si-and-link to select-target

And make sure it does not get prefixed with the subject type
This commit is contained in:
George Kiagiadakis
2022-12-25 11:11:36 +02:00
committed by Julian Bouzas
parent 374602d759
commit 08a9d39295
8 changed files with 16 additions and 13 deletions

View File

@@ -133,8 +133,7 @@ get_object_type (gpointer obj, WpProperties **properties)
static gint
get_default_event_priority (const gchar *event_type)
{
if (!g_strcmp0 (event_type, "find-target-si-and-link") ||
g_str_has_prefix (event_type, "select-"))
if (g_str_has_prefix (event_type, "select-"))
return 500;
else if (!g_strcmp0 (event_type, "rescan-session"))
return -500;
@@ -190,8 +189,12 @@ wp_standard_event_source_create_event (WpStandardEventSource *self,
if (subject_type) {
wp_properties_set (properties, "event.subject.type", subject_type);
full_event_type = g_strdup_printf ("%s-%s", subject_type, event_type);
event_type = full_event_type;
/* prefix the event with the subject type, unless it is a select-* event */
if (!g_str_has_prefix (event_type, "select-")) {
full_event_type = g_strdup_printf ("%s-%s", subject_type, event_type);
event_type = full_event_type;
}
}
if (misc_properties)
wp_properties_add (properties, misc_properties);

View File

@@ -14,7 +14,7 @@ SimpleEventHook {
after = "find-default-target@policy-desktop",
interests = {
EventInterest {
Constraint { "event.type", "=", "find-target-si-and-link" },
Constraint { "event.type", "=", "select-target" },
},
},
execute = function (event)

View File

@@ -13,7 +13,7 @@ SimpleEventHook {
after = "find-defined-target@policy-desktop",
interests = {
EventInterest {
Constraint { "event.type", "=", "find-target-si-and-link" },
Constraint { "event.type", "=", "select-target" },
},
},
execute = function (event)

View File

@@ -17,7 +17,7 @@ SimpleEventHook {
name = "find-defined-target@policy-desktop",
interests = {
EventInterest {
Constraint { "event.type", "=", "find-target-si-and-link" },
Constraint { "event.type", "=", "select-target" },
},
},
execute = function (event)

View File

@@ -13,7 +13,7 @@ SimpleEventHook {
before = "find-defined-target@policy-desktop",
interests = {
EventInterest {
Constraint { "event.type", "=", "find-target-si-and-link" },
Constraint { "event.type", "=", "select-target" },
},
},
execute = function (event)

View File

@@ -5,7 +5,7 @@
-- SPDX-License-Identifier: MIT
--
-- Links a session item to the target that has been previously selected.
-- This is meant to be the last hook in the find-target-si-and-link chain.
-- This is meant to be the last hook in the select-target chain.
local putils = require ("policy-utils")
local cutils = require ("common-utils")
@@ -15,7 +15,7 @@ SimpleEventHook {
after = "prepare-link@policy-desktop",
interests = {
EventInterest {
Constraint { "event.type", "=", "find-target-si-and-link" },
Constraint { "event.type", "=", "select-target" },
},
},
execute = function (event)

View File

@@ -16,7 +16,7 @@ SimpleEventHook {
after = "find-best-target@policy-desktop",
interests = {
EventInterest {
Constraint { "event.type", "=", "find-target-si-and-link" },
Constraint { "event.type", "=", "select-target" },
},
},
execute = function (event)

View File

@@ -5,7 +5,7 @@
-- SPDX-License-Identifier: MIT
--
-- Handle new linkables and trigger rescanning of the graph.
-- Rescan the graph by pushing new find-target-si-and-link events for
-- Rescan the graph by pushing new select-target events for
-- all linkables that need to be linked
-- Cleanup links when the linkables they are associated with are removed.
-- Also, cleanup flags attached to linkables.
@@ -103,7 +103,7 @@ SimpleEventHook {
end
-- push event to find target and link
source:call ("push-event", "find-target-si-and-link", si, nil)
source:call ("push-event", "select-target", si, nil)
::skip_linkable::
end