14b7fdd
diff -up cups-1.3.7/backend/ipp.c.eggcups cups-1.3.7/backend/ipp.c
14b7fdd
--- cups-1.3.7/backend/ipp.c.eggcups	2008-07-15 13:34:01.000000000 +0100
14b7fdd
+++ cups-1.3.7/backend/ipp.c	2008-07-15 13:34:01.000000000 +0100
14b7fdd
@@ -58,6 +58,70 @@ static char	pstmpname[1024] = "";	/* Tem
50551d0
 static char	tmpfilename[1024] = "";	/* Temporary spool file name */
50551d0
 static int	job_cancelled = 0;	/* Job cancelled? */
11255c8
 
11255c8
+#if HAVE_DBUS
11255c8
+#include <dbus/dbus.h>
11255c8
+
11255c8
+static DBusConnection *dbus_connection = NULL;
11255c8
+
11255c8
+static int
11255c8
+init_dbus (void)
11255c8
+{
11255c8
+  DBusConnection *connection;
11255c8
+  DBusError error;
11255c8
+
11255c8
+  if (dbus_connection &&
11255c8
+      !dbus_connection_get_is_connected (dbus_connection)) {
11255c8
+    dbus_connection_unref (dbus_connection);
11255c8
+    dbus_connection = NULL;
11255c8
+  }
11255c8
+  
11255c8
+  dbus_error_init (&error);
11255c8
+  connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
11255c8
+  if (connection == NULL) {
11255c8
+    dbus_error_free (&error);
11255c8
+    return -1;
11255c8
+  }
11255c8
+
11255c8
+  dbus_connection = connection;
11255c8
+  return 0;
11255c8
+}
11255c8
+
11255c8
+int
11255c8
+dbus_broadcast_queued_remote (const char *printer_uri,
11255c8
+			      ipp_status_t status,
11255c8
+			      unsigned int local_job_id,
11255c8
+			      unsigned int remote_job_id,
11255c8
+			      const char *username,
11255c8
+			      const char *printer_name)
11255c8
+{
11255c8
+  DBusMessage *message;
11255c8
+  DBusMessageIter iter;
11255c8
+  const char *errstr;
11255c8
+
11255c8
+  if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) {
11255c8
+    if (init_dbus () || !dbus_connection)
11255c8
+      return -1;
11255c8
+  }
11255c8
+
11255c8
+  errstr = ippErrorString (status);
11255c8
+  message = dbus_message_new_signal ("/com/redhat/PrinterSpooler",
11255c8
+				     "com.redhat.PrinterSpooler",
11255c8
+				     "JobQueuedRemote");
11255c8
+  dbus_message_iter_init_append (message, &iter);
11255c8
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri);
11255c8
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr);
11255c8
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id);
11255c8
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id);
11255c8
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username);
11255c8
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name);
11255c8
+
11255c8
+  dbus_connection_send (dbus_connection, message, NULL);
11255c8
+  dbus_connection_flush (dbus_connection);
11255c8
+  dbus_message_unref (message);
11255c8
+  
11255c8
+  return 0;
11255c8
+}
11255c8
+#endif /* HAVE_DBUS */
11255c8
 
11255c8
 /*
50551d0
  * Local functions...
14b7fdd
@@ -1004,6 +1068,15 @@ main(int  argc,				/* I - Number of comm
14b7fdd
                       job_id);
11255c8
     }
11255c8
 
11255c8
+#if HAVE_DBUS
11255c8
+    dbus_broadcast_queued_remote (argv[0],
11255c8
+				  ipp_status,
11255c8
+				  atoi (argv[1]),
11255c8
+				  job_id,
11255c8
+				  argv[2],
11255c8
+				  getenv ("PRINTER"));
11255c8
+#endif /* HAVE_DBUS */
11255c8
+
11255c8
     ippDelete(response);
11255c8
 
11255c8
     if (job_cancelled)
14b7fdd
diff -up cups-1.3.7/backend/Makefile.eggcups cups-1.3.7/backend/Makefile
14b7fdd
--- cups-1.3.7/backend/Makefile.eggcups	2007-08-08 20:27:51.000000000 +0100
14b7fdd
+++ cups-1.3.7/backend/Makefile	2008-07-15 13:34:01.000000000 +0100
14b7fdd
@@ -131,7 +131,7 @@ ieee1394-linux.o:	ieee1394.h
11255c8
 
11255c8
 ipp:	ipp.o ../cups/$(LIBCUPS)
11255c8
 	echo Linking $@...
11255c8
-	$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS)
50551d0
+	$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS) $(CUPSDLIBS)
11255c8
 	$(RM) http
11255c8
 	$(LN) ipp http
11255c8
 
14b7fdd
diff -up cups-1.3.7/scheduler/subscriptions.c.eggcups cups-1.3.7/scheduler/subscriptions.c
14b7fdd
--- cups-1.3.7/scheduler/subscriptions.c.eggcups	2008-01-23 22:23:42.000000000 +0000
14b7fdd
+++ cups-1.3.7/scheduler/subscriptions.c	2008-07-15 13:34:01.000000000 +0100
14b7fdd
@@ -1295,13 +1295,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
78ddcc4
     what = "PrinterAdded";
78ddcc4
   else if (event & CUPSD_EVENT_PRINTER_DELETED)
78ddcc4
     what = "PrinterRemoved";
78ddcc4
-  else if (event & CUPSD_EVENT_PRINTER_CHANGED)
78ddcc4
-    what = "QueueChanged";
78ddcc4
   else if (event & CUPSD_EVENT_JOB_CREATED)
78ddcc4
     what = "JobQueuedLocal";
78ddcc4
   else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
78ddcc4
            job->state_value == IPP_JOB_PROCESSING)
78ddcc4
     what = "JobStartedLocal";
78ddcc4
+  else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED))
78ddcc4
+    what = "QueueChanged";
78ddcc4
   else
78ddcc4
     return;
78ddcc4
 
14b7fdd
@@ -1337,7 +1337,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
78ddcc4
   dbus_message_append_iter_init(message, &iter);
78ddcc4
   if (dest)
78ddcc4
     dbus_message_iter_append_string(&iter, dest->name);
78ddcc4
-  if (job)
78ddcc4
+  if (job && strcmp (what, "QueueChanged") != 0)
78ddcc4
   {
78ddcc4
     dbus_message_iter_append_uint32(&iter, job->id);
78ddcc4
     dbus_message_iter_append_string(&iter, job->username);