parent
d2cba1d50a
commit
42eb3efe91
113
cups-pk-helper-jobcancelpurge.patch
Normal file
113
cups-pk-helper-jobcancelpurge.patch
Normal file
@ -0,0 +1,113 @@
|
||||
--- 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"/>
|
@ -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.patch
|
||||
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 PolicyKit.
|
||||
%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@redhat.com> - 0.0.4-13
|
||||
- Add JobCancelPurge method
|
||||
- Related: #548756
|
||||
|
||||
* Tue Feb 23 2010 Marek Kasik <mkasik@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
|
||||
|
Loading…
Reference in New Issue
Block a user