[gnome-control-center] printers: Do not notify about job edited by user
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Do not notify about job edited by user
- Date: Fri, 24 May 2019 17:08:18 +0000 (UTC)
commit 21df888699922457464ab9b6d244d26666161710
Author: Marek Kasik <mkasik redhat com>
Date: Fri May 24 16:58:54 2019 +0200
printers: Do not notify about job edited by user
Let gnome-settings-daemon know about intention to edit a job
so it does not show notification for this action as it
was initiated manually by user.
Do this via g-s-d's DBus method DoNotNotifyJob.
panels/printers/pp-job.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 2 deletions(-)
---
diff --git a/panels/printers/pp-job.c b/panels/printers/pp-job.c
index 33c83e76a..5a953b679 100644
--- a/panels/printers/pp-job.c
+++ b/panels/printers/pp-job.c
@@ -95,8 +95,32 @@ pp_job_cancel_purge_async (PpJob *self,
g_object_get (self, "id", &job_id, NULL);
+ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (bus == NULL)
+ {
+ g_warning ("Failed to get session bus: %s", error->message);
+ return;
+ }
+
+ g_dbus_connection_call (bus,
+ "org.gnome.SettingsDaemon.PrintNotifications",
+ "/org/gnome/SettingsDaemon/PrintNotifications",
+ "org.gnome.SettingsDaemon.PrintNotifications",
+ "DoNotNotifyJob",
+ g_variant_new ("(it)",
+ job_id,
+ 1 << IPP_JSTATE_CANCELED),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+
+ g_object_unref (bus);
+
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
- if (!bus)
+ if (bus == NULL)
{
g_warning ("Failed to get session bus: %s", error->message);
return;
@@ -143,11 +167,40 @@ pp_job_set_hold_until_async (PpJob *self,
GDBusConnection *bus;
g_autoptr(GError) error = NULL;
gint job_id;
+ gboolean resuming;
g_object_get (self, "id", &job_id, NULL);
+ if (g_strcmp0 (job_hold_until, "no-hold") == 0)
+ resuming = TRUE;
+ else
+ resuming = FALSE;
+
+ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (bus == NULL)
+ {
+ g_warning ("Failed to get session bus: %s", error->message);
+ return;
+ }
+
+ g_dbus_connection_call (bus,
+ "org.gnome.SettingsDaemon.PrintNotifications",
+ "/org/gnome/SettingsDaemon/PrintNotifications",
+ "org.gnome.SettingsDaemon.PrintNotifications",
+ "DoNotNotifyJob",
+ g_variant_new ("(it)",
+ job_id,
+ resuming ? 1 << IPP_JSTATE_PROCESSING : 1 << IPP_JSTATE_HELD),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+
+ g_object_unref (bus);
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
- if (!bus)
+ if (bus == NULL)
{
g_warning ("Failed to get session bus: %s", error->message);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]