lfb-event: Add getter and setter for app-id

For applications this is figured out automatically but notification
daemons and portal implementations might want to override it to have the
per-app feedback profile picked up automatically.
This commit is contained in:
Guido Günther
2023-04-17 13:32:21 +02:00
parent a58b47e1eb
commit 2de190fb09
3 changed files with 85 additions and 2 deletions
+8
View File
@@ -14,6 +14,7 @@ test_lfb_event_props (void)
g_autoptr(LfbEvent) event = NULL;
g_autofree gchar *evname = NULL;
g_autofree gchar *profile = NULL;
g_autofree gchar *app_id = NULL;
gint timeout;
g_assert_true (lfb_init (TEST_APP_ID, NULL));
@@ -25,10 +26,12 @@ test_lfb_event_props (void)
"event", &evname,
"timeout", &timeout,
"feedback-profile", &profile,
"app-id", &app_id,
NULL);
g_assert_cmpstr (evname, ==, "window-close");
g_assert_cmpint (timeout, ==, -1);
g_assert_null (profile);
g_assert_null (app_id);
g_assert_cmpint (lfb_event_get_end_reason (event), ==, LFB_EVENT_END_REASON_NATURAL);
g_assert_cmpint (lfb_event_get_state (event), ==, LFB_EVENT_STATE_NONE);
@@ -38,6 +41,11 @@ test_lfb_event_props (void)
g_assert_cmpstr (profile, ==, "full");
g_assert_cmpstr (lfb_event_get_feedback_profile (event), ==, "full");
g_object_set (event, "app-id", "com.example.foo", NULL);
g_object_get (event, "app-id", &app_id, NULL);
g_assert_cmpstr (app_id, ==, "com.example.foo");
g_assert_cmpstr (lfb_event_get_app_id (event), ==, "com.example.foo");
lfb_uninit ();
}