summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2019-05-24 16:58:54 +0200
committerMarek Kasik <mkasik@redhat.com>2019-05-24 19:14:17 +0200
commit1950a564a61c61409e28f645c9843d50b65c502d (patch)
treece36c82582af1dbbcc75cd7971e7f38d6dcf75e1
parent0cc75a330f326e2ea18cfacb8ca785ca21cff14b (diff)
downloadgnome-control-center-printers-don't-notify-print-jobs.tar.gz
printers: Do not notify about job edited by userprinters-don't-notify-print-jobs
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.
-rw-r--r--panels/printers/pp-job.c57
1 files 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;