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:

committed by
Julian Bouzas

parent
374602d759
commit
08a9d39295
@@ -133,8 +133,7 @@ get_object_type (gpointer obj, WpProperties **properties)
|
|||||||
static gint
|
static gint
|
||||||
get_default_event_priority (const gchar *event_type)
|
get_default_event_priority (const gchar *event_type)
|
||||||
{
|
{
|
||||||
if (!g_strcmp0 (event_type, "find-target-si-and-link") ||
|
if (g_str_has_prefix (event_type, "select-"))
|
||||||
g_str_has_prefix (event_type, "select-"))
|
|
||||||
return 500;
|
return 500;
|
||||||
else if (!g_strcmp0 (event_type, "rescan-session"))
|
else if (!g_strcmp0 (event_type, "rescan-session"))
|
||||||
return -500;
|
return -500;
|
||||||
@@ -190,9 +189,13 @@ wp_standard_event_source_create_event (WpStandardEventSource *self,
|
|||||||
|
|
||||||
if (subject_type) {
|
if (subject_type) {
|
||||||
wp_properties_set (properties, "event.subject.type", subject_type);
|
wp_properties_set (properties, "event.subject.type", subject_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);
|
full_event_type = g_strdup_printf ("%s-%s", subject_type, event_type);
|
||||||
event_type = full_event_type;
|
event_type = full_event_type;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (misc_properties)
|
if (misc_properties)
|
||||||
wp_properties_add (properties, misc_properties);
|
wp_properties_add (properties, misc_properties);
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ SimpleEventHook {
|
|||||||
after = "find-default-target@policy-desktop",
|
after = "find-default-target@policy-desktop",
|
||||||
interests = {
|
interests = {
|
||||||
EventInterest {
|
EventInterest {
|
||||||
Constraint { "event.type", "=", "find-target-si-and-link" },
|
Constraint { "event.type", "=", "select-target" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
execute = function (event)
|
execute = function (event)
|
||||||
|
@@ -13,7 +13,7 @@ SimpleEventHook {
|
|||||||
after = "find-defined-target@policy-desktop",
|
after = "find-defined-target@policy-desktop",
|
||||||
interests = {
|
interests = {
|
||||||
EventInterest {
|
EventInterest {
|
||||||
Constraint { "event.type", "=", "find-target-si-and-link" },
|
Constraint { "event.type", "=", "select-target" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
execute = function (event)
|
execute = function (event)
|
||||||
|
@@ -17,7 +17,7 @@ SimpleEventHook {
|
|||||||
name = "find-defined-target@policy-desktop",
|
name = "find-defined-target@policy-desktop",
|
||||||
interests = {
|
interests = {
|
||||||
EventInterest {
|
EventInterest {
|
||||||
Constraint { "event.type", "=", "find-target-si-and-link" },
|
Constraint { "event.type", "=", "select-target" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
execute = function (event)
|
execute = function (event)
|
||||||
|
@@ -13,7 +13,7 @@ SimpleEventHook {
|
|||||||
before = "find-defined-target@policy-desktop",
|
before = "find-defined-target@policy-desktop",
|
||||||
interests = {
|
interests = {
|
||||||
EventInterest {
|
EventInterest {
|
||||||
Constraint { "event.type", "=", "find-target-si-and-link" },
|
Constraint { "event.type", "=", "select-target" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
execute = function (event)
|
execute = function (event)
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
-- SPDX-License-Identifier: MIT
|
-- SPDX-License-Identifier: MIT
|
||||||
--
|
--
|
||||||
-- Links a session item to the target that has been previously selected.
|
-- 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 putils = require ("policy-utils")
|
||||||
local cutils = require ("common-utils")
|
local cutils = require ("common-utils")
|
||||||
@@ -15,7 +15,7 @@ SimpleEventHook {
|
|||||||
after = "prepare-link@policy-desktop",
|
after = "prepare-link@policy-desktop",
|
||||||
interests = {
|
interests = {
|
||||||
EventInterest {
|
EventInterest {
|
||||||
Constraint { "event.type", "=", "find-target-si-and-link" },
|
Constraint { "event.type", "=", "select-target" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
execute = function (event)
|
execute = function (event)
|
||||||
|
@@ -16,7 +16,7 @@ SimpleEventHook {
|
|||||||
after = "find-best-target@policy-desktop",
|
after = "find-best-target@policy-desktop",
|
||||||
interests = {
|
interests = {
|
||||||
EventInterest {
|
EventInterest {
|
||||||
Constraint { "event.type", "=", "find-target-si-and-link" },
|
Constraint { "event.type", "=", "select-target" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
execute = function (event)
|
execute = function (event)
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
-- SPDX-License-Identifier: MIT
|
-- SPDX-License-Identifier: MIT
|
||||||
--
|
--
|
||||||
-- Handle new linkables and trigger rescanning of the graph.
|
-- 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
|
-- all linkables that need to be linked
|
||||||
-- Cleanup links when the linkables they are associated with are removed.
|
-- Cleanup links when the linkables they are associated with are removed.
|
||||||
-- Also, cleanup flags attached to linkables.
|
-- Also, cleanup flags attached to linkables.
|
||||||
@@ -103,7 +103,7 @@ SimpleEventHook {
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- push event to find target and link
|
-- 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::
|
::skip_linkable::
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user