From ea4de006066027ed332de3ab48da345f757e3aa9 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 1 Nov 2018 17:16:09 +0000 Subject: plugins: Add desktop-entry hints to notifications This allows the notifications to be tied back to an application (or, in this case, control panel capplet) which is related to it; and allows the user to specify per-app preferences for how the notifications are to be displayed. https://wiki.gnome.org/Initiatives/GnomeGoals/NotificationSource Signed-off-by: Philip Withnall --- plugins/color/gsd-color-calibrate.c | 1 + plugins/datetime/gsd-datetime-manager.c | 1 + plugins/power/gsd-power-manager.c | 1 + plugins/print-notifications/gsd-print-notifications-manager.c | 5 +++++ plugins/print-notifications/gsd-printer.c | 1 + 5 files changed, 9 insertions(+) diff --git a/plugins/color/gsd-color-calibrate.c b/plugins/color/gsd-color-calibrate.c index e26f9bd4..5bf19845 100644 --- a/plugins/color/gsd-color-calibrate.c +++ b/plugins/color/gsd-color-calibrate.c @@ -137,6 +137,7 @@ gcm_session_notify_recalibrate (GsdColorCalibrate *calibrate, notify_notification_set_timeout (notification, GCM_SESSION_NOTIFY_TIMEOUT); notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW); notify_notification_set_app_name (notification, _("Color")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-color-panel"); notify_notification_add_action (notification, "recalibrate", diff --git a/plugins/datetime/gsd-datetime-manager.c b/plugins/datetime/gsd-datetime-manager.c index 7516c89b..1f3bcf8e 100644 --- a/plugins/datetime/gsd-datetime-manager.c +++ b/plugins/datetime/gsd-datetime-manager.c @@ -116,6 +116,7 @@ timezone_changed_cb (GsdTimezoneMonitor *timezone_monitor, g_free (notification_summary); notify_notification_set_app_name (self->priv->notification, _("Date & Time Settings")); + notify_notification_set_hint_string (self->priv->notification, "desktop-entry", "gnome-datetime-panel"); notify_notification_set_urgency (self->priv->notification, NOTIFY_URGENCY_NORMAL); notify_notification_set_timeout (self->priv->notification, NOTIFY_EXPIRES_NEVER); diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c index 6c417721..6093f119 100644 --- a/plugins/power/gsd-power-manager.c +++ b/plugins/power/gsd-power-manager.c @@ -323,6 +323,7 @@ create_notification (const char *summary, notification = notify_notification_new (summary, body, icon_name); /* TRANSLATORS: this is the notification application name */ notify_notification_set_app_name (notification, _("Power")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-power-panel"); notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL); *weak_pointer_location = notification; diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c index b8bfa8ae..0721903c 100644 --- a/plugins/print-notifications/gsd-print-notifications-manager.c +++ b/plugins/print-notifications/gsd-print-notifications-manager.c @@ -292,6 +292,7 @@ show_notification (gpointer user_data) "resident", g_variant_new_boolean (TRUE)); notify_notification_set_timeout (notification, REASON_TIMEOUT); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-printers-panel"); reason_data = g_new0 (ReasonData, 1); reason_data->printer_name = g_strdup (data->printer_name); @@ -528,6 +529,7 @@ check_job_for_authentication (gpointer userdata) secondary_text, "printer-symbolic"); notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-printers-panel"); notify_notification_add_action (notification, "default", /* This is a default action so the label won't be shown */ @@ -909,6 +911,7 @@ process_cups_notification (GsdPrintNotificationsManager *manager, second_row, "printer-symbolic"); notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-printers-panel"); notify_notification_set_hint (notification, "resident", g_variant_new_boolean (TRUE)); @@ -999,6 +1002,7 @@ process_cups_notification (GsdPrintNotificationsManager *manager, second_row, "printer-symbolic"); notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-printers-panel"); notify_notification_set_hint (notification, "resident", g_variant_new_boolean (TRUE)); @@ -1042,6 +1046,7 @@ process_cups_notification (GsdPrintNotificationsManager *manager, secondary_text, "printer-symbolic"); notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-printers-panel"); notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); notify_notification_show (notification, NULL); g_object_unref (notification); diff --git a/plugins/print-notifications/gsd-printer.c b/plugins/print-notifications/gsd-printer.c index df220e6e..573129b4 100644 --- a/plugins/print-notifications/gsd-printer.c +++ b/plugins/print-notifications/gsd-printer.c @@ -1029,6 +1029,7 @@ handle_method_call (GDBusConnection *connection, secondary_text, "printer-symbolic"); notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint_string (notification, "desktop-entry", "gnome-printers-panel"); notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); notify_notification_show (notification, NULL); -- cgit v1.2.1