[gnome-software/859-app-has-been-installed-notifications-sit-around-indefinitely] gs-common: Introduce gs_utils_withdraw_notifications()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/859-app-has-been-installed-notifications-sit-around-indefinitely] gs-common: Introduce gs_utils_withdraw_notifications()
- Date: Fri, 13 May 2022 08:01:46 +0000 (UTC)
commit e2d6da1d3198ee38be7d12b13a055a2ac0c77c4d
Author: Milan Crha <mcrha redhat com>
Date: Fri May 13 09:56:00 2022 +0200
gs-common: Introduce gs_utils_withdraw_notifications()
It can be used to remove notifications, which lose their meaning
after some time.
src/gs-common.c | 24 ++++++++++++++++++++++++
src/gs-common.h | 1 +
2 files changed, 25 insertions(+)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index 5cfc055ee..a6cbda8df 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -1001,3 +1001,27 @@ gs_utils_invoke_reboot_async (GCancellable *cancellable,
ready_callback,
user_data);
}
+
+/**
+ * gs_utils_withdraw_notifications:
+ * @application: (optional): a #GApplication, or %NULL
+ *
+ * Withdraws notifications, which are relevant only for some time, like
+ * when an application was installed or when a restart is required
+ * to be able to use an application.
+ *
+ * When the @application is %NULL, the default %GApplication is used
+ * to do the withdraw.
+ *
+ * Since: 43
+ **/
+void
+gs_utils_withdraw_notifications (GApplication *application)
+{
+ if (!application)
+ application = g_application_get_default ();
+ if (application) {
+ g_application_withdraw_notification (application, "installed");
+ g_application_withdraw_notification (application, "restart-required");
+ }
+}
diff --git a/src/gs-common.h b/src/gs-common.h
index 93904624b..1588120bc 100644
--- a/src/gs-common.h
+++ b/src/gs-common.h
@@ -64,5 +64,6 @@ gboolean gs_utils_split_time_difference (gint64 unix_time_seconds,
gint *out_weeks_ago,
gint *out_months_ago,
gint *out_years_ago);
+void gs_utils_withdraw_notifications (GApplication *application);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]