rpms/cups-pk-helper/devel cups-pk-helper-jobcancelpurge.patch, NONE, 1.1 cups-pk-helper.spec, 1.18, 1.19

Marek Kašík mkasik at fedoraproject.org
Mon Mar 22 15:40:45 UTC 2010


Author: mkasik

Update of /cvs/pkgs/rpms/cups-pk-helper/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv16174

Modified Files:
	cups-pk-helper.spec 
Added Files:
	cups-pk-helper-jobcancelpurge.patch 
Log Message:
* Mon Mar 22 2010 Marek Kasik <mkasik at redhat.com> - 0.0.4-13
- Add JobCancelPurge method
- Related: #548756


cups-pk-helper-jobcancelpurge.patch:
 cups-pk-helper-mechanism.c   |   11 ++++++++++-
 cups-pk-helper-mechanism.h   |    6 ++++++
 cups-pk-helper-mechanism.xml |    8 ++++++++
 cups.c                       |   20 ++++++++++++++++----
 cups.h                       |    1 +
 5 files changed, 41 insertions(+), 5 deletions(-)

--- NEW FILE cups-pk-helper-jobcancelpurge.patch ---
--- cups-pk-helper-0.0.4/src/cups.c	2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups.c	2010-03-22 15:41:36.000000000 +0100
@@ -1726,8 +1726,11 @@ cph_cups_server_set_settings (CphCups   
 gboolean
 cph_cups_job_cancel (CphCups    *cups,
                      int         job_id,
+                     gboolean    purge_job,
                      const char *user_name)
 {
+        ipp_t *request;
+
         g_return_val_if_fail (CPH_IS_CUPS (cups), FALSE);
 
         if (!_cph_cups_is_job_id_valid (cups, job_id))
@@ -1735,10 +1738,19 @@ cph_cups_job_cancel (CphCups    *cups,
         /* we don't check if the user name is valid or not because it comes
          * from getpwuid(), and not dbus */
 
-        return _cph_cups_send_new_simple_job_request (cups, IPP_CANCEL_JOB,
-                                                      job_id,
-                                                      user_name,
-                                                      CPH_RESOURCE_JOBS);
+        request = ippNewRequest (IPP_CANCEL_JOB);
+        _cph_cups_add_job_uri (request, job_id);
+
+        if (user_name != NULL)
+                ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+                              "requesting-user-name", NULL, user_name);
+
+#if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 4) || CUPS_VERSION_MAJOR > 1
+        if (purge_job)
+                ippAddBoolean (request, IPP_TAG_OPERATION, "purge-job", 1);
+#endif
+
+        return _cph_cups_send_request (cups, request, CPH_RESOURCE_JOBS);
 }
 
 gboolean
--- cups-pk-helper-0.0.4/src/cups.h	2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups.h	2010-03-22 15:41:36.000000000 +0100
@@ -169,6 +169,7 @@ gboolean cph_cups_is_printer_uri_local (
 
 gboolean cph_cups_job_cancel (CphCups    *cups,
                               int         job_id,
+                              gboolean    purge_job,
                               const char *user_name);
 
 gboolean cph_cups_job_restart (CphCups    *cups,
--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.c	2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.c	2010-03-22 15:43:33.000000000 +0100
@@ -988,6 +988,15 @@ cph_mechanism_job_cancel (CphMechanism  
                           int                    id,
                           DBusGMethodInvocation *context)
 {
+        return cph_mechanism_job_cancel_purge (mechanism, id, FALSE, context);
+}
+
+gboolean
+cph_mechanism_job_cancel_purge (CphMechanism          *mechanism,
+                                int                    id,
+                                gboolean               purge,
+                                DBusGMethodInvocation *context)
+{
         CphJobStatus  job_status;
         gboolean      ret;
         char         *user_name;
@@ -1023,7 +1032,7 @@ cph_mechanism_job_cancel (CphMechanism  
                 }
         }
 
-        ret = cph_cups_job_cancel (mechanism->priv->cups, id, user_name);
+        ret = cph_cups_job_cancel (mechanism->priv->cups, id, purge, user_name);
         _cph_mechanism_return_error (mechanism, context, !ret);
 
         g_free (user_name);
--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.h	2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.h	2010-03-22 15:41:36.000000000 +0100
@@ -226,6 +226,12 @@ cph_mechanism_job_cancel (CphMechanism  
                           DBusGMethodInvocation *context);
 
 gboolean
+cph_mechanism_job_cancel_purge (CphMechanism          *mechanism,
+                                int                    id,
+                                gboolean               purge,
+                                DBusGMethodInvocation *context);
+
+gboolean
 cph_mechanism_job_restart (CphMechanism          *mechanism,
                            int                    id,
                            DBusGMethodInvocation *context);
--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.xml	2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.xml	2010-03-22 15:44:36.000000000 +0100
@@ -174,12 +174,20 @@
       <arg name="error"    direction="out" type="s"/>
     </method>
 
+    <!-- JobCancel is deprecated; JobCancelPurge should be used instead -->
     <method name="JobCancel">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <arg name="jobid"    direction="in"  type="i"/>
       <arg name="error"    direction="out" type="s"/>
     </method>
 
+    <method name="JobCancelPurge">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg name="jobid"    direction="in"  type="i"/>
+      <arg name="purge"    direction="in"  type="b"/>
+      <arg name="error"    direction="out" type="s"/>
+    </method>
+
     <method name="JobRestart">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <arg name="jobid"    direction="in"  type="i"/>


Index: cups-pk-helper.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cups-pk-helper/devel/cups-pk-helper.spec,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -r1.18 -r1.19
--- cups-pk-helper.spec	23 Feb 2010 13:28:08 -0000	1.18
+++ cups-pk-helper.spec	22 Mar 2010 15:40:45 -0000	1.19
@@ -1,6 +1,6 @@
 Name:           cups-pk-helper
 Version:        0.0.4
-Release:        12%{?dist}
+Release:        13%{?dist}
 Summary:        A helper that makes system-config-printer use PolicyKit
 
 Group:          System Environment/Base
@@ -17,6 +17,7 @@ Patch5:         allow_authentication.pat
 Patch6:         cups-pk-helper-add-printer-ppd-optional.patch
 Patch7:         cups-pk-helper-job-status.patch
 Patch8:         cups-pk-helper-invalid-job.patch
+Patch9:         cups-pk-helper-jobcancelpurge.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -55,6 +56,7 @@ interfaces available under control of Po
 %patch6 -p1 -b .ppd
 %patch7 -p1 -b .job-status
 %patch8 -p1 -b .invalid-job
+%patch9 -p1 -b .jobcancelpurge
 
 %build
 # Patch0 modifies configure.ac
@@ -84,6 +86,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon Mar 22 2010 Marek Kasik <mkasik at redhat.com> - 0.0.4-13
+- Add JobCancelPurge method
+- Related: #548756
+
 * Tue Feb 23 2010 Marek Kasik <mkasik at redhat.com> - 0.0.4-12
 - Avoid timeout on job-related methods for invalid jobs
 - Make sure to return an error via dbus in case of failure



More information about the scm-commits mailing list